Discord.js v13.7
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const Interaction = require('./Interaction');
|
||||
const InteractionWebhook = require('./InteractionWebhook');
|
||||
const MessageAttachment = require('./MessageAttachment');
|
||||
const InteractionResponses = require('./interfaces/InteractionResponses');
|
||||
const { ApplicationCommandOptionTypes } = require('../util/Constants');
|
||||
|
||||
@@ -76,6 +77,7 @@ class BaseCommandInteraction extends Interaction {
|
||||
* @property {Collection<Snowflake, Role|APIRole>} [roles] The resolved roles
|
||||
* @property {Collection<Snowflake, Channel|APIChannel>} [channels] The resolved channels
|
||||
* @property {Collection<Snowflake, Message|APIMessage>} [messages] The resolved messages
|
||||
* @property {Collection<Snowflake, MessageAttachment>} [attachments] The resolved attachments
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -84,7 +86,7 @@ class BaseCommandInteraction extends Interaction {
|
||||
* @returns {CommandInteractionResolvedData}
|
||||
* @private
|
||||
*/
|
||||
transformResolved({ members, users, channels, roles, messages }) {
|
||||
transformResolved({ members, users, channels, roles, messages, attachments }) {
|
||||
const result = {};
|
||||
|
||||
if (members) {
|
||||
@@ -123,6 +125,14 @@ class BaseCommandInteraction extends Interaction {
|
||||
}
|
||||
}
|
||||
|
||||
if (attachments) {
|
||||
result.attachments = new Collection();
|
||||
for (const attachment of Object.values(attachments)) {
|
||||
const patched = new MessageAttachment(attachment.url, attachment.filename, attachment);
|
||||
result.attachments.set(attachment.id, patched);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -139,6 +149,7 @@ class BaseCommandInteraction extends Interaction {
|
||||
* @property {GuildMember|APIGuildMember} [member] The resolved member
|
||||
* @property {GuildChannel|ThreadChannel|APIChannel} [channel] The resolved channel
|
||||
* @property {Role|APIRole} [role] The resolved role
|
||||
* @property {MessageAttachment} [attachment] The resolved attachment
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -169,6 +180,9 @@ class BaseCommandInteraction extends Interaction {
|
||||
|
||||
const role = resolved.roles?.[option.value];
|
||||
if (role) result.role = this.guild?.roles._add(role) ?? role;
|
||||
|
||||
const attachment = resolved.attachments?.[option.value];
|
||||
if (attachment) result.attachment = new MessageAttachment(attachment.url, attachment.filename, attachment);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -182,6 +196,8 @@ class BaseCommandInteraction extends Interaction {
|
||||
editReply() {}
|
||||
deleteReply() {}
|
||||
followUp() {}
|
||||
showModal() {}
|
||||
awaitModalSubmit() {}
|
||||
}
|
||||
|
||||
InteractionResponses.applyToClass(BaseCommandInteraction, ['deferUpdate', 'update']);
|
||||
|
||||
Reference in New Issue
Block a user