list channels, switch guild, fix codeblock regex, sort commands in help, fix message update crash

This commit is contained in:
Cynthia Foxwell 2023-07-14 20:46:17 -06:00
parent 80a343e4ee
commit a9b3accdf6
6 changed files with 199 additions and 5 deletions

View file

@ -30,6 +30,10 @@ func MessageCreate(session *discordgo.Session, msg *discordgo.MessageCreate) {
}
func MessageUpdate(session *discordgo.Session, msg *discordgo.MessageUpdate) {
if msg.Author == nil {
return
}
if msg.Author.ID == session.State.User.ID {
return
}

View file

@ -20,12 +20,13 @@ func Ready(session *discordgo.Session, event *discordgo.Ready) {
defaultGuild := state.GetConfigValue("defaultGuild")
defaultChannel := state.GetConfigValue("defaultChannel")
if defaultGuild != "" {
_, err := session.State.Guild(defaultGuild)
guild, err := session.State.Guild(defaultGuild)
if err == nil {
if defaultChannel != "" {
state.SetCurrentChannel(defaultChannel)
state.SetLastChannel(defaultGuild, defaultChannel)
}
commands.SwitchGuild(session, guild.Name)
} else {
fmt.Println("\r% This account is not in the defined default guild.")
}