Browse Source

Fix ShardedClient#GetShardFor null-case (#742)

This resolves #742.

Common cases for IGuild being null on access are DMs (since they do not
belong to a guild) - this change resolves null guilds to shard zero,
where DMs are also received.
tags/2.0.0-beta
Christopher F 7 years ago
parent
commit
d5e9d6f9c1
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/Discord.Net.WebSocket/DiscordShardedClient.cs

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

@@ -1,4 +1,4 @@
using Discord.API;
using Discord.API;
using Discord.Rest;
using System;
using System.Collections.Generic;
@@ -133,7 +133,7 @@ namespace Discord.WebSocket
private DiscordSocketClient GetShardFor(ulong guildId)
=> GetShard(GetShardIdFor(guildId));
public DiscordSocketClient GetShardFor(IGuild guild)
=> GetShardFor(guild.Id);
=> GetShardFor(guild?.Id ?? 0);

/// <inheritdoc />
public override async Task<RestApplication> GetApplicationInfoAsync(RequestOptions options = null)


Loading…
Cancel
Save