typing: replace respond data

This commit is contained in:
March 7th 2022-07-15 17:35:01 +07:00
parent fad6d708b4
commit 98467dc92d
3 changed files with 6 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -397,7 +397,7 @@ class TextBasedChannel {
* @param {Snowflake} botId Bot Id (Supports application ID - not bot)
* @param {string} commandName Command name
* @param {...?string|string[]} args Command arguments
* @returns {Promise<Snowflake>} Nonce (Discord Timestamp) when command was sent
* @returns {Promise<InteractionResponseBody>}
*/
async sendSlash(botId, commandName, ...args) {
args = args.flat(2);
@ -443,7 +443,7 @@ class TextBasedChannel {
)}`,
);
}
const nonce = await commandTarget.sendSlashCommand(
return commandTarget.sendSlashCommand(
new (Message())(this.client, {
channel_id: this.id,
guild_id: this.guild?.id || null,
@ -453,7 +453,6 @@ class TextBasedChannel {
}),
args && args.length ? args : [],
);
return nonce;
}
static applyToClass(structure, full = false, ignore = []) {

6
typings/index.d.ts vendored
View File

@ -460,8 +460,8 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
private static transformCommand(command: ApplicationCommandData): RESTPostAPIApplicationCommandsJSONBody;
private static isAPICommandData(command: object): command is RESTPostAPIApplicationCommandsJSONBody;
// Add
public static sendSlashCommand(message: Message, options?: string[]): Promise<Snowflake>;
public static sendContextMenu(message: Message): Promise<Snowflake>;
public static sendSlashCommand(message: Message, options?: string[]): Promise<InteractionResponseBody>;
public static sendContextMenu(message: Message): Promise<InteractionResponseBody>;
}
export type ApplicationResolvable = Application | Activity | Snowflake;
@ -3946,7 +3946,7 @@ export interface TextBasedChannelFields extends PartialTextBasedChannelFields {
setNSFW(nsfw?: boolean, reason?: string): Promise<this>;
fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
sendTyping(): Promise<void>;
sendSlash(botId: Snowflake, commandName: string, ...args: any): Promise<Snowflake>;
sendSlash(botId: Snowflake, commandName: string, ...args: any): Promise<InteractionResponseBody>;
}
export function PartialWebhookMixin<T>(Base?: Constructable<T>): Constructable<T & PartialWebhookFields>;