fix !help and set it as game status

This commit is contained in:
kageru 2018-07-22 19:18:24 +02:00
parent efe45d0c94
commit 41b1587a25
Signed by untrusted user: kageru
GPG Key ID: 8282A2BEA4ADA3D2
3 changed files with 12 additions and 7 deletions

View File

@ -1,14 +1,20 @@
# Selphybot Changelog
Updates are listed in reverse chronological order.
### 1.3 (dev)
- use global array of pointers to commands to allow easier modification and avoid unnecessary memcpy
- added feedback to !complain (used to work but was forgotten when refactoring)
- lessen the retardation
- added !mods
- fix !help not showing all relevant commands
- made !help available to all users
- set !help as the currently played game
### 1.2
- added !help command to automatically print a list of all commands and some additional information
- finally wrote a readme
- updated wink regex
- added more misc commands
- added feedback to !complain (used to work but was forgotten when refactoring)
- use global array of pointers to commands to allow easier modification and avoid unnecessary memcpy
- lessen the retardation
### 1.1
- cooldowns are now stored per-user, not globally, and no longer apply in DMs

View File

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

View File

@ -34,6 +34,7 @@ func main() {
}
defer f.Close()
log.SetOutput(f)
dg.UpdateStatus(0, "!help")
addCommands()
fmt.Println("Bot running. selphyWoo")
@ -77,7 +78,7 @@ func addCommands() {
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})
registerCommand(Command{Trigger: "!help", OutputEmbed: getHelpEmbed(), Type: CommandTypeFullMatch})
fmt.Printf("Successfully initialized %d commands\n", len(commands))
log.Printf("Successfully initialized %d commands", len(commands))