mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
feat: right-clickybois (context menu support for ApplicationCommand and CommandInteraction) (#6176)
Co-authored-by: SpaceEEC <spaceeec@yahoo.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
This commit is contained in:
@@ -134,7 +134,7 @@ class CommandInteractionOptionResolver {
|
||||
* Gets a channel option.
|
||||
* @param {string} name The name of the option.
|
||||
* @param {boolean} [required=false] Whether to throw an error if the option is not found.
|
||||
* @returns {?(GuildChannel|APIInteractionDataResolvedOption)}
|
||||
* @returns {?(GuildChannel|APIGuildChannel)}
|
||||
* The value of the option, or null if not set and not required.
|
||||
*/
|
||||
getChannel(name, required = false) {
|
||||
@@ -190,7 +190,7 @@ class CommandInteractionOptionResolver {
|
||||
* Gets a member option.
|
||||
* @param {string} name The name of the option.
|
||||
* @param {boolean} [required=false] Whether to throw an error if the option is not found.
|
||||
* @returns {?(GuildMember|APIInteractionDataResolvedOption)}
|
||||
* @returns {?(GuildMember|APIGuildMember)}
|
||||
* The value of the option, or null if not set and not required.
|
||||
*/
|
||||
getMember(name, required = false) {
|
||||
@@ -213,13 +213,25 @@ class CommandInteractionOptionResolver {
|
||||
* Gets a mentionable option.
|
||||
* @param {string} name The name of the option.
|
||||
* @param {boolean} [required=false] Whether to throw an error if the option is not found.
|
||||
* @returns {?(User|GuildMember|APIInteractionDataResolvedOption|Role|APIRole)}
|
||||
* @returns {?(User|GuildMember|APIGuildMember|Role|APIRole)}
|
||||
* The value of the option, or null if not set and not required.
|
||||
*/
|
||||
getMentionable(name, required = false) {
|
||||
const option = this._getTypedOption(name, 'MENTIONABLE', ['user', 'member', 'role'], required);
|
||||
return option?.member ?? option?.user ?? option?.role ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a message option.
|
||||
* @param {string} name The name of the option.
|
||||
* @param {boolean} [required=false] Whether to throw an error if the option is not found.
|
||||
* @returns {?(Message|APIMessage)}
|
||||
* The value of the option, or null if not set and not required.
|
||||
*/
|
||||
getMessage(name, required = false) {
|
||||
const option = this._getTypedOption(name, '_MESSAGE', ['message'], required);
|
||||
return option?.message ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CommandInteractionOptionResolver;
|
||||
|
||||
Reference in New Issue
Block a user