diff --git a/src/matrixeventprocessor.ts b/src/matrixeventprocessor.ts index d518826becf366b45b1d60f4f1274a35944cb139..cd994a454515eaa826d477cac3eb0f4dd753498c 100644 --- a/src/matrixeventprocessor.ts +++ b/src/matrixeventprocessor.ts @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +/* eslint max-classes-per-file: 0 */ +/* eslint max-lines: 0 */ import * as Discord from "@mx-puppet/better-discord.js"; import { DiscordBot } from "./bot"; import { DiscordBridgeConfig } from "./config"; @@ -352,11 +354,11 @@ export class MatrixEventProcessor { const name = this.GetFilenameForMediaEvent(event.content); const url = this.bridge.botClient.mxcToHttp(event.content.url); if (size < MaxFileSize) { - const attachment = (await Util.DownloadFile(url)).buffer; - size = attachment.byteLength; + const attachment = await this.bridge.botClient.downloadContent(event.content.url); + size = attachment.data.byteLength; if (size < MaxFileSize) { return { - attachment, + attachment: attachment.data, name, } as Discord.FileOptions; }