fixed !help
This commit is contained in:
parent
d733c09242
commit
efe45d0c94
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
4
main.go
4
main.go
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue