mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
clean up webhooks and fix sending messages with webhooks (#1078)
* clean up webhooks and fix sending messages with webhooks * whoops * fix up options * Update Webhook.js * Update Webhook.js * Update Webhook.js
This commit is contained in:
committed by
Schuyler Cebulskie
parent
47707d245d
commit
c37cd3fd91
@@ -562,7 +562,8 @@ class RESTMethods {
|
||||
return this.rest.makeRequest('delete', Constants.Endpoints.webhook(webhook.id, webhook.token), false);
|
||||
}
|
||||
|
||||
sendWebhookMessage(webhook, content, { avatarURL, tts, disableEveryone, embeds } = {}, file = null) {
|
||||
sendWebhookMessage(webhook, content, { avatarURL, tts, disableEveryone, embeds, username } = {}, file = null) {
|
||||
username = username || webhook.name;
|
||||
if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);
|
||||
if (content) {
|
||||
if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) {
|
||||
@@ -570,13 +571,12 @@ class RESTMethods {
|
||||
}
|
||||
}
|
||||
return this.rest.makeRequest('post', `${Constants.Endpoints.webhook(webhook.id, webhook.token)}?wait=true`, false, {
|
||||
username: webhook.name,
|
||||
username,
|
||||
avatar_url: avatarURL,
|
||||
content,
|
||||
tts,
|
||||
file,
|
||||
embeds,
|
||||
});
|
||||
}, file);
|
||||
}
|
||||
|
||||
sendSlackWebhookMessage(webhook, body) {
|
||||
|
||||
Reference in New Issue
Block a user