Method HasPermission
| Improve this Doc View SourceHasPermission(DiscordPermission, Snowflake, IEnumerable<Snowflake>, Snowflake, Snowflake, IReadOnlyDictionary<Snowflake, DiscordRole>, IReadOnlyDictionary<Snowflake, DiscordOverwrite>?)
Returns whether a guild member has a set of permissions within the guild and optionally additionally within a specific guild channel.
Declaration
public static bool HasPermission(DiscordPermission permissions, Snowflake memberId, IEnumerable<Snowflake> memberRoleIds, Snowflake guildId, Snowflake guildOwnerId, IReadOnlyDictionary<Snowflake, DiscordRole> guildRoles, IReadOnlyDictionary<Snowflake, DiscordOverwrite>? channelOverwrites = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscordPermission | permissions | The set of permissions to check if the member has. |
| Snowflake | memberId | The ID of the guild member to check. |
| IEnumerable<Snowflake> | memberRoleIds | A list of role IDs that the member has. |
| Snowflake | guildId | The ID of the guild. |
| Snowflake | guildOwnerId | The ID of the owner of the guild. |
| IReadOnlyDictionary<Snowflake, DiscordRole> | guildRoles | A map of the guild's roles. |
| IReadOnlyDictionary<Snowflake, DiscordOverwrite> | channelOverwrites | A map of the channel's roles. If null, channel permissions will not be considered. |
Returns
| Type | Description |
|---|---|
| bool |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
HasPermission(DiscordPermission, IDiscordGuildMember, DiscordGuild, DiscordGuildChannel?)
Returns whether a guild member has a set of permissions within the guild and optionally additionally within a specific guild channel.
Declaration
public static bool HasPermission(DiscordPermission permissions, IDiscordGuildMember member, DiscordGuild guild, DiscordGuildChannel? channel = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscordPermission | permissions | The set of permissions to check if the member has. |
| IDiscordGuildMember | member | The guild member to check. |
| DiscordGuild | guild | The guild. |
| DiscordGuildChannel | channel | A guild channel. If null, channel permissions will not be considered. |
Returns
| Type | Description |
|---|---|
| bool |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if |
| ArgumentNullException | Thrown if |