feat: add UserContextMenuInteraction and MessageContextMenuInteraction (#7003)

Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: GrapeColor <grapecolor@users.noreply.github.com>
This commit is contained in:
GrapeColor
2021-12-01 20:31:37 +09:00
committed by GitHub
parent a39d8c4d9d
commit 4fe063f0d0
6 changed files with 90 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
const Base = require('./Base');
const { InteractionTypes, MessageComponentTypes } = require('../util/Constants');
const { InteractionTypes, MessageComponentTypes, ApplicationCommandTypes } = require('../util/Constants');
const Permissions = require('../util/Permissions');
const SnowflakeUtil = require('../util/SnowflakeUtil');
@@ -160,6 +160,22 @@ class Interaction extends Base {
return InteractionTypes[this.type] === InteractionTypes.APPLICATION_COMMAND && typeof this.targetId !== 'undefined';
}
/**
* Indicates whether this interaction is a {@link UserContextMenuInteraction}
* @returns {boolean}
*/
isUserContextMenu() {
return this.isContextMenu() && ApplicationCommandTypes[this.targetType] === ApplicationCommandTypes.USER;
}
/**
* Indicates whether this interaction is a {@link MessageContextMenuInteraction}
* @returns {boolean}
*/
isMessageContextMenu() {
return this.isContextMenu() && ApplicationCommandTypes[this.targetType] === ApplicationCommandTypes.MESSAGE;
}
/**
* Indicates whether this interaction is an {@link AutocompleteInteraction}
* @returns {boolean}