diff --git a/DisCatSharp/DiscordIntents.cs b/DisCatSharp/DiscordIntents.cs index b7541554f..34e2c6d92 100644 --- a/DisCatSharp/DiscordIntents.cs +++ b/DisCatSharp/DiscordIntents.cs @@ -1,199 +1,205 @@ // 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); - // => intents.HasIntent(DiscordIntents.GuildMembers | DiscordIntents.GuildPresences | DiscordIntents.GuildMessages); + => intents.HasIntent(DiscordIntents.GuildMembers | DiscordIntents.GuildPresences | DiscordIntents.MessageContent); } /// /// Represents gateway intents to be specified for connecting to Discord. /// [Flags] public enum DiscordIntents { /// /// Whether to include general guild events. Note that you receive empty message contents if you don't have the guild message 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 . /// GuildBans = 1 << 2, /// /// 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 receive empty contents if you don't have the guild message 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. + /// Furthermore known as Message Content Intent. + /// + MessageContent = 1 << 15, + /// /// Whether to include guild scheduled event events. /// These include , , , /// and . /// The events and are in experiment and not officially supported. /// GuildScheduledEvents = 1 << 16, /// /// 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, + /// /// Includes all intents. /// The and intents are privileged, and must be enabled on the bot's developer page. /// The will be privileged as of April 2022. /// All = AllUnprivileged | GuildMembers | GuildPresences } }