forked from kageru/discord-selphybot
added !help to list all commands
This commit is contained in:
parent
481a96e9d7
commit
54cac6075a
31
command.go
31
command.go
@ -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
|
||||
}
|
||||
|
1
main.go
1
main.go
@ -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})
|
||||
|
Loading…
Reference in New Issue
Block a user