feature: Remove /users/@me call for socket and rework sharded client a bit (#1860)
* Remove /users/@me call for socket and rework sharded client a bit * Remove override for login
This commit is contained in:
@@ -47,7 +47,7 @@ namespace Discord.WebSocket
|
||||
/// <summary>
|
||||
/// Gets the current logged-in user.
|
||||
/// </summary>
|
||||
public new SocketSelfUser CurrentUser { get => base.CurrentUser as SocketSelfUser; protected set => base.CurrentUser = value; }
|
||||
public virtual new SocketSelfUser CurrentUser { get => base.CurrentUser as SocketSelfUser; protected set => base.CurrentUser = value; }
|
||||
/// <summary>
|
||||
/// Gets a collection of guilds that the user is currently in.
|
||||
/// </summary>
|
||||
|
||||
@@ -40,7 +40,9 @@ namespace Discord.WebSocket
|
||||
/// <summary>
|
||||
/// Provides access to a REST-only client with a shared state from this client.
|
||||
/// </summary>
|
||||
public override DiscordSocketRestClient Rest => _shards[0].Rest;
|
||||
public override DiscordSocketRestClient Rest => _shards?[0].Rest;
|
||||
|
||||
public override SocketSelfUser CurrentUser { get => _shards?.FirstOrDefault(x => x.CurrentUser != null)?.CurrentUser; protected set => throw new InvalidOperationException(); }
|
||||
|
||||
/// <summary> Creates a new REST/WebSocket Discord client. </summary>
|
||||
public DiscordShardedClient() : this(null, new DiscordSocketConfig()) { }
|
||||
@@ -330,14 +332,6 @@ namespace Discord.WebSocket
|
||||
}
|
||||
return Task.Delay(0);
|
||||
};
|
||||
if (isPrimary)
|
||||
{
|
||||
client.Ready += () =>
|
||||
{
|
||||
CurrentUser = client.CurrentUser;
|
||||
return Task.Delay(0);
|
||||
};
|
||||
}
|
||||
|
||||
client.Connected += () => _shardConnectedEvent.InvokeAsync(client);
|
||||
client.Disconnected += (exception) => _shardDisconnectedEvent.InvokeAsync(exception, client);
|
||||
|
||||
@@ -193,11 +193,6 @@ namespace Discord.WebSocket
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
internal override async Task OnLoginAsync(TokenType tokenType, string token)
|
||||
{
|
||||
await Rest.OnLoginAsync(tokenType, token);
|
||||
}
|
||||
/// <inheritdoc />
|
||||
internal override async Task OnLogoutAsync()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user