mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +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.
|
* Sends a raw slack message with this webhook.
|
||||||
* @param {Object} body The raw body to send
|
* @param {Object} body The raw body to send
|
||||||
* @returns {Promise<Message|Object>}
|
* @returns {Promise<boolean>}
|
||||||
* @example
|
* @example
|
||||||
* // Send a slack message
|
* // Send a slack message
|
||||||
* webhook.sendSlackMessage({
|
* webhook.sendSlackMessage({
|
||||||
@@ -174,11 +174,7 @@ class Webhook {
|
|||||||
query: { wait: true },
|
query: { wait: true },
|
||||||
auth: false,
|
auth: false,
|
||||||
data: body,
|
data: body,
|
||||||
}).then(d => {
|
}).then(data => data.toString() === 'ok');
|
||||||
const channel = this.client.channels ? this.client.channels.get(d.channel_id) : undefined;
|
|
||||||
if (!channel) return d;
|
|
||||||
return channel.messages.add(d, false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
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(content?: StringResolvable, options?: WebhookMessageOptions & { split: true | SplitOptions } | MessageAdditions): Promise<Message[]>;
|
||||||
send(options?: WebhookMessageOptions & { split?: false } | MessageAdditions | APIMessage): Promise<Message>;
|
send(options?: WebhookMessageOptions & { split?: false } | MessageAdditions | APIMessage): Promise<Message>;
|
||||||
send(options?: WebhookMessageOptions & { split: true | SplitOptions } | 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
|
//#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user