diff --git a/src/bot.ts b/src/bot.ts index 83576493bf5692dc0f01b4f2d38e842dd3cc8881..48487fe31f0bdeba3948fefb37b297b782a6e0e3 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 6e28a0493c3f2a248c26b52fb200374b122790a5..d29ec7cb5215812b62f4b00652dadda0128537e5 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.