diff --git a/DisCatSharp/Enums/Permission.cs b/DisCatSharp/Enums/Permission.cs
index 6e38b1aa8..ab671c567 100644
--- a/DisCatSharp/Enums/Permission.cs
+++ b/DisCatSharp/Enums/Permission.cs
@@ -1,366 +1,375 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 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 FullPerms { 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.
/// This disallows users to run application command per default.
///
[PermissionString("No permissions")]
None = 0,
///
/// Indicates all permissions are granted
///
[PermissionString("All permissions")]
All = 0b0001_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111,
///
/// Allows creation of instant channel invites.
///
[PermissionString("Create instant invites")]
CreateInstantInvite = 1L << 0,
///
/// Allows kicking members.
///
[PermissionString("Kick members")]
KickMembers = 1L << 1,
///
/// Allows banning and unbanning members.
///
[PermissionString("Ban members")]
BanMembers = 1L << 2,
///
/// Enables full access on a given guild. This also overrides other permissions.
///
[PermissionString("Administrator")]
Administrator = 1L << 3,
///
/// Allows managing channels.
///
[PermissionString("Manage channels")]
ManageChannels = 1L << 4,
///
/// Allows managing the guild.
///
[PermissionString("Manage guild")]
ManageGuild = 1L << 5,
///
/// Allows adding reactions to messages.
///
[PermissionString("Add reactions")]
AddReactions = 1L << 6,
///
/// Allows viewing audit log entries.
///
[PermissionString("View audit log")]
ViewAuditLog = 1L << 7,
///
/// Allows the use of priority speaker.
///
[PermissionString("Use priority speaker")]
PrioritySpeaker = 1L << 8,
///
/// Allows the user to go live.
///
[PermissionString("Allow stream")]
Stream = 1L << 9,
///
/// Allows accessing text and voice channels. Disabling this permission hides channels.
///
[PermissionString("Read messages")]
AccessChannels = 1L << 10,
///
/// Allows sending messages (does not allow sending messages in threads).
///
[PermissionString("Send messages")]
SendMessages = 1L << 11,
///
/// Allows sending text-to-speech messages.
///
[PermissionString("Send TTS messages")]
SendTtsMessages = 1L << 12,
///
/// Allows managing messages of other users.
///
[PermissionString("Manage messages")]
ManageMessages = 1L << 13,
///
/// Allows embedding content in messages.
///
[PermissionString("Use embeds")]
EmbedLinks = 1L << 14,
///
/// Allows uploading files.
///
[PermissionString("Attach files")]
AttachFiles = 1L << 15,
///
/// Allows reading message history.
///
[PermissionString("Read message history")]
ReadMessageHistory = 1L << 16,
///
/// Allows using @everyone and @here mentions.
///
[PermissionString("Mention everyone")]
MentionEveryone = 1L << 17,
///
/// Allows using emojis from external servers, such as twitch or nitro emojis.
///
[PermissionString("Use external emojis")]
UseExternalEmojis = 1L << 18,
+ ///
+ /// Allows to view guild insights.
+ ///
[PermissionString("View guild insights")]
ViewGuildInsights = 1L << 19,
///
/// Allows connecting to voice chat.
///
[PermissionString("Use voice chat")]
UseVoice = 1L << 20,
///
/// Allows speaking in voice chat.
///
[PermissionString("Speak")]
Speak = 1L << 21,
///
/// Allows muting other members in voice chat.
///
[PermissionString("Mute voice chat members")]
MuteMembers = 1L << 22,
///
/// Allows deafening other members in voice chat.
///
[PermissionString("Deafen voice chat members")]
DeafenMembers = 1L << 23,
///
/// Allows moving voice chat members.
///
[PermissionString("Move voice chat members")]
MoveMembers = 1L << 24,
///
/// Allows using voice activation in voice chat. Revoking this will usage of push-to-talk.
///
[PermissionString("Use voice activity detection")]
UseVoiceDetection = 1L << 25,
///
/// Allows changing of own nickname.
///
[PermissionString("Change own nickname")]
ChangeNickname = 1L << 26,
///
/// Allows managing nicknames of other members.
///
[PermissionString("Manage nicknames")]
ManageNicknames = 1L << 27,
///
/// Allows managing roles in a guild.
///
[PermissionString("Manage roles")]
ManageRoles = 1L << 28,
///
/// Allows managing webhooks in a guild.
///
[PermissionString("Manage webhooks")]
ManageWebhooks = 1L << 29,
///
/// Allows managing guild emojis and stickers.
///
[PermissionString("Manage emojis & stickers")]
ManageEmojisAndStickers = 1L << 30,
///
/// Allows the user to use slash commands.
///
[PermissionString("Use application commands")]
UseApplicationCommands = 1L << 31,
///
/// Allows for requesting to speak in stage channels.
///
[PermissionString("Request to speak")]
RequestToSpeak = 1L << 32,
///
/// Allows managing guild events.
///
[PermissionString("Manage Events")]
ManageEvents = 1L << 33,
///
/// Allows for deleting and archiving threads, and viewing all private threads.
///
[PermissionString("Manage Threads")]
ManageThreads = 1L << 34,
///
/// Allows for creating threads.
///
[PermissionString("Create Public Threads")]
CreatePublicThreads = 1L << 35,
///
/// Allows for creating private threads.
///
[PermissionString("Create Private Threads")]
CreatePrivateThreads = 1L << 36,
///
/// Allows the usage of custom stickers from other servers.
///
[PermissionString("Use external Stickers")]
UseExternalStickers = 1L << 37,
///
/// Allows for sending messages in threads.
///
[PermissionString("Send messages in Threads")]
SendMessagesInThreads = 1L << 38,
///
/// Allows for launching activities (applications with the `EMBEDDED` flag) in a voice channel.
///
[PermissionString("Start Embedded Activities")]
StartEmbeddedActivities = 1L << 39,
///
/// Allows to perform limited moderation actions (timeout).
///
[PermissionString("Moderate Members")]
- ModerateMembers = 1L << 40
+ ModerateMembers = 1L << 40,
+
+ ///
+ /// Allows to view creator monetization insights
+ ///
+ [PermissionString("Moderate Members")]
+ ViewCreatorMonetizationInsights = 1<<41L
}
///
/// Defines a readable name for this permission.
///
[AttributeUsage(AttributeTargets.Field)]
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;
}
}