feat(Message): .clickButton() click the only one.
This commit is contained in:
parent
6d170f3555
commit
e197656225
@ -1060,12 +1060,19 @@ class Message extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Click specific button
|
* Click specific button or automatically if only one.
|
||||||
* @param {MessageButton|string} button Button ID
|
* @param {MessageButton|string|null} button Button ID
|
||||||
* @returns {Promise<InteractionResponse>}
|
* @returns {Promise<InteractionResponse>}
|
||||||
*/
|
*/
|
||||||
clickButton(button) {
|
clickButton(button) {
|
||||||
let buttonID;
|
let buttonID;
|
||||||
|
if (!button) {
|
||||||
|
if (this.components.length == 1 && this.components[0].type == 'ACTION_ROW') {
|
||||||
|
if (this.components[0].components.length == 1) {
|
||||||
|
buttonID = this.components[0].components[0].customId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (button instanceof MessageButton) button = button.customId;
|
if (button instanceof MessageButton) button = button.customId;
|
||||||
if (typeof button === 'string') buttonID = button;
|
if (typeof button === 'string') buttonID = button;
|
||||||
if (!buttonID) {
|
if (!buttonID) {
|
||||||
|
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@ -1974,7 +1974,7 @@ export class Message<Cached extends boolean = boolean> extends Base {
|
|||||||
// Added
|
// Added
|
||||||
public markUnread(): Promise<boolean>;
|
public markUnread(): Promise<boolean>;
|
||||||
public markRead(): Promise<boolean>;
|
public markRead(): Promise<boolean>;
|
||||||
public clickButton(button: MessageButton | string): Promise<InteractionResponse>;
|
public clickButton(button: MessageButton | string | null): Promise<InteractionResponse>;
|
||||||
public selectMenu(menuID: string, options: string[]): Promise<InteractionResponse>;
|
public selectMenu(menuID: string, options: string[]): Promise<InteractionResponse>;
|
||||||
public selectMenu(options: string[]): Promise<InteractionResponse>;
|
public selectMenu(options: string[]): Promise<InteractionResponse>;
|
||||||
public contextMenu(botID: Snowflake, commandName: string): Promise<InteractionResponse>;
|
public contextMenu(botID: Snowflake, commandName: string): Promise<InteractionResponse>;
|
||||||
|
Loading…
Reference in New Issue
Block a user