mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-22 20:47:28 +01:00
Add Discord message overload handling
This commit is contained in:
@@ -261,10 +261,20 @@ namespace Tgstation.Server.Host.Components.Chat.Providers
|
||||
ct: cancellationToken);
|
||||
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
Logger.LogWarning(
|
||||
"Failed to send to channel {channelId}: {result}",
|
||||
channelId,
|
||||
result.LogFormat());
|
||||
|
||||
if (result.Error is RestResultError<RestError> restError && restError.Error.Code == DiscordError.InvalidFormBody)
|
||||
await channelsClient.CreateMessageAsync(
|
||||
channelId,
|
||||
"TGS: Could not send message to Discord. Body was malformed or too long",
|
||||
messageReference: replyToReference,
|
||||
allowedMentions: allowedMentions,
|
||||
ct: cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user