@sjtdev/koishi-plugin-dota2tracker 1.3.0-pre.3 → 1.3.0-pre.5

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.js CHANGED
@@ -564,7 +564,7 @@ var require_zh_CN_constants = __commonJS({
564
564
  // src/locales/en-US.command.yml
565
565
  var require_en_US_command = __commonJS({
566
566
  "src/locales/en-US.command.yml"(exports2, module2) {
567
- module2.exports = { commands: { subscribe: { description: "After subscribing, players need to bind their Steam ID to this group.", usage: "After subscribing, players need to bind their Steam ID to this group. BOT will subscribe to the new game data of bound players in this group. After the STRATZ game analysis is completed, the game data will be generated into a picture battle report and published to this group.", messages: { subscribe_success: "Subscription successful.", subscribed: "This Channel has been subscribed, no need to subscribe again." } }, unsubscribe: { description: "Unsubscribe from this group.", messages: { unsubscribe_success: "Unsubscription successful.", not_subscribed: "This Channel has not been subscribed yet, so there is no need to unsubscribe." } } } };
567
+ module2.exports = { commands: { dota2tracker: { subscribe: { description: "After subscribing, players need to bind their Steam ID to this group.", usage: "After subscribing, players need to bind their Steam ID to this group. BOT will subscribe to the new game data of bound players in this group. After the STRATZ game analysis is completed, the game data will be generated into a picture battle report and published to this group.", messages: { subscribe_success: "Subscription successful.", subscribed: "This Channel has been subscribed, no need to subscribe again." } }, unsubscribe: { description: "Unsubscribe from this group.", messages: { unsubscribe_success: "Unsubscription successful.", not_subscribed: "This Channel has not been subscribed yet, so there is no need to unsubscribe." } }, bind: { description: "Bind your SteamID and optionally set a nickname.", usage: "Bind your SteamID to your account. If the group is subscribed, your new match data will be posted in the group in real-time.", examples: 'bind 123456789\nbind 123456789 John\nbind 123456789 "John Doe"', messages: { steam_id_invalid: "Invalid SteamID.", bind_success: "Binding successful,\nID: {userId}\nNickname: {nickName}\nSteamID: {steamId}", bind_failed: "Binding failed, {0}", reason_without_match: "Invalid SteamID or no matches found.", reason_fetch_failed: "Poor network conditions or other reasons prevented the verification of the SteamID. Please try again later.", already_binded: "You are already bound, no need to bind again.\nHere is your personal information:\nID: {userId}\nNickname: {nickName}\nSteamID: {steamId}", nick_name_too_long: "Nickname is too long, please limit it to 20 characters or less. (It can also be left blank)" } }, unbind: { description: "Unbind your personal information.", messages: { unbind_success: "Unbinding successful.", not_binded: "Not bound, no need to unbind." } }, rename: { description: "Change the nickname set during binding.", examples: 'rename John\nrename "John Doe"', messages: { rename_success: "Rename successful, now you are called {nick_name}.", empty_input: "Please enter your nickname.", not_binded: "Please bind first, you can set a nickname during binding.", nick_name_too_long: "Nickname is too long, please limit it to 20 characters." } }, "query-members": { description: "Query the players bound in this group.", messages: { no_members: "No players bound in this group.", query_failed: "Failed to query group members." } }, "query-match": { description: "Query the match data of the specified match ID and generate a picture.", examples: "query-match 1234567890", messages: { empty_input: "Please enter the match ID.", match_id_invalid: "Invalid match ID.", querying_match: "Searching for match details, please wait...", query_failed: "Failed to get match data." } }, "query-recent-match": { description: "Query the most recent match data and generate a picture.", usage: "Query the most recent match data of the specified player and generate a picture.\nThe parameter can be the player's SteamID or the nickname of a player bound in this group. If no parameter is provided, it will try to query the SteamID of the command caller.", examples: "query-recent-match\nquery-recent-match 123456789\nquery-recent-match John", messages: { not_binded: "By default, it tries to find your information from the bound SteamID players, but it seems you are not bound.\nPlease bind your SteamID in this group. (You can enter [-bind -h] for help)\nOr follow the command with the SteamID or nickname of the player you want to query.", steam_id_invalid: "Invalid SteamID and the player was not found in this group.", querying_match: "Searching for match details, please wait...", query_failed: "Failed to get the player's recent match.", not_in_group: "Command failed.\nCurrently not in a group chat, you must provide the specified player's SteamID." } }, "query-player": { description: "Query the player's personal information, optionally specify a hero.", options: { hero: "Query the player's usage of the specified hero (same as querying a hero, can use nickname or ID)" }, usage: "Query the personal information of the specified player and generate a picture, optionally specify a hero.\nThe parameter can be the player's SteamID or the nickname of a player bound in this group. If no parameter is provided, it will try to query the SteamID of the command caller.", examples: "query-player 123456789\nquery-player John\nquery-player John --hero Anti-Mage\nquery-player John -o Anti-Mage", messages: { not_binded: "By default, it tries to find your information from the bound SteamID players, but it seems you are not bound.\nPlease bind your SteamID in this group. (You can enter [-bind -h] for help)\nOr follow the command with the SteamID or nickname of the player you want to query.", steam_id_invalid: "Invalid SteamID and the player was not found in this group.", querying_player: "Retrieving player data, please wait...", query_failed: "Failed to get player information.", not_in_group: "Command failed.\nCurrently not in a group chat, you must provide the specified player's SteamID." } }, "query-hero": { description: "Query hero skills/stats information.", options: { random: "Randomly select a hero." }, usage: "Query the hero's skill descriptions and various stats, generate a picture.\nThe parameter can be the hero's ID, name, or common nickname.", examples: "query-hero 15\nquery-hero Razor\nquery-hero -r", messages: { not_found: "Hero not found, please confirm and re-enter.", querying_hero: "Retrieving hero data, please wait...", query_failed: "Failed to get hero data.", empty_input: "Please enter a parameter." } } } } };
568
568
  }
569
569
  });
570
570
 
@@ -585,7 +585,7 @@ var require_en_US = __commonJS({
585
585
  // src/locales/zh-CN.command.yml
586
586
  var require_zh_CN_command = __commonJS({
587
587
  "src/locales/zh-CN.command.yml"(exports2, module2) {
588
- module2.exports = { commands: { subscribe: { description: "订阅后还需玩家在本群绑定SteamID", usage: "订阅后还需玩家在本群绑定SteamID,BOT将订阅本群中已绑定玩家的新比赛数据,在STRATZ比赛解析完成后将比赛数据生成为图片战报发布至本群中。", messages: { subscribed: "本群已订阅,无需重复订阅。", subscribe_success: "订阅成功。" } }, unsubscribe: { description: "取消订阅本群。", messages: { unsubscribe_success: "取消订阅成功。", not_subscribed: "本群尚未订阅,无需取消订阅。" } }, bind: { description: "绑定SteamID,并起一个别名(也可以不起)", usage: "将你的SteamID与你的账号绑定,若本群已订阅将会实时获取你的新比赛数据发布至群中。", examples: "绑定 123456789\n绑定 123456789 张三", messages: { steam_id_invalid: "SteamID无效。", bind_success: "绑定成功,\nID:{userId}\n别名:{nickName}\nSteamID:{steamId}", bind_failed: "绑定失败,{reason}", already_binded: "你已绑定,无需重复绑定。\n以下是你的个人信息:\nID:{userId}\n别名:{nickName}\nSteamID:{steamId}", nick_name_too_long: "别名过长,请限制在20个字符以内。(也可以留空)" } } } };
588
+ module2.exports = { commands: { dota2tracker: { subscribe: { description: "订阅后还需玩家在本群绑定SteamID", usage: "订阅后还需玩家在本群绑定SteamID,BOT将订阅本群中已绑定玩家的新比赛数据,在STRATZ比赛解析完成后将比赛数据生成为图片战报发布至本群中。", messages: { subscribed: "本群已订阅,无需重复订阅。", subscribe_success: "订阅成功。" } }, unsubscribe: { description: "取消订阅本群。", messages: { unsubscribe_success: "取消订阅成功。", not_subscribed: "本群尚未订阅,无需取消订阅。" } }, bind: { description: "绑定SteamID,并起一个别名(也可以不起)", usage: "将你的SteamID与你的账号绑定,若本群已订阅将会实时获取你的新比赛数据发布至群中。", examples: '绑定 123456789\n绑定 123456789 张三\n绑定 123456789 "张 三"', messages: { steam_id_invalid: "SteamID无效。", bind_success: "绑定成功,\nID:{userId}\n别名:{nickName}\nSteamID:{steamId}", bind_failed: "绑定失败,{0}", reason_without_match: "SteamID无效或无任何场次。", reason_fetch_failed: "网络状况不佳或其他原因无法验证SteamID,请稍后重试。", already_binded: "你已绑定,无需重复绑定。\n以下是你的个人信息:\nID:{userId}\n别名:{nickName}\nSteamID:{steamId}", nick_name_too_long: "别名过长,请限制在20个字符以内。(也可以留空)" } }, unbind: { description: "取消绑定你的个人信息", messages: { unbind_success: "取消绑定成功。", not_binded: "尚未绑定,无需取消绑定。" } }, rename: { description: "修改绑定时设定的别名", examples: '改名 李四\n改名 "李 四"', messages: { rename_success: "改名成功,现在你叫{nick_name}了。", empty_input: "请输入你的别名。", not_binded: "请先绑定,绑定时即可设定别名。", nick_name_too_long: "别名过长,请限制在20个字符以内。" } }, "query-members": { description: "查询本群已绑定的玩家", messages: { no_members: "本群尚无绑定玩家。", query_failed: "查询群友失败。" } }, "query-match": { description: "查询指定比赛ID的比赛数据,生成图片发布", examples: "查询比赛 1234567890", messages: { empty_input: "请输入比赛ID。", match_id_invalid: "比赛ID无效。", querying_match: "正在搜索对局详情,请稍后……", query_failed: "获取比赛数据失败。" } }, "query-recent-match": { description: "查询最近的比赛数据,生成图片发布", usage: "查询指定玩家的最近一场比赛的比赛数据,生成图片发布。\n参数可输入该玩家的SteamID或已在本群绑定玩家的别名,无参数时尝试查询调用指令玩家的SteamID", examples: "查询最近比赛\n查询最近比赛 123456789\n查询最近比赛 张三", messages: { not_binded: "无参数时默认从已绑定SteamID玩家中寻找你的信息,但你似乎并没有绑定。\n请在本群绑定SteamID。(可输入【-绑定 -h】获取帮助)\n或在指令后跟上希望查询的SteamID或已绑定玩家的别名。", steam_id_invalid: "SteamID无效并且未在本群找到此玩家。", querying_match: "正在搜索对局详情,请稍后……", query_failed: "获取玩家最近比赛失败。", not_in_group: "指令调用失败。\n当前不属于群聊状态,必须提供指定玩家的SteamID。" } }, "query-player": { description: "查询玩家的个人信息,可指定英雄", options: { hero: "查询玩家指定英雄使用情况(同查询英雄,可用别名或ID)" }, usage: "查询指定玩家的个人信息,生成图片发布,可指定英雄。\n参数可输入该玩家的SteamID或已在本群绑定玩家的别名,无参数时尝试查询调用指令玩家的SteamID", examples: "查询玩家 123456789\n查询玩家 张三\n查询玩家 张三 hero 敌法师", messages: { not_binded: "无参数时默认从已绑定SteamID玩家中寻找你的信息,但你似乎并没有绑定。\n请在本群绑定SteamID。(可输入【-绑定 -h】获取帮助)\n或在指令后跟上希望查询的SteamID或已绑定玩家的别名。", steam_id_invalid: "SteamID无效并且未在本群找到此玩家。", querying_player: "正在获取玩家数据,请稍后……", query_failed: "获取玩家信息失败。", not_in_group: "指令调用失败。\n当前不属于群聊状态,必须提供指定玩家的SteamID。" } }, "query-hero": { description: "查询英雄技能/面板信息", options: { random: "随机选择英雄" }, usage: "查询英雄的技能说明与各项数据,生成图片发布。\n参数可输入英雄ID、英雄名、英雄常用别名。", examples: "查询英雄 15\n查询英雄 雷泽\n查询英雄 电魂", messages: { not_found: "未找到输入的英雄,请确认后重新输入。", querying_hero: "正在获取英雄数据,请稍后……", query_failed: "获取英雄数据失败。", empty_input: "请输入参数。" } } } } };
589
589
  }
590
590
  });
591
591
 
@@ -1056,10 +1056,10 @@ async function playerisValid(input) {
1056
1056
  const steamAccountId = parseInt(input);
1057
1057
  let queryRes = await query("VerifyingPlayer", { steamAccountId });
1058
1058
  if (queryRes.player.matchCount != null) return { isValid: true };
1059
- else return { isValid: false, reason: "SteamID无效或无任何场次。" };
1059
+ else return { isValid: false, reason: ".reason_without_match" };
1060
1060
  } catch (error) {
1061
1061
  console.error(error);
1062
- return { isValid: false, reason: "网络状况不佳SteamID验证失败,请稍后重试。" };
1062
+ return { isValid: false, reason: ".reason_fetch_failed" };
1063
1063
  }
1064
1064
  }
1065
1065
  __name(playerisValid, "playerisValid");
@@ -1144,7 +1144,7 @@ var name = "dota2tracker";
1144
1144
  var usage = `
1145
1145
  DOTA2Bot插件-提供自动追踪群友的最新对局的功能(需群友绑定),以及一系列查询功能。
1146
1146
  [本地化/dota2tracker](../../locales/dota2tracker)可以自定义英雄别名和位置代称等文本内容
1147
- **更多信息请进入[插件主页](https://github.com/sjtdev/koishi-plugin-dota2tracker)与[更新日志](https://github.com/sjtdev/koishi-plugin-dota2tracker/blob/master/changelog.md)查看。**`;
1147
+ **更多信息请进入[插件主页](https://sjtdev.github.io/koishi-plugin-dota2tracker/)与[更新日志](https://github.com/sjtdev/koishi-plugin-dota2tracker/blob/master/changelog.md)查看。**`;
1148
1148
  var inject = ["http", "database", "cron", "puppeteer", "cache"];
1149
1149
  var Config = import_koishi.Schema.intersect([
1150
1150
  import_koishi.Schema.object({
@@ -1223,7 +1223,7 @@ async function apply(ctx, config) {
1223
1223
  const resolvedChannel = channel ?? (await ctx.database.get("channel", { id: session?.event.channel.id ?? channelId }))?.at(0);
1224
1224
  return ctx.i18n.fallback((resolvedChannel?.locales ?? []).concat(Object.values(ctx.i18n.locales).map((locale) => Object.keys(locale).at(0)))).find((locale) => Object.keys(GraphqlLanguageEnum).some((language) => locale == language));
1225
1225
  }, "getLanguageTag");
1226
- ctx.command("subscribe").alias("订阅本群").action(async ({ session }) => {
1226
+ ctx.command("dota2tracker.subscribe").alias("订阅本群").action(async ({ session }) => {
1227
1227
  if (session.guild) {
1228
1228
  let currentGuild = (await ctx.database.get("dt_subscribed_guilds", {
1229
1229
  guildId: session.event.channel.id,
@@ -1239,7 +1239,7 @@ async function apply(ctx, config) {
1239
1239
  }
1240
1240
  }
1241
1241
  });
1242
- ctx.command("unsubscribe").alias("取消订阅").action(async ({ session }) => {
1242
+ ctx.command("dota2tracker.unsubscribe").alias("取消订阅").action(async ({ session }) => {
1243
1243
  if (session.guild) {
1244
1244
  let cancelingGuild = (await ctx.database.get("dt_subscribed_guilds", {
1245
1245
  guildId: session.event.channel.id,
@@ -1255,7 +1255,7 @@ async function apply(ctx, config) {
1255
1255
  }
1256
1256
  } else session.send(session.text(".not_subscribed"));
1257
1257
  });
1258
- ctx.command("bind <steam_id> [nick_name]").alias("绑定").action(async ({ session }, steam_id, nick_name) => {
1258
+ ctx.command("dota2tracker.bind <steam_id> [nick_name]").alias("绑定").action(async ({ session }, steam_id, nick_name) => {
1259
1259
  if (session.guild) {
1260
1260
  if (!steam_id || !/^\d{1,11}$/.test(steam_id)) {
1261
1261
  session.send(session.text(".steam_id_invalid"));
@@ -1272,7 +1272,7 @@ async function apply(ctx, config) {
1272
1272
  }
1273
1273
  let verifyRes = await playerisValid(steam_id);
1274
1274
  if (!verifyRes.isValid) {
1275
- session.send(session.text(`.bind_failed`, verifyRes));
1275
+ session.send(session.text(`.bind_failed`, [session.text(verifyRes.reason)]));
1276
1276
  return;
1277
1277
  }
1278
1278
  if (!/^(?:.{1,20})?$/.test(nick_name ?? "")) {
@@ -1289,7 +1289,7 @@ async function apply(ctx, config) {
1289
1289
  });
1290
1290
  }
1291
1291
  });
1292
- ctx.command("取消绑定", "取消绑定你的个人信息").action(async ({ session }) => {
1292
+ ctx.command("dota2tracker.unbind").alias("取消绑定").action(async ({ session }) => {
1293
1293
  if (session.guild) {
1294
1294
  let sessionPlayer = (await ctx.database.get("dt_subscribed_players", {
1295
1295
  guildId: session.event.channel.id,
@@ -1298,11 +1298,11 @@ async function apply(ctx, config) {
1298
1298
  }))[0];
1299
1299
  if (sessionPlayer) {
1300
1300
  await ctx.database.remove("dt_subscribed_players", sessionPlayer.id);
1301
- session.send("取消绑定成功。");
1302
- } else session.send("尚未绑定,无需取消绑定。");
1301
+ session.send(session.text(".unbind_success"));
1302
+ } else session.send(session.text(".not_binded"));
1303
1303
  }
1304
1304
  });
1305
- ctx.command("改名 <nick_name>", "修改绑定时设定的别名").example("改名 李四").action(async ({ session }, nick_name) => {
1305
+ ctx.command("dota2tracker.rename <nick_name>").alias("改名").action(async ({ session }, nick_name) => {
1306
1306
  if (session.guild) {
1307
1307
  let sessionPlayer = (await ctx.database.get("dt_subscribed_players", {
1308
1308
  guildId: session.event.channel.id,
@@ -1311,22 +1311,22 @@ async function apply(ctx, config) {
1311
1311
  }))[0];
1312
1312
  if (sessionPlayer) {
1313
1313
  if (!nick_name) {
1314
- session.send("请输入你的别名。");
1314
+ session.send(session.text(".emtpy_input"));
1315
1315
  return;
1316
1316
  }
1317
1317
  if (!/^.{1,20}$/.test(nick_name ?? "")) {
1318
- session.send("别名过长,请限制在20个字符以内。");
1318
+ session.send(session.text(".nick_name_too_long"));
1319
1319
  return;
1320
1320
  }
1321
1321
  sessionPlayer.nickName = nick_name;
1322
1322
  await ctx.database.set("dt_subscribed_players", sessionPlayer.id, { nickName: sessionPlayer.nickName });
1323
- session.send(`改名成功,现在你叫${nick_name}了。`);
1323
+ session.send(session.text(".rename_success", { nick_name }));
1324
1324
  } else {
1325
- session.send("请先绑定,绑定时即可设定别名。");
1325
+ session.send(session.text(".not_binded"));
1326
1326
  }
1327
1327
  }
1328
1328
  });
1329
- ctx.command("查询群友", "查询本群已绑定的玩家").action(async ({ session }) => {
1329
+ ctx.command("dota2tracker.query-members").alias("查询群友").action(async ({ session }) => {
1330
1330
  if (session.guild) {
1331
1331
  const languageTag = await getLanguageTag(session);
1332
1332
  const subscribedPlayers = await ctx.database.get("dt_subscribed_players", {
@@ -1334,7 +1334,7 @@ async function apply(ctx, config) {
1334
1334
  platform: session.platform
1335
1335
  });
1336
1336
  if (!subscribedPlayers.length) {
1337
- session.send("本群尚无绑定玩家。");
1337
+ session.send(session.text(".no_members"));
1338
1338
  return;
1339
1339
  }
1340
1340
  if (subscribedPlayers.length <= 20) {
@@ -1367,7 +1367,7 @@ async function apply(ctx, config) {
1367
1367
  session.send(await ctx.puppeteer.render(await genImageHTML(users, "guild_member" /* GuildMember */, "guild_member" /* GuildMember */, ctx, languageTag)));
1368
1368
  } catch (error) {
1369
1369
  ctx.logger.error(error);
1370
- session.send("查询群友失败。");
1370
+ session.send(session.text(".query_failed"));
1371
1371
  }
1372
1372
  }
1373
1373
  }
@@ -1444,16 +1444,16 @@ async function apply(ctx, config) {
1444
1444
  return await ctx.puppeteer.render(imageHTML);
1445
1445
  }
1446
1446
  __name(generateMatchImage, "generateMatchImage");
1447
- ctx.command("查询比赛 <match_id>", "查询比赛ID").alias("querymatch").usage("查询指定比赛ID的比赛数据,生成图片发布。").example("查询比赛 1234567890").action(async ({ session }, match_id) => {
1447
+ ctx.command("dota2tracker.query-match <match_id>").alias("查询比赛").action(async ({ session }, match_id) => {
1448
1448
  if (!match_id) {
1449
- session.send("请输入比赛ID。");
1449
+ session.send(session.text(".empty_input"));
1450
1450
  return;
1451
1451
  }
1452
1452
  if (!/^\d{1,11}$/.test(match_id)) {
1453
- session.send("比赛ID无效。");
1453
+ session.send(session.text(".match_id_invalid"));
1454
1454
  return;
1455
1455
  }
1456
- await session.send("正在搜索对局详情,请稍后...");
1456
+ await session.send(session.text(".querying_match"));
1457
1457
  try {
1458
1458
  const languageTag = await getLanguageTag(session);
1459
1459
  const matchQuery = await queryMatchData(Number(match_id));
@@ -1461,11 +1461,11 @@ async function apply(ctx, config) {
1461
1461
  const image = await generateMatchImage(match, languageTag);
1462
1462
  session.send((ctx.config.urlInMessageType.some((type) => type == "match") ? "https://stratz.com/matches/" + match.id : "") + image);
1463
1463
  } catch (error) {
1464
- session.send("获取比赛信息失败。");
1464
+ session.send(session.text(".query_failed"));
1465
1465
  ctx.logger.error(error);
1466
1466
  }
1467
1467
  });
1468
- ctx.command("查询最近比赛 [input_data]", "查询玩家的最近比赛").usage("查询指定玩家的最近一场比赛的比赛数据,生成图片发布。\n参数可输入该玩家的SteamID或已在本群绑定玩家的别名,无参数时尝试查询调用指令玩家的SteamID").example("查询最近比赛 123456789").example("查询最近比赛 张三").action(async ({ session }, input_data) => {
1468
+ ctx.command("dota2tracker.query-recent-match [input_data]").alias("查询最近比赛").action(async ({ session }, input_data) => {
1469
1469
  if (session.guild || !session.guild && input_data) {
1470
1470
  let sessionPlayer;
1471
1471
  if (!input_data) {
@@ -1475,7 +1475,7 @@ async function apply(ctx, config) {
1475
1475
  userId: session.event.user.id
1476
1476
  }))[0];
1477
1477
  if (!sessionPlayer) {
1478
- session.send("无参数时默认从已绑定SteamID玩家中寻找你的信息,但你似乎并没有绑定。\n请在本群绑定SteamID。(可输入【-绑定 -h】获取帮助)\n或在指令后跟上希望查询的SteamID或已绑定玩家的别名。");
1478
+ session.send(session.text(".not_binded"));
1479
1479
  return;
1480
1480
  }
1481
1481
  }
@@ -1485,17 +1485,17 @@ async function apply(ctx, config) {
1485
1485
  nickName: input_data
1486
1486
  }))[0];
1487
1487
  if (!(flagBindedPlayer || /^\d{1,11}$/.test(input_data))) {
1488
- session.send("SteamID不合法并且未在本群找到此玩家。");
1488
+ session.send(session.text(".steam_id_invalid"));
1489
1489
  return;
1490
1490
  }
1491
1491
  let lastMatchId = 0;
1492
1492
  try {
1493
- session.send("正在搜索对局详情,请稍后...");
1493
+ session.send(session.text(".querying_match"));
1494
1494
  lastMatchId = (await query("PlayersLastmatchRankinfo", {
1495
1495
  steamAccountIds: [parseInt(flagBindedPlayer?.steamId ?? input_data)]
1496
1496
  })).players[0].matches[0].id;
1497
1497
  } catch (error) {
1498
- session.send("获取玩家最近比赛失败。");
1498
+ session.send(session.text(".query_failed"));
1499
1499
  ctx.logger.error(error);
1500
1500
  return;
1501
1501
  }
@@ -1505,10 +1505,10 @@ async function apply(ctx, config) {
1505
1505
  const image = await generateMatchImage(match, languageTag);
1506
1506
  session.send((ctx.config.urlInMessageType.some((type) => type == "match") ? "https://stratz.com/matches/" + match.id : "") + image);
1507
1507
  } else {
1508
- session.send("<p>指令调用失败。</p><p>当前不属于群聊状态,必须提供指定玩家的SteamID。</p>");
1508
+ session.send(session.text(".not_in_group"));
1509
1509
  }
1510
1510
  });
1511
- ctx.command("查询玩家 <input_data>", "查询玩家信息,可指定英雄").usage("查询指定玩家的个人信息与最近战绩,生成图片发布。\n参数可输入该玩家的SteamID或已在本群绑定玩家的别名,无参数时尝试查询调用指令玩家的SteamID").option("hero", "-o <value:string> 查询玩家指定英雄使用情况(同其他英雄查询,可用简称与ID)").example("查询玩家 123456789").example("查询玩家 张三").example("查询玩家 张三 hero 敌法师").action(async ({ session, options }, input_data) => {
1511
+ ctx.command("dota2tracker.query-player <input_data>").option("hero", "-o <value:string>").alias("查询玩家").action(async ({ session, options }, input_data) => {
1512
1512
  if (session.guild || !session.guild && input_data) {
1513
1513
  let sessionPlayer;
1514
1514
  const languageTag = await getLanguageTag(session);
@@ -1519,7 +1519,7 @@ async function apply(ctx, config) {
1519
1519
  userId: session.event.user.id
1520
1520
  }))[0];
1521
1521
  if (!sessionPlayer) {
1522
- session.send("无参数时默认从已绑定SteamID玩家中寻找你的信息,但你似乎并没有绑定。\n请在本群绑定SteamID。(可输入【-绑定 -h】获取帮助)\n或在指令后跟上希望查询的SteamID或已绑定玩家的别名。");
1522
+ session.send(session.text(".not_binded"));
1523
1523
  return;
1524
1524
  }
1525
1525
  }
@@ -1529,10 +1529,10 @@ async function apply(ctx, config) {
1529
1529
  nickName: input_data
1530
1530
  }))[0];
1531
1531
  if (!(flagBindedPlayer || /^\d{1,11}$/.test(input_data))) {
1532
- session.send("SteamID不合法并且未在本群找到此玩家。");
1532
+ session.send(session.text(".steam_id_invalid"));
1533
1533
  return;
1534
1534
  }
1535
- session.send("正在获取玩家数据,请稍后...");
1535
+ session.send(session.text(".querying_player"));
1536
1536
  let heroId = findingHero(options.hero);
1537
1537
  let steamId = flagBindedPlayer?.steamId ?? input_data;
1538
1538
  let player;
@@ -1592,22 +1592,22 @@ async function apply(ctx, config) {
1592
1592
  );
1593
1593
  } catch (error) {
1594
1594
  ctx.logger.error(error);
1595
- session.send("获取玩家信息失败。");
1595
+ session.send(session.text(".query_failed"));
1596
1596
  }
1597
1597
  } else {
1598
- session.send("<p>指令调用失败。</p><p>当前不属于群聊状态,必须提供指定玩家的SteamID。</p>");
1598
+ session.send(session.text(".not_in_group"));
1599
1599
  }
1600
1600
  });
1601
- ctx.command("查询英雄 <input_data>", "查询英雄技能/面板信息").usage("查询英雄的技能说明与各项数据,生成图片发布。\n参数可输入英雄ID、英雄名、英雄常用别名").option("random", "-r 随机选择英雄").example("查询英雄 15").example("查询英雄 雷泽").example("查询英雄 电魂").action(async ({ session, options }, input_data) => {
1601
+ ctx.command("dota2tracker.query-hero <input_data>").option("random", "-r").alias("查询英雄").action(async ({ session, options }, input_data) => {
1602
1602
  const languageTag = await getLanguageTag(session);
1603
1603
  if (options.random) input_data = random.pick(Object.keys(dotaconstants2.heroes));
1604
1604
  if (input_data) {
1605
1605
  let heroId = findingHero(input_data);
1606
1606
  if (!heroId) {
1607
- session.send("未找到输入的英雄,请确认后重新输入。");
1607
+ session.send(session.text(".hero_not_found"));
1608
1608
  return;
1609
1609
  }
1610
- await session.send("正在获取英雄数据,请稍后...");
1610
+ await session.send(session.text(".querying_hero"));
1611
1611
  try {
1612
1612
  let hero = await queryHeroFromValve(heroId, languageTag);
1613
1613
  hero.facet_abilities.forEach((fa, i) => {
@@ -1700,10 +1700,10 @@ async function apply(ctx, config) {
1700
1700
  );
1701
1701
  } catch (error) {
1702
1702
  ctx.logger.error(error);
1703
- session.send("获取数据失败");
1703
+ session.send(session.text(".query_failed"));
1704
1704
  }
1705
1705
  } else {
1706
- session.send("请输入参数。");
1706
+ session.send(session.text(".empty_input"));
1707
1707
  }
1708
1708
  });
1709
1709
  function findingHero(input) {
@@ -1867,7 +1867,8 @@ async function apply(ctx, config) {
1867
1867
  avatar: guildMember?.avatar ?? players.find((player) => subPlayer.steamId == player.steamAccount.id).steamAccount.avatar,
1868
1868
  isRising: rankMap[subPlayer.steamId].rank > subPlayer.rank.rank || rankMap[subPlayer.steamId].rank == subPlayer.rank.rank && rankMap[subPlayer.steamId].leader < subPlayer.rank.leader || rankMap[subPlayer.steamId].leader > 0 && subPlayer.rank.leader == null,
1869
1869
  prevRank,
1870
- currRank
1870
+ currRank,
1871
+ date: (0, import_moment.default)()
1871
1872
  },
1872
1873
  "rank" + (config.rankBroadFun ? "_fun" : ""),
1873
1874
  "rank" /* Rank */,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sjtdev/koishi-plugin-dota2tracker",
3
3
  "description": "koishi插件-追踪群友的DOTA2对局",
4
- "version": "1.3.0-pre.3",
4
+ "version": "1.3.0-pre.5",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -1,6 +1,9 @@
1
- # @sjtdev/koishi-plugin-dota2tracker
1
+ # [@sjtdev/koishi-plugin-dota2tracker](https://sjtdev.github.io/koishi-plugin-dota2tracker/)
2
2
 
3
- [![npm](https://img.shields.io/npm/v/@sjtdev/koishi-plugin-dota2tracker?style=flat-square)](https://www.npmjs.com/package/@sjtdev/koishi-plugin-dota2tracker)
3
+ [![npm](https://img.shields.io/npm/v/@sjtdev/koishi-plugin-dota2tracker/latest?style=flat-square)](https://www.npmjs.com/package/@sjtdev/koishi-plugin-dota2tracker)
4
+ [![npm](https://img.shields.io/npm/v/@sjtdev/koishi-plugin-dota2tracker/next?style=flat-square)](https://www.npmjs.com/package/@sjtdev/koishi-plugin-dota2tracker)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@sjtdev/koishi-plugin-dota2tracker.svg?style=flat-square)](https://www.npmjs.com/package/@sjtdev/koishi-plugin-dota2tracker)
6
+ > [!TIP]两个标签取版本号最高的版为最新版本
4
7
 
5
8
  DOTA2Bot插件-提供自动追踪群友的最新对局的功能(需群友绑定),以及一系列查询功能。
6
9
  ### 安装
@@ -473,7 +473,7 @@
473
473
  <span class="lose" style="${hero.matchCount - hero.winCount == 0 ? "visibility:hidden;" : ""}width: ${(hero.matchCount - hero.winCount) * pixelOfPerMatchInTotal}px">${hero.matchCount - hero.winCount}</span>`).join("") %>
474
474
  <%- !player.genHero ?
475
475
  `<p class="tip row near">${$t("dota2tracker.template.recently_heroes")}</p>`:
476
- `<p class="tip row total">${$t("dota2tracker.template.last25match_")}</p>`
476
+ `<p class="tip row total">${$t("dota2tracker.template.last25matches_")}</p>`
477
477
  %>
478
478
  <%- player.heroesPerformance
479
479
  .filter((hero) => hero.matchCount > 1)
@@ -82,14 +82,14 @@
82
82
  }
83
83
  </style>
84
84
  </head>
85
- <% const {name, avatar, isRising, prevRank, currRank} = data; %>
85
+ <% const {name, avatar, isRising, prevRank, currRank, date} = data; %>
86
86
  <% const kind = isRising ? "xi" : "bei"; %>
87
- <body class="<%= kind %>" <%= `style="background-image: url( ${utils.getImageUrl(kind, undefined, "jpg")} )"`%>>
87
+ <body class="<%= kind %>" <%- `style="background-image: url( ${utils.getImageUrl(kind, undefined, "jpg")} )"`%>>
88
88
  <div class="wrapper">
89
89
  <p class="xi">热烈祝贺群友 <img src="<%= avatar %>" /><%= name %> 在天梯中再获进步,</p>
90
90
  <p class="xi">由
91
- <span class="rank prev"><%= d2a.rank[prevRank.medal] %><%= prevRank.leader ?? prevRank.star %></span>升为
92
- <span class="rank curr"><%= d2a.rank[currRank.medal] %><%= currRank.leader ?? currRank.star %></span>,再接再厉,再创辉煌!
91
+ <span class="rank prev"><%= $t("dota2tracker.template.ranks."+prevRank.medal) %><%= prevRank.leader ?? prevRank.star %></span>升为
92
+ <span class="rank curr"><%= $t("dota2tracker.template.ranks."+currRank.medal) %><%= currRank.leader ?? currRank.star %></span>,再接再厉,再创辉煌!
93
93
  </p>
94
94
  <p class="bei"><img src="<%= avatar %>" /></p>
95
95
  <p class="bei">寄</p>
@@ -105,7 +105,7 @@
105
105
  <p><%= currRank.leader ?? "" %></p>
106
106
  </div>
107
107
  </div>
108
- <p style="text-align: right; margin-top: 40px;">—— <%= moment().format('YYYY/MM/DD HH点mm分') %></p>
108
+ <p style="text-align: right; margin-top: 40px;">—— <%= date.format('YYYY/MM/DD HH点mm分') %></p>
109
109
  </div>
110
110
  </body>
111
111
  </html>