aboutsummaryrefslogtreecommitdiffstats
path: root/types.go
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2024-07-21 03:43:36 +0000
committerterminaldweller <devi@terminaldweller.com>2024-07-21 03:43:36 +0000
commit7a3795e44bf030fc0e27c49aea8c32a4457a59f5 (patch)
tree37d8ce89ad9a63688be5ee9bfa6632bde9a418ca /types.go
parentWIP (diff)
downloadmilla-7a3795e44bf030fc0e27c49aea8c32a4457a59f5.tar.gz
milla-7a3795e44bf030fc0e27c49aea8c32a4457a59f5.zip
we can now add new commands from lua plugins
Diffstat (limited to 'types.go')
-rw-r--r--types.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/types.go b/types.go
index 266eccc..d6f3236 100644
--- a/types.go
+++ b/types.go
@@ -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"`
}