Browse Source

Add socket debug

pull/1923/head
quin lynch 3 years ago
parent
commit
b07e92c573
5 changed files with 102 additions and 4 deletions
  1. +55
    -0
      src/Discord.Net.Core/Discord.Net.Core.xml
  2. +12
    -0
      src/Discord.Net.Rest/Discord.Net.Rest.xml
  3. +3
    -2
      src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj
  4. +17
    -0
      src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
  5. +15
    -2
      src/Discord.Net.WebSocket/DiscordSocketApiClient.cs

+ 55
- 0
src/Discord.Net.Core/Discord.Net.Core.xml View File

@@ -1978,6 +1978,53 @@
A task that represents the asynchronous stop operation.
</returns>
</member>
<member name="M:Discord.IStageChannel.RequestToSpeak(Discord.RequestOptions)">
<summary>
Indicates that the bot would like to speak within a stage channel.
</summary>
<param name="options">The options to be used when sending the request.</param>
<returns>
A task that represents the asynchronous request to speak operation.
</returns>
</member>
<member name="M:Discord.IStageChannel.BecomeSpeakerAsync(Discord.RequestOptions)">
<summary>
Makes the current user become a speaker within a stage.
</summary>
<param name="options">The options to be used when sending the request.</param>
<returns>
A task that represents the asynchronous speaker modify operation.
</returns>
</member>
<member name="M:Discord.IStageChannel.StopSpeakingAsync(Discord.RequestOptions)">
<summary>
Makes the current user a listener.
</summary>
<param name="options">The options to be used when sending the request.</param>
<returns>
A task that represents the asynchronous stop operation.
</returns>
</member>
<member name="M:Discord.IStageChannel.MoveToSpeaker(Discord.IGuildUser,Discord.RequestOptions)">
<summary>
Makes a user a speaker within a stage.
</summary>
<param name="user">The user to make the speaker.</param>
<param name="options">The options to be used when sending the request.</param>
<returns>
A task that represents the asynchronous move operation.
</returns>
</member>
<member name="M:Discord.IStageChannel.RemoveFromSpeaker(Discord.IGuildUser,Discord.RequestOptions)">
<summary>
Removes a user from speaking.
</summary>
<param name="user">The user to remove from speaking.</param>
<param name="options">The options to be used when sending the request.</param>
<returns>
A task that represents the asynchronous remove operation.
</returns>
</member>
<member name="T:Discord.ITextChannel">
<summary>
Represents a generic channel in a guild that can send and receive messages.
@@ -7550,6 +7597,14 @@
This must be less than the constant defined by <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.
</remarks>
</member>
<member name="P:Discord.MessageProperties.Embed">
<summary>
Gets or sets a single embed for this message.
</summary>
<remarks>
This property will be added to the <see cref="P:Discord.MessageProperties.Embed"/> array, in the future please use the array rather then this property.
</remarks>
</member>
<member name="P:Discord.MessageProperties.Embeds">
<summary>
Gets or sets the embeds of the message.


+ 12
- 0
src/Discord.Net.Rest/Discord.Net.Rest.xml View File

@@ -2313,6 +2313,18 @@
<member name="M:Discord.Rest.RestStageChannel.RequestToSpeak(Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.Rest.RestStageChannel.BecomeSpeakerAsync(Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.Rest.RestStageChannel.StopSpeakingAsync(Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.Rest.RestStageChannel.MoveToSpeaker(Discord.IGuildUser,Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.Rest.RestStageChannel.RemoveFromSpeaker(Discord.IGuildUser,Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="T:Discord.Rest.RestTextChannel">
<summary>
Represents a REST-based channel in a guild that can send and receive messages.


+ 3
- 2
src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Discord.Net.targets" />
<Import Project="../../StyleAnalyzer.targets" />
<PropertyGroup>
@@ -17,9 +17,10 @@
<PropertyGroup>
<DocumentationFile>..\Discord.Net.WebSocket\Discord.Net.WebSocket.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net461|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" />
<ProjectReference Include="..\Discord.Net.Rest\Discord.Net.Rest.csproj" />


+ 17
- 0
src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml View File

@@ -2189,6 +2189,11 @@
<member name="P:Discord.WebSocket.SocketStageChannel.Live">
<inheritdoc/>
</member>
<member name="P:Discord.WebSocket.SocketStageChannel.IsSpeaker">
<summary>
Returns <see langword="true"/> if the current user is a speaker within the stage, otherwise <see langword="false"/>.
</summary>
</member>
<member name="P:Discord.WebSocket.SocketStageChannel.Speakers">
<summary>
Gets a collection of users who are speakers within the stage.
@@ -2206,6 +2211,18 @@
<member name="M:Discord.WebSocket.SocketStageChannel.RequestToSpeak(Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketStageChannel.BecomeSpeakerAsync(Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketStageChannel.StopSpeakingAsync(Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketStageChannel.MoveToSpeaker(Discord.IGuildUser,Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="M:Discord.WebSocket.SocketStageChannel.RemoveFromSpeaker(Discord.IGuildUser,Discord.RequestOptions)">
<inheritdoc/>
</member>
<member name="T:Discord.WebSocket.SocketTextChannel">
<summary>
Represents a WebSocket-based channel in a guild that can send and receive messages.


+ 15
- 2
src/Discord.Net.WebSocket/DiscordSocketApiClient.cs View File

@@ -75,8 +75,15 @@ namespace Discord.API
using (var jsonReader = new JsonTextReader(reader))
{
var msg = _serializer.Deserialize<SocketFrame>(jsonReader);

if (msg != null)
{
#if DEBUG_PACKETS
Console.WriteLine($"<- {msg.Operation} [{msg.Type ?? "none"}] : {(msg.Payload as Newtonsoft.Json.Linq.JToken)?.ToString().Length}");
#endif

await _receivedGatewayEvent.InvokeAsync((GatewayOpCode)msg.Operation, msg.Sequence, msg.Type, msg.Payload).ConfigureAwait(false);
}
}
}
};
@@ -87,7 +94,13 @@ namespace Discord.API
{
var msg = _serializer.Deserialize<SocketFrame>(jsonReader);
if (msg != null)
{
#if DEBUG_PACKETS
Console.WriteLine($"<- {msg.Operation} [{msg.Type ?? "none"}] : {(msg.Payload as Newtonsoft.Json.Linq.JToken)?.ToString().Length}");
#endif

await _receivedGatewayEvent.InvokeAsync((GatewayOpCode)msg.Operation, msg.Sequence, msg.Type, msg.Payload).ConfigureAwait(false);
}
}
};
WebSocketClient.Closed += async ex =>
@@ -214,8 +227,8 @@ namespace Discord.API
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)}");
#if DEBUG_PACKETS
Console.WriteLine($"-> {opCode}:\n{SerializeJson(payload)}");
#endif
}



Loading…
Cancel
Save