mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-02-11 05:52:58 +00:00
State: Error out on fetching permission of a channel not in guild
This commit is contained in:
parent
8a21375916
commit
771591e5eb
|
@ -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(
|
func (s *State) Permissions(
|
||||||
channelID discord.ChannelID, userID discord.UserID) (discord.Permissions, error) {
|
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")
|
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 wg sync.WaitGroup
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in a new issue