Fix attempts to fetch channels in interactions (#2090)

* fix attempts to fetch channels in interactions

* remove test case
This commit is contained in:
Quin Lynch
2022-02-09 00:12:41 -04:00
committed by GitHub
parent 97e54e1047
commit 6290f75359
3 changed files with 39 additions and 50 deletions

View File

@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Model = Discord.API.Interaction;
using DataModel = Discord.API.ApplicationCommandInteractionData;
using Newtonsoft.Json;
using Discord.Net;
namespace Discord.Rest
{
@@ -130,7 +131,11 @@ namespace Discord.Rest
if(Channel == null && model.ChannelId.IsSpecified)
{
Channel = (IRestMessageChannel)await discord.GetChannelAsync(model.ChannelId.Value);
try
{
Channel = (IRestMessageChannel)await discord.GetChannelAsync(model.ChannelId.Value);
}
catch(HttpException x) when(x.DiscordCode == DiscordErrorCode.MissingPermissions) { } // ignore
}
UserLocale = model.UserLocale.IsSpecified