diff --git a/DisCatSharp/Enums/DiscordIntents.cs b/DisCatSharp/Enums/DiscordIntents.cs index 47861af06..8f302d094 100644 --- a/DisCatSharp/Enums/DiscordIntents.cs +++ b/DisCatSharp/Enums/DiscordIntents.cs @@ -1,231 +1,233 @@ // 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 a discord intent extensions. /// public static class DiscordIntentExtensions { /// /// Calculates whether these intents have a certain intent. /// /// The base intents. /// The intents to search for. /// public static bool HasIntent(this DiscordIntents intents, DiscordIntents search) => (intents & search) == search; /// /// Adds an intent to these intents. /// /// The base intents. /// The intents to add. /// public static DiscordIntents AddIntent(this DiscordIntents intents, DiscordIntents toAdd) => intents |= toAdd; /// /// Removes an intent from these intents. /// /// The base intents. /// The intents to remove. /// public static DiscordIntents RemoveIntent(this DiscordIntents intents, DiscordIntents toRemove) => intents &= ~toRemove; /// /// Whether it has all privileged intents. /// /// The intents. internal static bool HasAllPrivilegedIntents(this DiscordIntents intents) => intents.HasIntent(DiscordIntents.GuildMembers | DiscordIntents.GuildPresences | DiscordIntents.MessageContent); /// /// Whether it has all v9 privileged intents. /// /// The intents. internal static bool HasAllV9PrivilegedIntents(this DiscordIntents intents) => intents.HasIntent(DiscordIntents.GuildMembers | DiscordIntents.GuildPresences); } /// /// Represents gateway intents to be specified for connecting to Discord. /// [Flags] public enum DiscordIntents { /// /// Whether to include general guild events. Note that you may receive empty message contents if you don't have the message content intent. /// These include , , , , /// , , , /// , , , , /// , , , /// , , , /// , and . /// Guilds = 1 << 0, /// /// Whether to include guild member events. /// These include , , and . /// This is a privileged intent, and must be enabled on the bot's developer page. /// GuildMembers = 1 << 1, /// /// Whether to include guild ban events. - /// These include and . + /// These include , and . /// - GuildBans = 1 << 2, + GuildModeration = 1 << 2, + [Obsolete("Renamed to GuildModeration")] + GuildBans = GuildModeration, /// /// Whether to include guild emoji and sticker events. /// This includes and . /// GuildEmojisAndStickers = 1 << 3, /// /// Whether to include guild integration events. /// This includes . /// GuildIntegrations = 1 << 4, /// /// Whether to include guild webhook events. /// This includes . /// GuildWebhooks = 1 << 5, /// /// Whether to include guild invite events. /// These include and . /// GuildInvites = 1 << 6, /// /// Whether to include guild voice state events. /// This includes . /// GuildVoiceStates = 1 << 7, /// /// Whether to include guild presence events. /// This includes . /// This is a privileged intent, and must be enabled on the bot's developer page. /// GuildPresences = 1 << 8, /// /// Whether to include guild message events. Note that you may receive empty contents if you don't have the message content intent. /// You can enable it in the developer portal. If you have a verified bot, you might need to apply for the intent. /// These include , , and . /// GuildMessages = 1 << 9, /// /// Whether to include guild reaction events. /// These include , , /// and . /// GuildMessageReactions = 1 << 10, /// /// Whether to include guild typing events. /// These include . /// GuildMessageTyping = 1 << 11, /// /// Whether to include general direct message events. /// These include , , , /// and . /// These events only fire for DM channels. /// DirectMessages = 1 << 12, /// /// Whether to include direct message reaction events. /// These include , , /// and . /// These events only fire for DM channels. /// DirectMessageReactions = 1 << 13, /// /// Whether to include direct message typing events. /// This includes . /// This event only fires for DM channels. /// DirectMessageTyping = 1 << 14, /// /// Whether to include the content of guild messages. /// See https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-for-Verified-Bots for more information. /// MessageContent = 1 << 15, /// /// Whether to include guild scheduled event events. /// These include , , , /// and . /// GuildScheduledEvents = 1 << 16, /// /// Whether to include automod configuration events. /// These include , and . /// AutoModerationConfiguration = 1 << 20, /// /// Whether to include automod execution events. /// These includes . /// AutoModerationExecution = 1 << 21, /// /// Includes all unprivileged intents. /// These are all intents excluding and . /// The will be excluded as of April 2022. /// AllUnprivileged = Guilds | GuildBans | GuildEmojisAndStickers | GuildIntegrations | GuildWebhooks | GuildInvites | GuildVoiceStates | GuildMessages | GuildMessageReactions | GuildMessageTyping | DirectMessages | DirectMessageReactions | DirectMessageTyping | GuildScheduledEvents | AutoModerationConfiguration | DiscordIntents.AutoModerationExecution, /// /// Includes all intents. /// The , and intents are privileged, and must be enabled on the bot's developer page. /// The exist only in v10. /// All = AllUnprivileged | GuildMembers | GuildPresences | MessageContent, /// /// Includes all intents. /// The and intents are privileged, and must be enabled on the bot's developer page. /// The exist only in v10 and is removed here. /// AllV9Less = AllUnprivileged | GuildMembers | GuildPresences }