mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Attempt to fix webhook invocation errors
This commit is contained in:
parent
5f79aaf960
commit
8396e17a87
2 changed files with 33 additions and 4 deletions
|
|
@ -96,7 +96,22 @@ namespace PluralKit.Bot
|
|||
|
||||
// DiscordWebhookClient has a sync network call in its constructor (!!!)
|
||||
// and we want to punt that onto a task queue, so we do that.
|
||||
return Task.Run(() => new DiscordWebhookClient(webhook));
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return new DiscordWebhookClient(webhook);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// TODO: does this leak stuff inside the DiscordWebhookClient created above?
|
||||
|
||||
// Webhook itself was found in cache, but has been deleted on the channel
|
||||
// We request a new webhook instead
|
||||
return new DiscordWebhookClient(await _webhookCache.InvalidateAndRefreshWebhook(webhook));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private string FixClyde(string name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue