@sjtdev/koishi-plugin-dota2tracker 1.2.5-fix3 → 1.2.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/changelog.md +0 -3
- package/lib/index.js +12 -38
- package/package.json +1 -1
package/changelog.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -1690,23 +1690,17 @@ async function apply(ctx, config) {
|
|
|
1690
1690
|
}
|
|
1691
1691
|
});
|
|
1692
1692
|
const combinations = Array.from(combinationsMap.values());
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
"\n"
|
|
1705
|
-
)
|
|
1706
|
-
);
|
|
1707
|
-
} catch (error) {
|
|
1708
|
-
ctx.logger.error(error);
|
|
1709
|
-
}
|
|
1693
|
+
await ctx.broadcast(
|
|
1694
|
+
[`${guild.platform}:${guild.guildId}`],
|
|
1695
|
+
`昨日总结:
|
|
1696
|
+
${currentsubscribedPlayers.map(
|
|
1697
|
+
(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}`
|
|
1698
|
+
).join("\n")}
|
|
1699
|
+
${combinations.map((combi) => `组合[${combi.name}]: ${combi.winCount}胜${combi.matches.length - combi.winCount}负 胜率${Math.round(combi.winCount / combi.matches.length * 100)}%`).join("\n")}`.replace(
|
|
1700
|
+
/\s*\n\s*/g,
|
|
1701
|
+
"\n"
|
|
1702
|
+
)
|
|
1703
|
+
);
|
|
1710
1704
|
}
|
|
1711
1705
|
}
|
|
1712
1706
|
});
|
|
@@ -1772,7 +1766,7 @@ async function apply(ctx, config) {
|
|
|
1772
1766
|
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)}%`;
|
|
1773
1767
|
broadMatchMessage += broadPlayerMessage + "\n";
|
|
1774
1768
|
}
|
|
1775
|
-
await
|
|
1769
|
+
await ctx.broadcast([`${commingGuild.platform}:${commingGuild.guildId}`], broadMatchMessage + img);
|
|
1776
1770
|
ctx.logger.info(`${match.id}${match.parsedDateTime ? "已解析," : "已结束超过1小时仍未被解析,放弃解析直接"}生成图片并发布于${commingGuild.platform}:${commingGuild.guildId}。`);
|
|
1777
1771
|
}
|
|
1778
1772
|
if (match.parsedDateTime)
|
|
@@ -1813,26 +1807,6 @@ function genImageHTML(data, template, type) {
|
|
|
1813
1807
|
return result;
|
|
1814
1808
|
}
|
|
1815
1809
|
__name(genImageHTML, "genImageHTML");
|
|
1816
|
-
async function sendMessageToChannel(ctx, commingGuild, broadMatchMessage) {
|
|
1817
|
-
try {
|
|
1818
|
-
const targetChannels = await ctx.database.get("channel", { id: commingGuild.guildId, platform: commingGuild.platform });
|
|
1819
|
-
if (targetChannels.length === 1) {
|
|
1820
|
-
const bot = ctx.bots.find((bot2) => bot2.userId === targetChannels[0].assignee);
|
|
1821
|
-
if (bot) {
|
|
1822
|
-
await bot.sendMessage(commingGuild.guildId, broadMatchMessage);
|
|
1823
|
-
} else {
|
|
1824
|
-
throw new Error("指定的bot未找到。");
|
|
1825
|
-
}
|
|
1826
|
-
} else if (targetChannels.length > 1) {
|
|
1827
|
-
throw new Error("有复数个bot存在于该群组/频道,请移除多余bot。");
|
|
1828
|
-
} else {
|
|
1829
|
-
throw new Error("未找到目标群组/频道。");
|
|
1830
|
-
}
|
|
1831
|
-
} catch (error) {
|
|
1832
|
-
throw error;
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
__name(sendMessageToChannel, "sendMessageToChannel");
|
|
1836
1810
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1837
1811
|
0 && (module.exports = {
|
|
1838
1812
|
Config,
|