Browse Source

Rest based fetch for interactions that are not in cache

pull/1923/head
quin lynch 4 years ago
parent
commit
737a400e08
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      src/Discord.Net.WebSocket/DiscordSocketClient.cs

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

@@ -1796,7 +1796,19 @@ namespace Discord.WebSocket
channel = State.GetDMChannel(data.User.Value.Id);
}

if(channel is ISocketMessageChannel textChannel)
if (channel == null)
{
var channelModel = await this.Rest.ApiClient.GetChannelAsync(data.ChannelId.Value);

if (data.GuildId.IsSpecified)
channel = SocketTextChannel.Create(State.GetGuild(data.GuildId.Value), this.State, channelModel);
else
channel = (SocketChannel)SocketChannel.CreatePrivate(this, State, channelModel);

this.State.AddChannel(channel);
}

if (channel is ISocketMessageChannel textChannel)
{
var guild = (channel as SocketGuildChannel)?.Guild;
if (guild != null && !guild.IsSynced)


Loading…
Cancel
Save