Browse Source

Assign CurrentUserId in Sharded Client (#100)

* added interface method declarations

* inline docs

* current user id assignment in sharded client
pull/1923/head
Cenk Ergen GitHub 3 years ago
parent
commit
0796244507
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      src/Discord.Net.WebSocket/DiscordShardedClient.cs

+ 10
- 1
src/Discord.Net.WebSocket/DiscordShardedClient.cs View File

@@ -30,7 +30,16 @@ namespace Discord.WebSocket
/// <inheritdoc />
public override IActivity Activity { get => _shards[0].Activity; protected set { } }

internal new DiscordSocketApiClient ApiClient => base.ApiClient as DiscordSocketApiClient;
internal new DiscordSocketApiClient ApiClient
{
get
{
if (base.ApiClient.CurrentUserId == null)
base.ApiClient.CurrentUserId = CurrentUser?.Id;

return base.ApiClient;
}
}
/// <inheritdoc />
public override IReadOnlyCollection<SocketGuild> Guilds => GetGuilds().ToReadOnlyCollection(GetGuildCount);
/// <inheritdoc />


Loading…
Cancel
Save