From 0403a705b6260e3fa6a8656fd3220c28161a4c50 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 1 Mar 2023 20:41:10 +0200 Subject: [PATCH] Add help sections for all commands --- commands.go | 12 +++++++----- commands_botinteraction.go | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/commands.go b/commands.go index c5b9374..2967538 100644 --- a/commands.go +++ b/commands.go @@ -47,6 +47,8 @@ type WrappedCommandEvent struct { Portal *Portal } +var HelpSectionPortalManagement = commands.HelpSection{Name: "Portal management", Order: 20} + func (br *DiscordBridge) RegisterCommands() { proc := br.CommandProcessor.(*commands.Processor) proc.AddHandlers( @@ -327,7 +329,7 @@ var cmdRejoinSpace = &commands.FullHandler{ Func: wrapCommand(fnRejoinSpace), Name: "rejoin-space", Help: commands.HelpMeta{ - Section: commands.HelpSectionUnclassified, + Section: HelpSectionPortalManagement, Description: "Ask the bridge for an invite to a space you left", Args: "<_guild ID_/main/dms>", }, @@ -360,7 +362,7 @@ var cmdSetRelay = &commands.FullHandler{ Func: wrapCommand(fnSetRelay), Name: "set-relay", Help: commands.HelpMeta{ - Section: commands.HelpSectionUnclassified, + Section: HelpSectionPortalManagement, Description: "Create or set a relay webhook for a portal", Args: "[room ID] <​--url URL> OR <​--create [name]>", }, @@ -470,7 +472,7 @@ var cmdUnsetRelay = &commands.FullHandler{ Func: wrapCommand(fnUnsetRelay), Name: "unset-relay", Help: commands.HelpMeta{ - Section: commands.HelpSectionUnclassified, + Section: HelpSectionPortalManagement, Description: "Disable the relay webhook and optionally delete it on Discord", Args: "[--delete]", }, @@ -504,7 +506,7 @@ var cmdGuilds = &commands.FullHandler{ Name: "guilds", Aliases: []string{"servers", "guild", "server"}, Help: commands.HelpMeta{ - Section: commands.HelpSectionUnclassified, + Section: HelpSectionPortalManagement, Description: "Guild bridging management", Args: " [_guild ID_] [...]", }, @@ -618,7 +620,7 @@ var cmdDeleteAllPortals = &commands.FullHandler{ Func: wrapCommand(fnDeleteAllPortals), Name: "delete-all-portals", Help: commands.HelpMeta{ - Section: commands.HelpSectionUnclassified, + Section: commands.HelpSectionAdmin, Description: "Delete all portals.", }, RequiresAdmin: true, diff --git a/commands_botinteraction.go b/commands_botinteraction.go index 1e37fea..28a1340 100644 --- a/commands_botinteraction.go +++ b/commands_botinteraction.go @@ -28,12 +28,14 @@ import ( "maunium.net/go/mautrix/bridge/commands" ) +var HelpSectionDiscordBots = commands.HelpSection{Name: "Discord bot interaction", Order: 30} + var cmdCommands = &commands.FullHandler{ Func: wrapCommand(fnCommands), Name: "commands", Aliases: []string{"cmds", "cs"}, Help: commands.HelpMeta{ - Section: commands.HelpSectionUnclassified, + Section: HelpSectionDiscordBots, Description: "View parameters of bot interaction commands on Discord", Args: "search <_query_> OR help <_command_>", }, @@ -46,7 +48,7 @@ var cmdExec = &commands.FullHandler{ Name: "exec", Aliases: []string{"command", "cmd", "c", "exec", "e"}, Help: commands.HelpMeta{ - Section: commands.HelpSectionUnclassified, + Section: HelpSectionDiscordBots, Description: "Run bot interaction commands on Discord", Args: "<_command_> [_arg=value ..._]", },