aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin_chatcmd.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugin_chatcmd.go b/plugin_chatcmd.go
index 04e2396..c5915dc 100644
--- a/plugin_chatcmd.go
+++ b/plugin_chatcmd.go
@@ -12,13 +12,23 @@ var chatCmds map[string]ChatCmd
var chatCmdsMu sync.RWMutex
var chatCmdsOnce sync.Once
-func ChatCmdExists(name string) bool {
+func ChatCmds() map[string]ChatCmd {
initChatCmds()
chatCmdsMu.RLock()
defer chatCmdsMu.RUnlock()
- _, ok := chatCmds[name]
+ cmds := make(map[string]ChatCmd)
+ for name, cmd := range chatCmds {
+ cmds[name] = cmd
+ }
+
+ return cmds
+}
+
+func ChatCmdExists(name string) bool {
+ cmds := ChatCmds()
+ _, ok := cmds[name]
return ok
}