diff --git a/src/Discord.Net.WebSocket/API/Gateway/GatewayOpCode.cs b/src/Discord.Net.WebSocket/API/Gateway/GatewayOpCode.cs
index 13a2bb462..062aec224 100644
--- a/src/Discord.Net.WebSocket/API/Gateway/GatewayOpCode.cs
+++ b/src/Discord.Net.WebSocket/API/Gateway/GatewayOpCode.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
namespace Discord.API.Gateway
{
internal enum GatewayOpCode : byte
@@ -10,7 +10,7 @@ namespace Discord.API.Gateway
/// C→S - Used to associate a connection with a token and specify configuration.
Identify = 2,
/// C→S - Used to update client's status and current game id.
- StatusUpdate = 3,
+ PresenceUpdate = 3,
/// C→S - Used to join a particular voice channel.
VoiceStateUpdate = 4,
/// C→S - Used to ensure the guild's voice server is alive.
diff --git a/src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs b/src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs
index bb54d4cdd..3b7ef35d6 100644
--- a/src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs
+++ b/src/Discord.Net.WebSocket/API/Gateway/IdentifyParams.cs
@@ -16,7 +16,7 @@ namespace Discord.API.Gateway
[JsonProperty("shard")]
public Optional ShardingParams { get; set; }
[JsonProperty("presence")]
- public Optional Presence { get; set; }
+ public Optional Presence { get; set; }
[JsonProperty("intents")]
public Optional Intents { get; set; }
}
diff --git a/src/Discord.Net.WebSocket/API/Gateway/StatusUpdateParams.cs b/src/Discord.Net.WebSocket/API/Gateway/StatusUpdateParams.cs
index 5fec8b4bd..96897024c 100644
--- a/src/Discord.Net.WebSocket/API/Gateway/StatusUpdateParams.cs
+++ b/src/Discord.Net.WebSocket/API/Gateway/StatusUpdateParams.cs
@@ -4,15 +4,16 @@ using Newtonsoft.Json;
namespace Discord.API.Gateway
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
- internal class StatusUpdateParams
+ internal class PresenceUpdateParams
+
{
[JsonProperty("status")]
public UserStatus Status { get; set; }
- [JsonProperty("since"), Int53]
+ [JsonProperty("since", NullValueHandling = NullValueHandling.Include), Int53]
public long? IdleSince { get; set; }
[JsonProperty("afk")]
public bool IsAFK { get; set; }
- [JsonProperty("game")]
- public Game Game { get; set; }
+ [JsonProperty("activities")]
+ public object[] Activities { get; set; } // TODO, change to interface later
}
}
diff --git a/src/Discord.Net.WebSocket/ConnectionManager.cs b/src/Discord.Net.WebSocket/ConnectionManager.cs
index e444f359f..9a19f90f4 100644
--- a/src/Discord.Net.WebSocket/ConnectionManager.cs
+++ b/src/Discord.Net.WebSocket/ConnectionManager.cs
@@ -185,6 +185,11 @@ namespace Discord
_readyPromise.TrySetException(ex);
_connectionPromise.TrySetException(ex);
_connectionCancelToken?.Cancel();
+
+ _ = Task.Run(async () =>
+ {
+ await _logger.ErrorAsync($"Failed to start the connection: {ex}", ex);
+ });
}
public void CriticalError(Exception ex)
{
diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj
index 35ea4ffaa..b61a63032 100644
--- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj
+++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj
@@ -18,7 +18,7 @@
..\Discord.Net.WebSocket\Discord.Net.WebSocket.xml
- DEBUG;TRACE;DEBUG_LIMITS
+ TRACE
diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
index b880b2e58..aac3f2132 100644
--- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
+++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
@@ -13,7 +13,7 @@
C→S - Used to associate a connection with a token and specify configuration.
-
+
C→S - Used to update client's status and current game id.
diff --git a/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs b/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
index 65fd23d3f..449bf8e04 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
@@ -213,6 +213,10 @@ namespace Discord.API
options.BucketId = GatewayBucket.Get(GatewayBucketType.Unbucketed).Id;
await RequestQueue.SendAsync(new WebSocketRequest(WebSocketClient, bytes, true, opCode == GatewayOpCode.Heartbeat, options)).ConfigureAwait(false);
await _sentGatewayMessageEvent.InvokeAsync(opCode).ConfigureAwait(false);
+
+#if DEBUG
+ Console.WriteLine($"Sent {opCode}:\n{SerializeJson(payload)}");
+#endif
}
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)
@@ -237,12 +241,12 @@ namespace Discord.API
if (presence.HasValue)
{
- msg.Presence = new StatusUpdateParams
+ msg.Presence = new PresenceUpdateParams
{
Status = presence.Value.Item1,
IsAFK = presence.Value.Item2,
IdleSince = presence.Value.Item3,
- Game = presence.Value.Item4,
+ Activities = new object[] { presence.Value.Item4 }
};
}
@@ -264,18 +268,18 @@ namespace Discord.API
options = RequestOptions.CreateOrClone(options);
await SendGatewayAsync(GatewayOpCode.Heartbeat, lastSeq, options: options).ConfigureAwait(false);
}
- public async Task SendStatusUpdateAsync(UserStatus status, bool isAFK, long? since, GameModel game, RequestOptions options = null)
+ public async Task SendPresenceUpdateAsync(UserStatus status, bool isAFK, long? since, GameModel game, RequestOptions options = null)
{
options = RequestOptions.CreateOrClone(options);
- var args = new StatusUpdateParams
+ var args = new PresenceUpdateParams
{
Status = status,
IdleSince = since,
IsAFK = isAFK,
- Game = game
+ Activities = new object[] { game }
};
options.BucketId = GatewayBucket.Get(GatewayBucketType.PresenceUpdate).Id;
- await SendGatewayAsync(GatewayOpCode.StatusUpdate, args, options: options).ConfigureAwait(false);
+ await SendGatewayAsync(GatewayOpCode.PresenceUpdate, args, options: options).ConfigureAwait(false);
}
public async Task SendRequestMembersAsync(IEnumerable guildIds, RequestOptions options = null)
{
diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
index 3b283a004..52a5d309d 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
@@ -495,7 +495,7 @@ namespace Discord.WebSocket
var presence = BuildCurrentStatus() ?? (UserStatus.Online, false, null, null);
- await ApiClient.SendStatusUpdateAsync(
+ await ApiClient.SendPresenceUpdateAsync(
status: presence.Item1,
isAFK: presence.Item2,
since: presence.Item3,
diff --git a/src/Discord.Net/Discord.Net.nuspec b/src/Discord.Net/Discord.Net.nuspec
index 9632d9065..595203eba 100644
--- a/src/Discord.Net/Discord.Net.nuspec
+++ b/src/Discord.Net/Discord.Net.nuspec
@@ -2,7 +2,7 @@
Discord.Net.Labs
- 3.0.0-pre$suffix$
+ 3.0.1-pre$suffix$
Discord.Net Labs
Discord.Net Contributors
quinchs
@@ -14,25 +14,25 @@
https://avatars.githubusercontent.com/u/84047264
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+