koishi-plugin-tmp-bot 1.11.0 → 1.12.0

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.
@@ -88,5 +88,28 @@ module.exports = {
88
88
  error: false,
89
89
  data: result
90
90
  }
91
+ },
92
+ /**
93
+ * 查询车队成员信息
94
+ */
95
+ async vtcMember (http, vtcId, memberId) {
96
+ let result = null
97
+ try {
98
+ result = await http.get(`${BASE_API}/vtc/${vtcId}/member/${memberId}`)
99
+ } catch {
100
+ return {
101
+ error: true
102
+ }
103
+ }
104
+
105
+ // 拼接返回数据
106
+ let data = {
107
+ error: JSON.parse(result.error)
108
+ }
109
+ if (!data.error) {
110
+ data.data = result.response
111
+ }
112
+
113
+ return data
91
114
  }
92
115
  }
@@ -47,6 +47,7 @@ module.exports = async (ctx, cfg, session, tmpId) => {
47
47
 
48
48
  // 拼接消息模板
49
49
  let message = `<img src="${playerInfo.data.avatar}"/>`
50
+ message += '\n🆔TMP编号: ' + playerInfo.data.id
50
51
  message += '\n😀玩家名称: ' + playerInfo.data.name
51
52
  message += '\n🎮SteamID: ' + playerInfo.data.steamID64
52
53
  let registerDate = dayjs(playerInfo.data.joinDate + 'Z')
@@ -54,6 +55,14 @@ module.exports = async (ctx, cfg, session, tmpId) => {
54
55
  message += '\n💼所属分组: ' + (userGroup[playerInfo.data.groupName] || playerInfo.data.groupName)
55
56
  if (playerInfo.data.vtc && playerInfo.data.vtc.inVTC) {
56
57
  message += '\n🚚所属车队: ' + playerInfo.data.vtc.name
58
+ // 补充车队信息
59
+ try {
60
+ let vtcMemberResult = await truckersMpApi.vtcMember(ctx.http, playerInfo.data.vtc.id, playerInfo.data.vtc.memberID)
61
+ console.log(vtcMemberResult)
62
+ if (!vtcMemberResult.error) {
63
+ message += '\n🚚车队角色: ' + vtcMemberResult.data.role
64
+ }
65
+ } catch (e) {}
57
66
  }
58
67
  message += '\n🚫是否封禁: ' + (playerInfo.data.banned ? '是' : '否')
59
68
  if (playerInfo.data.banned) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-tmp-bot",
3
- "description": "欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人 QQ:3523283907",
4
- "version": "1.11.0",
3
+ "description": "欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人->QQ:3523283907",
4
+ "version": "1.12.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "homepage": "https://github.com/79887143/koishi-plugin-tmp-bot",
package/readme.md CHANGED
@@ -13,3 +13,4 @@
13
13
  | tmptraffic | 查询服务器热门地点路况信息,仅支持使用服务器简称查询,具体支持查询的服务器和服务器简称信息如下</br>Simulation 1 (简称: s1)</br>Simulation 2 (简称: s2)</br>ProMods (简称: p)</br>Arcade (简称: a) | tmptraffic s1 |
14
14
  | tmpserverats | 查询美卡服务器信息列表 | tmpserverats |
15
15
  | tmpserverets | 查询欧卡服务器信息列表 | tmpserverets |
16
+ | tmpversion | 查询版本信息 | tmpversion |