From 0bea51703010a4baf0e9e906c8b1f5def72c8359 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 17:13:37 -0600 Subject: [PATCH 01/10] executeWebhook returns a bare object, not a Message object. --- index.d.ts | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 489286a64..509df3c1b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -740,6 +740,32 @@ declare namespace Eris { (event: "resume", listener: () => void): T; } + interface WebhookResponse { + id: string; + type: number; + content: string; + channel_id: string; + author: { + bot?: true; + id: string; + username: string; + avatar?: string; + discriminator: string; + }; + attachments: Attachment[]; + embeds: EmbedOptions[]; + mentions: string[]; + mention_roles: string[]; + pinned: boolean; + mention_everyone: boolean; + tts: boolean; + timestamp: string; + edited_timestamp?: string; + flags: number; + nonce?: string; + webhook_id: string; + } + export class Client extends EventEmitter { token?: string; gatewayURL?: string; @@ -872,7 +898,7 @@ declare namespace Eris { token?: string, reason?: string ): Promise; - executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise; + executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise; executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise; executeSlackWebhook(webhookID: string, token: string, options?: { wait?: boolean }): Promise; deleteWebhook(webhookID: string, token?: string, reason?: string): Promise; From 00a06e1d5e32d4380de3cb14f17537ee19649138 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 17:32:10 -0600 Subject: [PATCH 02/10] revert typings --- index.d.ts | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/index.d.ts b/index.d.ts index 509df3c1b..489286a64 100644 --- a/index.d.ts +++ b/index.d.ts @@ -740,32 +740,6 @@ declare namespace Eris { (event: "resume", listener: () => void): T; } - interface WebhookResponse { - id: string; - type: number; - content: string; - channel_id: string; - author: { - bot?: true; - id: string; - username: string; - avatar?: string; - discriminator: string; - }; - attachments: Attachment[]; - embeds: EmbedOptions[]; - mentions: string[]; - mention_roles: string[]; - pinned: boolean; - mention_everyone: boolean; - tts: boolean; - timestamp: string; - edited_timestamp?: string; - flags: number; - nonce?: string; - webhook_id: string; - } - export class Client extends EventEmitter { token?: string; gatewayURL?: string; @@ -898,7 +872,7 @@ declare namespace Eris { token?: string, reason?: string ): Promise; - executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise; + executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise; executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise; executeSlackWebhook(webhookID: string, token: string, options?: { wait?: boolean }): Promise; deleteWebhook(webhookID: string, token?: string, reason?: string): Promise; From 580e3fc13db1dae4acc46fb8b14fea3fd3e49b03 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 17:44:48 -0600 Subject: [PATCH 03/10] return a Message object on executeWebhook --- lib/Client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index 0858f3c14..60b1dac08 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -643,7 +643,7 @@ class Client extends EventEmitter { username: options.username, avatar_url: options.avatarURL, tts: options.tts - }, options.file); + }, options.file).then(d => options.wait ? new Message(d, this) : d); } /** From bc96c8cd460994db24d19c1936e6722e2ee50801 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 17:49:46 -0600 Subject: [PATCH 04/10] jsdoc & variable name --- lib/Client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Client.js b/lib/Client.js index 60b1dac08..696b1bf9c 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -628,7 +628,7 @@ class Client extends EventEmitter { * @arg {Boolean} [options.tts=false] Whether the message should be a TTS message or not * @arg {Boolean} [options.wait=false] Whether to wait for the server to confirm the message create or not * @arg {Boolean} [options.disableEveryone] Whether to filter @everyone/@here or not (overrides default) - * @returns {Promise} + * @returns {Promise} */ executeWebhook(webhookID, token, options) { if(!options.content && !options.file && !options.embeds) { @@ -643,7 +643,7 @@ class Client extends EventEmitter { username: options.username, avatar_url: options.avatarURL, tts: options.tts - }, options.file).then(d => options.wait ? new Message(d, this) : d); + }, options.file).then((response) => options.wait ? new Message(response, this) : response); } /** From 3209fcaacb4f1d8697cdcbe5c7d7140f0e6d4f2a Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 17:50:15 -0600 Subject: [PATCH 05/10] executeWebhook does not return nothing. --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 489286a64..e5a56adca 100644 --- a/index.d.ts +++ b/index.d.ts @@ -873,7 +873,7 @@ declare namespace Eris { reason?: string ): Promise; executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise; - executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise; + executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise; executeSlackWebhook(webhookID: string, token: string, options?: { wait?: boolean }): Promise; deleteWebhook(webhookID: string, token?: string, reason?: string): Promise; getGuildWebhooks(guildID: string): Promise; From 8f6bdab1151827997b05f7ead36c8df6071fa62f Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 18:39:57 -0600 Subject: [PATCH 06/10] executeWebhook returns empty string when wait is false --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index e5a56adca..8fcefc575 100644 --- a/index.d.ts +++ b/index.d.ts @@ -873,7 +873,7 @@ declare namespace Eris { reason?: string ): Promise; executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise; - executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise; + executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise<"">; executeSlackWebhook(webhookID: string, token: string, options?: { wait?: boolean }): Promise; deleteWebhook(webhookID: string, token?: string, reason?: string): Promise; getGuildWebhooks(guildID: string): Promise; From 8d7cbf69ccc2011cb5c1254a93c72c0d68dd1bd8 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 18:40:35 -0600 Subject: [PATCH 07/10] typings (same as last) --- lib/Client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index 696b1bf9c..7b5d969ab 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -628,7 +628,7 @@ class Client extends EventEmitter { * @arg {Boolean} [options.tts=false] Whether the message should be a TTS message or not * @arg {Boolean} [options.wait=false] Whether to wait for the server to confirm the message create or not * @arg {Boolean} [options.disableEveryone] Whether to filter @everyone/@here or not (overrides default) - * @returns {Promise} + * @returns {Promise} */ executeWebhook(webhookID, token, options) { if(!options.content && !options.file && !options.embeds) { From 0ad6803002f5d02b3391d1d343eb741b326476b5 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 19:20:11 -0600 Subject: [PATCH 08/10] return changes --- lib/Client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Client.js b/lib/Client.js index 7b5d969ab..b718456d8 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -628,7 +628,7 @@ class Client extends EventEmitter { * @arg {Boolean} [options.tts=false] Whether the message should be a TTS message or not * @arg {Boolean} [options.wait=false] Whether to wait for the server to confirm the message create or not * @arg {Boolean} [options.disableEveryone] Whether to filter @everyone/@here or not (overrides default) - * @returns {Promise} + * @returns {Promise} */ executeWebhook(webhookID, token, options) { if(!options.content && !options.file && !options.embeds) { @@ -643,7 +643,7 @@ class Client extends EventEmitter { username: options.username, avatar_url: options.avatarURL, tts: options.tts - }, options.file).then((response) => options.wait ? new Message(response, this) : response); + }, options.file).then((response) => options.wait ? new Message(response, this) : undefined); } /** From 9024e8c81a8806a0f6239e4c75876c8598be73d1 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Thu, 28 Nov 2019 19:20:35 -0600 Subject: [PATCH 09/10] return changes --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 8fcefc575..489286a64 100644 --- a/index.d.ts +++ b/index.d.ts @@ -873,7 +873,7 @@ declare namespace Eris { reason?: string ): Promise; executeWebhook(webhookID: string, token: string, options: WebhookPayload & { wait: true }): Promise; - executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise<"">; + executeWebhook(webhookID: string, token: string, options: WebhookPayload): Promise; executeSlackWebhook(webhookID: string, token: string, options?: { wait?: boolean }): Promise; deleteWebhook(webhookID: string, token?: string, reason?: string): Promise; getGuildWebhooks(guildID: string): Promise; From 910b6489275045a93731c3ea3cb2cad00d2c01ed Mon Sep 17 00:00:00 2001 From: abal Date: Sat, 30 Nov 2019 17:23:14 -0800 Subject: [PATCH 10/10] Fix doc type --- lib/Client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index b718456d8..ad8eede20 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -628,7 +628,7 @@ class Client extends EventEmitter { * @arg {Boolean} [options.tts=false] Whether the message should be a TTS message or not * @arg {Boolean} [options.wait=false] Whether to wait for the server to confirm the message create or not * @arg {Boolean} [options.disableEveryone] Whether to filter @everyone/@here or not (overrides default) - * @returns {Promise} + * @returns {Promise} */ executeWebhook(webhookID, token, options) { if(!options.content && !options.file && !options.embeds) {