Skip to content

Commit

Permalink
fix(adapter): fix local image sending (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-fish authored May 9, 2021
1 parent 46be100 commit 409dcbc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/adapter-discord/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class DiscordBot extends Bot<'discord'> {
}
if (type === 'image' || type === 'video' && data.url) {
if (data.url.startsWith('file://')) {
const r = await this.sendEmbedMessage(requestUrl, readFileSync(data.url.slice(7)), {
const r = await this.sendEmbedMessage(requestUrl, readFileSync(data.url.slice(8)), {
...addition,
})
sentMessageId = r.id
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-kaiheila/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class KaiheilaBot extends Bot {
if (data.url.startsWith('file://') || data.url.startsWith('base64://')) {
const payload = new FormData()
payload.append('file', data.url.startsWith('file://')
? createReadStream(data.url.slice(7))
? createReadStream(data.url.slice(8))
: Buffer.from(data.url.slice(9), 'base64'))
const { url } = await this.request('POST', '/asset/create', payload, payload.getHeaders())
data.url = url
Expand Down

0 comments on commit 409dcbc

Please sign in to comment.