Browse Source

Fix NRE with default stickers

pull/1923/head
quin lynch 4 years ago
parent
commit
65a3245c83
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      src/Discord.Net.WebSocket/DiscordShardedClient.cs
  2. +2
    -2
      src/Discord.Net.WebSocket/DiscordSocketClient.cs

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

@@ -83,7 +83,7 @@ namespace Discord.WebSocket
_shardIdsToIndex = new Dictionary<int, int>();
config.DisplayInitialLog = false;
_baseConfig = config;
_defaultStickers = new ImmutableArray<StickerPack<SocketSticker>>();
_defaultStickers = ImmutableArray.Create<StickerPack<SocketSticker>>();

if (config.TotalShards == null)
_automaticShards = true;


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

@@ -149,7 +149,7 @@ namespace Discord.WebSocket
Rest = new DiscordSocketRestClient(config, ApiClient);
_heartbeatTimes = new ConcurrentQueue<long>();
_gatewayIntents = config.GatewayIntents;
_defaultStickers = new ImmutableArray<StickerPack<SocketSticker>>();
_defaultStickers = ImmutableArray.Create<StickerPack<SocketSticker>>();

_stateLock = new SemaphoreSlim(1, 1);
_gatewayLogger = LogManager.CreateLogger(ShardId == 0 && TotalShards == 1 ? "Gateway" : $"Shard #{ShardId}");
@@ -210,7 +210,7 @@ namespace Discord.WebSocket

internal override async Task OnLoginAsync(TokenType tokenType, string token)
{
if(this._shardedClient != null && this._defaultStickers.Length == 0)
if(this._shardedClient == null && this._defaultStickers.Length == 0)
{
var models = await ApiClient.ListNitroStickerPacksAsync().ConfigureAwait(false);



Loading…
Cancel
Save