From ad3eaa52b833f04f2b9d32d735c14cf5b7a9936f Mon Sep 17 00:00:00 2001 From: LittleC Date: Tue, 8 Aug 2023 23:43:47 +0800 Subject: [PATCH] fix(discord): send direct --- adapters/discord/src/message.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/adapters/discord/src/message.ts b/adapters/discord/src/message.ts index 487f1da1..923780fb 100644 --- a/adapters/discord/src/message.ts +++ b/adapters/discord/src/message.ts @@ -113,10 +113,7 @@ export class DiscordMessageEncoder extends MessageEncoder { } const sendDirect = async () => { - if (this.buffer.trim().length) { - await this.post({ ...addition, content: this.buffer.trim() }) - this.buffer = '' - } + await this.flush() return this.post({ ...addition, content: encodeURI(attrs.url) }) } @@ -151,13 +148,7 @@ export class DiscordMessageEncoder extends MessageEncoder { } async flushAssets(content: string) { - const { handleExternalAsset } = this.bot.config as DiscordMessageEncoder.Config - const mode = handleExternalAsset - if (mode === 'download') { - return this.sendEmbed(this.resourceBuffer, { ...this.addition, content }) - } else if (mode === 'direct') { - return this.post({ ...this.addition, content }) - } + return this.sendEmbed(this.resourceBuffer, { ...this.addition, content }) } async ensureWebhook() {