Skip to content

Commit

Permalink
feat(axios): isPrivate should be async
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 8, 2023
1 parent d83c00e commit 6846849
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion adapters/discord/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class DiscordMessageEncoder extends MessageEncoder<DiscordBot> {
return this.post({ ...addition, content: attrs.url })
}

if (this.bot.http.isPrivate(attrs.url)) {
if (await this.bot.http.isPrivate(attrs.url)) {
return await this.sendEmbed(attrs, addition)
}

Expand Down
2 changes: 1 addition & 1 deletion adapters/kook/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class KookMessageEncoder extends MessageEncoder<KookBot> {
}

private async transformUrl({ type, attrs }: h) {
if (this.bot.http.isPrivate(attrs.url)) {
if (await this.bot.http.isPrivate(attrs.url)) {
const payload = new FormData()
const result = await this.bot.ctx.http.file(attrs.url, attrs)
payload.append('file', Buffer.from(result.data), {
Expand Down
2 changes: 1 addition & 1 deletion packages/axios/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class Quester {
}

async toPublic(url: string) {
if (!this.isPrivate(url)) return url
if (!await this.isPrivate(url)) return url
const { headers, data } = await this.axios(url, {
method: 'GET',
responseType: 'arraybuffer',
Expand Down

0 comments on commit 6846849

Please sign in to comment.