better reaction handling

This commit is contained in:
Skillz
2020-08-28 13:46:41 -04:00
parent bc2c803475
commit 36fae98a05
2 changed files with 15 additions and 0 deletions
+14
View File
@@ -65,6 +65,16 @@ export function addReaction(
messageID: string,
reaction: string,
) {
if (!botHasChannelPermissions(channelID, [Permissions.ADD_REACTIONS])) {
throw new Error(Errors.MISSING_ADD_REACTIONS);
}
if (
!botHasChannelPermissions(channelID, [Permissions.READ_MESSAGE_HISTORY])
) {
throw new Error(Errors.MISSING_READ_MESSAGE_HISTORY);
}
return RequestManager.put(
endpoints.CHANNEL_MESSAGE_REACTION_ME(
channelID,
@@ -114,6 +124,10 @@ export function removeUserReaction(
reaction: string,
userID: string,
) {
if (!botHasChannelPermissions(channelID, [Permissions.MANAGE_MESSAGES])) {
throw new Error(Errors.MISSING_MANAGE_MESSAGES);
}
RequestManager.delete(
endpoints.CHANNEL_MESSAGE_REACTION_USER(
channelID,