From efcba1f555b6578cf092d1d4b23fa71e1df934ad Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Mon, 12 May 2025 00:27:36 +0100 Subject: [PATCH] Show aliases in help command --- internal/handler/handler.go | 18 ++++++++++++++++-- pkg/commands/img/img.go | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/internal/handler/handler.go b/internal/handler/handler.go index 0e41442..fb540a2 100644 --- a/internal/handler/handler.go +++ b/internal/handler/handler.go @@ -132,8 +132,19 @@ func (b *Bot) handler(session *discordgo.Session, message *discordgo.MessageCrea func printHelp(bot *Bot, h *Handler) { var commands []string - for cmd := range bot.commands { - commands = append(commands, cmd) + for command := range bot.commands { + var found []string + for a, c := range bot.aliases { + if c == command { + found = append(found, a) + } + } + + if len(found) > 0 { + commands = append(commands, fmt.Sprintf("%s (%s)", command, strings.Join(found, ", "))) + } else { + commands = append(commands, command) + } } _, _ = h.Session.ChannelMessageSendComplex(h.Message.ChannelID, &discordgo.MessageSend{ @@ -141,6 +152,9 @@ func printHelp(bot *Bot, h *Handler) { Title: "Help", Description: strings.Join(commands, "\n"), Color: color.RGBToDiscord(255, 255, 255), + Footer: &discordgo.MessageEmbedFooter{ + Text: "command (aliases...)", + }, }, Reference: h.Reference, }) diff --git a/pkg/commands/img/img.go b/pkg/commands/img/img.go index 21a1a80..bc9cc25 100644 --- a/pkg/commands/img/img.go +++ b/pkg/commands/img/img.go @@ -76,7 +76,7 @@ func registerSaveable(bot *handler.Bot) handler.Callback { Image: &discordgo.MessageEmbedImage{ URL: "attachment://saveable.gif", }, - Color: color.RGBToDiscord(1, 1, 1), + Color: color.RGBToDiscord(255, 255, 255), }, Files: []*discordgo.File{ { @@ -205,7 +205,7 @@ func registerCaption(bot *handler.Bot) handler.Callback { Image: &discordgo.MessageEmbedImage{ URL: "attachment://caption.jpeg", }, - Color: color.RGBToDiscord(1, 1, 1), + Color: color.RGBToDiscord(255, 255, 255), }, Files: []*discordgo.File{ {