commit de16fb10471909bcd473e752b5cc6a5b126cdb1f
parent 3919c3495e68a78293f2783836ff502918f91e07
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date: Sun, 23 Mar 2025 15:59:55 +0000
Help command
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/main.go b/main.go
@@ -267,6 +267,15 @@ func ircSender(config *IrcConfig, i *irc.Connection, cm <-chan Msg, cc <-chan co
switch cmd.name {
case "filters":
ircSendFilters(config, i, &f, &buf)
+ case "help":
+ ircSend(config, i, "Command line:", &buf)
+ ircSendHelp(config, i, &buf, "filters", "")
+ ircSendHelp(config, i, &buf, "help", "")
+ ircSendHelp(config, i, &buf, "ignore", "<topic>")
+ ircSendHelp(config, i, &buf, "important", "<topic>")
+ ircSendHelp(config, i, &buf, "quit", "[message]")
+ ircSendHelp(config, i, &buf, "unignore", "<topic>")
+ ircSendHelp(config, i, &buf, "unimportant", "<topic>")
case "ignore":
filterAddIgnored(&f, cmd.arg)
case "important":
@@ -333,6 +342,14 @@ func ircSendFilters(config *IrcConfig, i *irc.Connection, f *mqttTopicFilter, bu
ircSendTopicList(config, i, "ignored", f.ignored, buf)
}
+func ircSendHelp(config *IrcConfig, i *irc.Connection, buf *strings.Builder, cmd, arg string) {
+ if arg == "" {
+ ircSend(config, i, fmt.Sprintf("- %q", config.CmdStart+cmd+config.CmdEnd), buf)
+ } else {
+ ircSend(config, i, fmt.Sprintf("- %q", config.CmdStart+cmd+config.CmdMid+arg+config.CmdEnd), buf)
+ }
+}
+
func subscribeAll(m *mqtt.Client, ircQueue chan<- Msg, topics []string) {
for _, topic := range topics {
for {