@satorijs/adapter-kook
Advanced tools
Comparing version 4.5.0-alpha.1 to 4.5.0-alpha.2
@@ -660,3 +660,3 @@ var __defProp = Object.defineProperty; | ||
const payload = new FormData(); | ||
const result = await this.bot.ctx.http.file(src, attrs); | ||
const result = await this.bot.http.file(src, attrs); | ||
payload.append("file", new Blob([result.data], { type: result.mime }), attrs.file || result.filename); | ||
@@ -673,3 +673,3 @@ const { url } = await this.bot.request("POST", "/asset/create", payload); | ||
payload.append("file", new Blob([data], { type: headers.get("Content-Type") }), "file"); | ||
const { url } = await this.bot.request("POST", "/asset/create", payload); | ||
const { url } = await this.bot.http.post("/asset/create", payload); | ||
return url; | ||
@@ -925,4 +925,3 @@ } else { | ||
headers: { | ||
"Authorization": `Bot ${config.token}`, | ||
"Content-Type": "application/json" | ||
"Authorization": `Bot ${config.token}` | ||
} | ||
@@ -941,3 +940,2 @@ }).extend(config); | ||
} else { | ||
data = data instanceof FormData ? data : JSON.stringify(data); | ||
return (await this.http(method, path, { data, headers })).data; | ||
@@ -944,0 +942,0 @@ } |
{ | ||
"name": "@satorijs/adapter-kook", | ||
"description": "KOOK (开黑啦) Adapter for Satorijs", | ||
"version": "4.5.0-alpha.1", | ||
"version": "4.5.0-alpha.2", | ||
"main": "lib/index.js", | ||
@@ -35,4 +35,4 @@ "typings": "lib/index.d.ts", | ||
"peerDependencies": { | ||
"@satorijs/satori": "^3.6.0-alpha.2" | ||
"@satorijs/satori": "^3.6.0-alpha.3" | ||
} | ||
} |
@@ -20,3 +20,2 @@ import { Bot, Context, Fragment, h, Quester, Schema, Universal } from '@satorijs/satori' | ||
'Authorization': `Bot ${config.token}`, | ||
'Content-Type': 'application/json', | ||
}, | ||
@@ -37,3 +36,2 @@ }).extend(config) | ||
} else { | ||
data = data instanceof FormData ? data : JSON.stringify(data) | ||
return (await this.http(method, path, { data, headers })).data | ||
@@ -40,0 +38,0 @@ } |
@@ -54,3 +54,3 @@ import { Context, h, MessageEncoder, Schema } from '@satorijs/satori' | ||
const payload = new FormData() | ||
const result = await this.bot.ctx.http.file(src, attrs) | ||
const result = await this.bot.http.file(src, attrs) | ||
payload.append('file', new Blob([result.data], { type: result.mime }), attrs.file || result.filename) | ||
@@ -67,3 +67,3 @@ const { url } = await this.bot.request('POST', '/asset/create', payload) | ||
payload.append('file', new Blob([data], { type: headers.get('Content-Type') }), 'file') | ||
const { url } = await this.bot.request('POST', '/asset/create', payload) | ||
const { url } = await this.bot.http.post('/asset/create', payload) | ||
return url | ||
@@ -70,0 +70,0 @@ } else { |
Sorry, the diff of this file is not supported yet
152547
3547