adds a try catch around the create text channel call so if it fails it does not take out the bot.

- Reported by Darl
This commit is contained in:
Madpeter 2020-05-23 17:27:47 +01:00
parent ab6b7d7a69
commit acfc3da27c

View file

@ -119,9 +119,16 @@ namespace BSB.bottypes
{
display_topic = "" + channeltopictype + ":" + sender_id + ": Actions -> !clear, !close";
}
IGuildChannel channel = await DiscordServer.CreateTextChannelAsync(channelname, X => DiscordGetNewChannelProperies(X, channelname, display_topic, channeltopictype.ToLowerInvariant()));
ITextChannel Txtchan = await DiscordServer.GetTextChannelAsync(channel.Id);
return Txtchan;
try
{
IGuildChannel channel = await DiscordServer.CreateTextChannelAsync(channelname, X => DiscordGetNewChannelProperies(X, channelname, display_topic, channeltopictype.ToLowerInvariant()));
ITextChannel Txtchan = await DiscordServer.GetTextChannelAsync(channel.Id);
return Txtchan;
}
catch
{
return null;
}
}
protected void DiscordGetNewChannelProperies(TextChannelProperties C, string channelname, string channeltopic, string catname)