diff --git a/state/state.go b/state/state.go index 3c44d5c..cbdb74f 100644 --- a/state/state.go +++ b/state/state.go @@ -262,6 +262,8 @@ func (s *State) MemberColor(guildID discord.GuildID, userID discord.UserID) (dis //// +// Permissions gets the user's permissions in the given channel. If the channel +// is not in any guild, then an error is returned. func (s *State) Permissions( channelID discord.ChannelID, userID discord.UserID) (discord.Permissions, error) { @@ -270,6 +272,10 @@ func (s *State) Permissions( return 0, errors.Wrap(err, "failed to get channel") } + if !ch.GuildID.IsValid() { + return 0, errors.New("channel is not in a guild") + } + var wg sync.WaitGroup var (