Browse Source

fix: call OnLogin/OnLogout on DiscordSocketRestClient

Resolves #1277.
tags/2.1.0
Christopher Felegy 6 years ago
parent
commit
a44c13af78
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/Discord.Net.WebSocket/DiscordSocketClient.cs

+ 6
- 0
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -132,6 +132,10 @@ namespace Discord.WebSocket
ExclusiveBulkDelete = config.ExclusiveBulkDelete;
State = new ClientState(0, 0);
Rest = new DiscordSocketRestClient(config, ApiClient);
Rest.Log += (log) =>
{
return _restLogger.LogAsync(log.Severity, log.Message, log.Exception);
};
_heartbeatTimes = new ConcurrentQueue<long>();

_stateLock = new SemaphoreSlim(1, 1);
@@ -202,6 +206,7 @@ namespace Discord.WebSocket
}
else
_voiceRegions = _parentClient._voiceRegions;
await Rest.OnLoginAsync(tokenType, token);
}
/// <inheritdoc />
internal override async Task OnLogoutAsync()
@@ -209,6 +214,7 @@ namespace Discord.WebSocket
await StopAsync().ConfigureAwait(false);
_applicationInfo = null;
_voiceRegions = ImmutableDictionary.Create<string, RestVoiceRegion>();
await Rest.OnLogoutAsync();
}

/// <inheritdoc />


Loading…
Cancel
Save