Skip to content

Commit

Permalink
fix: call OnLogin/OnLogout on DiscordSocketRestClient
Browse files Browse the repository at this point in the history
Resolves #1277.
  • Loading branch information
foxbot committed May 18, 2019
1 parent f3b20b2 commit a44c13a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Discord.Net.WebSocket/DiscordSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ private DiscordSocketClient(DiscordSocketConfig config, API.DiscordSocketApiClie
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);
Expand Down Expand Up @@ -202,13 +206,15 @@ internal override async Task OnLoginAsync(TokenType tokenType, string token)
}
else
_voiceRegions = _parentClient._voiceRegions;
await Rest.OnLoginAsync(tokenType, token);
}
/// <inheritdoc />
internal override async Task OnLogoutAsync()
{
await StopAsync().ConfigureAwait(false);
_applicationInfo = null;
_voiceRegions = ImmutableDictionary.Create<string, RestVoiceRegion>();
await Rest.OnLogoutAsync();
}

/// <inheritdoc />
Expand Down

0 comments on commit a44c13a

Please sign in to comment.