added !help to list all commands

This commit is contained in:
kageru 2018-06-19 11:54:29 +02:00
parent 481a96e9d7
commit 54cac6075a
Signed by untrusted user: kageru
GPG Key ID: 4289AC14736877D7
2 changed files with 32 additions and 0 deletions

@ -201,3 +201,34 @@ func giveAgeRole(s *discordgo.Session, m *discordgo.MessageCreate) {
}
}
}
func getHelpEmbed() *discordgo.MessageEmbed {
commandList := "Im Folgenden findest du eine automatisch generierte Liste aller Commands. Um herauszufinden, was sie tun, probiere sie aus oder lies den Source Code (siehe unten).\n```"
for _, command := range commands {
if command.Type != CommandTypeRegex {
commandList += "- " + command.Trigger + "\n"
}
}
commandList += "```"
embed := &discordgo.MessageEmbed{
Author: &discordgo.MessageEmbedAuthor{},
Color: 0xffb90f,
Description: "__Hilfe__",
Fields: []*discordgo.MessageEmbedField {
&discordgo.MessageEmbedField {
Name: "__Commands__",
Value: commandList,
Inline: true,
},
&discordgo.MessageEmbedField {
Name: "__Bugs__",
Value: fmt.Sprintf("Bei Fragen zum Bot, Vorschlägen, Bugs etc. wende dich bitte an <@%s> oder öffne eine Issue auf https://git.kageru.moe/kageru/discord-selphybot.", config.Admins[0]),
Inline: true,
},
},
Thumbnail: &discordgo.MessageEmbedThumbnail{
URL: "https://static-cdn.jtvnw.net/emoticons/v1/1068185/3.0",
},
}
return embed
}

@ -70,6 +70,7 @@ func addCommands() {
// Information
registerCommand(Command{Trigger: "!welcome", OutputEmbed: getWelcomeEmbed(), Type: CommandTypeFullMatch, DMOnly: true})
registerCommand(Command{Trigger: "!help", OutputEmbed: getHelpEmbed(), Type: CommandTypeFullMatch, DMOnly: true})
// Admin and/or debug
registerCommand(Command{Trigger: "<@%s> <3", Output: "<@%s> <3", Type: CommandTypeFullMatch, AdminOnly: true, OutputIsReply: true, RequiresMention: true})