@sjtdev/koishi-plugin-dota2tracker 1.2.6-pre3 → 1.2.6

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/changelog.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### 1.2.6
2
+ 因koishi更新至4.17.10修复了主动发送消息的函数,本插件的发送消息方式也换回之前的方案以避免可能的代码问题。(功能使用上与1.2.6-pre3版本一致)
3
+
1
4
  ### 1.2.6-pre
2
5
  ##### (因koishi尚未更新发布pre版)
3
6
  **改进&修复**:修复了`查询英雄`图片中 技能数值未被正确替换、全才英雄基础攻击力显示错误的问题,并优化了命石描述显示方式
package/lib/index.js CHANGED
@@ -1698,10 +1698,8 @@ async function apply(ctx, config) {
1698
1698
  });
1699
1699
  const combinations = Array.from(combinationsMap.values());
1700
1700
  try {
1701
- await sendMessageToChannel(
1702
- ctx,
1703
- guild,
1704
- // [`${guild.platform}:${guild.guildId}`],
1701
+ await ctx.broadcast(
1702
+ [`${guild.platform}:${guild.guildId}`],
1705
1703
  `昨日总结:
1706
1704
  ${currentsubscribedPlayers.map(
1707
1705
  (player) => `${player.name}: ${player.winCount}胜${player.loseCount}负 胜率${Math.round(player.winCount / player.matches.length * 100)}%,平均KDA: [${player.avgKills}/${player.avgDeaths}/${player.avgAssists}](${player.avgKDA}),平均表现: ${player.avgImp > 0 ? "+" : ""}${player.avgImp}`
@@ -1779,7 +1777,7 @@ async function apply(ctx, config) {
1779
1777
  KDA:${((player.kills + player.assists) / (player.deaths || 1)).toFixed(2)} [${player.kills}/${player.deaths}/${player.assists}],GPM/XPM:${player.goldPerMinute}/${player.experiencePerMinute},补刀数:${player.numLastHits}/${player.numDenies},伤害/塔伤:${player.heroDamage}/${player.towerDamage},参战/参葬率:${(player.killContribution * 100).toFixed(2)}%/${(player.deathContribution * 100).toFixed(2)}%`;
1780
1778
  broadMatchMessage += broadPlayerMessage + "\n";
1781
1779
  }
1782
- await sendMessageToChannel(ctx, commingGuild, broadMatchMessage + img);
1780
+ await ctx.broadcast([`${commingGuild.platform}:${commingGuild.guildId}`], broadMatchMessage + img);
1783
1781
  ctx.logger.info(`${match.id}${match.parsedDateTime ? "已解析," : "已结束超过1小时仍未被解析,放弃解析直接"}生成图片并发布于${commingGuild.platform}:${commingGuild.guildId}。`);
1784
1782
  }
1785
1783
  if (match.parsedDateTime)
@@ -1820,22 +1818,6 @@ function genImageHTML(data, template, type) {
1820
1818
  return result;
1821
1819
  }
1822
1820
  __name(genImageHTML, "genImageHTML");
1823
- async function sendMessageToChannel(ctx, guild, broadMessage) {
1824
- const targetChannels = await ctx.database.get("channel", { id: guild.guildId, platform: guild.platform });
1825
- if (targetChannels.length === 1) {
1826
- const bot = ctx.bots.find((bot2) => bot2.userId === targetChannels[0].assignee);
1827
- if (bot) {
1828
- await bot.sendMessage(guild.guildId, broadMessage);
1829
- } else {
1830
- throw new Error("指定的bot未找到。");
1831
- }
1832
- } else if (targetChannels.length > 1) {
1833
- throw new Error("有复数个bot存在于该群组/频道,请移除多余bot。");
1834
- } else {
1835
- throw new Error("未找到目标群组/频道。");
1836
- }
1837
- }
1838
- __name(sendMessageToChannel, "sendMessageToChannel");
1839
1821
  // Annotate the CommonJS export names for ESM import in node:
1840
1822
  0 && (module.exports = {
1841
1823
  Config,
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.2.6-pre3",
4
+ "version": "1.2.6",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -31,7 +31,7 @@
31
31
  "moment": "^2.30.1"
32
32
  },
33
33
  "peerDependencies": {
34
- "koishi": "^4.17.8"
34
+ "koishi": "^4.17.10"
35
35
  },
36
36
  "koishi": {
37
37
  "preview": "true",