mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
src: Update Webhook#sendSlackMessage to be accurate with what the API returns (#3429)
* src: Update sendSlackMessage * typings
This commit is contained in:
@@ -155,7 +155,7 @@ class Webhook {
|
||||
/**
|
||||
* Sends a raw slack message with this webhook.
|
||||
* @param {Object} body The raw body to send
|
||||
* @returns {Promise<Message|Object>}
|
||||
* @returns {Promise<boolean>}
|
||||
* @example
|
||||
* // Send a slack message
|
||||
* webhook.sendSlackMessage({
|
||||
@@ -174,11 +174,7 @@ class Webhook {
|
||||
query: { wait: true },
|
||||
auth: false,
|
||||
data: body,
|
||||
}).then(d => {
|
||||
const channel = this.client.channels ? this.client.channels.get(d.channel_id) : undefined;
|
||||
if (!channel) return d;
|
||||
return channel.messages.add(d, false);
|
||||
});
|
||||
}).then(data => data.toString() === 'ok');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -1861,7 +1861,7 @@ declare module 'discord.js' {
|
||||
send(content?: StringResolvable, options?: WebhookMessageOptions & { split: true | SplitOptions } | MessageAdditions): Promise<Message[]>;
|
||||
send(options?: WebhookMessageOptions & { split?: false } | MessageAdditions | APIMessage): Promise<Message>;
|
||||
send(options?: WebhookMessageOptions & { split: true | SplitOptions } | MessageAdditions | APIMessage): Promise<Message[]>;
|
||||
sendSlackMessage(body: object): Promise<Message | object>;
|
||||
sendSlackMessage(body: object): Promise<boolean>;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user