mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-17 03:00:13 +00:00
fix(bot): clean up some error messages
This commit is contained in:
parent
d537f05b23
commit
8266100155
3 changed files with 35 additions and 18 deletions
|
|
@ -241,6 +241,12 @@ public class ProxiedMessage
|
||||||
{
|
{
|
||||||
throw new PKError("Could not edit message.");
|
throw new PKError("Could not edit message.");
|
||||||
}
|
}
|
||||||
|
catch (BadRequestException e)
|
||||||
|
{
|
||||||
|
if (e.Message == "Voice messages cannot be edited")
|
||||||
|
throw new PKError($"{e.Message}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<(PKMessage, SystemId)> GetMessageToEdit(Context ctx, Duration timeout, bool isReproxy)
|
private async Task<(PKMessage, SystemId)> GetMessageToEdit(Context ctx, Duration timeout, bool isReproxy)
|
||||||
|
|
|
||||||
|
|
@ -238,25 +238,33 @@ public class ProxyService
|
||||||
if (trigger.Flags.HasFlag(Message.MessageFlags.VoiceMessage))
|
if (trigger.Flags.HasFlag(Message.MessageFlags.VoiceMessage))
|
||||||
flags |= Message.MessageFlags.VoiceMessage;
|
flags |= Message.MessageFlags.VoiceMessage;
|
||||||
|
|
||||||
var proxyMessage = await _webhookExecutor.ExecuteWebhook(new ProxyRequest
|
try
|
||||||
{
|
{
|
||||||
GuildId = trigger.GuildId!.Value,
|
var proxyMessage = await _webhookExecutor.ExecuteWebhook(new ProxyRequest
|
||||||
ChannelId = rootChannel.Id,
|
{
|
||||||
ThreadId = threadId,
|
GuildId = trigger.GuildId!.Value,
|
||||||
MessageId = trigger.Id,
|
ChannelId = rootChannel.Id,
|
||||||
Name = await FixSameName(messageChannel.Id, ctx, match.Member),
|
ThreadId = threadId,
|
||||||
AvatarUrl = AvatarUtils.TryRewriteCdnUrl(match.Member.ProxyAvatar(ctx)),
|
MessageId = trigger.Id,
|
||||||
Content = content,
|
Name = await FixSameName(messageChannel.Id, ctx, match.Member),
|
||||||
Attachments = trigger.Attachments,
|
AvatarUrl = AvatarUtils.TryRewriteCdnUrl(match.Member.ProxyAvatar(ctx)),
|
||||||
FileSizeLimit = guild.FileSizeLimit(),
|
Content = content,
|
||||||
Embeds = embeds.ToArray(),
|
Attachments = trigger.Attachments,
|
||||||
Stickers = trigger.StickerItems,
|
FileSizeLimit = guild.FileSizeLimit(),
|
||||||
AllowEveryone = allowEveryone,
|
Embeds = embeds.ToArray(),
|
||||||
Flags = flags,
|
Stickers = trigger.StickerItems,
|
||||||
Tts = tts,
|
AllowEveryone = allowEveryone,
|
||||||
Poll = trigger.Poll,
|
Flags = flags,
|
||||||
});
|
Tts = tts,
|
||||||
await HandleProxyExecutedActions(ctx, autoproxySettings, trigger, proxyMessage, match);
|
Poll = trigger.Poll,
|
||||||
|
});
|
||||||
|
await HandleProxyExecutedActions(ctx, autoproxySettings, trigger, proxyMessage, match);
|
||||||
|
}
|
||||||
|
catch (PKError)
|
||||||
|
{
|
||||||
|
if (ctx.ProxyErrorMessageEnabled)
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ExecuteReproxy(Message trigger, PKMessage msg, List<ProxyMember> members, ProxyMember member, string prefix)
|
public async Task ExecuteReproxy(Message trigger, PKMessage msg, List<ProxyMember> members, ProxyMember member, string prefix)
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,9 @@ public class WebhookExecutorService
|
||||||
}
|
}
|
||||||
catch (BadRequestException e)
|
catch (BadRequestException e)
|
||||||
{
|
{
|
||||||
|
if (e.Message == "Cannot use one or more emoji included with this poll")
|
||||||
|
throw new PKError($"Discord rejected proxy message: {e.Message}");
|
||||||
|
|
||||||
// explanation for hacky: I don't care if this code fails, it just means it wasn't a username error
|
// explanation for hacky: I don't care if this code fails, it just means it wasn't a username error
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue