refactor: new node features (#5132)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
Sugden
2021-06-30 21:40:33 +01:00
committed by GitHub
parent f108746c15
commit 1e8f01253e
68 changed files with 305 additions and 360 deletions

View File

@@ -34,7 +34,7 @@ class Webhook {
* @name Webhook#token
* @type {?string}
*/
Object.defineProperty(this, 'token', { value: data.token || null, writable: true, configurable: true });
Object.defineProperty(this, 'token', { value: data.token ?? null, writable: true, configurable: true });
/**
* The avatar for the webhook
@@ -175,11 +175,7 @@ class Webhook {
query: { thread_id: messagePayload.options.threadID, wait: true },
auth: false,
})
.then(d => {
const channel = this.client.channels ? this.client.channels.cache.get(d.channel_id) : undefined;
if (!channel) return d;
return channel.messages.add(d, false);
});
.then(d => this.client.channels?.cache.get(d.channel_id)?.messages.add(d, false) ?? d);
}
/**