@sjtdev/koishi-plugin-dota2tracker 1.3.0 → 1.3.1
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 +27 -18
- package/package.json +1 -2
- package/queries/PlayerInfoWith25Matches.graphql +1 -0
- package/queries/PlayersLastmatchRankinfo.graphql +1 -0
- package/queries/VerifyingPlayer.graphql +3 -0
- package/template/guild_member/guild_member.ejs +2 -2
- package/template/player/player_1.ejs +5 -5
- package/template/rank/rank.ejs +35 -35
package/lib/index.js
CHANGED
|
@@ -582,7 +582,7 @@ var require_zh_CN_constants = __commonJS({
|
|
|
582
582
|
// src/locales/en-US.command.yml
|
|
583
583
|
var require_en_US_command = __commonJS({
|
|
584
584
|
"src/locales/en-US.command.yml"(exports2, module2) {
|
|
585
|
-
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.", options: { parse: "Whether to wait for match data parsing" }, examples: "query-match 1234567890\nquery-match 1234567890 -p\nquery-match 1234567890 --parse", 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.", waiting_for_parse: "Match data has not been parsed yet, a parse request has been sent to the server. The battle report will be sent once parsing is complete or times out." } }, "query-recent-match": { description: "Query the most recent match data and generate a picture.", options: { parse: "Whether to wait for match data parsing" }, 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\nquery-recent-match 123456789 -p\nquery-recent-match John --parse", 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\nquery-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." } } } } };
|
|
585
|
+
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)", is_anonymous: 'Please note: Your Steam player data is not public, and you will not be able to use the main functions of the BOT, such as "battle report tracking," "query-recent-match commands," etc.\nIf you need to make data public, please set it to public in the DOTA2 game settings.' } }, 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.", options: { parse: "Whether to wait for match data parsing" }, examples: "query-match 1234567890\nquery-match 1234567890 -p\nquery-match 1234567890 --parse", 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.", waiting_for_parse: "Match data has not been parsed yet, a parse request has been sent to the server. The battle report will be sent once parsing is complete or times out." } }, "query-recent-match": { description: "Query the most recent match data and generate a picture.", options: { parse: "Whether to wait for match data parsing" }, 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\nquery-recent-match 123456789 -p\nquery-recent-match John --parse", 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.", is_anonymous: "Your player data is not public, and recent match data cannot be obtained.\nIf you need to make data public, please set it to public in the DOTA2 game settings." } }, "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\nquery-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." } } } } };
|
|
586
586
|
}
|
|
587
587
|
});
|
|
588
588
|
|
|
@@ -603,7 +603,7 @@ var require_en_US = __commonJS({
|
|
|
603
603
|
// src/locales/zh-CN.command.yml
|
|
604
604
|
var require_zh_CN_command = __commonJS({
|
|
605
605
|
"src/locales/zh-CN.command.yml"(exports2, module2) {
|
|
606
|
-
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的比赛数据,生成图片发布", options: { parse: "是否等待解析比赛数据" }, examples: "查询比赛 1234567890\n查询比赛 1234567890 -p\n查询比赛 1234567890 --parse", messages: { empty_input: "请输入比赛ID。", match_id_invalid: "比赛ID无效。", querying_match: "正在搜索对局详情,请稍后……", query_failed: "获取比赛数据失败。", waiting_for_parse: "比赛数据尚未解析,已发送解析请求到服务器,战报将在解析完成或超时后发送。" } }, "query-recent-match": { description: "查询最近的比赛数据,生成图片发布", options: { parse: "是否等待解析比赛数据" }, usage: "查询指定玩家的最近一场比赛的比赛数据,生成图片发布。\n参数可输入该玩家的SteamID或已在本群绑定玩家的别名,无参数时尝试查询调用指令玩家的SteamID", examples: "查询最近比赛\n查询最近比赛 123456789\n查询最近比赛 张三\n查询最近比赛 123456789 -p\n查询最近比赛 张三 --parse", 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: "查询玩家\n查询玩家 123456789\n查询玩家 张三\n查询玩家 张三 --hero 敌法师\n查询玩家 张三 -o 15", 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: "请输入参数。" } } } } };
|
|
606
|
+
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个字符以内。(也可以留空)", is_anonymous: "请注意:你的Steam玩家数据并未公开,将无法使用BOT的主要功能,如“战报追踪”、“查询最近指令”等。\n如需公开数据,请在DOTA2游戏内设置中公开。" } }, 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的比赛数据,生成图片发布", options: { parse: "是否等待解析比赛数据" }, examples: "查询比赛 1234567890\n查询比赛 1234567890 -p\n查询比赛 1234567890 --parse", messages: { empty_input: "请输入比赛ID。", match_id_invalid: "比赛ID无效。", querying_match: "正在搜索对局详情,请稍后……", query_failed: "获取比赛数据失败。", waiting_for_parse: "比赛数据尚未解析,已发送解析请求到服务器,战报将在解析完成或超时后发送。" } }, "query-recent-match": { description: "查询最近的比赛数据,生成图片发布", options: { parse: "是否等待解析比赛数据" }, usage: "查询指定玩家的最近一场比赛的比赛数据,生成图片发布。\n参数可输入该玩家的SteamID或已在本群绑定玩家的别名,无参数时尝试查询调用指令玩家的SteamID", examples: "查询最近比赛\n查询最近比赛 123456789\n查询最近比赛 张三\n查询最近比赛 123456789 -p\n查询最近比赛 张三 --parse", messages: { not_binded: "无参数时默认从已绑定SteamID玩家中寻找你的信息,但你似乎并没有绑定。\n请在本群绑定SteamID。(可输入【绑定 -h】获取帮助)\n或在指令后跟上希望查询的SteamID或已绑定玩家的别名。", steam_id_invalid: "SteamID无效并且未在本群找到此玩家。", querying_match: "正在搜索对局详情,请稍后……", query_failed: "获取玩家最近比赛失败。", not_in_group: "指令调用失败。\n当前不属于群聊状态,必须提供指定玩家的SteamID。", is_anonymous: "你的比赛数据未公开,无法获取最近比赛数据。\n如需公开数据,请在DOTA2游戏内设置中公开。" } }, "query-player": { description: "查询玩家的个人信息,可指定英雄", options: { hero: "查询玩家指定英雄使用情况(同查询英雄,可用别名或ID)" }, usage: "查询指定玩家的个人信息,生成图片发布,可指定英雄。\n参数可输入该玩家的SteamID或已在本群绑定玩家的别名,无参数时尝试查询调用指令玩家的SteamID", examples: "查询玩家\n查询玩家 123456789\n查询玩家 张三\n查询玩家 张三 --hero 敌法师\n查询玩家 张三 -o 15", 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: "请输入参数。" } } } } };
|
|
607
607
|
}
|
|
608
608
|
});
|
|
609
609
|
|
|
@@ -1036,9 +1036,9 @@ function getFormattedMatchData(matchQuery, constantsQuery) {
|
|
|
1036
1036
|
__name(getFormattedMatchData, "getFormattedMatchData");
|
|
1037
1037
|
function getFormattedPlayerData(playerQuery, playerExtraQuery, genHero) {
|
|
1038
1038
|
const player = playerQuery.player;
|
|
1039
|
-
const playerExtra = playerExtraQuery
|
|
1039
|
+
const playerExtra = playerExtraQuery?.player;
|
|
1040
1040
|
let filteredDotaPlus = {};
|
|
1041
|
-
playerExtra
|
|
1041
|
+
playerExtra?.dotaPlus?.forEach((item) => {
|
|
1042
1042
|
if (!filteredDotaPlus[item.heroId] || filteredDotaPlus[item.heroId].level < item.level) {
|
|
1043
1043
|
filteredDotaPlus[item.heroId] = {
|
|
1044
1044
|
heroId: item.heroId,
|
|
@@ -1046,7 +1046,7 @@ function getFormattedPlayerData(playerQuery, playerExtraQuery, genHero) {
|
|
|
1046
1046
|
};
|
|
1047
1047
|
}
|
|
1048
1048
|
});
|
|
1049
|
-
playerExtra
|
|
1049
|
+
playerExtra?.heroesPerformance?.forEach((hero) => {
|
|
1050
1050
|
if (filteredDotaPlus[hero.hero.id]) {
|
|
1051
1051
|
filteredDotaPlus[hero.hero.id].shortName = hero.hero.shortName;
|
|
1052
1052
|
filteredDotaPlus[hero.hero.id].winCount = hero.winCount;
|
|
@@ -1060,13 +1060,13 @@ function getFormattedPlayerData(playerQuery, playerExtraQuery, genHero) {
|
|
|
1060
1060
|
inTop100: player.steamAccount.seasonLeaderboardRank ? player.steamAccount.seasonLeaderboardRank <= 10 ? "8c" : player.steamAccount.seasonLeaderboardRank <= 100 ? "8b" : void 0 : void 0
|
|
1061
1061
|
};
|
|
1062
1062
|
player.dotaPlus = Object.values(filteredDotaPlus);
|
|
1063
|
-
player.dotaPlus
|
|
1063
|
+
player.dotaPlus?.sort((a, b) => {
|
|
1064
1064
|
if (b.level !== a.level) {
|
|
1065
1065
|
return b.level - a.level;
|
|
1066
1066
|
}
|
|
1067
1067
|
return a.heroId - b.heroId;
|
|
1068
1068
|
});
|
|
1069
|
-
player.heroesPerformanceTop10 = playerExtra
|
|
1069
|
+
player.heroesPerformanceTop10 = playerExtra?.heroesPerformance.slice(0, 10);
|
|
1070
1070
|
if (genHero) {
|
|
1071
1071
|
const { matchCount, winCount, imp } = player.heroesPerformanceTop10[0];
|
|
1072
1072
|
player.matchCount = matchCount;
|
|
@@ -1075,6 +1075,8 @@ function getFormattedPlayerData(playerQuery, playerExtraQuery, genHero) {
|
|
|
1075
1075
|
player.dotaPlus = player.dotaPlus.filter((dpHero) => dpHero.heroId == genHero.heroId);
|
|
1076
1076
|
player.genHero = genHero;
|
|
1077
1077
|
}
|
|
1078
|
+
if (player.steamAccount.isAnonymous) {
|
|
1079
|
+
}
|
|
1078
1080
|
return player;
|
|
1079
1081
|
}
|
|
1080
1082
|
__name(getFormattedPlayerData, "getFormattedPlayerData");
|
|
@@ -1210,7 +1212,7 @@ async function playerisValid(input) {
|
|
|
1210
1212
|
try {
|
|
1211
1213
|
const steamAccountId = parseInt(input);
|
|
1212
1214
|
let queryRes = await query("VerifyingPlayer", { steamAccountId });
|
|
1213
|
-
if (queryRes.player.matchCount != null) return { isValid: true };
|
|
1215
|
+
if (queryRes.player.matchCount != null) return { isValid: true, isAnonymous: queryRes.player.steamAccount.isAnonymous };
|
|
1214
1216
|
else return { isValid: false, reason: ".reason_without_match" };
|
|
1215
1217
|
} catch (error) {
|
|
1216
1218
|
console.error(error);
|
|
@@ -1436,7 +1438,7 @@ async function apply(ctx, config) {
|
|
|
1436
1438
|
session.send(session.text(".nick_name_too_long"));
|
|
1437
1439
|
return;
|
|
1438
1440
|
}
|
|
1439
|
-
session.send(session.text(".bind_success", { userId: session.event.user.id, nickName: nick_name || "", steamId: steam_id }));
|
|
1441
|
+
session.send(session.text(".bind_success", { userId: session.event.user.id, nickName: nick_name || "", steamId: steam_id }) + (verifyRes.isAnonymous ? "\n" + session.text(".is_anonymous") : ""));
|
|
1440
1442
|
ctx.database.create("dt_subscribed_players", {
|
|
1441
1443
|
userId: session.event.user.id,
|
|
1442
1444
|
guildId: session.event.channel.id,
|
|
@@ -1661,9 +1663,14 @@ async function apply(ctx, config) {
|
|
|
1661
1663
|
let lastMatchId = 0;
|
|
1662
1664
|
try {
|
|
1663
1665
|
await session.send(session.text(".querying_match"));
|
|
1664
|
-
|
|
1666
|
+
const lastMatchQuery = await query("PlayersLastmatchRankinfo", {
|
|
1665
1667
|
steamAccountIds: [parseInt(flagBindedPlayer?.steamId ?? input_data)]
|
|
1666
|
-
})
|
|
1668
|
+
});
|
|
1669
|
+
if (lastMatchQuery.players[0].steamAccount.isAnonymous) {
|
|
1670
|
+
await session.send(session.text(".is_anonymous"));
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
lastMatchId = lastMatchQuery.players[0].matches[0]?.id;
|
|
1667
1674
|
} catch (error) {
|
|
1668
1675
|
session.send(session.text(".query_failed"));
|
|
1669
1676
|
ctx.logger.error(error);
|
|
@@ -1706,12 +1713,17 @@ async function apply(ctx, config) {
|
|
|
1706
1713
|
steamAccountId: steamId,
|
|
1707
1714
|
heroIds: heroId
|
|
1708
1715
|
});
|
|
1709
|
-
const playerExtraQuery = await query("PlayerExtraInfo", {
|
|
1716
|
+
const playerExtraQuery = !playerQuery.player.steamAccount.isAnonymous ? await query("PlayerExtraInfo", {
|
|
1710
1717
|
steamAccountId: steamId,
|
|
1711
1718
|
matchCount: playerQuery.player.matchCount,
|
|
1712
1719
|
totalHeroCount: Object.keys(dotaconstants2.heroes).length,
|
|
1713
1720
|
heroIds: heroId
|
|
1714
|
-
})
|
|
1721
|
+
}) : {
|
|
1722
|
+
player: {
|
|
1723
|
+
heroesPerformance: [],
|
|
1724
|
+
dotaPlus: null
|
|
1725
|
+
}
|
|
1726
|
+
};
|
|
1715
1727
|
const player = getFormattedPlayerData(playerQuery, playerExtraQuery, heroId ? { heroId, name: constantLocales[languageTag].dota2tracker.template.hero_names[heroId] } : null);
|
|
1716
1728
|
session.send(
|
|
1717
1729
|
(ctx.config.urlInMessageType.some((type) => type == "player") ? "https://stratz.com/players/" + player.steamAccount.id : "") + await ctx.puppeteer.render(await genImageHTML(player, config.template_player, "player" /* Player */, ctx, languageTag))
|
|
@@ -1824,7 +1836,7 @@ async function apply(ctx, config) {
|
|
|
1824
1836
|
const players = (await query("PlayersLastmatchRankinfo", {
|
|
1825
1837
|
steamAccountIds: subscribedPlayersSteamIds
|
|
1826
1838
|
})).players;
|
|
1827
|
-
const lastMatches = players.map((player) => player.matches[0]).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));
|
|
1839
|
+
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));
|
|
1828
1840
|
const sendedMatchesIds = [];
|
|
1829
1841
|
for await (const sendedMatchesId of ctx.cache.keys("dt_sended_match_id")) {
|
|
1830
1842
|
sendedMatchesIds.push(Number(sendedMatchesId));
|
|
@@ -1950,10 +1962,7 @@ async function apply(ctx, config) {
|
|
|
1950
1962
|
const img = await generateMatchImage(match, languageTag);
|
|
1951
1963
|
for (let commingGuild of pendingMatch.guilds[languageTag]) {
|
|
1952
1964
|
let broadMatchMessage = pendingMatch.hasMessage ? await generateMatchMessage(match, languageTag, commingGuild) : "";
|
|
1953
|
-
await ctx.broadcast(
|
|
1954
|
-
[`${commingGuild.platform}:${commingGuild.guildId}`],
|
|
1955
|
-
broadMatchMessage + (ctx.config.urlInMessageType.some((type) => type == "match") ? "https://stratz.com/matches/" + match.id : "") + img
|
|
1956
|
-
);
|
|
1965
|
+
await ctx.broadcast([`${commingGuild.platform}:${commingGuild.guildId}`], broadMatchMessage + (ctx.config.urlInMessageType.some((type) => type == "match") ? "https://stratz.com/matches/" + match.id : "") + img);
|
|
1957
1966
|
guildsToLogger.push({
|
|
1958
1967
|
matchId: match.id,
|
|
1959
1968
|
timeout: config.dataParsingTimeoutMinutes,
|
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.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"dota2"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"date-fns": "^4.1.0",
|
|
31
30
|
"dotaconstants": "^9.3.0",
|
|
32
31
|
"ejs": "^3.1.10",
|
|
33
32
|
"moment": "^2.30.1"
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
</head>
|
|
128
128
|
<body>
|
|
129
129
|
<% const users = data;
|
|
130
|
-
users.forEach(player=>{
|
|
130
|
+
users.forEach(player=>{
|
|
131
131
|
player.rank = {
|
|
132
132
|
medal: parseInt(player.steamAccount.seasonRank?.toString().split("")[0] ?? 0),
|
|
133
133
|
star: parseInt(player.steamAccount.seasonRank?.toString().split("")[1] ?? 0),
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
<span>${(playerInMatch.imp > 0 ? "+" : "") + playerInMatch.imp}</span>
|
|
164
164
|
</div>`}).join("")}
|
|
165
165
|
</div>`:0}
|
|
166
|
-
<div class="last_match_date">最近游戏: ${moment(new Date(user.matches[0]
|
|
166
|
+
<div class="last_match_date">最近游戏: ${moment(new Date((user.matches[0]?.startDateTime ?? 0) * 1000)).format("YYYY-MM-DD HH:mm:ss")}</div>
|
|
167
167
|
</div>`).join("")
|
|
168
168
|
%>
|
|
169
169
|
</body>
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
if (match.laneResult in outcomeCounts) {
|
|
378
378
|
outcomeCounts[match.laneResult]++;
|
|
379
379
|
}
|
|
380
|
-
});
|
|
380
|
+
});
|
|
381
381
|
// 无法动态获取tip元素个数
|
|
382
382
|
// const heroesCountPixels = 800 - ($(".tip:not(.row):not(.win_count):not(.lose_count)").length + 1) * 40;
|
|
383
383
|
const heroesCountPixels = 800 - (4+1) * 40;
|
|
@@ -393,7 +393,7 @@
|
|
|
393
393
|
const nearAdjustmentFactor = Math.min(highestCountsTotal.winCount / (highestCountsTotal.winCount + highestCountsTotal.loseCount), highestCountsTotal.loseCount / (highestCountsTotal.winCount + highestCountsTotal.loseCount));
|
|
394
394
|
|
|
395
395
|
const pixelOfPerMatchInNear = (heroesCountPixels / (highestCountsNear?.winCount + highestCountsNear?.loseCount ?? 1)) * nearAdjustmentFactor;
|
|
396
|
-
|
|
396
|
+
|
|
397
397
|
player.positionPerformance=[];
|
|
398
398
|
// 瞎j8定义的各位置代表物品,以后看情况调整
|
|
399
399
|
const positionIcons = ["damage","nuke","armor","speed","healing"];
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
<span><%-$t("dota2tracker.template.winrate_")%>
|
|
438
438
|
<span <%-`style="color:${utils.winRateColor(nearWinCount / nearMatchCount)};"`%>><%-((nearWinCount / nearMatchCount) * 100).toFixed(2)%>%</span>
|
|
439
439
|
</span>
|
|
440
|
-
<span><%-$t("dota2tracker.template.imp_")%><%-(player.performance
|
|
440
|
+
<span><%-$t("dota2tracker.template.imp_")%><%-(player.performance?.imp > 0 ? "+" : "") + player.performance?.imp%></span>
|
|
441
441
|
</p>
|
|
442
442
|
<p class="matches">
|
|
443
443
|
<span><%-$t("dota2tracker.template.lane")%>
|
|
@@ -451,7 +451,7 @@
|
|
|
451
451
|
<div class="rank">
|
|
452
452
|
<img class="medal" src="<%-utils.getImageUrl('medal_' +(player.inTop100??player.rank.medal))%>" alt="" />
|
|
453
453
|
<img class="star" src="<%-utils.getImageUrl('star_' + player.rank.star)%>" alt="" />
|
|
454
|
-
<p><%-player.steamAccount.seasonLeaderboardRank ?? ""%></p>
|
|
454
|
+
<p><%-player.steamAccount.seasonLeaderboardRank ?? ""%></p>
|
|
455
455
|
</div>
|
|
456
456
|
</div>
|
|
457
457
|
<div class="hero_winrate">
|
|
@@ -532,7 +532,7 @@
|
|
|
532
532
|
<%- player.matches.map((match) => {
|
|
533
533
|
const innerPlayer = match.players.find(innerPlayer => player.steamAccount.id == innerPlayer.steamAccount.id);
|
|
534
534
|
innerPlayer.teamKillsCount = match.parsedDateTime ?
|
|
535
|
-
(match[(innerPlayer.isRadiant ? "radiant" : "dire") + "Kills"]?.reduce((acc, cva) => acc + cva, 0) ?? 0) :
|
|
535
|
+
(match[(innerPlayer.isRadiant ? "radiant" : "dire") + "Kills"]?.reduce((acc, cva) => acc + cva, 0) ?? 0) :
|
|
536
536
|
match.players
|
|
537
537
|
.filter(p => p.isRadiant === innerPlayer.isRadiant)
|
|
538
538
|
.reduce((k, p) => k + p.kills, 0);
|
package/template/rank/rank.ejs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<% const rank = data; %>
|
|
2
|
-
<head>
|
|
3
|
-
<style>
|
|
4
|
-
html,
|
|
5
|
-
body {
|
|
6
|
-
width: 128px;
|
|
7
|
-
height: 128px;
|
|
8
|
-
margin: 0;
|
|
9
|
-
padding: 0;
|
|
10
|
-
background-color: #0000;
|
|
11
|
-
}
|
|
12
|
-
div {
|
|
13
|
-
width: 128px;
|
|
14
|
-
height: 128px;
|
|
15
|
-
position: relative;
|
|
16
|
-
}
|
|
17
|
-
div > * {
|
|
18
|
-
position: absolute;
|
|
19
|
-
width: 100%;
|
|
20
|
-
}
|
|
21
|
-
p {
|
|
22
|
-
margin: 0;
|
|
23
|
-
text-align: center;
|
|
24
|
-
color: #fff;
|
|
25
|
-
bottom: 8px;
|
|
26
|
-
font-size: 20px;
|
|
27
|
-
text-shadow: -2px -2px 0 rgba(0, 0, 0, 0.5), 2px -2px 0 rgba(0, 0, 0, 0.5), -2px 2px 0 rgba(0, 0, 0, 0.5), 2px 2px 0 rgba(0, 0, 0, 0.5); /* 描边效果 */
|
|
28
|
-
}
|
|
29
|
-
</style>
|
|
30
|
-
</head>
|
|
31
|
-
<div>
|
|
32
|
-
<img src="<%= utils.getImageUrl('medal_' + (rank.inTop100 ?? rank.medal)) %>" />
|
|
33
|
-
<img src="<%= utils.getImageUrl("star_" + rank.star) %>" />
|
|
34
|
-
<p><%= rank.leader %></p>
|
|
35
|
-
</div>
|
|
1
|
+
<% const rank = data; %>
|
|
2
|
+
<head>
|
|
3
|
+
<style>
|
|
4
|
+
html,
|
|
5
|
+
body {
|
|
6
|
+
width: 128px;
|
|
7
|
+
height: 128px;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
background-color: #0000;
|
|
11
|
+
}
|
|
12
|
+
div {
|
|
13
|
+
width: 128px;
|
|
14
|
+
height: 128px;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
div > * {
|
|
18
|
+
position: absolute;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
p {
|
|
22
|
+
margin: 0;
|
|
23
|
+
text-align: center;
|
|
24
|
+
color: #fff;
|
|
25
|
+
bottom: 8px;
|
|
26
|
+
font-size: 20px;
|
|
27
|
+
text-shadow: -2px -2px 0 rgba(0, 0, 0, 0.5), 2px -2px 0 rgba(0, 0, 0, 0.5), -2px 2px 0 rgba(0, 0, 0, 0.5), 2px 2px 0 rgba(0, 0, 0, 0.5); /* 描边效果 */
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
30
|
+
</head>
|
|
31
|
+
<div>
|
|
32
|
+
<img src="<%= utils.getImageUrl('medal_' + (rank.inTop100 ?? rank.medal)) %>" />
|
|
33
|
+
<img src="<%= utils.getImageUrl("star_" + rank.star) %>" />
|
|
34
|
+
<p><%= rank.leader %></p>
|
|
35
|
+
</div>
|