mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 09:40:10 +00:00
fix(bot): ignore permission errors trying to delete user messages in DMs
This commit is contained in:
parent
c91349a1d6
commit
9be65d03b1
1 changed files with 7 additions and 0 deletions
|
|
@ -150,6 +150,9 @@ public class ReactionAdded: IEventHandler<MessageReactionAddEvent>
|
||||||
if (authorId != null && authorId != evt.UserId)
|
if (authorId != null && authorId != evt.UserId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!(await _cache.PermissionsIn(evt.ChannelId)).HasFlag(PermissionSet.ManageMessages))
|
||||||
|
return;
|
||||||
|
|
||||||
// todo: don't try to delete the user's own messages in DMs
|
// todo: don't try to delete the user's own messages in DMs
|
||||||
// this is hard since we don't have the message author object, but it happens infrequently enough to not really care about the 403s, I guess?
|
// this is hard since we don't have the message author object, but it happens infrequently enough to not really care about the 403s, I guess?
|
||||||
|
|
||||||
|
|
@ -161,6 +164,10 @@ public class ReactionAdded: IEventHandler<MessageReactionAddEvent>
|
||||||
{
|
{
|
||||||
// Message was deleted by something/someone else before we got to it
|
// Message was deleted by something/someone else before we got to it
|
||||||
}
|
}
|
||||||
|
catch (ForbiddenException)
|
||||||
|
{
|
||||||
|
// user reacted with :x: to their own message
|
||||||
|
}
|
||||||
|
|
||||||
// No need to delete database row here, it'll get deleted by the once-per-minute scheduled task.
|
// No need to delete database row here, it'll get deleted by the once-per-minute scheduled task.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue