Update relay.cs
add a try catch around discord webhook support in the event it kills itself
This commit is contained in:
parent
bdab4f14a0
commit
eccd78e98b
1 changed files with 11 additions and 4 deletions
|
|
@ -64,10 +64,17 @@ namespace BSB.bottypes
|
|||
if ((myconfig.DiscordRelay_GroupUUID == group_uuid.ToString()) || (myconfig.DiscordRelay_GroupUUID == "*") || (myconfig.DiscordRelay_GroupUUID == "all"))
|
||||
{
|
||||
Group Gr = mygroups[group_uuid];
|
||||
using var DWHclient = new DiscordWebhookClient(myconfig.DiscordRelay_URL);
|
||||
string SendMessage = "(" + Gr.Name + ") @" + sender_name + ":" + message + "";
|
||||
await DWHclient.SendMessageAsync(text: SendMessage).ConfigureAwait(false);
|
||||
DWHclient.Dispose();
|
||||
try
|
||||
{
|
||||
using var DWHclient = new DiscordWebhookClient(myconfig.DiscordRelay_URL);
|
||||
string SendMessage = "(" + Gr.Name + ") @" + sender_name + ":" + message + "";
|
||||
await DWHclient.SendMessageAsync(text: SendMessage).ConfigureAwait(false);
|
||||
DWHclient.Dispose();
|
||||
}
|
||||
catch {
|
||||
Info("Discord web hook has failed - marking as disabled untill next restart!");
|
||||
myconfig.DiscordRelay_URL = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue