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:
parent
d077702f11
commit
3223191979
1 changed files with 13 additions and 7 deletions
|
|
@ -14,13 +14,19 @@ namespace BetterSecondBot.DiscordSupervisor
|
|||
{
|
||||
if (AllowNewOutbound() == true)
|
||||
{
|
||||
|
||||
channelname = channelname.ToLowerInvariant();
|
||||
channelname = String.Concat(channelname.Where(char.IsLetterOrDigit));
|
||||
ITextChannel Channel = await FindTextChannel(channelname, catmap[catmapid], sender_id, TopicType, false).ConfigureAwait(true);
|
||||
if (Channel != null)
|
||||
{
|
||||
return await Channel.SendMessageAsync(message).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
channelname = channelname.ToLowerInvariant();
|
||||
channelname = String.Concat(channelname.Where(char.IsLetterOrDigit));
|
||||
ITextChannel Channel = await FindTextChannel(channelname, catmap[catmapid], sender_id, TopicType, false).ConfigureAwait(true);
|
||||
if (Channel != null)
|
||||
{
|
||||
return await Channel.SendMessageAsync(message).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue