diff --git a/DisCatSharp/Enums/Permission.cs b/DisCatSharp/Enums/Permission.cs index 97c4a90d8..b5a7f0bcf 100644 --- a/DisCatSharp/Enums/Permission.cs +++ b/DisCatSharp/Enums/Permission.cs @@ -1,363 +1,363 @@ // This file is part of the DisCatSharp project. // // Copyright (c) 2021 AITSYS // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. using System; namespace DisCatSharp { /// /// Represents permission methods. /// public static class PermissionMethods { /// /// Gets the full permissions enum (long). /// - internal static Permissions FULL_PERMS { get; } = (Permissions)1099511627775L; // 2199023255551L + internal static Permissions FULL_PERMS { get; } = (Permissions)2199023255551L; /// /// Calculates whether this permission set contains the given permission. /// /// The permissions to calculate from /// permission you want to check /// public static bool HasPermission(this Permissions p, Permissions permission) => p.HasFlag(Permissions.Administrator) || (p & permission) == permission; /// /// Grants permissions. /// /// The permissions to add to. /// Permission to add. /// public static Permissions Grant(this Permissions p, Permissions grant) => p | grant; /// /// Revokes permissions. /// /// The permissions to take from. /// Permission to take. /// public static Permissions Revoke(this Permissions p, Permissions revoke) => p & ~revoke; } /// /// Whether a permission is allowed, denied or unset /// public enum PermissionLevel { /// /// Said permission is Allowed /// Allowed, /// /// Said permission is Denied /// Denied, /// /// Said permission is Unset /// Unset } /// /// Bitwise permission flags. /// [Flags] public enum Permissions : long { /// /// Indicates no permissions given. /// [PermissionString("No permissions")] None = 0x0000000000000000, /// /// Indicates all permissions are granted /// [PermissionString("All permissions")] - All = 1099511627775, // 2199023255551 + All = 2199023255551, /// /// Allows creation of instant channel invites. /// [PermissionString("Create instant invites")] CreateInstantInvite = 0x0000000000000001, /// /// Allows kicking members. /// [PermissionString("Kick members")] KickMembers = 0x0000000000000002, /// /// Allows banning and unbanning members. /// [PermissionString("Ban members")] BanMembers = 0x0000000000000004, /// /// Enables full access on a given guild. This also overrides other permissions. /// [PermissionString("Administrator")] Administrator = 0x0000000000000008, /// /// Allows managing channels. /// [PermissionString("Manage channels")] ManageChannels = 0x0000000000000010, /// /// Allows managing the guild. /// [PermissionString("Manage guild")] ManageGuild = 0x0000000000000020, /// /// Allows adding reactions to messages. /// [PermissionString("Add reactions")] AddReactions = 0x0000000000000040, /// /// Allows viewing audit log entries. /// [PermissionString("View audit log")] ViewAuditLog = 0x0000000000000080, /// /// Allows the use of priority speaker. /// [PermissionString("Use priority speaker")] PrioritySpeaker = 0x0000000000000100, /// /// Allows accessing text and voice channels. Disabling this permission hides channels. /// [PermissionString("Read messages")] AccessChannels = 0x0000000000000400, /// /// Allows sending messages (does not allow sending messages in threads). /// [PermissionString("Send messages")] SendMessages = 0x0000000000000800, /// /// Allows sending text-to-speech messages. /// [PermissionString("Send TTS messages")] SendTtsMessages = 0x0000000000001000, /// /// Allows managing messages of other users. /// [PermissionString("Manage messages")] ManageMessages = 0x0000000000002000, /// /// Allows embedding content in messages. /// [PermissionString("Use embeds")] EmbedLinks = 0x0000000000004000, /// /// Allows uploading files. /// [PermissionString("Attach files")] AttachFiles = 0x0000000000008000, /// /// Allows reading message history. /// [PermissionString("Read message history")] ReadMessageHistory = 0x0000000000010000, /// /// Allows using @everyone and @here mentions. /// [PermissionString("Mention everyone")] MentionEveryone = 0x0000000000020000, /// /// Allows using emojis from external servers, such as twitch or nitro emojis. /// [PermissionString("Use external emojis")] UseExternalEmojis = 0x0000000000040000, /// /// Allows connecting to voice chat. /// [PermissionString("Use voice chat")] UseVoice = 0x0000000000100000, /// /// Allows speaking in voice chat. /// [PermissionString("Speak")] Speak = 0x0000000000200000, /// /// Allows muting other members in voice chat. /// [PermissionString("Mute voice chat members")] MuteMembers = 0x0000000000400000, /// /// Allows deafening other members in voice chat. /// [PermissionString("Deafen voice chat members")] DeafenMembers = 0x0000000000800000, /// /// Allows moving voice chat members. /// [PermissionString("Move voice chat members")] MoveMembers = 0x0000000001000000, /// /// Allows using voice activation in voice chat. Revoking this will usage of push-to-talk. /// [PermissionString("Use voice activity detection")] UseVoiceDetection = 0x0000000002000000, /// /// Allows changing of own nickname. /// [PermissionString("Change own nickname")] ChangeNickname = 0x0000000004000000, /// /// Allows managing nicknames of other members. /// [PermissionString("Manage nicknames")] ManageNicknames = 0x0000000008000000, /// /// Allows managing roles in a guild. /// [PermissionString("Manage roles")] ManageRoles = 0x0000000010000000, /// /// Allows managing webhooks in a guild. /// [PermissionString("Manage webhooks")] ManageWebhooks = 0x0000000020000000, /// /// Allows managing guild emojis and stickers. /// [PermissionString("Manage emojis & stickers")] ManageEmojisAndStickers = 0x0000000040000000, /// /// Allows the user to go live. /// [PermissionString("Allow stream")] Stream = 0x0000000000000200, /// /// Allows the user to use slash commands. /// [PermissionString("Use application commands")] UseApplicationCommands = 0x0000000080000000, /// /// Allows for requesting to speak in stage channels. /// [PermissionString("Request to speak")] RequestToSpeak = 0x0000000100000000, /// /// Allows managing guild events. /// [PermissionString("Manage Events")] ManageEvents = 0x0000000200000000, /// /// Allows for deleting and archiving threads, and viewing all private threads. /// [PermissionString("Manage Threads")] ManageThreads = 0x0000000400000000, /// /// Allows for creating threads. /// [PermissionString("Create Public Threads")] CreatePublicThreads = 0x0000000800000000, /// /// Allows for creating private threads. /// [PermissionString("Create Private Threads")] CreatePrivateThreads = 0x0000001000000000, /// /// Allows the usage of custom stickers from other servers. /// [PermissionString("Use external Stickers")] UseExternalStickers = 0x0000002000000000, /// /// Allows for sending messages in threads. /// [PermissionString("Send messages in Threads")] SendMessagesInThreads = 0x0000004000000000, /// /// Allows for launching activities (applications with the `EMBEDDED` flag) in a voice channel. /// [PermissionString("Start Embedded Activities")] - StartEmbeddedActivities = 0x0000008000000000//, + StartEmbeddedActivities = 0x0000008000000000, - /*/// - /// Allows to time-out a member. + /// + /// Allows to moderate member. /// - [PermissionString("Time-out Members")] - TimeOutMembers = 0x0000010000000000*/ + [PermissionString("Moderate Members")] + TimeOutMembers = 0x0000010000000000 } /// /// Defines a readable name for this permission. /// [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public sealed class PermissionStringAttribute : Attribute { /// /// Gets the readable name for this permission. /// public string String { get; } /// /// Defines a readable name for this permission. /// /// Readable name for this permission. public PermissionStringAttribute(string str) { this.String = str; } } }