diff --git a/DisCatSharp.Docs/articles/important_changes/10_0_0.md b/DisCatSharp.Docs/articles/important_changes/10_0_0.md index 89adca707..d17d3975e 100644 --- a/DisCatSharp.Docs/articles/important_changes/10_0_0.md +++ b/DisCatSharp.Docs/articles/important_changes/10_0_0.md @@ -1,24 +1,24 @@ --- uid: important_changes_10_0_0 title: Version 10.0.0 --- # Upgrade from **9.9.0** to **10.0.0** ## What is new in DisCatSharp? - Advanced dependency injection system - Support for API v10 - Message content intent - Properly working application command localization - Optimized lib code - Pre-implementation of upcoming things - Support for [Channel Type](xref:DisCatSharp.Enums.ChannelType) `Forum` ## What changed? To get message content with API v10, you have to enable the message content intent in the developer portal AND to specify the [DiscordIntent](xref:DisCatSharp.DiscordIntents) `MessageContent`. Otherwise you won't receive message contents from guild messages were the bot isn't mentioned. -## Backward Support +## Backwards Compatibility -You can always specify to use a prior API version. -I.e. if you want to use API V9, you can use `DiscordIntents.AllV9Less` to enable all for thiss version valid intents. \ No newline at end of file +You can always choose to use a previous API version. +I.e. if you want to use API V9, you can use `DiscordIntents.AllV9Less` to enable all intents that are valid for this version. diff --git a/DisCatSharp/DiscordIntents.cs b/DisCatSharp/DiscordIntents.cs index eb4cdfeb1..0b11bc251 100644 --- a/DisCatSharp/DiscordIntents.cs +++ b/DisCatSharp/DiscordIntents.cs @@ -1,220 +1,221 @@ // 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 . /// 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 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. - /// Furthermore known as Message Content Intent. + /// See https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-for-Verified-Bots for more informations. /// 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 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 } }