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)
|
if (AllowNewOutbound() == true)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
channelname = channelname.ToLowerInvariant();
|
{
|
||||||
channelname = String.Concat(channelname.Where(char.IsLetterOrDigit));
|
channelname = channelname.ToLowerInvariant();
|
||||||
ITextChannel Channel = await FindTextChannel(channelname, catmap[catmapid], sender_id, TopicType, false).ConfigureAwait(true);
|
channelname = String.Concat(channelname.Where(char.IsLetterOrDigit));
|
||||||
if (Channel != null)
|
ITextChannel Channel = await FindTextChannel(channelname, catmap[catmapid], sender_id, TopicType, false).ConfigureAwait(true);
|
||||||
{
|
if (Channel != null)
|
||||||
return await Channel.SendMessageAsync(message).ConfigureAwait(false);
|
{
|
||||||
|
return await Channel.SendMessageAsync(message).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue