在沙盒是能正常运行的
错误
session Error: Bad Request
at [cordis.invoke] (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@cordisjs\plugin-http\lib\index.cjs:334:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async [as sendPrivateMessage] (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@satorijs\adapter-qq\lib\index.cjs:587:32)
at async send (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@satorijs\adapter-qq\lib\index.cjs:991:46)
at async QQMessageEncoder.flush (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@satorijs\adapter-qq\lib\index.cjs:1019:5)
at async QQMessageEncoder.send (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@satorijs\core\lib\index.cjs:625:5)
at async Proxy.sendMessage (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@satorijs\core\lib\index.cjs:355:22)
at async _Command.eval (eval at (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules\koishi-plugin-blockly-null\lib\index.js:197:32), :9:7)
at async Array. (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@koishijs\core\lib\index.cjs:1078:14)
at async _Command.execute (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@koishijs\core\lib\index.cjs:1092:22)
at async C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@koishijs\core\lib\index.cjs:2059:22
at async Proxy.withScope (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@koishijs\core\lib\index.cjs:1968:22)
at async next (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@koishijs\core\lib\index.cjs:824:16)
at async next (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@koishijs\core\lib\index.cjs:824:16)
at async next (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@koishijs\core\lib\index.cjs:824:16)
at async Processor._handleMessage (C:\Users\zhang\AppData\Roaming\Koishi\Desktop\data\instances\default\node_modules@koishijs\core\lib\index.cjs:835:22)
代码
import { JSONPath as parseJson } from “jsonpath-plus”
export const name = “api”
export async function apply(ctx){
ctx.command(‘111 <域名:string>’).action(async ({session},…args)=>{
{
let msg = await ctx.http.get((‘https://who.cx/api/price?domain=域名’ + String(args[0])),{responseType:“json”});
await session.send(([‘域名价格(仅供参考)
‘,await parseJson({path: “$.domain”, json: msg}),’
价格’,await parseJson({path: “$.new”, json: msg}),’
续费’,await parseJson({path: “$.renew”, json: msg})].join(‘’)));
}
});
}