Skip to content

Commit

Permalink
fix(discord): send direct
Browse files Browse the repository at this point in the history
  • Loading branch information
XxLittleCxX committed Aug 8, 2023
1 parent 0bd21a3 commit ad3eaa5
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions adapters/discord/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,7 @@ export class DiscordMessageEncoder extends MessageEncoder<DiscordBot> {
}

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) })
}

Expand Down Expand Up @@ -151,13 +148,7 @@ export class DiscordMessageEncoder extends MessageEncoder<DiscordBot> {
}

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() {
Expand Down

0 comments on commit ad3eaa5

Please sign in to comment.