koishi-plugin-ciyi 1.3.0 → 1.4.0

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.
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Context, Schema, Session } from "koishi";
2
2
  import { History } from "./view";
3
3
  export declare const name = "ciyi";
4
- export declare const usage = "## \u4F7F\u7528\n\n\u8BBE\u7F6E\u6307\u4EE4\u522B\u540D\u540E\uFF0C\u53D1\u9001 `ciyi` \u67E5\u770B\u73A9\u6CD5\u3002\u6BCF\u65E5\u85CF\u4E00\u4E2A\u4E24\u5B57\u8BCD\uFF0C\u9996\u6B21\u7528 `ciyi.\u731C <\u8BCD>` \u5F00\u9898\uFF0C\u4E4B\u540E\u53EF\u4EE5\u76F4\u63A5\u53D1\u9001\u4E24\u5B57\u8BCD\u7EE7\u7EED\u731C\u3002\u88F8\u8BCD\u8BBE\u7F6E\u53EA\u5BF9\u5F53\u524D\u7FA4\u751F\u6548\uFF0C\u91CD\u542F\u540E\u6062\u590D\u9ED8\u8BA4\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `ciyi` | \u73A9\u6CD5 |\n| `ciyi.\u731C <\u8BCD>` | \u5F00\u59CB\u4ECA\u65E5\u6E38\u620F\u5E76\u63D0\u4EA4\u731C\u6D4B |\n| `ciyi.\u88F8\u8BCD [\u5F00/\u5173]` | \u5207\u6362\u672C\u7FA4\u65E0\u524D\u7F00\u7EED\u731C |\n| `ciyi.\u6392\u884C\u699C` | \u731C\u4E2D\u6B21\u6570\u6392\u884C |";
4
+ export declare const usage = "## \u4F7F\u7528\n\n\u53D1\u9001 `ciyi` \u67E5\u770B\u73A9\u6CD5\u3002\u6BCF\u65E5\u85CF\u4E00\u4E2A\u4E24\u5B57\u8BCD\uFF0C\u7528 `ciyi.\u731C <\u8BCD>` \u5F00\u9898\uFF0C\u4E4B\u540E\u53EF\u4EE5\u76F4\u63A5\u53D1\u9001\u4E24\u5B57\u8BCD\u7EE7\u7EED\u731C\u3002\u88F8\u8BCD\u8BBE\u7F6E\u53EA\u5BF9\u5F53\u524D\u9891\u9053\u751F\u6548\uFF0C\u91CD\u542F\u540E\u6062\u590D\u9ED8\u8BA4\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `ciyi` | \u73A9\u6CD5 |\n| `ciyi.\u731C <\u8BCD>` | \u5F00\u59CB\u4ECA\u65E5\u6E38\u620F\u5E76\u63D0\u4EA4\u731C\u6D4B |\n| `ciyi.\u88F8\u8BCD [\u5F00/\u5173]` | \u5F00\u5173\u672C\u9891\u9053\u7684\u65E0\u524D\u7F00\u7EED\u731C |\n| `ciyi.\u6392\u884C\u699C` | \u7D2F\u8BA1\u731C\u4E2D\u6392\u884C\u699C |";
5
5
  export declare const inject: {
6
6
  required: string[];
7
7
  optional: string[];
package/lib/index.js CHANGED
@@ -1043,7 +1043,7 @@ __name(renderRankCard, "renderRankCard");
1043
1043
  var name = "ciyi";
1044
1044
  var usage = `## 使用
1045
1045
 
1046
- 设置指令别名后,发送 \`ciyi\` 查看玩法。每日藏一个两字词,首次用 \`ciyi.猜 <词>\` 开题,之后可以直接发送两字词继续猜。裸词设置只对当前群生效,重启后恢复默认。
1046
+ 发送 \`ciyi\` 查看玩法。每日藏一个两字词,用 \`ciyi.猜 <词>\` 开题,之后可以直接发送两字词继续猜。裸词设置只对当前频道生效,重启后恢复默认。
1047
1047
 
1048
1048
  ## 指令
1049
1049
 
@@ -1051,18 +1051,18 @@ var usage = `## 使用
1051
1051
  | --- | --- |
1052
1052
  | \`ciyi\` | 玩法 |
1053
1053
  | \`ciyi.猜 <词>\` | 开始今日游戏并提交猜测 |
1054
- | \`ciyi.裸词 [开/关]\` | 切换本群无前缀续猜 |
1055
- | \`ciyi.排行榜\` | 猜中次数排行 |`;
1054
+ | \`ciyi.裸词 [开/关]\` | 开关本频道的无前缀续猜 |
1055
+ | \`ciyi.排行榜\` | 累计猜中排行榜 |`;
1056
1056
  var inject = { required: ["database"], optional: ["canvas"] };
1057
1057
  var Config = import_koishi.Schema.object({
1058
- atReply: import_koishi.Schema.boolean().default(false).description("响应时 @"),
1059
- quoteReply: import_koishi.Schema.boolean().default(false).description("响应时引用"),
1058
+ atReply: import_koishi.Schema.boolean().default(false).description("回复时 @ 用户。"),
1059
+ quoteReply: import_koishi.Schema.boolean().default(false).description("回复时引用消息。"),
1060
1060
  isEnableMiddleware: import_koishi.Schema.boolean().default(true).description(
1061
- "是否启用中间件(若启用,已开题时可以不使用指令直接猜测;ciyi.裸词 指令可在单个群内临时切换)"
1061
+ "已开题时,直接发送两字词即可续猜,无需指令前缀。各频道可用「ciyi.裸词」临时切换。"
1062
1062
  ),
1063
- renderImage: import_koishi.Schema.boolean().default(true).description("渲染图片(复用 Koishi Canvas 服务;不可用时使用等价文本)"),
1064
- maxHistory: import_koishi.Schema.number().default(10).min(0).description("猜测板最多列出的历史条数(最新一次猜测始终会列出)"),
1065
- maxRank: import_koishi.Schema.number().default(10).min(0).description("最大排行榜人数")
1063
+ renderImage: import_koishi.Schema.boolean().default(true).description("把猜测板渲染成图片,复用 Koishi Canvas 服务。服务不可用时自动回退为等价文本。"),
1064
+ maxHistory: import_koishi.Schema.number().default(10).min(0).description("猜测板最多列出的历史条数。最新一次猜测始终会列出。"),
1065
+ maxRank: import_koishi.Schema.number().default(10).min(0).description("排行榜最多显示的人数。")
1066
1066
  });
1067
1067
  function getMiddlewareGuess(session) {
1068
1068
  const message = session.event.message;
@@ -1092,7 +1092,7 @@ function resolveMiddlewareSwitch(config, override, action) {
1092
1092
  }
1093
1093
  const on = arg === "开" || arg === "开启";
1094
1094
  if (!on && arg !== "关" && arg !== "关闭") {
1095
- return { error: "裸词开关只认 开 / 关 / 状态" };
1095
+ return { error: "裸词开关只认「开」「关」「状态」" };
1096
1096
  }
1097
1097
  if (on === config) {
1098
1098
  return { override: void 0, on: config, reverted: override !== void 0 };
@@ -1149,23 +1149,24 @@ function apply(ctx, cfg) {
1149
1149
  }
1150
1150
  return await session.execute(`ciyi.猜 ${guess}`);
1151
1151
  });
1152
- ctx.command("ciyi", "词意(猜词游戏)").action(async ({ session }) => {
1152
+ ctx.command("ciyi", "词意 · 按意思远近找词").action(async ({ session }) => {
1153
1153
  return await wf(session);
1154
1154
  });
1155
1155
  ctx.command("ciyi.猜 <guess:string>", "报一个两字词").usage("例:ciyi.猜 山水").action(async ({ session }, guess) => {
1156
1156
  return await c(session, guess?.trim());
1157
1157
  });
1158
- ctx.command("ciyi.排行榜", "累计猜中次数榜").action(async ({ session }) => {
1158
+ ctx.command("ciyi.排行榜", "查看累计猜中排行榜").action(async ({ session }) => {
1159
1159
  return await phb(session);
1160
1160
  });
1161
- ctx.command("ciyi.裸词 [state:string]", "临时开关本群的裸词续猜").usage("例:ciyi.裸词(切换)· ciyi.裸词 开 · ciyi.裸词 关 · ciyi.裸词 状态").action(async ({ session }, state) => {
1161
+ ctx.command("ciyi.裸词 [state:string]", "开关本频道的无前缀续猜").usage("例:ciyi.裸词(切换)· ciyi.裸词 开 · ciyi.裸词 关 · ciyi.裸词 状态").action(async ({ session }, state) => {
1162
1162
  const result = resolveMiddlewareSwitch(
1163
1163
  cfg.isEnableMiddleware,
1164
1164
  session.channelId === void 0 ? void 0 : middlewareOverrides.get(session.channelId),
1165
1165
  state
1166
1166
  );
1167
1167
  if ("error" in result) {
1168
- return await sendMsg(session, `⚠️ ${result.error}。例:ciyi.裸词 开`);
1168
+ return await sendMsg(session, `⚠️ ${result.error}
1169
+ 例:「ciyi.裸词 开」,不带参数则来回切换。`);
1169
1170
  }
1170
1171
  if (result.override === void 0) middlewareOverrides.delete(session.channelId);
1171
1172
  else middlewareOverrides.set(session.channelId, result.override);
@@ -1288,16 +1289,16 @@ function apply(ctx, cfg) {
1288
1289
  }
1289
1290
  __name(introText, "introText");
1290
1291
  function middlewareSwitchText(o) {
1291
- const mark = o.on ? "✅" : "⛔";
1292
+ const mark = "✅";
1292
1293
  const state = o.on ? "开启" : "停用";
1293
1294
  const config = cfg.isEnableMiddleware ? "开启" : "停用";
1294
1295
  if (!o.temporary) {
1295
1296
  return `${mark} 裸词续猜 · ${o.reverted ? "已复原," : ""}跟随插件配置(${state})`;
1296
1297
  }
1297
- const hint = o.on ? "开题后直接发送两字词即可续猜" : "续猜请用 ciyi.猜 山水";
1298
+ const hint = o.on ? "开题后直接发送两字词即可续猜" : "续猜改用「ciyi.猜 山水」";
1298
1299
  return [
1299
- `${mark} 裸词续猜 · 本群临时${state}(插件配置:${config})`,
1300
- `${hint};再次发送 ciyi.裸词 复原`
1300
+ `${mark} 裸词续猜 · 本频道临时${state}(插件配置:${config})`,
1301
+ `${hint};再次发送「ciyi.裸词」复原`
1301
1302
  ].join("\n");
1302
1303
  }
1303
1304
  __name(middlewareSwitchText, "middlewareSwitchText");
@@ -1319,7 +1320,7 @@ function apply(ctx, cfg) {
1319
1320
  if (!entries.length) {
1320
1321
  return textCard(
1321
1322
  "词意每日挑战排行榜",
1322
- "榜上无名。今日第一个猜中的人,会写在这里。"
1323
+ "榜上无名。今日第一个猜中的人,名字会写在这里。"
1323
1324
  );
1324
1325
  }
1325
1326
  return textCard(
@@ -1422,30 +1423,31 @@ function apply(ctx, cfg) {
1422
1423
  __name(getTodayGame, "getTodayGame");
1423
1424
  async function c(session, guess) {
1424
1425
  if (!guess || Array.from(guess).length !== 2) {
1425
- return await sendMsg(session, "⚠️ 词意只收两字词。例:ciyi.猜 山水");
1426
+ return await sendMsg(session, "⚠️ 词意只收两字词\n例:「ciyi.猜 山水」。");
1426
1427
  }
1427
1428
  if (!allWords_default.includes(guess)) {
1428
- return await sendMsg(session, `⚠️ 「${guess}」不在词库中,换个常见些的词试试。`);
1429
+ return await sendMsg(session, `⚠️ 「${guess}」不在词库里
1430
+ 换个常见些的词试试。`);
1429
1431
  }
1430
1432
  const gameInfo = await getTodayGame(session);
1431
1433
  if (!gameInfo) {
1432
1434
  return await sendMsg(
1433
1435
  session,
1434
- "❌ 今日题目暂时无法载入,请稍后再试。"
1436
+ "❌ 今日的题目没能载入\n词库文件暂时读不到,稍后再试一次。"
1435
1437
  );
1436
1438
  }
1437
1439
  if (gameInfo.isOver) {
1438
1440
  return await sendMsg(
1439
1441
  session,
1440
- `今日挑战已结束。答案是「${gameInfo.answer}
1441
- 明日零点换新题。发送 ciyi.排行榜 查看战绩。`
1442
+ `💡 今日挑战已结束,答案是「${gameInfo.answer}」。
1443
+ 明日零点换新题,发送「ciyi.排行榜」看战绩。`
1442
1444
  );
1443
1445
  }
1444
1446
  if (gameInfo.guessedHistoryInOneGame.includes(guess)) {
1445
1447
  const old = gameInfo.history.find((it) => it.guess === guess);
1446
1448
  return await sendMsg(
1447
1449
  session,
1448
- old ? `⚠️ 「${guess}」已猜过 · #${old.rank} · ${tierOf(old.rank).name}` : `⚠️ 「${guess}」已猜过`
1450
+ old ? `💡 「${guess}」已经猜过 · #${old.rank} · ${tierOf(old.rank).name}` : `💡 「${guess}」已经猜过`
1449
1451
  );
1450
1452
  }
1451
1453
  if (guess === gameInfo.answer) {
@@ -1497,7 +1499,8 @@ function apply(ctx, cfg) {
1497
1499
  const entry = getHistory(guess, rankList);
1498
1500
  if (!entry) {
1499
1501
  logger.warn(`「${guess}」不在 ${gameInfo.answer} 的榜单中`);
1500
- return await sendMsg(session, `⚠️ 「${guess}」不在今日榜单中,换个词试试。`);
1502
+ return await sendMsg(session, `⚠️ 「${guess}」不在今日的榜单里
1503
+ 换个词试试。`);
1501
1504
  }
1502
1505
  const history = [...gameInfo.history, entry];
1503
1506
  await ctx.database.set(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ciyi",
3
3
  "description": "Koishi 的词意猜词插件。",
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [