From 31c1cbae6b1a0d09aaf4a0f31a5ffa7ae421a7de Mon Sep 17 00:00:00 2001 From: Forbidden-A Date: Mon, 12 Oct 2020 10:28:04 +0300 Subject: [PATCH] Added help command --- go.mod | 1 - go.sum | 8 -------- internal/exts/info/help.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 internal/exts/info/help.go diff --git a/go.mod b/go.mod index f4ae69b..42f3b37 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/dustinpianalto/rpnparse v1.0.1 github.com/emersion/go-imap v1.0.5 github.com/emersion/go-message v0.12.0 - github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/lib/pq v1.3.0 github.com/olebedev/when v0.0.0-20190311101825-c3b538a97254 ) diff --git a/go.sum b/go.sum index f7ae336..e9867af 100644 --- a/go.sum +++ b/go.sum @@ -2,19 +2,11 @@ github.com/AlekSi/pointer v1.0.0 h1:KWCWzsvFxNLcmM5XmiqHsGTTsuwZMsLFwWF9Y+//bNE= github.com/AlekSi/pointer v1.0.0/go.mod h1:1kjywbfcPFCmncIxtk6fIEub6LKrfMz3gc5QKVOSOA8= github.com/bwmarrin/discordgo v0.20.2 h1:nA7jiTtqUA9lT93WL2jPjUp8ZTEInRujBdx1C9gkr20= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= -github.com/bwmarrin/discordgo v0.20.3-0.20200525154655-ca64123b05de h1:0TOVVwGrmv0PA+/vuekQIRY9jJ9rcHYnicIaph3/4S4= -github.com/bwmarrin/discordgo v0.20.3-0.20200525154655-ca64123b05de/go.mod h1:c1WtWUGN6nREDmzIpyTp/iD3VYt4Fpx+bVyfBG7JE+M= github.com/bwmarrin/discordgo v0.22.0 h1:uBxY1HmlVCsW1IuaPjpCGT6A2DBwRn0nvOguQIxDdFM= github.com/bwmarrin/discordgo v0.22.0/go.mod h1:c1WtWUGN6nREDmzIpyTp/iD3VYt4Fpx+bVyfBG7JE+M= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dustinpianalto/disgoman v0.0.10 h1:UzmvMpOi4peF59tXGaNfVU+ePHs1hILa6gQbjxjWQ9g= -github.com/dustinpianalto/disgoman v0.0.10/go.mod h1:v3FM6n+4dH9XlvO+IDx6MN3DUnGq6YVDBvy1A1k202g= -github.com/dustinpianalto/disgoman v0.0.12 h1:dLptU2ZTUZJaLBOKeE6qjuL8gqdAr6ehHSOtfHmUpL8= -github.com/dustinpianalto/disgoman v0.0.12/go.mod h1:v3FM6n+4dH9XlvO+IDx6MN3DUnGq6YVDBvy1A1k202g= -github.com/dustinpianalto/disgoman v0.0.14 h1:hsk56JATBE5eH5GPCDGeiTdYxok4m+edSYiYz5Uj8uo= -github.com/dustinpianalto/disgoman v0.0.14/go.mod h1:v3FM6n+4dH9XlvO+IDx6MN3DUnGq6YVDBvy1A1k202g= github.com/dustinpianalto/disgoman v0.0.15 h1:kdIw6jhC82WBut7+4BarqxBw06dozU+Hu47LQzkkoGM= github.com/dustinpianalto/disgoman v0.0.15/go.mod h1:v3FM6n+4dH9XlvO+IDx6MN3DUnGq6YVDBvy1A1k202g= github.com/dustinpianalto/rpnparse v1.0.1 h1:ZvH1/RIe5hh3RGSAXOgtngEDHNPTF+DMh88XFWpQjzY= diff --git a/internal/exts/info/help.go b/internal/exts/info/help.go new file mode 100644 index 0000000..ce73472 --- /dev/null +++ b/internal/exts/info/help.go @@ -0,0 +1,28 @@ +package info + +import ( + "fmt" + "github.com/dustinpianalto/disgoman" +) + +var HelpCommand = &disgoman.Command{ + Name: "info", + Aliases: []string{"?","h"}, + Description: "", + OwnerOnly: false, + Hidden: true, + RequiredPermissions: 0, + Invoke: HelpFunc, +} + +func HelpFunc(ctx disgoman.Context, args []string) { + var message = ">>> Command | Description\n" + for name, command := range ctx.CommandManager.Commands { + if command.OwnerOnly || command.Hidden { + continue + } + + message += fmt.Sprintf("%s | %s\n", name, command.Description) + } + _, _ = ctx.Send(message) +} \ No newline at end of file