diff --git a/command.go b/command.go index f513ed4..eba1d42 100644 --- a/command.go +++ b/command.go @@ -56,6 +56,9 @@ func registerCommand(command Command) { command.Trigger = strings.ToLower(command.Trigger) } command.UsersOnCooldown = mapset.NewSet() + if command.AllowedChannels == nil { + command.AllowedChannels = mapset.NewSet() + } commands = append(commands, &command) } @@ -164,7 +167,9 @@ func commandAllowed(session *discordgo.Session, message *discordgo.MessageCreate } // no allowed channels = all channels are allowed. // DMs are whitelisted by default - if command.AllowedChannels.Cardinality() != 0 && !command.AllowedChannels.Contains(message.ChannelID) && !isDM(session, message) { + if command.AllowedChannels.Cardinality() != 0 && + !command.AllowedChannels.Contains(message.ChannelID) && + isDM(session, message) { return false } return true