diff --git a/src/Discord.Net.Core/DiscordConfig.cs b/src/Discord.Net.Core/DiscordConfig.cs
index 429ad7b0c..da8525644 100644
--- a/src/Discord.Net.Core/DiscordConfig.cs
+++ b/src/Discord.Net.Core/DiscordConfig.cs
@@ -16,7 +16,7 @@ namespace Discord
/// Discord API documentation
/// .
///
- public const int APIVersion = 6;
+ public const int APIVersion = 9;
///
/// Returns the Voice API version Discord.Net uses.
///
@@ -43,7 +43,7 @@ namespace Discord
///
/// The user agent used in each Discord.Net request.
///
- public static string UserAgent { get; } = $"DiscordBot (https://github.com/RogueException/Discord.Net, v{Version})";
+ public static string UserAgent { get; } = $"DiscordBot (https://github.com/discord-net/Discord.Net, v{Version})";
///
/// Returns the base Discord API URL.
///
@@ -141,18 +141,6 @@ namespace Discord
///
internal bool DisplayInitialLog { get; set; } = true;
- ///
- /// Gets or sets the level of precision of the rate limit reset response.
- ///
- ///
- /// If set to , this value will be rounded up to the
- /// nearest second.
- ///
- ///
- /// The currently set .
- ///
- public RateLimitPrecision RateLimitPrecision { get; set; } = RateLimitPrecision.Millisecond;
-
///
/// Gets or sets whether or not rate-limits should use the system clock.
///
diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
index 36d735157..0bbd64786 100644
--- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
+++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
@@ -28,13 +28,6 @@ namespace Discord
///
int AFKTimeout { get; }
///
- /// Gets a value that indicates whether this guild is embeddable (i.e. can use widget).
- ///
- ///
- /// if this guild has a widget enabled; otherwise .
- ///
- bool IsEmbeddable { get; }
- ///
/// Gets a value that indicates whether this guild has the widget enabled.
///
///
@@ -147,14 +140,6 @@ namespace Discord
///
ulong DefaultChannelId { get; }
///
- /// Gets the ID of the widget embed channel of this guild.
- ///
- ///
- /// A representing the snowflake identifier of the embedded channel found within the
- /// widget settings of this guild; if none is set.
- ///
- ulong? EmbedChannelId { get; }
- ///
/// Gets the ID of the channel assigned to the widget of this guild.
///
///
@@ -364,16 +349,6 @@ namespace Discord
///
Task ModifyAsync(Action func, RequestOptions options = null);
///
- /// Modifies this guild's embed channel.
- ///
- /// The delegate containing the properties to modify the guild widget with.
- /// The options to be used when sending the request.
- ///
- /// A task that represents the asynchronous modification operation.
- ///
- [Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")]
- Task ModifyEmbedAsync(Action func, RequestOptions options = null);
- ///
/// Modifies this guild's widget.
///
/// The delegate containing the properties to modify the guild widget with.
@@ -592,17 +567,6 @@ namespace Discord
///
Task GetDefaultChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
- /// Gets the embed channel (i.e. the channel set in the guild's widget settings) in this guild.
- ///
- /// The that determines whether the object should be fetched from cache.
- /// The options to be used when sending the request.
- ///
- /// A task that represents the asynchronous get operation. The task result contains the embed channel set
- /// within the server's widget settings; if none is set.
- ///
- [Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
- Task GetEmbedChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
- ///
/// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
///
/// The that determines whether the object should be fetched from cache.
diff --git a/src/Discord.Net.Core/Entities/Guilds/PermissionTarget.cs b/src/Discord.Net.Core/Entities/Guilds/PermissionTarget.cs
index 3da2fb147..fb759e4c5 100644
--- a/src/Discord.Net.Core/Entities/Guilds/PermissionTarget.cs
+++ b/src/Discord.Net.Core/Entities/Guilds/PermissionTarget.cs
@@ -8,10 +8,10 @@ namespace Discord
///
/// The target of the permission is a role.
///
- Role,
+ Role = 0,
///
/// The target of the permission is a user.
///
- User
+ User = 1,
}
}
diff --git a/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs b/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
index 1589e2ae5..c2d0e13bc 100644
--- a/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
+++ b/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
@@ -36,18 +36,6 @@ namespace Discord
///
Task ModifyAsync(Action func, RequestOptions options = null);
///
- /// Modifies the suppression of this message.
- ///
- ///
- /// This method modifies whether or not embeds in this message are suppressed (hidden).
- ///
- /// Whether or not embeds in this message should be suppressed.
- /// The options to be used when sending the request.
- ///
- /// A task that represents the asynchronous modification operation.
- ///
- Task ModifySuppressionAsync(bool suppressEmbeds, RequestOptions options = null);
- ///
/// Adds this message to its channel's pinned messages.
///
/// The options to be used when sending the request.
diff --git a/src/Discord.Net.Core/Entities/Messages/MessageType.cs b/src/Discord.Net.Core/Entities/Messages/MessageType.cs
index ad1f3a3cd..bfe763cad 100644
--- a/src/Discord.Net.Core/Entities/Messages/MessageType.cs
+++ b/src/Discord.Net.Core/Entities/Messages/MessageType.cs
@@ -60,9 +60,6 @@ namespace Discord
///
/// The message is an inline reply.
///
- ///
- /// Only available in API v8.
- ///
Reply = 19,
}
}
diff --git a/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs b/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs
index ba6757fc6..ef4e40a11 100644
--- a/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs
+++ b/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs
@@ -90,6 +90,9 @@ namespace Discord
/// Creates a new with the provided packed value.
public GuildPermissions(ulong rawValue) { RawValue = rawValue; }
+ /// Creates a new with the provided packed value after converting to ulong.
+ public GuildPermissions(string rawValue) { RawValue = ulong.Parse(rawValue); }
+
private GuildPermissions(ulong initialValue,
bool? createInstantInvite = null,
bool? kickMembers = null,
diff --git a/src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs b/src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs
index 7876d49ff..6ee79b427 100644
--- a/src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs
+++ b/src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs
@@ -93,6 +93,13 @@ namespace Discord
DenyValue = denyValue;
}
+ /// Creates a new OverwritePermissions with the provided allow and deny packed values after converting to ulong.
+ public OverwritePermissions(string allowValue, string denyValue)
+ {
+ AllowValue = ulong.Parse(allowValue);
+ DenyValue = ulong.Parse(denyValue);
+ }
+
private OverwritePermissions(ulong allowValue, ulong denyValue,
PermValue? createInstantInvite = null,
PermValue? manageChannel = null,
diff --git a/src/Discord.Net.Core/Entities/Users/IPresence.cs b/src/Discord.Net.Core/Entities/Users/IPresence.cs
index a17ac0df2..6972037f0 100644
--- a/src/Discord.Net.Core/Entities/Users/IPresence.cs
+++ b/src/Discord.Net.Core/Entities/Users/IPresence.cs
@@ -7,10 +7,6 @@ namespace Discord
///
public interface IPresence
{
- ///
- /// Gets the activity this user is currently doing.
- ///
- IActivity Activity { get; }
///
/// Gets the current status of this user.
///
diff --git a/src/Discord.Net.Core/GatewayIntents.cs b/src/Discord.Net.Core/GatewayIntents.cs
index f3dc5ceb9..6976806b2 100644
--- a/src/Discord.Net.Core/GatewayIntents.cs
+++ b/src/Discord.Net.Core/GatewayIntents.cs
@@ -39,5 +39,16 @@ namespace Discord
DirectMessageReactions = 1 << 13,
/// This intent includes TYPING_START
DirectMessageTyping = 1 << 14,
+ ///
+ /// This intent includes all but and
+ /// that are privileged must be enabled for the application.
+ ///
+ AllUnprivileged = Guilds | GuildBans | GuildEmojis | GuildIntegrations | GuildWebhooks | GuildInvites |
+ GuildVoiceStates | GuildMessages | GuildMessageReactions | GuildMessageTyping | DirectMessages |
+ DirectMessageReactions | DirectMessageTyping,
+ ///
+ /// This intent includes all of them, including privileged ones.
+ ///
+ All = AllUnprivileged | GuildMembers | GuildPresences
}
}
diff --git a/src/Discord.Net.Core/RateLimitPrecision.cs b/src/Discord.Net.Core/RateLimitPrecision.cs
deleted file mode 100644
index fe3c1b90e..000000000
--- a/src/Discord.Net.Core/RateLimitPrecision.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace Discord
-{
- ///
- /// Specifies the level of precision to request in the rate limit
- /// response header.
- ///
- public enum RateLimitPrecision
- {
- ///
- /// Specifies precision rounded up to the nearest whole second
- ///
- Second,
- ///
- /// Specifies precision rounded to the nearest millisecond.
- ///
- Millisecond
- }
-}
diff --git a/src/Discord.Net.Rest/API/Common/Guild.cs b/src/Discord.Net.Rest/API/Common/Guild.cs
index 46075ce4d..bd25c7e1a 100644
--- a/src/Discord.Net.Rest/API/Common/Guild.cs
+++ b/src/Discord.Net.Rest/API/Common/Guild.cs
@@ -23,10 +23,6 @@ namespace Discord.API
public ulong? AFKChannelId { get; set; }
[JsonProperty("afk_timeout")]
public int AFKTimeout { get; set; }
- [JsonProperty("embed_enabled")]
- public Optional EmbedEnabled { get; set; }
- [JsonProperty("embed_channel_id")]
- public Optional EmbedChannelId { get; set; }
[JsonProperty("verification_level")]
public VerificationLevel VerificationLevel { get; set; }
[JsonProperty("default_message_notifications")]
diff --git a/src/Discord.Net.Rest/API/Common/GuildEmbed.cs b/src/Discord.Net.Rest/API/Common/GuildEmbed.cs
deleted file mode 100644
index d81632181..000000000
--- a/src/Discord.Net.Rest/API/Common/GuildEmbed.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma warning disable CS1591
-using Newtonsoft.Json;
-
-namespace Discord.API
-{
- internal class GuildEmbed
- {
- [JsonProperty("enabled")]
- public bool Enabled { get; set; }
- [JsonProperty("channel_id")]
- public ulong? ChannelId { get; set; }
- }
-}
diff --git a/src/Discord.Net.Rest/API/Common/Overwrite.cs b/src/Discord.Net.Rest/API/Common/Overwrite.cs
index 1f3548a1c..3d94b0640 100644
--- a/src/Discord.Net.Rest/API/Common/Overwrite.cs
+++ b/src/Discord.Net.Rest/API/Common/Overwrite.cs
@@ -10,8 +10,8 @@ namespace Discord.API
[JsonProperty("type")]
public PermissionTarget TargetType { get; set; }
[JsonProperty("deny"), Int53]
- public ulong Deny { get; set; }
+ public string Deny { get; set; }
[JsonProperty("allow"), Int53]
- public ulong Allow { get; set; }
+ public string Allow { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Common/Presence.cs b/src/Discord.Net.Rest/API/Common/Presence.cs
index b37ad4229..b44e9185d 100644
--- a/src/Discord.Net.Rest/API/Common/Presence.cs
+++ b/src/Discord.Net.Rest/API/Common/Presence.cs
@@ -13,8 +13,6 @@ namespace Discord.API
public Optional GuildId { get; set; }
[JsonProperty("status")]
public UserStatus Status { get; set; }
- [JsonProperty("game")]
- public Game Game { get; set; }
[JsonProperty("roles")]
public Optional Roles { get; set; }
diff --git a/src/Discord.Net.Rest/API/Common/Role.cs b/src/Discord.Net.Rest/API/Common/Role.cs
index 190ae25c0..c655175da 100644
--- a/src/Discord.Net.Rest/API/Common/Role.cs
+++ b/src/Discord.Net.Rest/API/Common/Role.cs
@@ -18,7 +18,7 @@ namespace Discord.API
[JsonProperty("position")]
public int Position { get; set; }
[JsonProperty("permissions"), Int53]
- public ulong Permissions { get; set; }
+ public string Permissions { get; set; }
[JsonProperty("managed")]
public bool Managed { get; set; }
[JsonProperty("tags")]
diff --git a/src/Discord.Net.Rest/API/Common/UserGuild.cs b/src/Discord.Net.Rest/API/Common/UserGuild.cs
index f4f763885..825e9a09a 100644
--- a/src/Discord.Net.Rest/API/Common/UserGuild.cs
+++ b/src/Discord.Net.Rest/API/Common/UserGuild.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
@@ -14,6 +14,6 @@ namespace Discord.API
[JsonProperty("owner")]
public bool Owner { get; set; }
[JsonProperty("permissions"), Int53]
- public ulong Permissions { get; set; }
+ public string Permissions { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Rest/ModifyChannelPermissionsParams.cs b/src/Discord.Net.Rest/API/Rest/ModifyChannelPermissionsParams.cs
index 0fe5f7e5a..269111a61 100644
--- a/src/Discord.Net.Rest/API/Rest/ModifyChannelPermissionsParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/ModifyChannelPermissionsParams.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rest
@@ -7,13 +7,13 @@ namespace Discord.API.Rest
internal class ModifyChannelPermissionsParams
{
[JsonProperty("type")]
- public string Type { get; }
+ public int Type { get; }
[JsonProperty("allow")]
- public ulong Allow { get; }
+ public string Allow { get; }
[JsonProperty("deny")]
- public ulong Deny { get; }
+ public string Deny { get; }
- public ModifyChannelPermissionsParams(string type, ulong allow, ulong deny)
+ public ModifyChannelPermissionsParams(int type, string allow, string deny)
{
Type = type;
Allow = allow;
diff --git a/src/Discord.Net.Rest/API/Rest/ModifyGuildRoleParams.cs b/src/Discord.Net.Rest/API/Rest/ModifyGuildRoleParams.cs
index 287e1cafe..8605411c5 100644
--- a/src/Discord.Net.Rest/API/Rest/ModifyGuildRoleParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/ModifyGuildRoleParams.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rest
@@ -9,7 +9,7 @@ namespace Discord.API.Rest
[JsonProperty("name")]
public Optional Name { get; set; }
[JsonProperty("permissions")]
- public Optional Permissions { get; set; }
+ public Optional Permissions { get; set; }
[JsonProperty("color")]
public Optional Color { get; set; }
[JsonProperty("hoist")]
diff --git a/src/Discord.Net.Rest/API/Rest/SuppressEmbedParams.cs b/src/Discord.Net.Rest/API/Rest/SuppressEmbedParams.cs
deleted file mode 100644
index 9139627b8..000000000
--- a/src/Discord.Net.Rest/API/Rest/SuppressEmbedParams.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Newtonsoft.Json;
-
-namespace Discord.API.Rest
-{
- [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
- internal class SuppressEmbedParams
- {
- [JsonProperty("suppress")]
- public bool Suppressed { get; set; }
- }
-}
diff --git a/src/Discord.Net.Rest/ClientHelper.cs b/src/Discord.Net.Rest/ClientHelper.cs
index b60c02cab..3ff8212fe 100644
--- a/src/Discord.Net.Rest/ClientHelper.cs
+++ b/src/Discord.Net.Rest/ClientHelper.cs
@@ -69,14 +69,6 @@ namespace Discord.Rest
return RestGuild.Create(client, model);
return null;
}
- public static async Task GetGuildEmbedAsync(BaseDiscordClient client,
- ulong id, RequestOptions options)
- {
- var model = await client.ApiClient.GetGuildEmbedAsync(id, options).ConfigureAwait(false);
- if (model != null)
- return RestGuildEmbed.Create(model);
- return null;
- }
public static async Task GetGuildWidgetAsync(BaseDiscordClient client,
ulong id, RequestOptions options)
{
diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs
index d3e4aa515..002472e5a 100644
--- a/src/Discord.Net.Rest/DiscordRestApiClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs
@@ -45,20 +45,18 @@ namespace Discord.API
internal string AuthToken { get; private set; }
internal IRestClient RestClient { get; private set; }
internal ulong? CurrentUserId { get; set; }
- public RateLimitPrecision RateLimitPrecision { get; private set; }
internal bool UseSystemClock { get; set; }
internal JsonSerializer Serializer => _serializer;
/// Unknown OAuth token type.
public DiscordRestApiClient(RestClientProvider restClientProvider, string userAgent, RetryMode defaultRetryMode = RetryMode.AlwaysRetry,
- JsonSerializer serializer = null, RateLimitPrecision rateLimitPrecision = RateLimitPrecision.Second, bool useSystemClock = true)
+ JsonSerializer serializer = null, bool useSystemClock = true)
{
_restClientProvider = restClientProvider;
UserAgent = userAgent;
DefaultRetryMode = defaultRetryMode;
_serializer = serializer ?? new JsonSerializer { ContractResolver = new DiscordContractResolver() };
- RateLimitPrecision = rateLimitPrecision;
UseSystemClock = useSystemClock;
RequestQueue = new RequestQueue();
@@ -75,7 +73,6 @@ namespace Discord.API
RestClient.SetHeader("accept", "*/*");
RestClient.SetHeader("user-agent", UserAgent);
RestClient.SetHeader("authorization", GetPrefixedToken(AuthTokenType, AuthToken));
- RestClient.SetHeader("X-RateLimit-Precision", RateLimitPrecision.ToString().ToLower());
}
/// Unknown OAuth token type.
internal static string GetPrefixedToken(TokenType tokenType, string token)
@@ -645,16 +642,6 @@ namespace Discord.API
return await SendJsonAsync("PATCH", () => $"channels/{channelId}/messages/{messageId}", args, ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
}
- public async Task SuppressEmbedAsync(ulong channelId, ulong messageId, Rest.SuppressEmbedParams args, RequestOptions options = null)
- {
- Preconditions.NotEqual(channelId, 0, nameof(channelId));
- Preconditions.NotEqual(messageId, 0, nameof(messageId));
- options = RequestOptions.CreateOrClone(options);
-
- var ids = new BucketIds(channelId: channelId);
- await SendJsonAsync("POST", () => $"channels/{channelId}/messages/{messageId}/suppress-embeds", args, ids, options: options).ConfigureAwait(false);
- }
-
public async Task AddReactionAsync(ulong channelId, ulong messageId, string emoji, RequestOptions options = null)
{
Preconditions.NotEqual(channelId, 0, nameof(channelId));
@@ -936,7 +923,7 @@ namespace Discord.API
var ids = new BucketIds(guildId: guildId);
string reason = string.IsNullOrWhiteSpace(args.Reason) ? "" : $"&reason={Uri.EscapeDataString(args.Reason)}";
- await SendAsync("PUT", () => $"guilds/{guildId}/bans/{userId}?delete-message-days={args.DeleteMessageDays}{reason}", ids, options: options).ConfigureAwait(false);
+ await SendAsync("PUT", () => $"guilds/{guildId}/bans/{userId}?delete_message_days={args.DeleteMessageDays}{reason}", ids, options: options).ConfigureAwait(false);
}
/// and must not be equal to zero.
public async Task RemoveGuildBanAsync(ulong guildId, ulong userId, RequestOptions options = null)
@@ -949,32 +936,6 @@ namespace Discord.API
await SendAsync("DELETE", () => $"guilds/{guildId}/bans/{userId}", ids, options: options).ConfigureAwait(false);
}
- //Guild Embeds
- /// must not be equal to zero.
- public async Task GetGuildEmbedAsync(ulong guildId, RequestOptions options = null)
- {
- Preconditions.NotEqual(guildId, 0, nameof(guildId));
- options = RequestOptions.CreateOrClone(options);
-
- try
- {
- var ids = new BucketIds(guildId: guildId);
- return await SendAsync("GET", () => $"guilds/{guildId}/embed", ids, options: options).ConfigureAwait(false);
- }
- catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
- }
- /// must not be equal to zero.
- /// must not be .
- public async Task ModifyGuildEmbedAsync(ulong guildId, Rest.ModifyGuildEmbedParams args, RequestOptions options = null)
- {
- Preconditions.NotNull(args, nameof(args));
- Preconditions.NotEqual(guildId, 0, nameof(guildId));
- options = RequestOptions.CreateOrClone(options);
-
- var ids = new BucketIds(guildId: guildId);
- return await SendJsonAsync("PATCH", () => $"guilds/{guildId}/embed", args, ids, options: options).ConfigureAwait(false);
- }
-
//Guild Widget
/// must not be equal to zero.
public async Task GetGuildWidgetAsync(ulong guildId, RequestOptions options = null)
diff --git a/src/Discord.Net.Rest/DiscordRestClient.cs b/src/Discord.Net.Rest/DiscordRestClient.cs
index 7eff7363c..9cdb8e409 100644
--- a/src/Discord.Net.Rest/DiscordRestClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestClient.cs
@@ -29,10 +29,7 @@ namespace Discord.Rest
internal DiscordRestClient(DiscordRestConfig config, API.DiscordRestApiClient api) : base(config, api) { }
private static API.DiscordRestApiClient CreateApiClient(DiscordRestConfig config)
- => new API.DiscordRestApiClient(config.RestClientProvider,
- DiscordRestConfig.UserAgent,
- rateLimitPrecision: config.RateLimitPrecision,
- useSystemClock: config.UseSystemClock);
+ => new API.DiscordRestApiClient(config.RestClientProvider, DiscordRestConfig.UserAgent, useSystemClock: config.UseSystemClock);
internal override void Dispose(bool disposing)
{
@@ -80,9 +77,6 @@ namespace Discord.Rest
=> ClientHelper.GetGuildAsync(this, id, false, options);
public Task GetGuildAsync(ulong id, bool withCounts, RequestOptions options = null)
=> ClientHelper.GetGuildAsync(this, id, withCounts, options);
- [Obsolete("This endpoint is deprecated, use GetGuildWidgetAsync instead.")]
- public Task GetGuildEmbedAsync(ulong id, RequestOptions options = null)
- => ClientHelper.GetGuildEmbedAsync(this, id, options);
public Task GetGuildWidgetAsync(ulong id, RequestOptions options = null)
=> ClientHelper.GetGuildWidgetAsync(this, id, options);
public IAsyncEnumerable> GetGuildSummariesAsync(RequestOptions options = null)
diff --git a/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs b/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
index 7c4edb43e..22395ab3a 100644
--- a/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
@@ -33,8 +33,8 @@ namespace Discord.Rest
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
- Allow = overwrite.Permissions.AllowValue,
- Deny = overwrite.Permissions.DenyValue
+ Allow = overwrite.Permissions.AllowValue.ToString(),
+ Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
: Optional.Create(),
};
@@ -59,8 +59,8 @@ namespace Discord.Rest
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
- Allow = overwrite.Permissions.AllowValue,
- Deny = overwrite.Permissions.DenyValue
+ Allow = overwrite.Permissions.AllowValue.ToString(),
+ Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
: Optional.Create(),
};
@@ -84,8 +84,8 @@ namespace Discord.Rest
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
- Allow = overwrite.Permissions.AllowValue,
- Deny = overwrite.Permissions.DenyValue
+ Allow = overwrite.Permissions.AllowValue.ToString(),
+ Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
: Optional.Create(),
};
@@ -328,13 +328,13 @@ namespace Discord.Rest
public static async Task AddPermissionOverwriteAsync(IGuildChannel channel, BaseDiscordClient client,
IUser user, OverwritePermissions perms, RequestOptions options)
{
- var args = new ModifyChannelPermissionsParams("member", perms.AllowValue, perms.DenyValue);
+ var args = new ModifyChannelPermissionsParams((int)PermissionTarget.User, perms.AllowValue.ToString(), perms.DenyValue.ToString());
await client.ApiClient.ModifyChannelPermissionsAsync(channel.Id, user.Id, args, options).ConfigureAwait(false);
}
public static async Task AddPermissionOverwriteAsync(IGuildChannel channel, BaseDiscordClient client,
IRole role, OverwritePermissions perms, RequestOptions options)
{
- var args = new ModifyChannelPermissionsParams("role", perms.AllowValue, perms.DenyValue);
+ var args = new ModifyChannelPermissionsParams((int)PermissionTarget.Role, perms.AllowValue.ToString(), perms.DenyValue.ToString());
await client.ApiClient.ModifyChannelPermissionsAsync(channel.Id, role.Id, args, options).ConfigureAwait(false);
}
public static async Task RemovePermissionOverwriteAsync(IGuildChannel channel, BaseDiscordClient client,
@@ -450,8 +450,8 @@ namespace Discord.Rest
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
- Allow = overwrite.Permissions.AllowValue,
- Deny = overwrite.Permissions.DenyValue
+ Allow = overwrite.Permissions.AllowValue.ToString(),
+ Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
};
await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
index d10d046ee..331c6f615 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
@@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
-using EmbedModel = Discord.API.GuildEmbed;
using WidgetModel = Discord.API.GuildWidget;
using Model = Discord.API.Guild;
using RoleModel = Discord.API.Role;
@@ -81,26 +80,6 @@ namespace Discord.Rest
return await client.ApiClient.ModifyGuildAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
}
/// is null.
- public static async Task ModifyEmbedAsync(IGuild guild, BaseDiscordClient client,
- Action func, RequestOptions options)
- {
- if (func == null) throw new ArgumentNullException(nameof(func));
-
- var args = new GuildEmbedProperties();
- func(args);
- var apiArgs = new API.Rest.ModifyGuildEmbedParams
- {
- Enabled = args.Enabled
- };
-
- if (args.Channel.IsSpecified)
- apiArgs.ChannelId = args.Channel.Value?.Id;
- else if (args.ChannelId.IsSpecified)
- apiArgs.ChannelId = args.ChannelId.Value;
-
- return await client.ApiClient.ModifyGuildEmbedAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
- }
- /// is null.
public static async Task ModifyWidgetAsync(IGuild guild, BaseDiscordClient client,
Action func, RequestOptions options)
{
@@ -205,8 +184,8 @@ namespace Discord.Rest
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
- Allow = overwrite.Permissions.AllowValue,
- Deny = overwrite.Permissions.DenyValue
+ Allow = overwrite.Permissions.AllowValue.ToString(),
+ Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
: Optional.Create(),
};
@@ -233,8 +212,8 @@ namespace Discord.Rest
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
- Allow = overwrite.Permissions.AllowValue,
- Deny = overwrite.Permissions.DenyValue
+ Allow = overwrite.Permissions.AllowValue.ToString(),
+ Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
: Optional.Create(),
};
@@ -258,8 +237,8 @@ namespace Discord.Rest
{
TargetId = overwrite.TargetId,
TargetType = overwrite.TargetType,
- Allow = overwrite.Permissions.AllowValue,
- Deny = overwrite.Permissions.DenyValue
+ Allow = overwrite.Permissions.AllowValue.ToString(),
+ Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
: Optional.Create(),
};
@@ -320,7 +299,7 @@ namespace Discord.Rest
Hoist = isHoisted,
Mentionable = isMentionable,
Name = name,
- Permissions = permissions?.RawValue ?? Optional.Create()
+ Permissions = permissions?.RawValue.ToString() ?? Optional.Create()
};
var model = await client.ApiClient.CreateGuildRoleAsync(guild.Id, createGuildRoleParams, options).ConfigureAwait(false);
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
index 57918a1e7..980b0c5fb 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
@@ -6,7 +6,6 @@ using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
-using EmbedModel = Discord.API.GuildEmbed;
using WidgetModel = Discord.API.GuildWidget;
using Model = Discord.API.Guild;
@@ -27,8 +26,6 @@ namespace Discord.Rest
///
public int AFKTimeout { get; private set; }
///
- public bool IsEmbeddable { get; private set; }
- ///
public bool IsWidgetEnabled { get; private set; }
///
public VerificationLevel VerificationLevel { get; private set; }
@@ -42,8 +39,6 @@ namespace Discord.Rest
///
public ulong? AFKChannelId { get; private set; }
///
- public ulong? EmbedChannelId { get; private set; }
- ///
public ulong? WidgetChannelId { get; private set; }
///
public ulong? SystemChannelId { get; private set; }
@@ -133,16 +128,12 @@ namespace Discord.Rest
internal void Update(Model model)
{
AFKChannelId = model.AFKChannelId;
- if (model.EmbedChannelId.IsSpecified)
- EmbedChannelId = model.EmbedChannelId.Value;
if (model.WidgetChannelId.IsSpecified)
WidgetChannelId = model.WidgetChannelId.Value;
SystemChannelId = model.SystemChannelId;
RulesChannelId = model.RulesChannelId;
PublicUpdatesChannelId = model.PublicUpdatesChannelId;
AFKTimeout = model.AFKTimeout;
- if (model.EmbedEnabled.IsSpecified)
- IsEmbeddable = model.EmbedEnabled.Value;
if (model.WidgetEnabled.IsSpecified)
IsWidgetEnabled = model.WidgetEnabled.Value;
IconId = model.Icon;
@@ -200,11 +191,6 @@ namespace Discord.Rest
Available = true;
}
- internal void Update(EmbedModel model)
- {
- EmbedChannelId = model.ChannelId;
- IsEmbeddable = model.Enabled;
- }
internal void Update(WidgetModel model)
{
WidgetChannelId = model.ChannelId;
@@ -241,15 +227,6 @@ namespace Discord.Rest
Update(model);
}
- ///
- /// is .
- [Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")]
- public async Task ModifyEmbedAsync(Action func, RequestOptions options = null)
- {
- var model = await GuildHelper.ModifyEmbedAsync(this, Discord, func, options).ConfigureAwait(false);
- Update(model);
- }
-
///
/// is .
public async Task ModifyWidgetAsync(Action func, RequestOptions options = null)
@@ -463,23 +440,6 @@ namespace Discord.Rest
.FirstOrDefault();
}
- ///
- /// Gets the embed channel (i.e. the channel set in the guild's widget settings) in this guild.
- ///
- /// The options to be used when sending the request.
- ///
- /// A task that represents the asynchronous get operation. The task result contains the embed channel set
- /// within the server's widget settings; if none is set.
- ///
- [Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
- public async Task GetEmbedChannelAsync(RequestOptions options = null)
- {
- var embedId = EmbedChannelId;
- if (embedId.HasValue)
- return await GuildHelper.GetChannelAsync(this, Discord, embedId.Value, options).ConfigureAwait(false);
- return null;
- }
-
///
/// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
///
@@ -937,15 +897,6 @@ namespace Discord.Rest
return null;
}
///
- [Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
- async Task IGuild.GetEmbedChannelAsync(CacheMode mode, RequestOptions options)
- {
- if (mode == CacheMode.AllowDownload)
- return await GetEmbedChannelAsync(options).ConfigureAwait(false);
- else
- return null;
- }
- ///
async Task IGuild.GetWidgetChannelAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuildEmbed.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuildEmbed.cs
deleted file mode 100644
index 41c76eb06..000000000
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuildEmbed.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Diagnostics;
-using Model = Discord.API.GuildEmbed;
-
-namespace Discord.Rest
-{
- [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
- public struct RestGuildEmbed
- {
- public bool IsEnabled { get; private set; }
- public ulong? ChannelId { get; private set; }
-
- internal RestGuildEmbed(bool isEnabled, ulong? channelId)
- {
- ChannelId = channelId;
- IsEnabled = isEnabled;
- }
- internal static RestGuildEmbed Create(Model model)
- {
- return new RestGuildEmbed(model.Enabled, model.ChannelId);
- }
-
- public override string ToString() => ChannelId?.ToString() ?? "Unknown";
- private string DebuggerDisplay => $"{ChannelId} ({(IsEnabled ? "Enabled" : "Disabled")})";
- }
-}
diff --git a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
index 1bc284836..31252466b 100644
--- a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
@@ -122,15 +122,6 @@ namespace Discord.Rest
await client.ApiClient.DeleteMessageAsync(channelId, msgId, options).ConfigureAwait(false);
}
- public static async Task SuppressEmbedsAsync(IMessage msg, BaseDiscordClient client, bool suppress, RequestOptions options)
- {
- var apiArgs = new API.Rest.SuppressEmbedParams
- {
- Suppressed = suppress
- };
- await client.ApiClient.SuppressEmbedAsync(msg.Channel.Id, msg.Id, apiArgs, options).ConfigureAwait(false);
- }
-
public static async Task AddReactionAsync(ulong channelId, ulong messageId, IEmote emote, BaseDiscordClient client, RequestOptions options)
{
await client.ApiClient.AddReactionAsync(channelId, messageId, emote is Emote e ? $"{e.Name}:{e.Id}" : UrlEncode(emote.Name), options).ConfigureAwait(false);
diff --git a/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
index 1274f1fd3..aa6b44da6 100644
--- a/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
@@ -164,9 +164,6 @@ namespace Discord.Rest
///
public Task UnpinAsync(RequestOptions options = null)
=> MessageHelper.UnpinAsync(this, Discord, options);
- ///
- public Task ModifySuppressionAsync(bool suppressEmbeds, RequestOptions options = null)
- => MessageHelper.SuppressEmbedsAsync(this, Discord, suppressEmbeds, options);
public string Resolve(int startIndex, TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name,
TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name)
diff --git a/src/Discord.Net.Rest/Entities/Roles/RoleHelper.cs b/src/Discord.Net.Rest/Entities/Roles/RoleHelper.cs
index d570f078b..73ab7ca31 100644
--- a/src/Discord.Net.Rest/Entities/Roles/RoleHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Roles/RoleHelper.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Threading.Tasks;
using Model = Discord.API.Role;
using BulkParams = Discord.API.Rest.ModifyGuildRolesParams;
@@ -24,7 +24,7 @@ namespace Discord.Rest
Hoist = args.Hoist,
Mentionable = args.Mentionable,
Name = args.Name,
- Permissions = args.Permissions.IsSpecified ? args.Permissions.Value.RawValue : Optional.Create()
+ Permissions = args.Permissions.IsSpecified ? args.Permissions.Value.RawValue.ToString() : Optional.Create()
};
var model = await client.ApiClient.ModifyGuildRoleAsync(role.Guild.Id, role.Id, apiArgs, options).ConfigureAwait(false);
diff --git a/src/Discord.Net.Rest/Net/Converters/DiscordContractResolver.cs b/src/Discord.Net.Rest/Net/Converters/DiscordContractResolver.cs
index a1ed20c6f..931c0c4c9 100644
--- a/src/Discord.Net.Rest/Net/Converters/DiscordContractResolver.cs
+++ b/src/Discord.Net.Rest/Net/Converters/DiscordContractResolver.cs
@@ -73,8 +73,6 @@ namespace Discord.Net.Converters
}
//Enums
- if (type == typeof(PermissionTarget))
- return PermissionTargetConverter.Instance;
if (type == typeof(UserStatus))
return UserStatusConverter.Instance;
if (type == typeof(EmbedType))
diff --git a/src/Discord.Net.Rest/Net/Converters/PermissionTargetConverter.cs b/src/Discord.Net.Rest/Net/Converters/PermissionTargetConverter.cs
deleted file mode 100644
index de2e379d7..000000000
--- a/src/Discord.Net.Rest/Net/Converters/PermissionTargetConverter.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Newtonsoft.Json;
-using System;
-
-namespace Discord.Net.Converters
-{
- internal class PermissionTargetConverter : JsonConverter
- {
- public static readonly PermissionTargetConverter Instance = new PermissionTargetConverter();
-
- public override bool CanConvert(Type objectType) => true;
- public override bool CanRead => true;
- public override bool CanWrite => true;
-
- /// Unknown permission target.
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
- {
- switch ((string)reader.Value)
- {
- case "member":
- return PermissionTarget.User;
- case "role":
- return PermissionTarget.Role;
- default:
- throw new JsonSerializationException("Unknown permission target.");
- }
- }
-
- /// Invalid permission target.
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
- {
- switch ((PermissionTarget)value)
- {
- case PermissionTarget.User:
- writer.WriteValue("member");
- break;
- case PermissionTarget.Role:
- writer.WriteValue("role");
- break;
- default:
- throw new JsonSerializationException("Invalid permission target.");
- }
- }
- }
-}
diff --git a/src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs b/src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs
index 92a494b71..bb54d4cdd 100644
--- a/src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs
+++ b/src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs
@@ -17,8 +17,6 @@ namespace Discord.API.Gateway
public Optional ShardingParams { get; set; }
[JsonProperty("presence")]
public Optional Presence { get; set; }
- [JsonProperty("guild_subscriptions")]
- public Optional GuildSubscriptions { get; set; }
[JsonProperty("intents")]
public Optional Intents { get; set; }
}
diff --git a/src/Discord.Net.WebSocket/BaseSocketClient.cs b/src/Discord.Net.WebSocket/BaseSocketClient.cs
index 36e6c02a9..1cfcaa1ee 100644
--- a/src/Discord.Net.WebSocket/BaseSocketClient.cs
+++ b/src/Discord.Net.WebSocket/BaseSocketClient.cs
@@ -83,7 +83,6 @@ namespace Discord.WebSocket
: base(config, client) => BaseConfig = config;
private static DiscordSocketApiClient CreateApiClient(DiscordSocketConfig config)
=> new DiscordSocketApiClient(config.RestClientProvider, config.WebSocketProvider, DiscordRestConfig.UserAgent,
- rateLimitPrecision: config.RateLimitPrecision,
useSystemClock: config.UseSystemClock);
///
diff --git a/src/Discord.Net.WebSocket/DiscordShardedClient.cs b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
index 4c94b14e8..c406ead62 100644
--- a/src/Discord.Net.WebSocket/DiscordShardedClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
@@ -91,8 +91,7 @@ namespace Discord.WebSocket
}
}
private static API.DiscordSocketApiClient CreateApiClient(DiscordSocketConfig config)
- => new API.DiscordSocketApiClient(config.RestClientProvider, config.WebSocketProvider, DiscordRestConfig.UserAgent,
- rateLimitPrecision: config.RateLimitPrecision);
+ => new API.DiscordSocketApiClient(config.RestClientProvider, config.WebSocketProvider, DiscordRestConfig.UserAgent);
internal async Task AcquireIdentifyLockAsync(int shardId, CancellationToken token)
{
diff --git a/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs b/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
index d14a314d6..d1407da01 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
@@ -40,9 +40,8 @@ namespace Discord.API
public DiscordSocketApiClient(RestClientProvider restClientProvider, WebSocketProvider webSocketProvider, string userAgent,
string url = null, RetryMode defaultRetryMode = RetryMode.AlwaysRetry, JsonSerializer serializer = null,
- RateLimitPrecision rateLimitPrecision = RateLimitPrecision.Second,
bool useSystemClock = true)
- : base(restClientProvider, userAgent, defaultRetryMode, serializer, rateLimitPrecision, useSystemClock)
+ : base(restClientProvider, userAgent, defaultRetryMode, serializer, useSystemClock)
{
_gatewayUrl = url;
if (url != null)
@@ -216,7 +215,7 @@ namespace Discord.API
await _sentGatewayMessageEvent.InvokeAsync(opCode).ConfigureAwait(false);
}
- public async Task SendIdentifyAsync(int largeThreshold = 100, int shardID = 0, int totalShards = 1, bool guildSubscriptions = true, GatewayIntents? gatewayIntents = null, (UserStatus, bool, long?, GameModel)? presence = null, RequestOptions options = null)
+ public async Task SendIdentifyAsync(int largeThreshold = 100, int shardID = 0, int totalShards = 1, GatewayIntents gatewayIntents = GatewayIntents.AllUnprivileged, (UserStatus, bool, long?, GameModel)? presence = null, RequestOptions options = null)
{
options = RequestOptions.CreateOrClone(options);
var props = new Dictionary
@@ -234,10 +233,7 @@ namespace Discord.API
options.BucketId = GatewayBucket.Get(GatewayBucketType.Identify).Id;
- if (gatewayIntents.HasValue)
- msg.Intents = (int)gatewayIntents.Value;
- else
- msg.GuildSubscriptions = guildSubscriptions;
+ msg.Intents = (int)gatewayIntents;
if (presence.HasValue)
{
diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
index e284fd883..b8eba1fc4 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
@@ -43,8 +43,7 @@ namespace Discord.WebSocket
private DateTimeOffset? _statusSince;
private RestApplication _applicationInfo;
private bool _isDisposed;
- private bool _guildSubscriptions;
- private GatewayIntents? _gatewayIntents;
+ private GatewayIntents _gatewayIntents;
///
/// Provides access to a REST-only client with a shared state from this client.
@@ -140,7 +139,6 @@ namespace Discord.WebSocket
State = new ClientState(0, 0);
Rest = new DiscordSocketRestClient(config, ApiClient);
_heartbeatTimes = new ConcurrentQueue();
- _guildSubscriptions = config.GuildSubscriptions;
_gatewayIntents = config.GatewayIntents;
_stateLock = new SemaphoreSlim(1, 1);
@@ -182,8 +180,7 @@ namespace Discord.WebSocket
_largeGuilds = new ConcurrentQueue();
}
private static API.DiscordSocketApiClient CreateApiClient(DiscordSocketConfig config)
- => new API.DiscordSocketApiClient(config.RestClientProvider, config.WebSocketProvider, DiscordRestConfig.UserAgent, config.GatewayHost,
- rateLimitPrecision: config.RateLimitPrecision);
+ => new API.DiscordSocketApiClient(config.RestClientProvider, config.WebSocketProvider, DiscordRestConfig.UserAgent, config.GatewayHost);
///
internal override void Dispose(bool disposing)
{
@@ -243,7 +240,7 @@ namespace Discord.WebSocket
else
{
await _gatewayLogger.DebugAsync("Identifying").ConfigureAwait(false);
- await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, guildSubscriptions: _guildSubscriptions, gatewayIntents: _gatewayIntents, presence: BuildCurrentStatus()).ConfigureAwait(false);
+ await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, gatewayIntents: _gatewayIntents, presence: BuildCurrentStatus()).ConfigureAwait(false);
}
}
finally
@@ -335,7 +332,7 @@ namespace Discord.WebSocket
{
var user = SocketGlobalUser.Create(this, state, model);
user.GlobalUser.AddRef();
- user.Presence = new SocketPresence(UserStatus.Online, null, null, null);
+ user.Presence = new SocketPresence(UserStatus.Online, null, null);
return user;
});
}
@@ -469,7 +466,8 @@ namespace Discord.WebSocket
{
if (CurrentUser == null)
return;
- CurrentUser.Presence = new SocketPresence(Status, Activity, null, null);
+ var activities = _activity.IsSpecified ? ImmutableList.Create(_activity.Value) : null;
+ CurrentUser.Presence = new SocketPresence(Status, null, activities);
var presence = BuildCurrentStatus() ?? (UserStatus.Online, false, null, null);
@@ -564,7 +562,7 @@ namespace Discord.WebSocket
await _shardedClient.AcquireIdentifyLockAsync(ShardId, _connection.CancelToken).ConfigureAwait(false);
try
{
- await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, guildSubscriptions: _guildSubscriptions, gatewayIntents: _gatewayIntents, presence: BuildCurrentStatus()).ConfigureAwait(false);
+ await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, gatewayIntents: _gatewayIntents, presence: BuildCurrentStatus()).ConfigureAwait(false);
}
finally
{
@@ -572,7 +570,7 @@ namespace Discord.WebSocket
}
}
else
- await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, guildSubscriptions: _guildSubscriptions, gatewayIntents: _gatewayIntents, presence: BuildCurrentStatus()).ConfigureAwait(false);
+ await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards, gatewayIntents: _gatewayIntents, presence: BuildCurrentStatus()).ConfigureAwait(false);
}
break;
case GatewayOpCode.Reconnect:
@@ -595,7 +593,8 @@ namespace Discord.WebSocket
var state = new ClientState(data.Guilds.Length, data.PrivateChannels.Length);
var currentUser = SocketSelfUser.Create(this, state, data.User);
- currentUser.Presence = new SocketPresence(Status, Activity, null, null);
+ var activities = _activity.IsSpecified ? ImmutableList.Create(_activity.Value) : null;
+ currentUser.Presence = new SocketPresence(Status, null, activities);
ApiClient.CurrentUserId = currentUser.Id;
int unavailableGuilds = 0;
for (int i = 0; i < data.Guilds.Length; i++)
diff --git a/src/Discord.Net.WebSocket/DiscordSocketConfig.cs b/src/Discord.Net.WebSocket/DiscordSocketConfig.cs
index a45d4f5be..90b746787 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketConfig.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketConfig.cs
@@ -127,12 +127,6 @@ namespace Discord.WebSocket
///
public bool? ExclusiveBulkDelete { get; set; } = null;
- ///
- /// Gets or sets enabling dispatching of guild subscription events e.g. presence and typing events.
- /// This is not used if are provided.
- ///
- public bool GuildSubscriptions { get; set; } = true;
-
///
/// Gets or sets the maximum identify concurrency.
///
@@ -172,14 +166,15 @@ namespace Discord.WebSocket
private int maxWaitForGuildAvailable = 10000;
///
- /// Gets or sets gateway intents to limit what events are sent from Discord. Allows for more granular control than the property.
+ /// Gets or sets gateway intents to limit what events are sent from Discord.
+ /// The default is .
///
///
/// For more information, please see
/// GatewayIntents
/// on the official Discord API documentation.
///
- public GatewayIntents? GatewayIntents { get; set; }
+ public GatewayIntents GatewayIntents { get; set; } = GatewayIntents.AllUnprivileged;
///
/// Initializes a new instance of the class with the default configuration.
diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
index 0e36c6b50..ed8a6c532 100644
--- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -46,8 +46,6 @@ namespace Discord.WebSocket
///
public int AFKTimeout { get; private set; }
///
- public bool IsEmbeddable { get; private set; }
- ///
public bool IsWidgetEnabled { get; private set; }
///
public VerificationLevel VerificationLevel { get; private set; }
@@ -84,7 +82,6 @@ namespace Discord.WebSocket
public ulong? ApplicationId { get; internal set; }
internal ulong? AFKChannelId { get; private set; }
- internal ulong? EmbedChannelId { get; private set; }
internal ulong? WidgetChannelId { get; private set; }
internal ulong? SystemChannelId { get; private set; }
internal ulong? RulesChannelId { get; private set; }
@@ -198,21 +195,6 @@ namespace Discord.WebSocket
}
}
///
- /// Gets the embed channel (i.e. the channel set in the guild's widget settings) in this guild.
- ///
- ///
- /// A channel set within the server's widget settings; if none is set.
- ///
- [Obsolete("This property is deprecated, use WidgetChannel instead.")]
- public SocketGuildChannel EmbedChannel
- {
- get
- {
- var id = EmbedChannelId;
- return id.HasValue ? GetChannel(id.Value) : null;
- }
- }
- ///
/// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
///
///
@@ -440,16 +422,12 @@ namespace Discord.WebSocket
internal void Update(ClientState state, Model model)
{
AFKChannelId = model.AFKChannelId;
- if (model.EmbedChannelId.IsSpecified)
- EmbedChannelId = model.EmbedChannelId.Value;
if (model.WidgetChannelId.IsSpecified)
WidgetChannelId = model.WidgetChannelId.Value;
SystemChannelId = model.SystemChannelId;
RulesChannelId = model.RulesChannelId;
PublicUpdatesChannelId = model.PublicUpdatesChannelId;
AFKTimeout = model.AFKTimeout;
- if (model.EmbedEnabled.IsSpecified)
- IsEmbeddable = model.EmbedEnabled.Value;
if (model.WidgetEnabled.IsSpecified)
IsWidgetEnabled = model.WidgetEnabled.Value;
IconId = model.Icon;
@@ -548,11 +526,6 @@ namespace Discord.WebSocket
///
/// is .
- [Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")]
- public Task ModifyEmbedAsync(Action func, RequestOptions options = null)
- => GuildHelper.ModifyEmbedAsync(this, Discord, func, options);
- ///
- /// is .
public Task ModifyWidgetAsync(Action func, RequestOptions options = null)
=> GuildHelper.ModifyWidgetAsync(this, Discord, func, options);
///
@@ -1234,8 +1207,6 @@ namespace Discord.WebSocket
///
ulong IGuild.DefaultChannelId => DefaultChannel?.Id ?? 0;
///
- ulong? IGuild.EmbedChannelId => EmbedChannelId;
- ///
ulong? IGuild.WidgetChannelId => WidgetChannelId;
///
ulong? IGuild.SystemChannelId => SystemChannelId;
@@ -1290,10 +1261,6 @@ namespace Discord.WebSocket
Task IGuild.GetDefaultChannelAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult(DefaultChannel);
///
- [Obsolete("This method is deprecated, use GetWidgetChannelAsync instead.")]
- Task IGuild.GetEmbedChannelAsync(CacheMode mode, RequestOptions options)
- => Task.FromResult(EmbedChannel);
- ///
Task IGuild.GetWidgetChannelAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult(WidgetChannel);
///
diff --git a/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs b/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs
index 2a8b45ca1..597544f4d 100644
--- a/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs
+++ b/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs
@@ -189,9 +189,6 @@ namespace Discord.WebSocket
///
public Task UnpinAsync(RequestOptions options = null)
=> MessageHelper.UnpinAsync(this, Discord, options);
- ///
- public Task ModifySuppressionAsync(bool suppressEmbeds, RequestOptions options = null)
- => MessageHelper.SuppressEmbedsAsync(this, Discord, suppressEmbeds, options);
public string Resolve(int startIndex, TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name,
TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name)
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketPresence.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketPresence.cs
index 407e14419..fe672a4d6 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketPresence.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketPresence.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
+using System.Linq;
using Model = Discord.API.Presence;
namespace Discord.WebSocket
@@ -15,15 +16,12 @@ namespace Discord.WebSocket
///
public UserStatus Status { get; }
///
- public IActivity Activity { get; }
- ///
public IImmutableSet ActiveClients { get; }
///
public IImmutableList Activities { get; }
- internal SocketPresence(UserStatus status, IActivity activity, IImmutableSet activeClients, IImmutableList activities)
+ internal SocketPresence(UserStatus status, IImmutableSet activeClients, IImmutableList activities)
{
Status = status;
- Activity = activity;
ActiveClients = activeClients ?? ImmutableHashSet.Empty;
Activities = activities ?? ImmutableList.Empty;
}
@@ -31,7 +29,7 @@ namespace Discord.WebSocket
{
var clients = ConvertClientTypesDict(model.ClientStatus.GetValueOrDefault());
var activities = ConvertActivitiesList(model.Activities);
- return new SocketPresence(model.Status, model.Game?.ToEntity(), clients, activities);
+ return new SocketPresence(model.Status, clients, activities);
}
///
/// Creates a new containing all of the client types
@@ -84,7 +82,7 @@ namespace Discord.WebSocket
/// A string that resolves to .
///
public override string ToString() => Status.ToString();
- private string DebuggerDisplay => $"{Status}{(Activity != null ? $", {Activity.Name}": "")}";
+ private string DebuggerDisplay => $"{Status}{(Activities?.FirstOrDefault()?.Name ?? "")}";
internal SocketPresence Clone() => this;
}
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUnknownUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUnknownUser.cs
index dd2e747b4..840a1c30b 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketUnknownUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUnknownUser.cs
@@ -25,7 +25,7 @@ namespace Discord.WebSocket
///
public override bool IsWebhook => false;
///
- internal override SocketPresence Presence { get { return new SocketPresence(UserStatus.Offline, null, null, null); } set { } }
+ internal override SocketPresence Presence { get { return new SocketPresence(UserStatus.Offline, null, null); } set { } }
///
/// This field is not supported for an unknown user.
internal override SocketGlobalUser GlobalUser =>
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
index 4e6d4b3f8..979314be3 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
@@ -38,8 +38,6 @@ namespace Discord.WebSocket
///
public string Mention => MentionUtils.MentionUser(Id);
///
- public IActivity Activity => Presence.Activity;
- ///
public UserStatus Status => Presence.Status;
///
public IImmutableSet ActiveClients => Presence.ActiveClients ?? ImmutableHashSet.Empty;
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketWebhookUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketWebhookUser.cs
index c22164f95..404ab116d 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketWebhookUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketWebhookUser.cs
@@ -30,7 +30,7 @@ namespace Discord.WebSocket
///
public override bool IsWebhook => true;
///
- internal override SocketPresence Presence { get { return new SocketPresence(UserStatus.Offline, null, null, null); } set { } }
+ internal override SocketPresence Presence { get { return new SocketPresence(UserStatus.Offline, null, null); } set { } }
internal override SocketGlobalUser GlobalUser =>
throw new NotSupportedException();