Update ChannelControl.cs

adds try catch around SendMessageAsync to deal with the channel http connection going away mid data stream
This commit is contained in:
Madpeterz 2021-03-25 04:45:57 +00:00
parent d077702f11
commit 3223191979

View file

@ -14,7 +14,8 @@ namespace BetterSecondBot.DiscordSupervisor
{ {
if (AllowNewOutbound() == true) if (AllowNewOutbound() == true)
{ {
try
{
channelname = channelname.ToLowerInvariant(); channelname = channelname.ToLowerInvariant();
channelname = String.Concat(channelname.Where(char.IsLetterOrDigit)); channelname = String.Concat(channelname.Where(char.IsLetterOrDigit));
ITextChannel Channel = await FindTextChannel(channelname, catmap[catmapid], sender_id, TopicType, false).ConfigureAwait(true); ITextChannel Channel = await FindTextChannel(channelname, catmap[catmapid], sender_id, TopicType, false).ConfigureAwait(true);
@ -23,6 +24,11 @@ namespace BetterSecondBot.DiscordSupervisor
return await Channel.SendMessageAsync(message).ConfigureAwait(false); return await Channel.SendMessageAsync(message).ConfigureAwait(false);
} }
} }
catch
{
return null;
}
}
return null; return null;
} }