-
-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Initial commit of changes. Changed permissions from bitwise index to use bitwise flags instead. Modified relevant methods involved * Revised enum value naming * Added FlagsAttribute to ChannelPermission, GuildPermission * Added comments per Joe4evr suggestion * Added underlines to hex value digits for readability per Joe4evr suggestion * updated names to better reflect actual permission names as per SubZero0 suggestion * fix for 236775c * Replaced Math.Pow with left shift operator * Cleaned up the formatting of ChannelPermission and GuildPermission enums to make it easier to read
- Loading branch information
1 parent
759db34
commit f996338
Showing
6 changed files
with
153 additions
and
145 deletions.
There are no files selected for viewing
62 changes: 29 additions & 33 deletions
62
src/Discord.Net.Core/Entities/Permissions/ChannelPermission.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,36 @@ | ||
namespace Discord | ||
using System; | ||
|
||
namespace Discord | ||
{ | ||
public enum ChannelPermission : byte | ||
[FlagsAttribute] | ||
public enum ChannelPermission : ulong | ||
{ | ||
//General | ||
CreateInstantInvite = 0, | ||
//KickMembers = 1, | ||
//BanMembers = 2, | ||
//Administrator = 3, | ||
ManageChannel = 4, | ||
//ManageGuild = 5, | ||
// General | ||
CreateInstantInvite = 0x00_00_00_01, | ||
ManageChannels = 0x00_00_00_10, | ||
|
||
//Text | ||
AddReactions = 6, | ||
ReadMessages = 10, | ||
SendMessages = 11, | ||
SendTTSMessages = 12, | ||
ManageMessages = 13, | ||
EmbedLinks = 14, | ||
AttachFiles = 15, | ||
ReadMessageHistory = 16, | ||
MentionEveryone = 17, | ||
UseExternalEmojis = 18, | ||
// Text | ||
AddReactions = 0x00_00_00_40, | ||
ReadMessages = 0x00_00_04_00, | ||
SendMessages = 0x00_00_08_00, | ||
SendTTSMessages = 0x00_00_10_00, | ||
ManageMessages = 0x00_00_20_00, | ||
EmbedLinks = 0x00_00_40_00, | ||
AttachFiles = 0x00_00_80_00, | ||
ReadMessageHistory = 0x00_01_00_00, | ||
MentionEveryone = 0x00_02_00_00, | ||
UseExternalEmojis = 0x00_04_00_00, | ||
|
||
//Voice | ||
Connect = 20, | ||
Speak = 21, | ||
MuteMembers = 22, | ||
DeafenMembers = 23, | ||
MoveMembers = 24, | ||
UseVAD = 25, | ||
// Voice | ||
Connect = 0x00_10_00_00, | ||
Speak = 0x00_20_00_00, | ||
MuteMembers = 0x00_40_00_00, | ||
DeafenMembers = 0x00_80_00_00, | ||
MoveMembers = 0x01_00_00_00, | ||
UseVAD = 0x02_00_00_00, | ||
|
||
//General2 | ||
//ChangeNickname = 26, | ||
//ManageNicknames = 27, | ||
ManagePermissions = 28, | ||
ManageWebhooks = 29, | ||
//ManageEmojis = 30 | ||
// More General | ||
ManageRoles = 0x10_00_00_00, | ||
ManageWebhooks = 0x20_00_00_00, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 37 additions & 33 deletions
70
src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,44 @@ | ||
namespace Discord | ||
using System; | ||
|
||
namespace Discord | ||
{ | ||
public enum GuildPermission : byte | ||
[FlagsAttribute] | ||
public enum GuildPermission : ulong | ||
{ | ||
//General | ||
CreateInstantInvite = 0, | ||
KickMembers = 1, | ||
BanMembers = 2, | ||
Administrator = 3, | ||
ManageChannels = 4, | ||
ManageGuild = 5, | ||
// General | ||
CreateInstantInvite = 0x00_00_00_01, | ||
KickMembers = 0x00_00_00_02, | ||
BanMembers = 0x00_00_00_04, | ||
Administrator = 0x00_00_00_08, | ||
ManageChannels = 0x00_00_00_10, | ||
ManageGuild = 0x00_00_00_20, | ||
|
||
//Text | ||
AddReactions = 6, | ||
ReadMessages = 10, | ||
SendMessages = 11, | ||
SendTTSMessages = 12, | ||
ManageMessages = 13, | ||
EmbedLinks = 14, | ||
AttachFiles = 15, | ||
ReadMessageHistory = 16, | ||
MentionEveryone = 17, | ||
UseExternalEmojis = 18, | ||
// Text | ||
AddReactions = 0x00_00_00_40, | ||
ViewAuditLog = 0x00_00_00_80, | ||
ReadMessages = 0x00_00_04_00, | ||
SendMessages = 0x00_00_08_00, | ||
SendTTSMessages = 0x00_00_10_00, | ||
ManageMessages = 0x00_00_20_00, | ||
EmbedLinks = 0x00_00_40_00, | ||
AttachFiles = 0x00_00_80_00, | ||
ReadMessageHistory = 0x00_01_00_00, | ||
MentionEveryone = 0x00_02_00_00, | ||
UseExternalEmojis = 0x00_04_00_00, | ||
|
||
//Voice | ||
Connect = 20, | ||
Speak = 21, | ||
MuteMembers = 22, | ||
DeafenMembers = 23, | ||
MoveMembers = 24, | ||
UseVAD = 25, | ||
// Voice | ||
Connect = 0x00_10_00_00, | ||
Speak = 0x00_20_00_00, | ||
MuteMembers = 0x00_40_00_00, | ||
DeafenMembers = 0x00_80_00_00, | ||
MoveMembers = 0x01_00_00_00, | ||
UseVAD = 0x02_00_00_00, | ||
|
||
//General2 | ||
ChangeNickname = 26, | ||
ManageNicknames = 27, | ||
ManageRoles = 28, | ||
ManageWebhooks = 29, | ||
ManageEmojis = 30 | ||
// General 2 | ||
ChangeNickname = 0x04_00_00_00, | ||
ManageNicknames = 0x08_00_00_00, | ||
ManageRoles = 0x10_00_00_00, | ||
ManageWebhooks = 0x20_00_00_00, | ||
ManageEmojis = 0x40_00_00_00 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.