mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-05-14 08:02:17 +00:00
Show aliases in help command
This commit is contained in:
parent
e8f6e7cc0a
commit
efcba1f555
2 changed files with 18 additions and 4 deletions
|
@ -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,
|
||||
})
|
||||
|
|
|
@ -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{
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue