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 /types.go | |
parent | WIP (diff) | |
download | milla-7a3795e44bf030fc0e27c49aea8c32a4457a59f5.tar.gz milla-7a3795e44bf030fc0e27c49aea8c32a4457a59f5.zip |
we can now add new commands from lua plugins
Diffstat (limited to '')
-rw-r--r-- | types.go | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -35,6 +35,11 @@ type WatchList struct { Words []string `toml:"watchWords"` } +type LuaCommand struct { + Path string + FuncName string +} + type TomlConfig struct { IrcServer string `toml:"ircServer"` IrcNick string `toml:"ircNick"` @@ -66,6 +71,7 @@ type TomlConfig struct { CustomCommands map[string]CustomCommand `toml:"customCommands"` WatchLists map[string]WatchList `toml:"watchList"` LuaStates map[string]LuaLstates + LuaCommands map[string]LuaCommand Temp float64 `toml:"temp"` RequestTimeout int `toml:"requestTimeout"` MillaReconnectDelay int `toml:"millaReconnectDelay"` @@ -112,6 +118,22 @@ func (config *TomlConfig) deleteLstate(name string) { delete(config.LuaStates, name) } +func (config *TomlConfig) insertLuaCommand( + cmd, path, name string, +) { + if config.LuaCommands == nil { + config.LuaCommands = make(map[string]LuaCommand) + } + config.LuaCommands[cmd] = LuaCommand{Path: path, FuncName: name} +} + +func (config *TomlConfig) deleteLuaCommand(name string) { + if config.LuaCommands == nil { + return + } + delete(config.LuaCommands, name) +} + type AppConfig struct { Ircd map[string]TomlConfig `toml:"ircd"` } |