@@ -382,7 +382,7 @@ public sealed partial class GatewayClient : WebSocketClient, IEntity
382382 public partial event Func < GuildUser , ValueTask > ? GuildUserUpdate ;
383383
384384 /// <summary>
385- /// Sent in response to <see cref="RequestGuildUsersAsync(GuildUsersRequestProperties, WebSocketPayloadProperties , CancellationToken)"/>. You can use the <see cref="GuildUserChunkEventArgs.ChunkIndex"/> and <see cref="GuildUserChunkEventArgs.ChunkCount"/> to calculate how many chunks are left for your request.<br/>
385+ /// Sent in response to <see cref="RequestGuildUsersAsync(GuildUsersRequestProperties, WebSocketMessageProperties , CancellationToken)"/>. You can use the <see cref="GuildUserChunkEventArgs.ChunkIndex"/> and <see cref="GuildUserChunkEventArgs.ChunkCount"/> to calculate how many chunks are left for your request.<br/>
386386 /// </summary>
387387 /// <remarks>
388388 /// <br/> Required Intents: None
@@ -896,7 +896,7 @@ private protected override void OnConnected()
896896
897897 private ValueTask SendIdentifyAsync ( ConnectionState connectionState , PresenceProperties ? presence = null , CancellationToken cancellationToken = default )
898898 {
899- GatewayPayloadProperties < GatewayIdentifyProperties > payload = new ( GatewayOpcode . Identify , new ( Token . RawToken )
899+ GatewayMessageProperties < GatewayIdentifyProperties > message = new ( GatewayOpcode . Identify , new ( Token . RawToken )
900900 {
901901 ConnectionProperties = _connectionProperties ,
902902 LargeThreshold = _largeThreshold ,
@@ -907,7 +907,7 @@ private ValueTask SendIdentifyAsync(ConnectionState connectionState, PresencePro
907907
908908 _latencyTimer . Start ( ) ;
909909
910- return SendConnectionObjectAsync ( connectionState , payload , Serialization . Default . GatewayPayloadPropertiesGatewayIdentifyProperties , _internalTextPayloadProperties , cancellationToken ) ;
910+ return SendConnectionObjectAsync ( connectionState , message , Serialization . Default . GatewayMessagePropertiesGatewayIdentifyProperties , _internalTextMessageProperties , cancellationToken ) ;
911911 }
912912
913913 /// <summary>
@@ -926,7 +926,7 @@ public async ValueTask StartAsync(PresenceProperties? presence = null, Cancellat
926926 /// Resumes the session specified by <paramref name="sessionId"/>.
927927 /// </summary>
928928 /// <param name="sessionId">The session to resume.</param>
929- /// <param name="sequenceNumber">The sequence number of the payload to resume from.</param>
929+ /// <param name="sequenceNumber">The sequence number of the message to resume from.</param>
930930 /// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
931931 /// <returns></returns>
932932 public async ValueTask ResumeAsync ( string sessionId , int sequenceNumber , CancellationToken cancellationToken = default )
@@ -950,48 +950,48 @@ private protected override ValueTask TryResumeAsync(ConnectionState connectionSt
950950
951951 private ValueTask TryResumeAsync ( ConnectionState connectionState , string sessionId , int sequenceNumber , CancellationToken cancellationToken = default )
952952 {
953- GatewayPayloadProperties < GatewayResumeProperties > payload = new ( GatewayOpcode . Resume , new ( Token . RawToken , sessionId , sequenceNumber ) ) ;
953+ GatewayMessageProperties < GatewayResumeProperties > message = new ( GatewayOpcode . Resume , new ( Token . RawToken , sessionId , sequenceNumber ) ) ;
954954
955955 _latencyTimer . Start ( ) ;
956956
957- return SendConnectionObjectAsync ( connectionState , payload , Serialization . Default . GatewayPayloadPropertiesGatewayResumeProperties , _internalTextPayloadProperties , cancellationToken ) ;
957+ return SendConnectionObjectAsync ( connectionState , message , Serialization . Default . GatewayMessagePropertiesGatewayResumeProperties , _internalTextMessageProperties , cancellationToken ) ;
958958 }
959959
960960 private protected override ValueTask HeartbeatAsync ( ConnectionState connectionState , CancellationToken cancellationToken = default )
961961 {
962- GatewayPayloadProperties < int > payload = new ( GatewayOpcode . Heartbeat , SequenceNumber ) ;
962+ GatewayMessageProperties < int > message = new ( GatewayOpcode . Heartbeat , SequenceNumber ) ;
963963
964964 _latencyTimer . Start ( ) ;
965965
966- return SendConnectionObjectAsync ( connectionState , payload , Serialization . Default . GatewayPayloadPropertiesInt32 , _internalTextPayloadProperties , cancellationToken ) ;
966+ return SendConnectionObjectAsync ( connectionState , message , Serialization . Default . GatewayMessagePropertiesInt32 , _internalTextMessageProperties , cancellationToken ) ;
967967 }
968968
969- private protected override ValueTask ProcessPayloadAsync ( State state , ConnectionState connectionState , WebSocketMessageType messageType , ReadOnlySpan < byte > payload )
969+ private protected override ValueTask ProcessMessageAsync ( State state , ConnectionState connectionState , WebSocketMessageType messageType , ReadOnlySpan < byte > message )
970970 {
971- var rawPayload = _compression . Decompress ( payload ) ;
972- var jsonPayload = JsonSerializer . Deserialize ( rawPayload , Serialization . Default . JsonGatewayPayload ) ! ;
973- return HandlePayloadAsync ( state , connectionState , jsonPayload ) ;
971+ var rawMessage = _compression . Decompress ( message ) ;
972+ var jsonMessage = JsonSerializer . Deserialize ( rawMessage , Serialization . Default . JsonGatewayMessage ) ! ;
973+ return HandleMessageAsync ( state , connectionState , jsonMessage ) ;
974974 }
975975
976- private async ValueTask HandlePayloadAsync ( State state , ConnectionState connectionState , JsonGatewayPayload payload )
976+ private async ValueTask HandleMessageAsync ( State state , ConnectionState connectionState , JsonGatewayMessage message )
977977 {
978- switch ( payload . Opcode )
978+ switch ( message . Opcode )
979979 {
980980 case GatewayOpcode . Dispatch :
981- SequenceNumber = payload . SequenceNumber . GetValueOrDefault ( ) ;
981+ SequenceNumber = message . SequenceNumber . GetValueOrDefault ( ) ;
982982
983- Log ( LogLevel . Debug , payload , null , static ( s , e ) =>
983+ Log ( LogLevel . Debug , message , null , static ( s , e ) =>
984984 {
985985 return $ "'{ s . Event } ' event received.";
986986 } ) ;
987987
988988 try
989989 {
990- await ProcessEventAsync ( state , connectionState , payload ) . ConfigureAwait ( false ) ;
990+ await ProcessEventAsync ( state , connectionState , message ) . ConfigureAwait ( false ) ;
991991 }
992992 catch ( Exception ex )
993993 {
994- Log ( LogLevel . Error , payload , ex , static ( s , e ) =>
994+ Log ( LogLevel . Error , message , ex , static ( s , e ) =>
995995 {
996996 return $ "An error occurred while processing '{ s . Event } ' event.{ Environment . NewLine } { e } ";
997997 } ) ;
@@ -1015,14 +1015,14 @@ private async ValueTask HandlePayloadAsync(State state, ConnectionState connecti
10151015 {
10161016 Log < object ? > ( LogLevel . Error , null , ex , static ( s , e ) =>
10171017 {
1018- return $ "An error occurred while sending the identify payload .{ Environment . NewLine } { e } ";
1018+ return $ "An error occurred while sending the identify message .{ Environment . NewLine } { e } ";
10191019 } ) ;
10201020 }
10211021 break ;
10221022 case GatewayOpcode . Hello :
10231023 Log < object ? > ( LogLevel . Debug , null , null , static ( s , e ) => "Hello received." ) ;
10241024
1025- StartHeartbeating ( connectionState , payload . Data . GetValueOrDefault ( ) . ToObject ( Serialization . Default . JsonHello ) . HeartbeatInterval ) ;
1025+ StartHeartbeating ( connectionState , message . Data . GetValueOrDefault ( ) . ToObject ( Serialization . Default . JsonHello ) . HeartbeatInterval ) ;
10261026 break ;
10271027 case GatewayOpcode . HeartbeatACK :
10281028 var latency = _latencyTimer . Elapsed ;
@@ -1040,11 +1040,11 @@ private async ValueTask HandlePayloadAsync(State state, ConnectionState connecti
10401040 /// <summary>
10411041 /// Joins, moves, or disconnects the app from a voice channel.
10421042 /// </summary>
1043- public ValueTask UpdateVoiceStateAsync ( VoiceStateProperties voiceState , WebSocketPayloadProperties ? properties = null , CancellationToken cancellationToken = default )
1043+ public ValueTask UpdateVoiceStateAsync ( VoiceStateProperties voiceState , WebSocketMessageProperties ? properties = null , CancellationToken cancellationToken = default )
10441044 {
1045- GatewayPayloadProperties < VoiceStateProperties > payload = new ( GatewayOpcode . VoiceStateUpdate , voiceState ) ;
1045+ GatewayMessageProperties < VoiceStateProperties > message = new ( GatewayOpcode . VoiceStateUpdate , voiceState ) ;
10461046
1047- return SendObjectAsync ( payload , Serialization . Default . GatewayPayloadPropertiesVoiceStateProperties , properties , cancellationToken ) ;
1047+ return SendObjectAsync ( message , Serialization . Default . GatewayMessagePropertiesVoiceStateProperties , properties , cancellationToken ) ;
10481048 }
10491049
10501050 /// <summary>
@@ -1053,27 +1053,27 @@ public ValueTask UpdateVoiceStateAsync(VoiceStateProperties voiceState, WebSocke
10531053 /// <param name="presence">The presence to set.</param>
10541054 /// <param name="properties"></param>
10551055 /// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
1056- public ValueTask UpdatePresenceAsync ( PresenceProperties presence , WebSocketPayloadProperties ? properties = null , CancellationToken cancellationToken = default )
1056+ public ValueTask UpdatePresenceAsync ( PresenceProperties presence , WebSocketMessageProperties ? properties = null , CancellationToken cancellationToken = default )
10571057 {
1058- GatewayPayloadProperties < PresenceProperties > payload = new ( GatewayOpcode . PresenceUpdate , presence ) ;
1058+ GatewayMessageProperties < PresenceProperties > message = new ( GatewayOpcode . PresenceUpdate , presence ) ;
10591059
1060- return SendObjectAsync ( payload , Serialization . Default . GatewayPayloadPropertiesPresenceProperties , properties , cancellationToken ) ;
1060+ return SendObjectAsync ( message , Serialization . Default . GatewayMessagePropertiesPresenceProperties , properties , cancellationToken ) ;
10611061 }
10621062
10631063 /// <summary>
10641064 /// Requests users for a guild.
10651065 /// </summary>
1066- public ValueTask RequestGuildUsersAsync ( GuildUsersRequestProperties requestProperties , WebSocketPayloadProperties ? properties = null , CancellationToken cancellationToken = default )
1066+ public ValueTask RequestGuildUsersAsync ( GuildUsersRequestProperties requestProperties , WebSocketMessageProperties ? properties = null , CancellationToken cancellationToken = default )
10671067 {
1068- GatewayPayloadProperties < GuildUsersRequestProperties > payload = new ( GatewayOpcode . RequestGuildUsers , requestProperties ) ;
1068+ GatewayMessageProperties < GuildUsersRequestProperties > message = new ( GatewayOpcode . RequestGuildUsers , requestProperties ) ;
10691069
1070- return SendObjectAsync ( payload , Serialization . Default . GatewayPayloadPropertiesGuildUsersRequestProperties , properties , cancellationToken ) ;
1070+ return SendObjectAsync ( message , Serialization . Default . GatewayMessagePropertiesGuildUsersRequestProperties , properties , cancellationToken ) ;
10711071 }
10721072
1073- private async Task ProcessEventAsync ( State state , ConnectionState connectionState , JsonGatewayPayload payload )
1073+ private async Task ProcessEventAsync ( State state , ConnectionState connectionState , JsonGatewayMessage message )
10741074 {
1075- var data = payload . Data . GetValueOrDefault ( ) ;
1076- var name = payload . Event ! ;
1075+ var data = message . Data . GetValueOrDefault ( ) ;
1076+ var name = message . Event ! ;
10771077 switch ( name )
10781078 {
10791079 case "READY" :
0 commit comments