koishi-plugin-nmc-radar 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +11 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -334,10 +334,19 @@ var Config = import_koishi.Schema.object({
334
334
  defaultResolver: import_koishi.Schema.union(Object.keys(resolvers)).default("img").description("默认输出类型。")
335
335
  });
336
336
  function apply(ctx, config) {
337
+ ctx.i18n.define("zh-CN", {
338
+ commands: {
339
+ radar: {
340
+ messages: {
341
+ unknown: "未知雷达站名称,可使用 radar.list 查看所有雷达站。"
342
+ }
343
+ }
344
+ }
345
+ });
337
346
  const command = ctx.command("radar <name:string>", "查看雷达图").alias("雷达").option("name", "--name <name:string> 雷达站名称").option("count", "-n <count:number> 最大输出数量").option("reverse", "-R 反转顺序").option("type", "--type <type:string> 输出类型", { type: Object.keys(resolvers) }).option("type", "--img 输出图片", { value: "img" }).option("type", "--url 输出 URL", { value: "url" }).action(async ({ session, options = {} }, name2) => {
338
347
  options.name ??= name2;
339
348
  if (!(name2 in radars_default))
340
- return void session?.send("雷达站不存在,可使用 radar.list 查看所有雷达站。");
349
+ return void session?.send(session.text(".messages.unknown"));
341
350
  const url = radars_default[options.name];
342
351
  const { window: { document } } = new import_jsdom.JSDOM(await ctx.http.get(url));
343
352
  const nodes = document.querySelectorAll("div[data-img]");
@@ -376,7 +385,7 @@ function apply(ctx, config) {
376
385
  }
377
386
  return filePath;
378
387
  }));
379
- const buffer = filePaths.filter(Boolean).flatMap((filePath) => `file '${filePath.replaceAll("\\", "/")}'`).join("\n");
388
+ const buffer = filePaths.filter(Boolean).flatMap((filePath) => `file 'file:${filePath.replaceAll("\\", "/")}'`).join("\n");
380
389
  await ctx2.ffmpeg.builder().input(import_node_buffer.Buffer.from(buffer)).inputOption("-f", "concat").inputOption("-safe", "0").inputOption("-protocol_whitelist", "file,fd").inputOption("-r", options.fps).outputOption("-loop", options.loop).outputOption("-filter_complex", [
381
390
  "[0:v]split[out1][out2]",
382
391
  "[out1]palettegen[p]",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-nmc-radar",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "气象台雷达图插件",
5
5
  "typings": "lib/index.d.ts",
6
6
  "license": "MIT",