From dcd19f951def76c7ea3bb1bbd0e371695aedfb9e Mon Sep 17 00:00:00 2001 From: salixor <salixor@pm.me> Date: Thu, 26 Dec 2024 00:10:32 +0100 Subject: [PATCH] Fix some awaits (TODO: fix the external lib) --- src/matrixeventprocessor.ts | 4 ++-- src/matrixmessageprocessor.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/matrixeventprocessor.ts b/src/matrixeventprocessor.ts index cd994a4..cfc829a 100644 --- a/src/matrixeventprocessor.ts +++ b/src/matrixeventprocessor.ts @@ -352,7 +352,7 @@ export class MatrixEventProcessor { let size = event.content.info.size || 0; const name = this.GetFilenameForMediaEvent(event.content); - const url = this.bridge.botClient.mxcToHttp(event.content.url); + const url = await this.bridge.botClient.mxcToHttp(event.content.url); if (size < MaxFileSize) { const attachment = await this.bridge.botClient.downloadContent(event.content.url); size = attachment.data.byteLength; @@ -405,7 +405,7 @@ export class MatrixEventProcessor { replyEmbed.setTimestamp(new Date(sourceEvent.origin_server_ts!)); if (this.HasAttachment(sourceEvent)) { - const url = this.bridge.botClient.mxcToHttp(sourceEvent.content!.url!); + const url = await this.bridge.botClient.mxcToHttp(sourceEvent.content!.url!); if (["m.image", "m.sticker"].includes(sourceEvent.content!.msgtype as string) || sourceEvent.type === "m.sticker") { // we have an image reply diff --git a/src/matrixmessageprocessor.ts b/src/matrixmessageprocessor.ts index 20d0f42..6b46ecf 100644 --- a/src/matrixmessageprocessor.ts +++ b/src/matrixmessageprocessor.ts @@ -129,7 +129,8 @@ export class MatrixMessageProcessor { }, mxcUrlToHttp: (mxc: string) => { if (params && params.mxClient) { - return params.mxClient.mxcToHttp(mxc); + // TODO: Il faut aussi upgrade matrix-discord-parse qui a un souci de typage ! + return params.mxClient.mxcToHttp(mxc) as unknown as string; } return mxc; }, -- GitLab