diff --git a/src/Discord.Net.Core/Entities/ApplicationFlags.cs b/src/Discord.Net.Core/Entities/ApplicationFlags.cs index 0410f63b..0c6cfe7e 100644 --- a/src/Discord.Net.Core/Entities/ApplicationFlags.cs +++ b/src/Discord.Net.Core/Entities/ApplicationFlags.cs @@ -11,6 +11,8 @@ namespace Discord; /// public enum ApplicationFlags { + UsesAutoModApi = 1 << 6, + GatewayPresence = 1 << 12, GatewayPresenceLimited = 1 << 13, diff --git a/src/Discord.Net.Core/Entities/Guilds/GuildFeature.cs b/src/Discord.Net.Core/Entities/Guilds/GuildFeature.cs index e5a2feb8..eab00647 100644 --- a/src/Discord.Net.Core/Entities/Guilds/GuildFeature.cs +++ b/src/Discord.Net.Core/Entities/Guilds/GuildFeature.cs @@ -13,185 +13,260 @@ namespace Discord /// The guild has no features. /// None = 0L, + /// /// The guild has access to animated banners. /// AnimatedBanner = 1L << 0, + /// /// The guild has access to set an animated guild icon. /// AnimatedIcon = 1L << 1, + /// /// The guild has access to set a guild banner image. /// Banner = 1L << 2, + /// /// The guild has access to channel banners. /// ChannelBanner = 1L << 3, + /// /// The guild has access to use commerce features (i.e. create store channels). /// Commerce = 1L << 4, + /// - /// The guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates. This feature is mutable. + /// The guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates. /// + /// + /// This feature is mutable. + /// Community = 1L << 5, + /// - /// The guild is able to be discovered in the directory. This feature is mutable. + /// The guild is able to be discovered in the directory. /// + /// + /// This feature is mutable. + /// Discoverable = 1L << 6, + /// /// The guild has discoverable disabled. /// DiscoverableDisabled = 1L << 7, + /// /// The guild has enabled discoverable before. /// EnabledDiscoverableBefore = 1L << 8, + /// /// The guild is able to be featured in the directory. /// Featureable = 1L << 9, + /// /// The guild has a force relay. /// ForceRelay = 1L << 10, + /// /// The guild has a directory entry. /// HasDirectoryEntry = 1L << 11, + /// /// The guild is a hub. /// Hub = 1L << 12, + /// /// You shouldn't be here... /// InternalEmployeeOnly = 1L << 13, + /// /// The guild has access to set an invite splash background. /// InviteSplash = 1L << 14, + /// /// The guild is linked to a hub. /// LinkedToHub = 1L << 15, + /// /// The guild has member profiles. /// MemberProfiles = 1L << 16, + /// /// The guild has enabled Membership Screening. /// MemberVerificationGateEnabled = 1L << 17, + /// /// The guild has enabled monetization. /// MonetizationEnabled = 1L << 18, + /// /// The guild has more emojis. /// MoreEmoji = 1L << 19, + /// /// The guild has increased custom sticker slots. /// MoreStickers = 1L << 20, + /// /// The guild has access to create news channels. /// News = 1L << 21, + /// /// The guild has new thread permissions. /// NewThreadPermissions = 1L << 22, + /// /// The guild is partnered. /// Partnered = 1L << 23, + /// /// The guild has a premium tier three override; guilds made by Discord usually have this. /// PremiumTier3Override = 1L << 24, + /// /// The guild can be previewed before joining via Membership Screening or the directory. /// PreviewEnabled = 1L << 25, + /// /// The guild has access to create private threads. /// PrivateThreads = 1L << 26, + /// /// The guild has relay enabled. /// RelayEnabled = 1L << 27, + /// /// The guild is able to set role icons. /// RoleIcons = 1L << 28, + /// /// The guild has role subscriptions available for purchase. /// RoleSubscriptionsAvailableForPurchase = 1L << 29, + /// /// The guild has role subscriptions enabled. /// RoleSubscriptionsEnabled = 1L << 30, + /// /// The guild has access to the seven day archive time for threads. /// SevenDayThreadArchive = 1L << 31, + /// /// The guild has text in voice enabled. /// TextInVoiceEnabled = 1L << 32, + /// /// The guild has threads enabled. /// ThreadsEnabled = 1L << 33, + /// /// The guild has testing threads enabled. /// ThreadsEnabledTesting = 1L << 34, + /// /// The guild has the default thread auto archive. /// ThreadsDefaultAutoArchiveDuration = 1L << 35, + /// /// The guild has access to the three day archive time for threads. /// ThreeDayThreadArchive = 1L << 36, + /// /// The guild has enabled ticketed events. /// TicketedEventsEnabled = 1L << 37, + /// /// The guild has access to set a vanity URL. /// VanityUrl = 1L << 38, + /// /// The guild is verified. /// Verified = 1L << 39, + /// /// The guild has access to set 384kbps bitrate in voice (previously VIP voice servers). /// VIPRegions = 1L << 40, + /// /// The guild has enabled the welcome screen. /// WelcomeScreenEnabled = 1L << 41, + /// /// The guild has been set as a support server on the App Directory. /// DeveloperSupportServer = 1L << 42, + /// - /// The guild has invites disabled. This feature is mutable. + /// The guild has invites disabled. /// + /// + /// This feature is mutable. + /// InvitesDisabled = 1L << 43, + /// /// The guild has auto moderation enabled. /// - AutoModeration = 1L << 44 + AutoModeration = 1L << 44, + + /// + /// This guild has alerts for join raids disabled. + /// + /// + /// This feature is mutable. + /// + RaidAlertsDisabled = 1L << 45, + + /// + /// This guild has Clyde AI enabled. + /// + /// + /// This feature is mutable. + /// + ClydeEnabled = 1L << 46, + + /// + /// This guild has a guild web page vanity url. + /// + GuildWebPageVanityUrl = 1L << 47 } } diff --git a/src/Discord.Net.Core/Entities/Guilds/GuildProperties.cs b/src/Discord.Net.Core/Entities/Guilds/GuildProperties.cs index 19bbb8f9..c73c6687 100644 --- a/src/Discord.Net.Core/Entities/Guilds/GuildProperties.cs +++ b/src/Discord.Net.Core/Entities/Guilds/GuildProperties.cs @@ -118,5 +118,10 @@ namespace Discord /// Gets or sets the guild features enabled in this guild. Features that are not mutable will be ignored. /// public Optional Features { get; set; } + + /// + /// Gets or sets the ID of the safety alerts channel. + /// + public Optional SafetyAlertsChannelId { get; set; } } } diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs index a0b95759..9109b579 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs @@ -134,6 +134,14 @@ namespace Discord /// ulong? WidgetChannelId { get; } /// + /// Gets the ID of the channel assigned to the safety alerts channel of this guild. + /// + /// + /// A representing the snowflake identifier of the safety alerts channel; + /// if none is set. + /// + ulong? SafetyAlertsChannelId { get; } + /// /// Gets the ID of the channel where randomized welcome messages are sent. /// /// diff --git a/src/Discord.Net.Core/Entities/Guilds/IUserGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IUserGuild.cs index 741dc335..83bde9ba 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IUserGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IUserGuild.cs @@ -26,5 +26,21 @@ namespace Discord /// A flags enum containing all the features for the guild. /// GuildFeatures Features { get; } + + /// + /// Gets the approximate number of members in this guild. + /// + /// + /// Only available when getting a guild via REST when `with_counts` is true. + /// + int? ApproximateMemberCount { get; } + + /// + /// Gets the approximate number of non-offline members in this guild. + /// + /// + /// Only available when getting a guild via REST when `with_counts` is true. + /// + int? ApproximatePresenceCount { get; } } } diff --git a/src/Discord.Net.Rest/API/Common/Guild.cs b/src/Discord.Net.Rest/API/Common/Guild.cs index d091c26a..98f949f0 100644 --- a/src/Discord.Net.Rest/API/Common/Guild.cs +++ b/src/Discord.Net.Rest/API/Common/Guild.cs @@ -44,6 +44,8 @@ namespace Discord.API public Optional WidgetEnabled { get; set; } [JsonProperty("widget_channel_id")] public Optional WidgetChannelId { get; set; } + [JsonProperty("safety_alerts_channel_id")] + public Optional SafetyAlertsChannelId { get; set; } [JsonProperty("system_channel_id")] public ulong? SystemChannelId { get; set; } [JsonProperty("premium_tier")] diff --git a/src/Discord.Net.Rest/API/Common/UserGuild.cs b/src/Discord.Net.Rest/API/Common/UserGuild.cs index a501604a..3fc340d4 100644 --- a/src/Discord.Net.Rest/API/Common/UserGuild.cs +++ b/src/Discord.Net.Rest/API/Common/UserGuild.cs @@ -16,5 +16,11 @@ namespace Discord.API public string Permissions { get; set; } [JsonProperty("features")] public GuildFeatures Features { get; set; } + + [JsonProperty("approximate_member_count")] + public Optional ApproximateMemberCount { get; set; } + + [JsonProperty("approximate_presence_count")] + public Optional ApproximatePresenceCount { get; set; } } } diff --git a/src/Discord.Net.Rest/API/Rest/ModifyGuildParams.cs b/src/Discord.Net.Rest/API/Rest/ModifyGuildParams.cs index 4324fda4..3a0c0a17 100644 --- a/src/Discord.Net.Rest/API/Rest/ModifyGuildParams.cs +++ b/src/Discord.Net.Rest/API/Rest/ModifyGuildParams.cs @@ -27,6 +27,8 @@ namespace Discord.API.Rest public Optional Splash { get; set; } [JsonProperty("afk_channel_id")] public Optional AfkChannelId { get; set; } + [JsonProperty("safety_alerts_channel_id")] + public Optional SafetyAlertsChannelId { get; set; } [JsonProperty("owner_id")] public Optional OwnerId { get; set; } [JsonProperty("explicit_content_filter")] diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index 4a5ea199..8936aba3 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -2245,7 +2245,7 @@ namespace Discord.API int limit = args.Limit.GetValueOrDefault(int.MaxValue); ulong afterGuildId = args.AfterGuildId.GetValueOrDefault(0); - return await SendAsync>("GET", () => $"users/@me/guilds?limit={limit}&after={afterGuildId}", new BucketIds(), options: options).ConfigureAwait(false); + return await SendAsync>("GET", () => $"users/@me/guilds?limit={limit}&after={afterGuildId}&with_counts=true", new BucketIds(), options: options).ConfigureAwait(false); } public async Task GetMyApplicationAsync(RequestOptions options = null) { diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index 9ca01ead..9dc8713b 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -43,6 +43,8 @@ namespace Discord.Rest /// public ulong? WidgetChannelId { get; private set; } /// + public ulong? SafetyAlertsChannelId { get; private set; } + /// public ulong? SystemChannelId { get; private set; } /// public ulong? RulesChannelId { get; private set; } @@ -151,6 +153,8 @@ namespace Discord.Rest AFKChannelId = model.AFKChannelId; if (model.WidgetChannelId.IsSpecified) WidgetChannelId = model.WidgetChannelId.Value; + if (model.SafetyAlertsChannelId.IsSpecified) + SafetyAlertsChannelId = model.SafetyAlertsChannelId.Value; SystemChannelId = model.SystemChannelId; RulesChannelId = model.RulesChannelId; PublicUpdatesChannelId = model.PublicUpdatesChannelId; diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestUserGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestUserGuild.cs index 66b424a6..e959d3a1 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestUserGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestUserGuild.cs @@ -24,6 +24,12 @@ namespace Discord.Rest /// public GuildFeatures Features { get; private set; } + /// + public int? ApproximateMemberCount { get; private set; } + + /// + public int? ApproximatePresenceCount { get; private set; } + internal RestUserGuild(BaseDiscordClient discord, ulong id) : base(discord, id) { @@ -42,6 +48,8 @@ namespace Discord.Rest Name = model.Name; Permissions = new GuildPermissions(model.Permissions); Features = model.Features; + ApproximateMemberCount = model.ApproximateMemberCount.IsSpecified ? model.ApproximateMemberCount.Value : null; + ApproximatePresenceCount = model.ApproximatePresenceCount.IsSpecified ? model.ApproximatePresenceCount.Value : null; } public async Task LeaveAsync(RequestOptions options = null) diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index 2f54e610..fd24f6a1 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -93,6 +93,7 @@ namespace Discord.WebSocket internal ulong? AFKChannelId { get; private set; } internal ulong? WidgetChannelId { get; private set; } + internal ulong? SafetyAlertsChannelId { get; private set; } internal ulong? SystemChannelId { get; private set; } internal ulong? RulesChannelId { get; private set; } internal ulong? PublicUpdatesChannelId { get; private set; } @@ -220,6 +221,22 @@ namespace Discord.WebSocket return id.HasValue ? GetChannel(id.Value) : null; } } + + /// + /// Gets the safety alerts channel in this guild. + /// + /// + /// The channel set for receiving safety alerts channel; if none is set. + /// + public SocketGuildChannel SafetyAlertsChannel + { + get + { + var id = SafetyAlertsChannelId; + return id.HasValue ? GetChannel(id.Value) : null; + } + } + /// /// Gets the system channel where randomized welcome messages are sent in this guild. /// @@ -498,6 +515,8 @@ namespace Discord.WebSocket AFKChannelId = model.AFKChannelId; if (model.WidgetChannelId.IsSpecified) WidgetChannelId = model.WidgetChannelId.Value; + if (model.SafetyAlertsChannelId.IsSpecified) + SafetyAlertsChannelId = model.SafetyAlertsChannelId.Value; SystemChannelId = model.SystemChannelId; RulesChannelId = model.RulesChannelId; PublicUpdatesChannelId = model.PublicUpdatesChannelId; @@ -1894,6 +1913,8 @@ namespace Discord.WebSocket /// ulong? IGuild.WidgetChannelId => WidgetChannelId; /// + ulong? IGuild.SafetyAlertsChannelId => SafetyAlertsChannelId; + /// ulong? IGuild.SystemChannelId => SystemChannelId; /// ulong? IGuild.RulesChannelId => RulesChannelId;