mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(bot): expose PKErrors from message edit proxy handler
This commit is contained in:
parent
3129f05b0f
commit
c91349a1d6
1 changed files with 9 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ using Myriad.Cache;
|
|||
using Myriad.Extensions;
|
||||
using Myriad.Gateway;
|
||||
using Myriad.Rest;
|
||||
using Myriad.Rest.Types.Requests;
|
||||
using Myriad.Types;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
|
@ -76,6 +77,14 @@ public class MessageEdited: IEventHandler<MessageUpdateEvent>
|
|||
}
|
||||
// Catch any failed proxy checks so they get ignored in the global error handler
|
||||
catch (ProxyService.ProxyChecksFailedException) { }
|
||||
|
||||
catch (PKError e)
|
||||
{
|
||||
// User-facing errors, print to the channel properly formatted
|
||||
if (botPermissions.HasFlag(PermissionSet.SendMessages))
|
||||
await _rest.CreateMessage(evt.ChannelId,
|
||||
new MessageRequest { Content = $"{Emojis.Error} {e.Message}" });
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<MessageCreateEvent> GetMessageCreateEvent(MessageUpdateEvent evt, CachedMessage lastMessage,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue