diff options
author | terminaldweller <devi@terminaldweller.com> | 2024-07-21 03:43:36 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2024-07-21 03:43:36 +0000 |
commit | 7a3795e44bf030fc0e27c49aea8c32a4457a59f5 (patch) | |
tree | 37d8ce89ad9a63688be5ee9bfa6632bde9a418ca /main.go | |
parent | WIP (diff) | |
download | milla-7a3795e44bf030fc0e27c49aea8c32a4457a59f5.tar.gz milla-7a3795e44bf030fc0e27c49aea8c32a4457a59f5.zip |
we can now add new commands from lua plugins
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -220,6 +220,8 @@ func getHelpString() string { helpString += "cmd - run a custom command defined in the customcommands file\n" helpString += "getall - returns all config options with their value\n" helpString += "memstats - returns the memory status currently being used\n" + helpString += "load - loads a lua script\n" + helpString += "unload - unloads a lua script\n" return helpString } @@ -535,9 +537,25 @@ func runCommand( break } + for key, value := range appConfig.LuaCommands { + if value.Path == args[1] { + appConfig.deleteLuaCommand(key) + + break + } + } + appConfig.deleteLstate(args[1]) default: - client.Cmd.Reply(event, errUnknCmd.Error()) + _, ok := appConfig.LuaCommands[args[0]] + if !ok { + client.Cmd.Reply(event, errUnknCmd.Error()) + + break + } + + result := RunLuaFunc(args[0], args[1], client, appConfig) + client.Cmd.Reply(event, result) } } |