mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
feat: interactions (#5448)
Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Advaith <advaithj1@gmail.com> Co-authored-by: Shiaupiau <stu43005@gmail.com> Co-authored-by: monbrey <rsm999@uowmail.edu.au> Co-authored-by: Tiemen <ThaTiemsz@users.noreply.github.com> Co-authored-by: Carter <carter@elhnet.net>
This commit is contained in:
@@ -11,7 +11,7 @@ const Sticker = require('./Sticker');
|
||||
const { Error, TypeError } = require('../errors');
|
||||
const ReactionManager = require('../managers/ReactionManager');
|
||||
const Collection = require('../util/Collection');
|
||||
const { MessageTypes, SystemMessageTypes } = require('../util/Constants');
|
||||
const { InteractionTypes, MessageTypes, SystemMessageTypes } = require('../util/Constants');
|
||||
const MessageFlags = require('../util/MessageFlags');
|
||||
const Permissions = require('../util/Permissions');
|
||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||
@@ -232,6 +232,30 @@ class Message extends Base {
|
||||
if (data.referenced_message) {
|
||||
this.channel.messages.add(data.referenced_message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Partial data of the interaction that a message is a reply to
|
||||
* @typedef {object} MessageInteraction
|
||||
* @property {Snowflake} id The ID of the interaction
|
||||
* @property {InteractionType} type The type of the interaction
|
||||
* @property {string} commandName The name of the interaction's application command
|
||||
* @property {User} user The user that invoked the interaction
|
||||
*/
|
||||
|
||||
if (data.interaction) {
|
||||
/**
|
||||
* Partial data of the interaction that this message is a reply to
|
||||
* @type {?MessageInteraction}
|
||||
*/
|
||||
this.interaction = {
|
||||
id: data.interaction.id,
|
||||
type: InteractionTypes[data.interaction.type],
|
||||
commandName: data.interaction.name,
|
||||
user: this.client.users.add(data.interaction.user),
|
||||
};
|
||||
} else if (!this.interaction) {
|
||||
this.interaction = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user