koishi-plugin-tmp-bot 1.11.0 → 1.12.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.
@@ -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
  }
@@ -41,12 +41,10 @@ module.exports = async (ctx, cfg, session, tmpId) => {
41
41
 
42
42
  // 查询线上信息
43
43
  let playerMapInfo = await truckyAppApi.online(ctx.http, tmpId)
44
- if (playerMapInfo.error) {
45
- return '查询玩家信息失败,请重试'
46
- }
47
44
 
48
45
  // 拼接消息模板
49
46
  let message = `<img src="${playerInfo.data.avatar}"/>`
47
+ message += '\n🆔TMP编号: ' + playerInfo.data.id
50
48
  message += '\n😀玩家名称: ' + playerInfo.data.name
51
49
  message += '\n🎮SteamID: ' + playerInfo.data.steamID64
52
50
  let registerDate = dayjs(playerInfo.data.joinDate + 'Z')
@@ -54,6 +52,14 @@ module.exports = async (ctx, cfg, session, tmpId) => {
54
52
  message += '\n💼所属分组: ' + (userGroup[playerInfo.data.groupName] || playerInfo.data.groupName)
55
53
  if (playerInfo.data.vtc && playerInfo.data.vtc.inVTC) {
56
54
  message += '\n🚚所属车队: ' + playerInfo.data.vtc.name
55
+ // 补充车队信息
56
+ try {
57
+ let vtcMemberResult = await truckersMpApi.vtcMember(ctx.http, playerInfo.data.vtc.id, playerInfo.data.vtc.memberID)
58
+ console.log(vtcMemberResult)
59
+ if (!vtcMemberResult.error) {
60
+ message += '\n🚚车队角色: ' + vtcMemberResult.data.role
61
+ }
62
+ } catch (e) {}
57
63
  }
58
64
  message += '\n🚫是否封禁: ' + (playerInfo.data.banned ? '是' : '否')
59
65
  if (playerInfo.data.banned) {
@@ -76,12 +82,14 @@ module.exports = async (ctx, cfg, session, tmpId) => {
76
82
  }
77
83
  }
78
84
  message += '\n🚫封禁次数: ' + playerInfo.data.bansCount || 0
79
- message += '\n📶在线状态: ' + (playerMapInfo.data.online ? `在线🟢 (${playerMapInfo.data.serverDetails.name})` : '离线⚫')
80
- if (playerMapInfo.data.online) {
81
- message += '\n🌍线上位置: '
82
- message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.country)
83
- message += ' - '
84
- message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName)
85
+ if (playerMapInfo && !playerMapInfo.error) {
86
+ message += '\n📶在线状态: ' + (playerMapInfo.data.online ? `在线🟢 (${playerMapInfo.data.serverDetails.name})` : '离线⚫')
87
+ if (playerMapInfo.data.online) {
88
+ message += '\n🌍线上位置: '
89
+ message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.country)
90
+ message += ' - '
91
+ message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName)
92
+ }
85
93
  }
86
94
  let patreon = playerInfo.data.patreon
87
95
  if (patreon && patreon.active) {
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.1",
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 |