From f94290817e6fc3f646158be81b36247a734b2867 Mon Sep 17 00:00:00 2001 From: Will Hunt <will@half-shot.uk> Date: Wed, 1 May 2019 16:39:09 +0100 Subject: [PATCH] Fix explanations --- src/bot.ts | 2 +- src/discordas.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index 8357649..48487fe 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -185,7 +185,7 @@ export class DiscordBot { }); // Due to messages often arriving before we get a response from the send call, - // messages get delayed from discord. We use Util.Delay to handle this. + // messages get delayed from discord. We use Util.DelayedPromise to handle this. client.on("messageDelete", async (msg: Discord.Message) => { try { diff --git a/src/discordas.ts b/src/discordas.ts index 6e28a04..d29ec7c 100644 --- a/src/discordas.ts +++ b/src/discordas.ts @@ -95,11 +95,13 @@ async function run(port: number, fileConfig: DiscordBridgeConfig) { }, onEvent: async (request) => { // tslint:disable-next-line no-any + // This function emulates the Bluebird.done function so the underlying bridge library doesn't + // break. const done = function(resolve: (res: any) => void, reject: (err: Error) => void) { // tslint:disable-next-line no-invalid-this no-floating-promises (this as Promise<{}>).then(resolve); // tslint:disable-next-line no-invalid-this no-floating-promises - (this as Promise<{}>).then(reject); + (this as Promise<{}>).catch(reject); }; try { // Build our own context. -- GitLab