Minor change (description)

- feat(ApplicationCommand): add `min_length` and `max_length` for string option (v13) #8217 (Djs v13.9)
- fix(Interaction): Button.click & Menu.select return Snowflake
- feat(MessagePayload): Send Activity message
This commit is contained in:
March 7th
2022-07-07 16:10:51 +07:00
parent 578bc0adde
commit 010272fba7
12 changed files with 90 additions and 23 deletions

View File

@@ -166,14 +166,16 @@ class MessageButton extends BaseMessageComponent {
/**
* Click the button
* @param {Message} message Discord Message
* @returns {boolean}
* @returns {Promise<Snowflake>}
*/
async click(message) {
const nonce = SnowflakeUtil.generate();
if (!(message instanceof Message)) throw new Error('[UNKNOWN_MESSAGE] Please pass a valid Message');
if (!this.customId || this.style == 5 || this.disabled) return false; // Button URL, Disabled
await message.client.api.interactions.post({
data: {
type: 3, // ?
nonce,
guild_id: message.guild?.id ?? null, // In DMs
channel_id: message.channel.id,
message_id: message.id,
@@ -184,10 +186,9 @@ class MessageButton extends BaseMessageComponent {
component_type: 2, // Button
custom_id: this.customId,
},
nonce: SnowflakeUtil.generate(),
},
});
return true;
return nonce;
}
}