@sjtdev/koishi-plugin-dota2tracker 1.5.2 → 1.5.4
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 +202 -177
- package/package.json +3 -3
- package/template/guild_member/guild_member.ejs +6 -1
- package/template/hero/hero_1.ejs +6 -1
- package/template/images/disconnected.png +0 -0
- package/template/images/lane_stomp.svg +1 -1
- package/template/images/lane_stomped.svg +1 -1
- package/template/images/lane_victory.svg +1 -1
- package/template/item/item.ejs +3 -0
- package/template/item/itemlist.ejs +6 -0
- package/template/match/match_1/item.ejs +11 -0
- package/template/match/match_1/main.ejs +35 -0
- package/template/match/match_1/player.ejs +154 -0
- package/template/match/match_1/style.css +746 -0
- package/template/match/match_1.ejs +54 -1044
- package/template/match/match_2/original.css +17 -14
- package/template/match/match_2/original.ejs +4 -5
- package/template/match/match_2+.ejs +3 -0
- package/template/match/match_2.ejs +3 -0
- package/template/player/player_1.ejs +6 -1
- package/template/rank/rank_fun.ejs +6 -1
- package/template/report/daily.ejs +6 -1
package/lib/index.js
CHANGED
|
@@ -38,14 +38,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
38
38
|
// src/locales/en-US.schema.yml
|
|
39
39
|
var require_en_US_schema = __commonJS({
|
|
40
40
|
"src/locales/en-US.schema.yml"(exports2, module2) {
|
|
41
|
-
module2.exports = { _config: { base: { $desc: "Basic Settings", STRATZ_API_TOKEN: "Required. API TOKEN from stratz.com, available at https://stratz.com/api.", dataParsingTimeoutMinutes: "Time to wait for match data parsing (in minutes). If the data parsing time exceeds the waiting time, the report will be generated directly without waiting for the parsing to complete.", proxyAddress: "Proxy address. Leave blank to disable the proxy." }, message: { $desc: "Message Settings", urlInMessageType: { $desc: "Include links in messages, <br/>please select the message type:", $inner: ["Include stratz match page link in match query and report messages", "Include stratz player page link in player information query messages", "Include Dota Encyclopedia hero page link in hero data query messages"] }, rankBroadSwitch: "Rank change broadcast", rankBroadStar: "Star change broadcast", rankBroadLeader: "Leaderboard rank change broadcast", rankBroadFun: "Fun broadcast template", maxSendItemCount: "Maximum number of item images to send<br/>When exceeded, the following option determines whether to send the item list", showItemListAtTooMuchItems: "Send item list when exceeding max count<br/>Controls whether to send the item list image when search results exceed maxSendItemCount", customItemAlias: { $desc: "Custom item aliases<br/>\nAdd additional aliases when built-in list is insufficient. \nFor widely-used missing aliases, please submit issues/pull requests to the source repository.<br/>\n(Example **Keyword**: Blink Dagger,**Alias**: Blink)", keyword: "Keyword", alias: "Alias" } }, report: { $desc: "Summary Settings", dailyReportSwitch: "Daily Report Function", dailyReportHours: "Daily report time in hours", dailyReportShowCombi: "Show combinations in daily report", weeklyReportSwitch: "Weekly Report Function", weeklyReportDayHours: "Weekly report published on (day) at (hour)", weeklyReportShowCombi: "Show combinations in weekly report" }, template: { $desc: "Template Settings", template_match: "Template used to generate match information images, see https://sjtdev.github.io/koishi-plugin-dota2tracker/template-match.html for template display.", template_player: "Template used to generate player information images. (Currently only one template available)", template_hero: "Template used to generate hero information images. (Currently only one template available)", playerRankEstimate: "Estimate the rank of players without a rank in the player template <br>Estimated rank will be displayed as a gray image" } } };
|
|
41
|
+
module2.exports = { _config: { base: { $desc: "Basic Settings", STRATZ_API_TOKEN: "Required. API TOKEN from stratz.com, available at https://stratz.com/api.", dataParsingTimeoutMinutes: "Time to wait for match data parsing (in minutes). If the data parsing time exceeds the waiting time, the report will be generated directly without waiting for the parsing to complete.", proxyAddress: "Proxy address. Leave blank to disable the proxy." }, message: { $desc: "Message Settings", urlInMessageType: { $desc: "Include links in messages, <br/>please select the message type:", $inner: ["Include stratz match page link in match query and report messages", "Include stratz player page link in player information query messages", "Include Dota Encyclopedia hero page link in hero data query messages"] }, rankBroadSwitch: "Rank change broadcast", rankBroadStar: "Star change broadcast", rankBroadLeader: "Leaderboard rank change broadcast", rankBroadFun: "Fun broadcast template", maxSendItemCount: "Maximum number of item images to send<br/>When exceeded, the following option determines whether to send the item list", showItemListAtTooMuchItems: "Send item list when exceeding max count<br/>Controls whether to send the item list image when search results exceed maxSendItemCount", customItemAlias: { $desc: "Custom item aliases<br/>\nAdd additional aliases when built-in list is insufficient. \nFor widely-used missing aliases, please submit issues/pull requests to the source repository.<br/>\n(Example **Keyword**: Blink Dagger,**Alias**: Blink)", keyword: "Keyword", alias: "Alias" } }, report: { $desc: "Summary Settings", dailyReportSwitch: "Daily Report Function", dailyReportHours: "Daily report time in hours", dailyReportShowCombi: "Show combinations in daily report", weeklyReportSwitch: "Weekly Report Function", weeklyReportDayHours: "Weekly report published on (day) at (hour)", weeklyReportShowCombi: "Show combinations in weekly report" }, template: { $desc: "Template Settings", template_match: "Template used to generate match information images, see https://sjtdev.github.io/koishi-plugin-dota2tracker/template-match.html for template display.", template_player: "Template used to generate player information images. (Currently only one template available)", template_hero: "Template used to generate hero information images. (Currently only one template available)", playerRankEstimate: "Estimate the rank of players without a rank in the player template <br>Estimated rank will be displayed as a gray image", templateFonts: 'Font names used in the template. Requires font files installed on the koishi host machine. \nMultiple fonts can be added; the system will use the first available font from top to bottom. \nIf all fonts are unavailable, falls back to system defaults. \nImportant formatting rules: \n- Enclose font names in quotes (" ") if they contain spaces or special characters (recommended for all font names)\n- Do NOT enclose generic font family names (e.g. sans-serif, monospace) in quotes\nExamples:\n```\n"Microsoft YaHei"\nsans-serif\n```\nFor details on font-family syntax, see:\n[📖 MDN: font-family](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family)' } } };
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
// src/locales/zh-CN.schema.yml
|
|
46
46
|
var require_zh_CN_schema = __commonJS({
|
|
47
47
|
"src/locales/zh-CN.schema.yml"(exports2, module2) {
|
|
48
|
-
module2.exports = { _config: { base: { $desc: "基础设置", STRATZ_API_TOKEN: "※必须。stratz.com的API TOKEN,可在 https://stratz.com/api 获取。", dataParsingTimeoutMinutes: "等待比赛数据解析的时间(单位:分钟)。如果数据解析时间超过等待时间,将直接生成战报而不再等待解析完成。", proxyAddress: "代理地址,留空时不使用代理" }, message: { $desc: "消息设置", urlInMessageType: { $desc: "在消息中附带链接,<br/>请选择消息类型:", $inner: ["在查询比赛与战报消息中附带stratz比赛页面链接", "在查询玩家信息消息中附带stratz玩家页面链接", "在查询英雄数据消息中附带刀塔百科对应英雄页面链接"] }, rankBroadSwitch: "段位变动播报", rankBroadStar: "星级变动播报", rankBroadLeader: "冠绝名次变动播报", rankBroadFun: "整活播报模板", maxSendItemCount: "最大发送物品图片数量,<br/> 当超过指定数量时将由下方选项决定是否发送查询结果的物品列表图片", showItemListAtTooMuchItems: "在查询结果的物品数量超过指定数量时,是否发送查询结果的物品列表图片", customItemAlias: { $desc: "额外物品别名设置<br/>当插件内置的[物品别名列表](https://github.com/sjtdev/koishi-plugin-dota2tracker/blob/master/src/locales/zh-CN.constants.json#L304-L407)中没有想要的物品别名可在此处追加,如果是插件疏漏的广为人知的物品别名推荐到源码仓库提交issue或pull request完善列表。<br/>(例如 **关键词**: 闪烁匕首,**别名**: 跳刀)", keyword: "关键词", alias: "别名" } }, report: { $desc: "总结设置", dailyReportSwitch: "日报功能", dailyReportHours: "日报时间小时", dailyReportShowCombi: "日报是否显示组合", weeklyReportSwitch: "周报功能", weeklyReportDayHours: "周报发布于周(几)的(几)点", weeklyReportShowCombi: "周报是否显示组合" }, template: { $desc: "模板设置", template_match: "
|
|
48
|
+
module2.exports = { _config: { base: { $desc: "基础设置", STRATZ_API_TOKEN: "※必须。stratz.com的API TOKEN,可在 https://stratz.com/api 获取。", dataParsingTimeoutMinutes: "等待比赛数据解析的时间(单位:分钟)。如果数据解析时间超过等待时间,将直接生成战报而不再等待解析完成。", proxyAddress: "代理地址,留空时不使用代理" }, message: { $desc: "消息设置", urlInMessageType: { $desc: "在消息中附带链接,<br/>请选择消息类型:", $inner: ["在查询比赛与战报消息中附带stratz比赛页面链接", "在查询玩家信息消息中附带stratz玩家页面链接", "在查询英雄数据消息中附带刀塔百科对应英雄页面链接"] }, rankBroadSwitch: "段位变动播报", rankBroadStar: "星级变动播报", rankBroadLeader: "冠绝名次变动播报", rankBroadFun: "整活播报模板", maxSendItemCount: "最大发送物品图片数量,<br/> 当超过指定数量时将由下方选项决定是否发送查询结果的物品列表图片", showItemListAtTooMuchItems: "在查询结果的物品数量超过指定数量时,是否发送查询结果的物品列表图片", customItemAlias: { $desc: "额外物品别名设置<br/>当插件内置的[物品别名列表](https://github.com/sjtdev/koishi-plugin-dota2tracker/blob/master/src/locales/zh-CN.constants.json#L304-L407)中没有想要的物品别名可在此处追加,如果是插件疏漏的广为人知的物品别名推荐到源码仓库提交issue或pull request完善列表。<br/>(例如 **关键词**: 闪烁匕首,**别名**: 跳刀)", keyword: "关键词", alias: "别名" } }, report: { $desc: "总结设置", dailyReportSwitch: "日报功能", dailyReportHours: "日报时间小时", dailyReportShowCombi: "日报是否显示组合", weeklyReportSwitch: "周报功能", weeklyReportDayHours: "周报发布于周(几)的(几)点", weeklyReportShowCombi: "周报是否显示组合" }, template: { $desc: "模板设置", template_match: "生成比赛信息图片使用的模板,显示效果见 [📖 文档-模板展示页](https://sjtdev.github.io/koishi-plugin-dota2tracker/template-match.html)。", template_player: "生成玩家信息图片使用的模板。(目前仅有一张模板)", template_hero: "生成英雄信息图片使用的模板。(目前仅有一张模板)", playerRankEstimate: "在player模板中对没有段位的玩家进行段位估算 <br>估算的段位将以灰色图片显示", templateFonts: '模板所使用的字体名。需要 koishi 所在设备安装字体文件。 \n可添加多个字体名,将从上到下回退到第一个可用字体;若所有字体都不可用,则使用系统默认字体。 \n其中字体名若包含空格或特殊字符需要在名称首尾添加引号(此处建议尽量强制使用引号); \n若使用字体族名则必须**不使用引号**,如:\n```\n"Microsoft YaHei"\nsans-serif\n```\n有关font-family的更多信息,请查阅 [📖 MDN: font-family](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-family) ' } } };
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -55,6 +55,7 @@ var require_en_US_constants = __commonJS({
|
|
|
55
55
|
module2.exports = {
|
|
56
56
|
dota2tracker: {
|
|
57
57
|
usage: "DOTA2Bot plugin - provides the functionality to automatically track the latest matches of group members (requires group members to bind), as well as a series of query functions. \n[Localization/dota2tracker](../../locales/dota2tracker) allows customization of hero aliases and position nicknames, etc. \n**For more information, please visit the [plugin homepage](https://sjtdev.github.io/koishi-plugin-dota2tracker/) and [changelog](https://github.com/sjtdev/koishi-plugin-dota2tracker/blob/master/changelog.md).**",
|
|
58
|
+
usage_cron: "<p style='color: #FF9800;'> currently does not have<b> cron service </b>enabled, and can only provide query services. <br>If you need to enable active messaging services such as battle report tracking, please restart the plugin after the <b> cron service </b> is configured. </p>",
|
|
58
59
|
template: {
|
|
59
60
|
game_modes: {
|
|
60
61
|
NONE: "None",
|
|
@@ -366,6 +367,7 @@ var require_zh_CN_constants = __commonJS({
|
|
|
366
367
|
module2.exports = {
|
|
367
368
|
dota2tracker: {
|
|
368
369
|
usage: "DOTA2Bot插件-提供自动追踪群友的最新对局的功能(需群友绑定),以及一系列查询功能。 \n[本地化/dota2tracker](../../locales/dota2tracker)可以自定义英雄别名和位置代称等文本内容 \n**更多信息请进入[插件主页](https://sjtdev.github.io/koishi-plugin-dota2tracker/)与[更新日志](https://github.com/sjtdev/koishi-plugin-dota2tracker/blob/master/changelog.md)查看。**",
|
|
370
|
+
usage_cron: "<p style='color: #FF9800;'>当前未启用<b> cron服务 </b>,仅能提供查询服务。<br>若需开启战报追踪等主动消息服务,请于配置完成 <b> cron服务 </b> 后重启本插件。</p>",
|
|
369
371
|
template: {
|
|
370
372
|
game_modes: {
|
|
371
373
|
NONE: "未知",
|
|
@@ -792,7 +794,7 @@ var require_en_US_template = __commonJS({
|
|
|
792
794
|
// src/locales/en-US.yml
|
|
793
795
|
var require_en_US = __commonJS({
|
|
794
796
|
"src/locales/en-US.yml"(exports2, module2) {
|
|
795
|
-
module2.exports = { dota2tracker: { heroes_nicknames: { "0": 'Please strictly follow the format of "", "" when filling out, if the format is incorrect, only the default name of the hero will be used. The default name of the hero may be omitted.', "1": '"Anti-Mage"', "2": '"Axe"', "3": '"Bane"', "4": '"Bloodseeker"', "5": '"Crystal Maiden"', "6": '"Drow Ranger"', "7": '"Earthshaker"', "8": '"Juggernaut"', "9": '"Mirana"', "10": '"Morphling"', "11": '"Shadow Fiend"', "12": '"Phantom Lancer"', "13": '"Puck"', "14": '"Pudge"', "15": '"Razor"', "16": '"Sand King"', "17": '"Storm Spirit"', "18": '"Sven"', "19": '"Tiny"', "20": '"Vengeful Spirit"', "21": '"Windranger"', "22": '"Zeus"', "23": '"Kunkka"', "25": '"Lina"', "26": '"Lion"', "27": '"Shadow Shaman"', "28": '"Slardar"', "29": '"Tidehunter"', "30": '"Witch Doctor"', "31": '"Lich"', "32": '"Riki"', "33": '"Enigma"', "34": '"Tinker"', "35": '"Sniper"', "36": '"Necrophos"', "37": '"Warlock"', "38": '"Beastmaster"', "39": '"Queen of Pain"', "40": '"Venomancer"', "41": '"Faceless Void"', "42": '"Wraith King"', "43": '"Death Prophet"', "44": '"Phantom Assassin"', "45": '"Pugna"', "46": '"Templar Assassin"', "47": '"Viper"', "48": '"Luna"', "49": '"Dragon Knight"', "50": '"Dazzle"', "51": '"Clockwerk"', "52": '"Leshrac"', "53": `"Nature's Prophet"`, "54": '"Lifestealer"', "55": '"Dark Seer"', "56": '"Clinkz"', "57": '"Omniknight"', "58": '"Enchantress"', "59": '"Huskar"', "60": '"Night Stalker"', "61": '"Broodmother"', "62": '"Bounty Hunter"', "63": '"Weaver"', "64": '"Jakiro"', "65": '"Batrider"', "66": '"Chen"', "67": '"Spectre"', "68": '"Ancient Apparition"', "69": '"Doom"', "70": '"Ursa"', "71": '"Spirit Breaker"', "72": '"Gyrocopter"', "73": '"Alchemist"', "74": '"Invoker"', "75": '"Silencer"', "76": '"Outworld Devourer"', "77": '"Lycan"', "78": '"Brewmaster"', "79": '"Shadow Demon"', "80": '"Lone Druid"', "81": '"Chaos Knight"', "82": '"Meepo"', "83": '"Treant Protector"', "84": '"Ogre Magi"', "85": '"Undying"', "86": '"Rubick"', "87": '"Disruptor"', "88": '"Nyx Assassin"', "89": '"Naga Siren"', "90": '"Keeper of the Light"', "91": '"Io"', "92": '"Visage"', "93": '"Slark"', "94": '"Medusa"', "95": '"Troll Warlord"', "96": '"Centaur Warrunner"', "97": '"Magnus"', "98": '"Timbersaw"', "99": '"Bristleback"', "100": '"Tusk"', "101": '"Skywrath Mage"', "102": '"Abaddon"', "103": '"Elder Titan"', "104": '"Legion Commander"', "105": '"Techies"', "106": '"Ember Spirit"', "107": '"Earth Spirit"', "108": '"Underlord"', "109": '"Terrorblade"', "110": '"Phoenix"', "111": '"Oracle"', "112": '"Winter Wyvern"', "113": '"Arc Warden"', "114": '"Monkey King"', "119": '"Dark Willow"', "120": '"Pangolier"', "121": '"Grimstroke"', "123": '"Hoodwink"', "126": '"Void Spirit"', "128": '"Snapfire"', "129": '"Mars"', "131": '"Ring Master"', "135": '"Dawnbreaker"', "136": '"Marci"', "137": '"Primal Beast"', "138": '"Muerta"', "145": '"Kez"' }, broadcast: { WIN_NEGATIVE: `"Won the match by sheer luck", "Won the match by a stroke of bad luck", "Coasted to victory", "Didn't even show up for the team fight, but my teammates won 4v5"`, WIN_POSITIVE: '"Led the team to victory", "Dominated the opponents and secured the win", "Carried the game to victory", "Treated the opponents like pigs and won", "Won again; this game is just so monotonous and dull", "Simply achieved a win in the match"', LOSE_NEGATIVE: '"Got crushed and lost the match", "Lost the match miserably", "Got my head knocked sideways and lost the match with a blown mindset", "Went fishing but got eaten by the fish, lost the match", "Played terribly", "Simply suffered a loss in the match"', LOSE_POSITIVE: `"Lost the match with no way to turn it around", "Gave it my all, but still lost the match", "Though we lost, we still have honor", "Couldn't carry my teammates, lost the match", "Lost again, it hurts; I'd rather it be me losing"`, message: "{name}'s {hero_name} {comment}.\nKDA: {kda}, GPM/XPM: {gpm_xpm}, Last Hits/Denies: {lh_dn}, Damage/Tower Damage: {damage}, Kill/Death Contribution Rate: {kc_dc}", rank_changed: "Player {name} rank changed: {prev.medal} {prev.star} → {curr.medal} {curr.star}" }, logger: { fetch_guilds_failed: "Failed to fetch guild information.", match_tracked: "Tracked the latest unreported match {match.id} from group {#each messageToLogger as item}{item.platform}:{item.guildId} for users [{#each item.players as player}{player.nickName}({player.steamId}){#if player === item.players[item.players.length - 1]}{/if}{#if player !== item.players[item.players.length - 1]} and {/if}{/each}]{#if item !== messageToLogger[messageToLogger.length - 1]}, {/if}{/each}.", parse_request_sent: "The parsing request for match {matchId} has been successfully sent to the STRATZ server.", parse_request_failed: "The parsing request for match {matchId} failed to send.", match_parsed: "Match {matchId} has been parsed, an image was generated and published to {#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}, {/if}{/each}.", match_unparsed: "Match {matchId} exceeded the waiting time [{timeout}] and remains unparsed, an image was generated and published to {#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}, {/if}{/each}.", waiting_for_parse: "Match {matchId} is still being parsed, continue waiting.", report_sent: "Posted {title} on {platform}:{guildId}.", rank_sent: "Posted rank change information of {player.nickName} ({player.steamId}) on {platform}:{guildId}.", ejs_error: "Error rendering EJS template: {error}" } } };
|
|
797
|
+
module2.exports = { dota2tracker: { heroes_nicknames: { "0": 'Please strictly follow the format of "", "" when filling out, if the format is incorrect, only the default name of the hero will be used. The default name of the hero may be omitted.', "1": '"Anti-Mage"', "2": '"Axe"', "3": '"Bane"', "4": '"Bloodseeker"', "5": '"Crystal Maiden"', "6": '"Drow Ranger"', "7": '"Earthshaker"', "8": '"Juggernaut"', "9": '"Mirana"', "10": '"Morphling"', "11": '"Shadow Fiend"', "12": '"Phantom Lancer"', "13": '"Puck"', "14": '"Pudge"', "15": '"Razor"', "16": '"Sand King"', "17": '"Storm Spirit"', "18": '"Sven"', "19": '"Tiny"', "20": '"Vengeful Spirit"', "21": '"Windranger"', "22": '"Zeus"', "23": '"Kunkka"', "25": '"Lina"', "26": '"Lion"', "27": '"Shadow Shaman"', "28": '"Slardar"', "29": '"Tidehunter"', "30": '"Witch Doctor"', "31": '"Lich"', "32": '"Riki"', "33": '"Enigma"', "34": '"Tinker"', "35": '"Sniper"', "36": '"Necrophos"', "37": '"Warlock"', "38": '"Beastmaster"', "39": '"Queen of Pain"', "40": '"Venomancer"', "41": '"Faceless Void"', "42": '"Wraith King"', "43": '"Death Prophet"', "44": '"Phantom Assassin"', "45": '"Pugna"', "46": '"Templar Assassin"', "47": '"Viper"', "48": '"Luna"', "49": '"Dragon Knight"', "50": '"Dazzle"', "51": '"Clockwerk"', "52": '"Leshrac"', "53": `"Nature's Prophet"`, "54": '"Lifestealer"', "55": '"Dark Seer"', "56": '"Clinkz"', "57": '"Omniknight"', "58": '"Enchantress"', "59": '"Huskar"', "60": '"Night Stalker"', "61": '"Broodmother"', "62": '"Bounty Hunter"', "63": '"Weaver"', "64": '"Jakiro"', "65": '"Batrider"', "66": '"Chen"', "67": '"Spectre"', "68": '"Ancient Apparition"', "69": '"Doom"', "70": '"Ursa"', "71": '"Spirit Breaker"', "72": '"Gyrocopter"', "73": '"Alchemist"', "74": '"Invoker"', "75": '"Silencer"', "76": '"Outworld Devourer"', "77": '"Lycan"', "78": '"Brewmaster"', "79": '"Shadow Demon"', "80": '"Lone Druid"', "81": '"Chaos Knight"', "82": '"Meepo"', "83": '"Treant Protector"', "84": '"Ogre Magi"', "85": '"Undying"', "86": '"Rubick"', "87": '"Disruptor"', "88": '"Nyx Assassin"', "89": '"Naga Siren"', "90": '"Keeper of the Light"', "91": '"Io"', "92": '"Visage"', "93": '"Slark"', "94": '"Medusa"', "95": '"Troll Warlord"', "96": '"Centaur Warrunner"', "97": '"Magnus"', "98": '"Timbersaw"', "99": '"Bristleback"', "100": '"Tusk"', "101": '"Skywrath Mage"', "102": '"Abaddon"', "103": '"Elder Titan"', "104": '"Legion Commander"', "105": '"Techies"', "106": '"Ember Spirit"', "107": '"Earth Spirit"', "108": '"Underlord"', "109": '"Terrorblade"', "110": '"Phoenix"', "111": '"Oracle"', "112": '"Winter Wyvern"', "113": '"Arc Warden"', "114": '"Monkey King"', "119": '"Dark Willow"', "120": '"Pangolier"', "121": '"Grimstroke"', "123": '"Hoodwink"', "126": '"Void Spirit"', "128": '"Snapfire"', "129": '"Mars"', "131": '"Ring Master"', "135": '"Dawnbreaker"', "136": '"Marci"', "137": '"Primal Beast"', "138": '"Muerta"', "145": '"Kez"' }, broadcast: { WIN_NEGATIVE: `"Won the match by sheer luck", "Won the match by a stroke of bad luck", "Coasted to victory", "Didn't even show up for the team fight, but my teammates won 4v5"`, WIN_POSITIVE: '"Led the team to victory", "Dominated the opponents and secured the win", "Carried the game to victory", "Treated the opponents like pigs and won", "Won again; this game is just so monotonous and dull", "Simply achieved a win in the match"', LOSE_NEGATIVE: '"Got crushed and lost the match", "Lost the match miserably", "Got my head knocked sideways and lost the match with a blown mindset", "Went fishing but got eaten by the fish, lost the match", "Played terribly", "Simply suffered a loss in the match"', LOSE_POSITIVE: `"Lost the match with no way to turn it around", "Gave it my all, but still lost the match", "Though we lost, we still have honor", "Couldn't carry my teammates, lost the match", "Lost again, it hurts; I'd rather it be me losing"`, message: "{name}'s {hero_name} {comment}.\nKDA: {kda}, GPM/XPM: {gpm_xpm}, Last Hits/Denies: {lh_dn}, Damage/Tower Damage: {damage}, Kill/Death Contribution Rate: {kc_dc}", rank_changed: "Player {name} rank changed: {prev.medal} {prev.star} → {curr.medal} {curr.star}" }, logger: { fetch_guilds_failed: "Failed to fetch guild information.", match_tracked: "Tracked the latest unreported match {match.id} from group {#each messageToLogger as item}{item.platform}:{item.guildId} for users [{#each item.players as player}{player.nickName}({player.steamId}){#if player === item.players[item.players.length - 1]}{/if}{#if player !== item.players[item.players.length - 1]} and {/if}{/each}]{#if item !== messageToLogger[messageToLogger.length - 1]}, {/if}{/each}.", parse_request_sent: "The parsing request for match {matchId} has been successfully sent to the STRATZ server.", parse_request_failed: "The parsing request for match {matchId} failed to send.", match_parsed: "Match {matchId} has been parsed, an image was generated and published to {#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}, {/if}{/each}.", match_unparsed: "Match {matchId} exceeded the waiting time [{timeout}] and remains unparsed, an image was generated and published to {#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}, {/if}{/each}.", waiting_for_parse: "Match {matchId} is still being parsed, continue waiting.", report_sent: "Posted {title} on {platform}:{guildId}.", rank_sent: "Posted rank change information of {player.nickName} ({player.steamId}) on {platform}:{guildId}.", ejs_error: "Error rendering EJS template: {error}", cron_not_enabled: "Cron service is not enabled; match report tracking cannot run." } } };
|
|
796
798
|
}
|
|
797
799
|
});
|
|
798
800
|
|
|
@@ -813,7 +815,7 @@ var require_zh_CN_template = __commonJS({
|
|
|
813
815
|
// src/locales/zh-CN.yml
|
|
814
816
|
var require_zh_CN = __commonJS({
|
|
815
817
|
"src/locales/zh-CN.yml"(exports2, module2) {
|
|
816
|
-
module2.exports = { dota2tracker: { heroes_nicknames: { "0": '请严格遵循 "", "" 格式填写(如下方默认数据,注意是英文半角符号),如果格式有误将仅使用英雄默认名称。可以不包含英雄默认名称。', "1": '"敌法师", "敌法", "AM"', "2": '"斧王"', "3": '"祸乱之源", "祸乱", "水桶腰"', "4": '"血魔"', "5": '"水晶室女", "冰女", "CM"', "6": '"卓尔游侠", "小黑"', "7": '"撼地者", "小牛", "牛头"', "8": '"主宰", "剑圣", "jugg", "奶棒人"', "9": '"米拉娜", "白虎", "pom"', "10": '"变体精灵", "水人"', "11": '"影魔", "影魔王", "SF", "影儿魔儿"', "12": '"幻影长矛手", "PL"', "13": '"帕克"', "14": '"帕吉", "屠夫", "扒鸡", "啪唧"', "15": '"雷泽", "电魂", "电棍"', "16": '"沙王", "SK"', "17": '"风暴之灵", "蓝猫"', "18": '"斯温", "流浪剑客", "流浪"', "19": '"小小"', "20": '"复仇之魂", "复仇", "VS"', "21": '"风行者", "风行", "WR"', "22": '"宙斯"', "23": '"昆卡", "船长"', "25": '"莉娜", "火女"', "26": '"莱恩", "恶魔巫师", "Lion"', "27": '"暗影萨满", "小Y", "小歪"', "28": '"斯拉达", "大鱼", "大鱼人"', "29": '"潮汐猎人", "潮汐", "西瓜皮"', "30": '"巫医"', "31": '"巫妖"', "32": '"力丸", "隐形刺客", "隐刺"', "33": '"谜团"', "34": '"修补匠", "TK", "Tinker"', "35": '"狙击手", "矮人火枪手", "火枪", "传说哥"', "36": '"瘟疫法师", "死灵法", "NEC"', "37": '"术士", "Warlock"', "38": '"兽王"', "39": '"痛苦女王", "女王", "QOP"', "40": '"剧毒术士", "剧毒"', "41": '"虚空假面", "虚空", "JB脸"', "42": '"冥魂大帝", "骷髅王"', "43": '"死亡先知", "DP"', "44": '"幻影刺客", "幻刺", "PA"', "45": '"帕格纳", "骨法", "湮灭法师"', "46": '"圣堂刺客", "圣堂", "TA"', "47": '"冥界亚龙", "毒龙", "Viper"', "48": '"露娜", "月骑", "Luna"', "49": '"龙骑士", "龙骑"', "50": '"戴泽", "暗影牧师", "暗牧"', "51": '"发条技师", "发条"', "52": '"拉席克", "老鹿"', "53": '"先知"', "54": '"噬魂鬼", "小狗"', "55": '"黑暗贤者", "黑贤"', "56": '"克林克兹", "小骷髅"', "57": '"全能骑士", "全能"', "58": '"魅惑魔女", "小鹿"', "59": '"哈斯卡", "神灵", "神灵武士"', "60": '"暗夜魔王", "夜魔"', "61": '"育母蜘蛛", "蜘蛛"', "62": '"赏金猎人", "赏金"', "63": '"编织者", "蚂蚁"', "64": '"杰奇洛", "双头龙"', "65": '"蝙蝠骑士", "蝙蝠"', "66": '"陈", "老陈"', "67": '"幽鬼", "SPE", "UG"', "68": '"远古冰魄", "冰魂"', "69": '"末日使者", "末日", "Doom"', "70": '"熊战士", "拍拍", "拍拍熊"', "71": '"裂魂人", "白牛", "sb"', "72": '"矮人直升机", "飞机"', "73": '"炼金术士", "炼金"', "74": '"祈求者", "卡尔"', "75": '"沉默术士", "沉默"', "76": '"殁境神蚀者", "黑鸟"', "77": '"狼人"', "78": '"酒仙", "熊猫", "熊猫酒仙"', "79": '"暗影恶魔", "毒狗"', "80": '"德鲁伊", "熊德"', "81": '"混沌骑士", "混沌", "CK"', "82": '"米波"', "83": '"树精卫士", "大树", "树精"', "84": '"食人魔魔法师", "蓝胖"', "85": '"不朽尸王", "尸王"', "86": '"拉比克"', "87": '"干扰者", "萨尔"', "88": '"司夜刺客", "小强"', "89": '"娜迦海妖", "小娜迦"', "90": '"光之守卫", "光法"', "91": '"艾欧", "小精灵", "精灵", "IO"', "92": '"维萨吉", "死灵龙", "死灵飞龙"', "93": '"斯拉克", "小鱼", "小鱼人"', "94": '"美杜莎", "一姐", "美杜莎"', "95": '"巨魔战将", "巨魔", "巨馍蘸酱"', "96": '"半人马战行者", "人马", "半人马"', "97": '"马格纳斯", "猛犸"', "98": '"伐木机", "花母鸡"', "99": '"钢背兽", "钢背"', "100": '"巨牙海民", "海民"', "101": '"天怒法师", "天怒"', "102": '"亚巴顿"', "103": '"上古巨神", "大牛"', "104": '"军团指挥官", "军团"', "105": '"工程师", "炸弹", "炸弹人"', "106": '"灰烬之灵", "火猫"', "107": '"大地之灵", "土猫"', "108": '"孽主", "大屁股"', "109": '"恐怖利刃", "TB"', "110": '"凤凰", "烧鸡"', "111": '"神谕者", "神谕"', "112": '"寒冬飞龙", "冰龙"', "113": '"天穹守望者", "电狗"', "114": '"齐天大圣", "大圣"', "119": '"邪影芳灵", "小仙女", "花仙子"', "120": '"石鳞剑士", "滚滚"', "121": '"天涯墨客", "墨客"', "123": '"森海飞霞", "松鼠", "小松鼠", "小松许"', "126": '"虚无之灵", "紫猫"', "128": '"电炎绝手", "老奶奶"', "129": '"玛尔斯"', "131": '"百戏大王"', "135": '"破晓辰星", "大锤"', "136": '"玛西"', "137": '"獸", "畜"', "138": '"琼英碧灵", "奶绿", "绿奶奶"', "145": '"凯", "鸟人"' }, broadcast: { WIN_NEGATIVE: '"侥幸赢得了比赛", "走狗屎运赢得了比赛", "躺赢了比赛", "打团都没来, 队友4V5赢得了比赛"', WIN_POSITIVE: '"带领团队走向了胜利", "暴打对面后赢得了胜利", " CARRY全场赢得了胜利", "把对面当猪宰了, 赢得了胜利", "又赢了, 这游戏就是这么枯燥, 且乏味", "直接进行一个比赛的赢"', LOSE_NEGATIVE: '"被人按在地上摩擦, 输掉了这场比赛", "悲惨地输掉了比赛", "头都被打歪了, 心态爆炸地输掉了比赛", "捕鱼被鱼吃了, 输掉了比赛", "打的是个几把", "直接进行一个比赛的输"', LOSE_POSITIVE: '"无力回天输掉了比赛", "尽力了, 但还是输了比赛", "背靠世界树, 虽败犹荣", "带不动队友, 输了比赛", "又输了, 很难受, 宁愿输的是我"', message: "{name}的{hero_name}{comment}。\nKDA:{kda},GPM/XPM:{gpm_xpm},补刀/反补:{lh_dn},伤害/塔伤:{damage},参战/参葬率:{kc_dc}", rank_changed: "群友 {name} 段位变动:{prev.medal}{prev.star} → {curr.medal}{curr.star}" }, logger: { fetch_guilds_failed: "获取群组信息失败,将继续后续步骤。", match_tracked: "追踪到来自{#each messageToLogger as item}群组 {item.platform}:{item.guildId} 的用户[{#each item.players as player}{player.nickName}({player.steamId}){#if player === item.players[item.players.length - 1]}{/if}{#if player !== item.players[item.players.length - 1]}、{/if}{/each}]{#if item !== messageToLogger[messageToLogger.length - 1]}、{/if}{/each}的尚未播报过的最新比赛 {match.id}。", parse_request_sent: "比赛 {matchId} 解析请求已成功发送至STRATZ服务器。", parse_request_failed: "比赛 {matchId} 解析请求发送失败。", match_parsed: "比赛 {matchId} 已解析,生成图片并发布于{#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}、{/if}{/each}。", match_unparsed: "比赛 {matchId} 超过等待时间[{timeout}]仍未解析,生成图片并发布于{#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}、{/if}{/each}。", waiting_for_parse: "比赛 {matchId} 尚未解析完成,继续等待。", report_sent: "发布{title}于{platform}:{guildId}。", rank_sent: "向{platform}:{guildId}发布{player.nickName}({player.steamId})的段位变动信息。", ejs_error: "EJS模板渲染错误:{error}" } } };
|
|
818
|
+
module2.exports = { dota2tracker: { heroes_nicknames: { "0": '请严格遵循 "", "" 格式填写(如下方默认数据,注意是英文半角符号),如果格式有误将仅使用英雄默认名称。可以不包含英雄默认名称。', "1": '"敌法师", "敌法", "AM"', "2": '"斧王"', "3": '"祸乱之源", "祸乱", "水桶腰"', "4": '"血魔"', "5": '"水晶室女", "冰女", "CM"', "6": '"卓尔游侠", "小黑"', "7": '"撼地者", "小牛", "牛头"', "8": '"主宰", "剑圣", "jugg", "奶棒人"', "9": '"米拉娜", "白虎", "pom"', "10": '"变体精灵", "水人"', "11": '"影魔", "影魔王", "SF", "影儿魔儿"', "12": '"幻影长矛手", "PL"', "13": '"帕克"', "14": '"帕吉", "屠夫", "扒鸡", "啪唧"', "15": '"雷泽", "电魂", "电棍"', "16": '"沙王", "SK"', "17": '"风暴之灵", "蓝猫"', "18": '"斯温", "流浪剑客", "流浪"', "19": '"小小"', "20": '"复仇之魂", "复仇", "VS"', "21": '"风行者", "风行", "WR"', "22": '"宙斯"', "23": '"昆卡", "船长"', "25": '"莉娜", "火女"', "26": '"莱恩", "恶魔巫师", "Lion"', "27": '"暗影萨满", "小Y", "小歪"', "28": '"斯拉达", "大鱼", "大鱼人"', "29": '"潮汐猎人", "潮汐", "西瓜皮"', "30": '"巫医"', "31": '"巫妖"', "32": '"力丸", "隐形刺客", "隐刺"', "33": '"谜团"', "34": '"修补匠", "TK", "Tinker"', "35": '"狙击手", "矮人火枪手", "火枪", "传说哥"', "36": '"瘟疫法师", "死灵法", "NEC"', "37": '"术士", "Warlock"', "38": '"兽王"', "39": '"痛苦女王", "女王", "QOP"', "40": '"剧毒术士", "剧毒"', "41": '"虚空假面", "虚空", "JB脸"', "42": '"冥魂大帝", "骷髅王"', "43": '"死亡先知", "DP"', "44": '"幻影刺客", "幻刺", "PA"', "45": '"帕格纳", "骨法", "湮灭法师"', "46": '"圣堂刺客", "圣堂", "TA"', "47": '"冥界亚龙", "毒龙", "Viper"', "48": '"露娜", "月骑", "Luna"', "49": '"龙骑士", "龙骑"', "50": '"戴泽", "暗影牧师", "暗牧"', "51": '"发条技师", "发条"', "52": '"拉席克", "老鹿"', "53": '"先知"', "54": '"噬魂鬼", "小狗"', "55": '"黑暗贤者", "黑贤"', "56": '"克林克兹", "小骷髅"', "57": '"全能骑士", "全能"', "58": '"魅惑魔女", "小鹿"', "59": '"哈斯卡", "神灵", "神灵武士"', "60": '"暗夜魔王", "夜魔"', "61": '"育母蜘蛛", "蜘蛛"', "62": '"赏金猎人", "赏金"', "63": '"编织者", "蚂蚁"', "64": '"杰奇洛", "双头龙"', "65": '"蝙蝠骑士", "蝙蝠"', "66": '"陈", "老陈"', "67": '"幽鬼", "SPE", "UG"', "68": '"远古冰魄", "冰魂"', "69": '"末日使者", "末日", "Doom"', "70": '"熊战士", "拍拍", "拍拍熊"', "71": '"裂魂人", "白牛", "sb"', "72": '"矮人直升机", "飞机"', "73": '"炼金术士", "炼金"', "74": '"祈求者", "卡尔"', "75": '"沉默术士", "沉默"', "76": '"殁境神蚀者", "黑鸟"', "77": '"狼人"', "78": '"酒仙", "熊猫", "熊猫酒仙"', "79": '"暗影恶魔", "毒狗"', "80": '"德鲁伊", "熊德"', "81": '"混沌骑士", "混沌", "CK"', "82": '"米波"', "83": '"树精卫士", "大树", "树精"', "84": '"食人魔魔法师", "蓝胖"', "85": '"不朽尸王", "尸王"', "86": '"拉比克"', "87": '"干扰者", "萨尔"', "88": '"司夜刺客", "小强"', "89": '"娜迦海妖", "小娜迦"', "90": '"光之守卫", "光法"', "91": '"艾欧", "小精灵", "精灵", "IO"', "92": '"维萨吉", "死灵龙", "死灵飞龙"', "93": '"斯拉克", "小鱼", "小鱼人"', "94": '"美杜莎", "一姐", "美杜莎"', "95": '"巨魔战将", "巨魔", "巨馍蘸酱"', "96": '"半人马战行者", "人马", "半人马"', "97": '"马格纳斯", "猛犸"', "98": '"伐木机", "花母鸡"', "99": '"钢背兽", "钢背"', "100": '"巨牙海民", "海民"', "101": '"天怒法师", "天怒"', "102": '"亚巴顿"', "103": '"上古巨神", "大牛"', "104": '"军团指挥官", "军团"', "105": '"工程师", "炸弹", "炸弹人"', "106": '"灰烬之灵", "火猫"', "107": '"大地之灵", "土猫"', "108": '"孽主", "大屁股"', "109": '"恐怖利刃", "TB"', "110": '"凤凰", "烧鸡"', "111": '"神谕者", "神谕"', "112": '"寒冬飞龙", "冰龙"', "113": '"天穹守望者", "电狗"', "114": '"齐天大圣", "大圣"', "119": '"邪影芳灵", "小仙女", "花仙子"', "120": '"石鳞剑士", "滚滚"', "121": '"天涯墨客", "墨客"', "123": '"森海飞霞", "松鼠", "小松鼠", "小松许"', "126": '"虚无之灵", "紫猫"', "128": '"电炎绝手", "老奶奶"', "129": '"玛尔斯"', "131": '"百戏大王"', "135": '"破晓辰星", "大锤"', "136": '"玛西"', "137": '"獸", "畜"', "138": '"琼英碧灵", "奶绿", "绿奶奶"', "145": '"凯", "鸟人"' }, broadcast: { WIN_NEGATIVE: '"侥幸赢得了比赛", "走狗屎运赢得了比赛", "躺赢了比赛", "打团都没来, 队友4V5赢得了比赛"', WIN_POSITIVE: '"带领团队走向了胜利", "暴打对面后赢得了胜利", " CARRY全场赢得了胜利", "把对面当猪宰了, 赢得了胜利", "又赢了, 这游戏就是这么枯燥, 且乏味", "直接进行一个比赛的赢"', LOSE_NEGATIVE: '"被人按在地上摩擦, 输掉了这场比赛", "悲惨地输掉了比赛", "头都被打歪了, 心态爆炸地输掉了比赛", "捕鱼被鱼吃了, 输掉了比赛", "打的是个几把", "直接进行一个比赛的输"', LOSE_POSITIVE: '"无力回天输掉了比赛", "尽力了, 但还是输了比赛", "背靠世界树, 虽败犹荣", "带不动队友, 输了比赛", "又输了, 很难受, 宁愿输的是我"', message: "{name}的{hero_name}{comment}。\nKDA:{kda},GPM/XPM:{gpm_xpm},补刀/反补:{lh_dn},伤害/塔伤:{damage},参战/参葬率:{kc_dc}", rank_changed: "群友 {name} 段位变动:{prev.medal}{prev.star} → {curr.medal}{curr.star}" }, logger: { fetch_guilds_failed: "获取群组信息失败,将继续后续步骤。", match_tracked: "追踪到来自{#each messageToLogger as item}群组 {item.platform}:{item.guildId} 的用户[{#each item.players as player}{player.nickName}({player.steamId}){#if player === item.players[item.players.length - 1]}{/if}{#if player !== item.players[item.players.length - 1]}、{/if}{/each}]{#if item !== messageToLogger[messageToLogger.length - 1]}、{/if}{/each}的尚未播报过的最新比赛 {match.id}。", parse_request_sent: "比赛 {matchId} 解析请求已成功发送至STRATZ服务器。", parse_request_failed: "比赛 {matchId} 解析请求发送失败。", match_parsed: "比赛 {matchId} 已解析,生成图片并发布于{#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}、{/if}{/each}。", match_unparsed: "比赛 {matchId} 超过等待时间[{timeout}]仍未解析,生成图片并发布于{#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}、{/if}{/each}。", waiting_for_parse: "比赛 {matchId} 尚未解析完成,继续等待。", report_sent: "发布{title}于{platform}:{guildId}。", rank_sent: "向{platform}:{guildId}发布{player.nickName}({player.steamId})的段位变动信息。", ejs_error: "EJS模板渲染错误:{error}", cron_not_enabled: "未启用cron服务,无法运行战报追踪。" } } };
|
|
817
819
|
}
|
|
818
820
|
});
|
|
819
821
|
|
|
@@ -1032,17 +1034,24 @@ function getFormattedMatchData(matchQuery, constantsQuery) {
|
|
|
1032
1034
|
if (!match.party[player.partyId]) match.party[player.partyId] = party_mark[party_index++];
|
|
1033
1035
|
}
|
|
1034
1036
|
if (player.stats.matchPlayerBuffEvent) {
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1037
|
+
const buffMap = /* @__PURE__ */ new Map();
|
|
1038
|
+
for (const event of player.stats.matchPlayerBuffEvent) {
|
|
1039
|
+
const isAbility = event.abilityId != null;
|
|
1040
|
+
const id = isAbility ? event.abilityId : event.itemId;
|
|
1041
|
+
const type = isAbility ? "ability" : "item";
|
|
1042
|
+
const compositeKey = `${type}|${id}`;
|
|
1043
|
+
const current = buffMap.get(compositeKey);
|
|
1044
|
+
if (!current || event.stackCount > current.stackCount) {
|
|
1045
|
+
buffMap.set(compositeKey, {
|
|
1046
|
+
id,
|
|
1047
|
+
type,
|
|
1048
|
+
stackCount: event.stackCount ?? 0
|
|
1049
|
+
});
|
|
1039
1050
|
}
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
event
|
|
1045
|
-
}));
|
|
1051
|
+
}
|
|
1052
|
+
player.buffs = Array.from(buffMap.values());
|
|
1053
|
+
} else {
|
|
1054
|
+
player.buffs = [];
|
|
1046
1055
|
}
|
|
1047
1056
|
switch (player.lane) {
|
|
1048
1057
|
case "SAFE_LANE":
|
|
@@ -1060,7 +1069,7 @@ function getFormattedMatchData(matchQuery, constantsQuery) {
|
|
|
1060
1069
|
}
|
|
1061
1070
|
let items_timelist = {};
|
|
1062
1071
|
const supportItemIds = [30, 40, 42, 43, 188];
|
|
1063
|
-
|
|
1072
|
+
const supportItemsCount = supportItemIds.reduce((obj, key) => {
|
|
1064
1073
|
obj[key] = 0;
|
|
1065
1074
|
return obj;
|
|
1066
1075
|
}, {});
|
|
@@ -1090,11 +1099,19 @@ function getFormattedMatchData(matchQuery, constantsQuery) {
|
|
|
1090
1099
|
case 42:
|
|
1091
1100
|
case 43:
|
|
1092
1101
|
case 188:
|
|
1093
|
-
|
|
1102
|
+
supportItemsCount[item.itemId]++;
|
|
1094
1103
|
break;
|
|
1095
1104
|
}
|
|
1096
1105
|
}
|
|
1097
1106
|
}
|
|
1107
|
+
player.supportItemsCount = [];
|
|
1108
|
+
for (let itemId in supportItemsCount) {
|
|
1109
|
+
if (supportItemsCount[itemId] === 0) continue;
|
|
1110
|
+
player.supportItemsCount.push({
|
|
1111
|
+
name: dotaconstants.item_ids[itemId],
|
|
1112
|
+
count: supportItemsCount[itemId]
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1098
1115
|
player.items = [];
|
|
1099
1116
|
player.backpacks = [];
|
|
1100
1117
|
const prefix = "recipe_";
|
|
@@ -1180,8 +1197,8 @@ function getFormattedMatchData(matchQuery, constantsQuery) {
|
|
|
1180
1197
|
}
|
|
1181
1198
|
}
|
|
1182
1199
|
if (player.variant != null) {
|
|
1183
|
-
player.facet = constants.facets.find((facet) => facet.id == player.hero.facets[player.variant - 1]
|
|
1184
|
-
player.facet.name = player.facet.language
|
|
1200
|
+
player.facet = constants.facets.find((facet) => facet.id == player.hero.facets[player.variant - 1]?.facetId);
|
|
1201
|
+
player.facet && (player.facet.name = player.facet.language?.displayName ?? player.facet.name);
|
|
1185
1202
|
}
|
|
1186
1203
|
});
|
|
1187
1204
|
let ComparisonMode;
|
|
@@ -1654,7 +1671,8 @@ var globRequire_locales_template_yml = __glob({
|
|
|
1654
1671
|
var name = "dota2tracker";
|
|
1655
1672
|
var usage = "";
|
|
1656
1673
|
var inject = {
|
|
1657
|
-
required: ["http", "database", "
|
|
1674
|
+
required: ["http", "database", "puppeteer", "cache"],
|
|
1675
|
+
optional: ["cron"]
|
|
1658
1676
|
};
|
|
1659
1677
|
var pluginDir2 = import_path2.default.resolve(__dirname, "..");
|
|
1660
1678
|
var pluginVersion = require(import_path2.default.join(pluginDir2, "package.json")).version;
|
|
@@ -1681,7 +1699,7 @@ var Config = import_koishi2.Schema.intersect([
|
|
|
1681
1699
|
})
|
|
1682
1700
|
).default([]).role("table"),
|
|
1683
1701
|
rankBroadSwitch: import_koishi2.Schema.boolean().default(false)
|
|
1684
|
-
}),
|
|
1702
|
+
}).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.message, acc), {})),
|
|
1685
1703
|
import_koishi2.Schema.union([
|
|
1686
1704
|
import_koishi2.Schema.object({
|
|
1687
1705
|
rankBroadSwitch: import_koishi2.Schema.const(true).required(),
|
|
@@ -1690,12 +1708,12 @@ var Config = import_koishi2.Schema.intersect([
|
|
|
1690
1708
|
rankBroadFun: import_koishi2.Schema.boolean().default(false)
|
|
1691
1709
|
}),
|
|
1692
1710
|
import_koishi2.Schema.object({})
|
|
1693
|
-
])
|
|
1694
|
-
])
|
|
1711
|
+
]).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.message, acc), {}))
|
|
1712
|
+
]),
|
|
1695
1713
|
import_koishi2.Schema.intersect([
|
|
1696
1714
|
import_koishi2.Schema.object({
|
|
1697
1715
|
dailyReportSwitch: import_koishi2.Schema.boolean().default(false)
|
|
1698
|
-
}),
|
|
1716
|
+
}).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.report, acc), {})),
|
|
1699
1717
|
import_koishi2.Schema.union([
|
|
1700
1718
|
import_koishi2.Schema.object({
|
|
1701
1719
|
dailyReportSwitch: import_koishi2.Schema.const(true).required(),
|
|
@@ -1703,10 +1721,10 @@ var Config = import_koishi2.Schema.intersect([
|
|
|
1703
1721
|
dailyReportShowCombi: import_koishi2.Schema.boolean().default(true)
|
|
1704
1722
|
}),
|
|
1705
1723
|
import_koishi2.Schema.object({})
|
|
1706
|
-
]),
|
|
1724
|
+
]).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.report, acc), {})),
|
|
1707
1725
|
import_koishi2.Schema.object({
|
|
1708
1726
|
weeklyReportSwitch: import_koishi2.Schema.boolean().default(false)
|
|
1709
|
-
}),
|
|
1727
|
+
}).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.report, acc), {})).description(void 0),
|
|
1710
1728
|
import_koishi2.Schema.union([
|
|
1711
1729
|
import_koishi2.Schema.object({
|
|
1712
1730
|
weeklyReportSwitch: import_koishi2.Schema.const(true).required(),
|
|
@@ -1714,13 +1732,14 @@ var Config = import_koishi2.Schema.intersect([
|
|
|
1714
1732
|
weeklyReportShowCombi: import_koishi2.Schema.boolean().default(true)
|
|
1715
1733
|
}),
|
|
1716
1734
|
import_koishi2.Schema.object({})
|
|
1717
|
-
])
|
|
1718
|
-
])
|
|
1735
|
+
]).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.report, acc), {}))
|
|
1736
|
+
]),
|
|
1719
1737
|
import_koishi2.Schema.object({
|
|
1720
1738
|
template_match: import_koishi2.Schema.union([...readDirectoryFilesSync(import_path2.default.join(pluginDir2, "template", "match"))]).default("match_1"),
|
|
1721
1739
|
template_player: import_koishi2.Schema.union([...readDirectoryFilesSync(import_path2.default.join(pluginDir2, "template", "player"))]).default("player_1"),
|
|
1722
1740
|
template_hero: import_koishi2.Schema.union([...readDirectoryFilesSync(import_path2.default.join(pluginDir2, "template", "hero"))]).default("hero_1"),
|
|
1723
|
-
playerRankEstimate: import_koishi2.Schema.boolean().default(true)
|
|
1741
|
+
playerRankEstimate: import_koishi2.Schema.boolean().default(true),
|
|
1742
|
+
templateFonts: import_koishi2.Schema.array(String).default([]).role("table")
|
|
1724
1743
|
}).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.template, acc), {}))
|
|
1725
1744
|
]);
|
|
1726
1745
|
var pendingMatches = [];
|
|
@@ -1742,6 +1761,8 @@ async function apply(ctx, config) {
|
|
|
1742
1761
|
}, "getLanguageTag");
|
|
1743
1762
|
const GlobalLanguageTag = await getLanguageTag();
|
|
1744
1763
|
usage = $t(GlobalLanguageTag, "dota2tracker.usage");
|
|
1764
|
+
if (!ctx.cron)
|
|
1765
|
+
usage += "\n" + $t(GlobalLanguageTag, "dota2tracker.usage_cron");
|
|
1745
1766
|
ctx.command("dota2tracker.subscribe").alias("订阅本群").action(async ({ session }) => {
|
|
1746
1767
|
if (session.guild) {
|
|
1747
1768
|
let currentGuild = (await ctx.database.get("dt_subscribed_guilds", {
|
|
@@ -2248,6 +2269,7 @@ async function apply(ctx, config) {
|
|
|
2248
2269
|
}
|
|
2249
2270
|
__name(fuzzySearchItems, "fuzzySearchItems");
|
|
2250
2271
|
ctx.on("ready", async () => {
|
|
2272
|
+
if (!ctx.cron) ctx.logger.info($t(GlobalLanguageTag, "dota2tracker.logger.cron_not_enabled"));
|
|
2251
2273
|
ctx.model.extend("dt_subscribed_guilds", { id: "unsigned", guildId: "string", platform: "string" }, { autoInc: true });
|
|
2252
2274
|
ctx.model.extend(
|
|
2253
2275
|
"dt_subscribed_players",
|
|
@@ -2262,178 +2284,180 @@ async function apply(ctx, config) {
|
|
|
2262
2284
|
},
|
|
2263
2285
|
{ autoInc: true }
|
|
2264
2286
|
);
|
|
2265
|
-
if (config.dailyReportSwitch) {
|
|
2287
|
+
if (config.dailyReportSwitch && ctx.cron) {
|
|
2266
2288
|
ctx.cron(`0 ${config.dailyReportHours} * * *`, async function() {
|
|
2267
2289
|
const oneDayAgo = (0, import_moment.default)().subtract(1, "days").unix();
|
|
2268
2290
|
await report(oneDayAgo, "dota2tracker.template.yesterdays_summary", config.dailyReportShowCombi);
|
|
2269
2291
|
});
|
|
2270
2292
|
}
|
|
2271
|
-
if (config.weeklyReportSwitch) {
|
|
2293
|
+
if (config.weeklyReportSwitch && ctx.cron) {
|
|
2272
2294
|
ctx.cron(`0 ${config.weeklyReportDayHours[1]} * * ${config.weeklyReportDayHours[0]}`, async function() {
|
|
2273
2295
|
const oneWeekAgo = (0, import_moment.default)().subtract(1, "weeks").unix();
|
|
2274
2296
|
await report(oneWeekAgo, "dota2tracker.template.last_weeks_summary", config.weeklyReportShowCombi);
|
|
2275
2297
|
});
|
|
2276
2298
|
}
|
|
2277
|
-
ctx.cron
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
tempGuildsByLanguage[languageTag]
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
tempGuild
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2299
|
+
if (ctx.cron) {
|
|
2300
|
+
ctx.cron("* * * * *", async function() {
|
|
2301
|
+
const subscribedGuilds = await ctx.database.get("dt_subscribed_guilds", void 0);
|
|
2302
|
+
const subscribedPlayersInGuild = (await ctx.database.get("dt_subscribed_players", void 0)).filter((player) => subscribedGuilds.some((guild) => guild.guildId == player.guildId));
|
|
2303
|
+
if (subscribedPlayersInGuild.length > 0) {
|
|
2304
|
+
const subscribedPlayersSteamIds = subscribedPlayersInGuild.map((player) => player.steamId).filter(function(value, index, self) {
|
|
2305
|
+
return self.indexOf(value) === index;
|
|
2306
|
+
});
|
|
2307
|
+
const players = (await query("PlayersLastmatchRankinfo", {
|
|
2308
|
+
steamAccountIds: subscribedPlayersSteamIds
|
|
2309
|
+
})).players;
|
|
2310
|
+
const lastMatches = players.map((player) => player.matches[0]).filter((match) => match && match.id).filter((item, index, self) => index === self.findIndex((t) => t.id === item.id)).filter((match) => import_moment.default.unix(match.startDateTime).isAfter((0, import_moment.default)().subtract(1, "days"))).filter((match) => !pendingMatches.some((pendingMatch) => pendingMatch.matchId == match.id));
|
|
2311
|
+
const sendedMatchesIds = [];
|
|
2312
|
+
for await (const sendedMatchesId of ctx.cache.keys("dt_sended_match_id")) {
|
|
2313
|
+
sendedMatchesIds.push(Number(sendedMatchesId));
|
|
2314
|
+
}
|
|
2315
|
+
for (const match of lastMatches.filter((match2) => !sendedMatchesIds.includes(match2.id))) {
|
|
2316
|
+
const tempGuildsByLanguage = {};
|
|
2317
|
+
for (const player of match.players) {
|
|
2318
|
+
const subscribedPlayers = subscribedPlayersInGuild.filter((subscribedPlayer) => subscribedPlayer.steamId === player.steamAccount.id);
|
|
2319
|
+
for (const subscribedPlayer of subscribedPlayers) {
|
|
2320
|
+
if (subscribedPlayer) {
|
|
2321
|
+
const languageTag = await getLanguageTag({ channelId: subscribedPlayer.guildId });
|
|
2322
|
+
if (!tempGuildsByLanguage[languageTag]) {
|
|
2323
|
+
tempGuildsByLanguage[languageTag] = [];
|
|
2324
|
+
}
|
|
2325
|
+
const tempGuild = tempGuildsByLanguage[languageTag].find((guild) => guild.guildId === subscribedPlayer.guildId && guild.platform === subscribedPlayer.platform);
|
|
2326
|
+
if (tempGuild) {
|
|
2327
|
+
tempGuild.players.push(subscribedPlayer);
|
|
2328
|
+
} else {
|
|
2329
|
+
tempGuildsByLanguage[languageTag].push({
|
|
2330
|
+
guildId: subscribedPlayer.guildId,
|
|
2331
|
+
platform: subscribedPlayer.platform,
|
|
2332
|
+
players: [subscribedPlayer]
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2311
2335
|
}
|
|
2312
2336
|
}
|
|
2313
2337
|
}
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
hasMessage: true
|
|
2320
|
-
});
|
|
2321
|
-
const messageToLogger = [];
|
|
2322
|
-
Object.entries(tempGuildsByLanguage).forEach(([languageTag, guilds]) => {
|
|
2323
|
-
guilds.forEach((guild) => {
|
|
2324
|
-
messageToLogger.push({
|
|
2325
|
-
languageTag,
|
|
2326
|
-
platform: guild.platform,
|
|
2327
|
-
guildId: guild.guildId,
|
|
2328
|
-
players: guild.players.map((player) => ({ nickName: player.nickName, steamId: player.steamId }))
|
|
2329
|
-
});
|
|
2338
|
+
pendingMatches.push({
|
|
2339
|
+
matchId: match.id,
|
|
2340
|
+
guilds: tempGuildsByLanguage,
|
|
2341
|
+
queryTime: /* @__PURE__ */ new Date(),
|
|
2342
|
+
hasMessage: true
|
|
2330
2343
|
});
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2344
|
+
const messageToLogger = [];
|
|
2345
|
+
Object.entries(tempGuildsByLanguage).forEach(([languageTag, guilds]) => {
|
|
2346
|
+
guilds.forEach((guild) => {
|
|
2347
|
+
messageToLogger.push({
|
|
2348
|
+
languageTag,
|
|
2349
|
+
platform: guild.platform,
|
|
2350
|
+
guildId: guild.guildId,
|
|
2351
|
+
players: guild.players.map((player) => ({ nickName: player.nickName, steamId: player.steamId }))
|
|
2352
|
+
});
|
|
2353
|
+
});
|
|
2336
2354
|
});
|
|
2337
|
-
ctx.logger.info($t(GlobalLanguageTag,
|
|
2355
|
+
ctx.logger.info($t(GlobalLanguageTag, "dota2tracker.logger.match_tracked", { messageToLogger, match }));
|
|
2356
|
+
if (!match.parsedDateTime) {
|
|
2357
|
+
const response = await query("RequestMatchDataAnalysis", {
|
|
2358
|
+
matchId: match.id
|
|
2359
|
+
});
|
|
2360
|
+
ctx.logger.info($t(GlobalLanguageTag, `dota2tracker.logger.parse_request_${response.stratz.matchRetry ? "sent" : "failed"}`, { matchId: match.id }));
|
|
2361
|
+
}
|
|
2338
2362
|
}
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
)
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2363
|
+
const rankMap = players.reduce((map, player) => {
|
|
2364
|
+
map[player.steamAccount.id] = {
|
|
2365
|
+
rank: player.steamAccount.seasonRank,
|
|
2366
|
+
leader: player.steamAccount.seasonLeaderboardRank
|
|
2367
|
+
};
|
|
2368
|
+
return map;
|
|
2369
|
+
}, {});
|
|
2370
|
+
for (let subPlayer of subscribedPlayersInGuild) {
|
|
2371
|
+
if (subPlayer.rank.rank !== rankMap[subPlayer.steamId].rank || subPlayer.rank.leader !== rankMap[subPlayer.steamId].board) {
|
|
2372
|
+
if (Object.keys(subPlayer.rank).length != 0) {
|
|
2373
|
+
if (config.rankBroadSwitch) {
|
|
2374
|
+
const ranks = ["prevRank", "currRank"].reduce((acc, key) => {
|
|
2375
|
+
const source = key === "prevRank" ? subPlayer.rank : rankMap[subPlayer.steamId];
|
|
2376
|
+
acc[key] = {
|
|
2377
|
+
medal: parseInt(source.rank?.toString().split("")[0] ?? "0"),
|
|
2378
|
+
star: parseInt(source.rank?.toString().split("")[1] ?? "0"),
|
|
2379
|
+
leader: source.leader,
|
|
2380
|
+
inTop100: source.leader ? source.leader <= 10 ? "8c" : source.leader <= 100 ? "8b" : void 0 : void 0
|
|
2381
|
+
};
|
|
2382
|
+
return acc;
|
|
2383
|
+
}, {});
|
|
2384
|
+
const prevRank = ranks["prevRank"];
|
|
2385
|
+
const currRank = ranks["currRank"];
|
|
2386
|
+
if (prevRank.medal !== currRank.medal || prevRank.star !== currRank.star && config.rankBroadStar || prevRank.leader !== currRank.leader && config.rankBroadLeader) {
|
|
2387
|
+
const guildMember = await ctx.bots.find((bot) => bot.platform == subPlayer.platform)?.getGuildMember?.(subPlayer.guildId, subPlayer.userId);
|
|
2388
|
+
const name2 = subPlayer.nickName ?? guildMember?.nick ?? players.find((player) => player.steamAccount.id == subPlayer.steamId)?.steamAccount.name ?? subPlayer.steamId;
|
|
2389
|
+
const languageTag = await getLanguageTag({ channelId: subPlayer.guildId });
|
|
2390
|
+
if (config.rankBroadFun === true) {
|
|
2391
|
+
const img = await ctx.puppeteer.render(
|
|
2392
|
+
await genImageHTML(
|
|
2393
|
+
{
|
|
2394
|
+
name: name2,
|
|
2395
|
+
avatar: guildMember?.avatar ?? players.find((player) => subPlayer.steamId == player.steamAccount.id).steamAccount.avatar,
|
|
2396
|
+
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,
|
|
2397
|
+
prevRank,
|
|
2398
|
+
currRank,
|
|
2399
|
+
date: (0, import_moment.default)()
|
|
2400
|
+
},
|
|
2401
|
+
"rank" + (config.rankBroadFun ? "_fun" : ""),
|
|
2402
|
+
"rank" /* Rank */,
|
|
2403
|
+
ctx,
|
|
2404
|
+
languageTag
|
|
2405
|
+
)
|
|
2406
|
+
);
|
|
2407
|
+
await ctx.broadcast([`${subPlayer.platform}:${subPlayer.guildId}`], img);
|
|
2408
|
+
} else {
|
|
2409
|
+
const message = $t(languageTag, "dota2tracker.broadcast.rank_changed", {
|
|
2410
|
+
name: name2,
|
|
2411
|
+
prev: { medal: $t(languageTag, "dota2tracker.template.ranks." + prevRank.medal), star: prevRank.star },
|
|
2412
|
+
curr: { medal: $t(languageTag, "dota2tracker.template.ranks." + currRank.medal), star: currRank.star }
|
|
2413
|
+
});
|
|
2414
|
+
const img = await ctx.puppeteer.render(await genImageHTML(currRank, "rank" + (config.rankBroadFun ? "2" : ""), "rank" /* Rank */, ctx, languageTag));
|
|
2415
|
+
await ctx.broadcast([`${subPlayer.platform}:${subPlayer.guildId}`], message + img);
|
|
2416
|
+
}
|
|
2417
|
+
ctx.logger.info($t(GlobalLanguageTag, "dota2tracker.logger.rank_sent", { platform: subPlayer.platform, guildId: subPlayer.guildId, player: { nickName: subPlayer.nickName, steamId: subPlayer.steamId } }));
|
|
2393
2418
|
}
|
|
2394
|
-
ctx.logger.info($t(GlobalLanguageTag, "dota2tracker.logger.rank_sent", { platform: subPlayer.platform, guildId: subPlayer.guildId, player: { nickName: subPlayer.nickName, steamId: subPlayer.steamId } }));
|
|
2395
2419
|
}
|
|
2396
2420
|
}
|
|
2421
|
+
ctx.database.set("dt_subscribed_players", subPlayer.id, { rank: rankMap[subPlayer.steamId] });
|
|
2397
2422
|
}
|
|
2398
|
-
ctx.database.set("dt_subscribed_players", subPlayer.id, { rank: rankMap[subPlayer.steamId] });
|
|
2399
2423
|
}
|
|
2400
2424
|
}
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
}
|
|
2425
|
+
if (pendingMatches.length > 0) {
|
|
2426
|
+
const now = (0, import_moment.default)();
|
|
2427
|
+
const pendingMatch = pendingMatches[(now.hours() * 60 + now.minutes()) % pendingMatches.length];
|
|
2428
|
+
try {
|
|
2429
|
+
const matchQuery = await queryMatchData(pendingMatch.matchId);
|
|
2430
|
+
const hasParsedData = matchQuery.match.parsedDateTime && matchQuery.match.players.filter((player) => player?.stats?.heroDamageReport?.dealtTotal).length > 0;
|
|
2431
|
+
const isMatchTimeout = import_moment.default.unix(matchQuery.match.endDateTime).isBefore(now.subtract(config.dataParsingTimeoutMinutes, "minutes"));
|
|
2432
|
+
const isQueryTimeout = (0, import_moment.default)(pendingMatch.queryTime).isBefore(now.subtract(config.dataParsingTimeoutMinutes, "minutes"));
|
|
2433
|
+
if (hasParsedData || isMatchTimeout && isQueryTimeout) {
|
|
2434
|
+
const guildsToLogger = [];
|
|
2435
|
+
for (const languageTag of Object.keys(pendingMatch.guilds)) {
|
|
2436
|
+
let match = await formatMatchData(matchQuery, languageTag);
|
|
2437
|
+
const img = await generateMatchImage(match, languageTag);
|
|
2438
|
+
for (let commingGuild of pendingMatch.guilds[languageTag]) {
|
|
2439
|
+
let broadMatchMessage = pendingMatch.hasMessage ? await generateMatchMessage(match, languageTag, commingGuild) : "";
|
|
2440
|
+
await ctx.broadcast([`${commingGuild.platform}:${commingGuild.guildId}`], broadMatchMessage + (ctx.config.urlInMessageType.some((type) => type == "match") ? "https://stratz.com/matches/" + match.id : "") + img);
|
|
2441
|
+
guildsToLogger.push({
|
|
2442
|
+
matchId: match.id,
|
|
2443
|
+
timeout: config.dataParsingTimeoutMinutes,
|
|
2444
|
+
platform: commingGuild.platform,
|
|
2445
|
+
guildId: commingGuild.guildId,
|
|
2446
|
+
languageTag
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2425
2449
|
}
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2450
|
+
ctx.logger.info($t(GlobalLanguageTag, `dota2tracker.logger.match_${matchQuery.match.parsedDateTime ? "parsed" : "unparsed"}`, { matchId: matchQuery.match.id, guilds: guildsToLogger }));
|
|
2451
|
+
ctx.cache.set("dt_sended_match_id", String(pendingMatch.matchId), void 0, days_30);
|
|
2452
|
+
pendingMatches = pendingMatches.filter((item) => item.matchId != pendingMatch.matchId);
|
|
2453
|
+
} else ctx.logger.info($t(GlobalLanguageTag, "dota2tracker.logger.waiting_for_parse", { matchId: matchQuery.match.id }));
|
|
2454
|
+
} catch (error) {
|
|
2455
|
+
ctx.logger.error(error);
|
|
2456
|
+
await ctx.cache.delete("dt_previous_query_results", String(pendingMatch.matchId));
|
|
2457
|
+
}
|
|
2434
2458
|
}
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2459
|
+
});
|
|
2460
|
+
}
|
|
2437
2461
|
});
|
|
2438
2462
|
async function report(timeAgo, titleKey, showCombi) {
|
|
2439
2463
|
const subscribedGuilds = await ctx.database.get("dt_subscribed_guilds", void 0);
|
|
@@ -2554,7 +2578,8 @@ async function apply(ctx, config) {
|
|
|
2554
2578
|
eh: escapeHTML,
|
|
2555
2579
|
$t: templateI18nHelper,
|
|
2556
2580
|
languageTag,
|
|
2557
|
-
Random: import_koishi3.Random
|
|
2581
|
+
Random: import_koishi3.Random,
|
|
2582
|
+
fontFamily: ctx2.config.templateFonts
|
|
2558
2583
|
};
|
|
2559
2584
|
function templateI18nHelper(key, param) {
|
|
2560
2585
|
return $t(languageTag, key, param);
|