fixed !help

This commit is contained in:
kageru 2018-07-22 15:43:46 +02:00
parent d733c09242
commit efe45d0c94
Signed by untrusted user: kageru
GPG Key ID: 8282A2BEA4ADA3D2
2 changed files with 6 additions and 2 deletions

View File

@ -207,7 +207,9 @@ 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 {
fmt.Println(command.Trigger)
if command.Type != CommandTypeRegex && (!command.AdminOnly || command.DMOnly) {
fmt.Sprintf("%s appended", command.Trigger)
commandList += "- " + command.Trigger + "\n"
}
}

View File

@ -70,13 +70,15 @@ func addCommands() {
// Information
registerCommand(Command{Trigger: "!welcome", OutputEmbed: getWelcomeEmbed(), Type: CommandTypeFullMatch, DMOnly: true})
registerCommand(Command{Trigger: "!help", OutputEmbed: getHelpEmbed(), Type: CommandTypeFullMatch, DMOnly: true})
registerCommand(Command{Trigger: "!mods", Output: "Bei Fragen, Problemen und Beschwerden wende dich bitte an die Moderatoren oder schick mir eine Nachricht beginnend mit !complain, um dich anonym zu beschweren.\nAktuell anwesende Mods werden dir rechts mit dem Rang „Maid“ angezeigt.", Type: CommandTypeFullMatch})
// Admin and/or debug
registerCommand(Command{Trigger: "<@%s> <3", Output: "<@%s> <3", Type: CommandTypeFullMatch, AdminOnly: true, OutputIsReply: true, RequiresMention: true})
registerCommand(Command{Trigger: "echo", Type: CommandTypePrefix, Function: echoMessage, AdminOnly: true})
// This needs to be the last command because getHelpEmbed is evaluated here once, not on every function call. Putting it too early will result in missing commands in the output.
registerCommand(Command{Trigger: "!help", OutputEmbed: getHelpEmbed(), Type: CommandTypeFullMatch, DMOnly: true})
fmt.Printf("Successfully initialized %d commands\n", len(commands))
log.Printf("Successfully initialized %d commands", len(commands))
}