koishi-plugin-tmp-bot 1.9.0 → 1.11.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.
package/lib/api/truckersMpApi.js
CHANGED
|
@@ -69,5 +69,24 @@ module.exports = {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
return data
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* 游戏版本
|
|
75
|
+
*/
|
|
76
|
+
async version (http) {
|
|
77
|
+
let result = null
|
|
78
|
+
try {
|
|
79
|
+
result = await http.get(`${BASE_API}/version`)
|
|
80
|
+
} catch {
|
|
81
|
+
return {
|
|
82
|
+
error: true
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 拼接返回数据
|
|
87
|
+
return {
|
|
88
|
+
error: false,
|
|
89
|
+
data: result
|
|
90
|
+
}
|
|
72
91
|
}
|
|
73
92
|
}
|
package/lib/command/tmpQuery.js
CHANGED
|
@@ -12,8 +12,8 @@ const userGroup = {
|
|
|
12
12
|
'Retired Legend': '退役',
|
|
13
13
|
'Game Developer': '游戏开发者',
|
|
14
14
|
'Retired Team Member': '退休团队成员',
|
|
15
|
-
'Add-On Team': '
|
|
16
|
-
'Game Moderator': '
|
|
15
|
+
'Add-On Team': '附加组件团队',
|
|
16
|
+
'Game Moderator': '游戏管理员'
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -48,8 +48,10 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
48
48
|
// 拼接消息模板
|
|
49
49
|
let message = `<img src="${playerInfo.data.avatar}"/>`
|
|
50
50
|
message += '\n😀玩家名称: ' + playerInfo.data.name
|
|
51
|
-
message += '\n
|
|
52
|
-
|
|
51
|
+
message += '\n🎮SteamID: ' + playerInfo.data.steamID64
|
|
52
|
+
let registerDate = dayjs(playerInfo.data.joinDate + 'Z')
|
|
53
|
+
message += '\n📑注册日期: ' + registerDate.format('YYYY年MM月DD日') + ` (${dayjs().diff(registerDate, 'day')}天)`
|
|
54
|
+
message += '\n💼所属分组: ' + (userGroup[playerInfo.data.groupName] || playerInfo.data.groupName)
|
|
53
55
|
if (playerInfo.data.vtc && playerInfo.data.vtc.inVTC) {
|
|
54
56
|
message += '\n🚚所属车队: ' + playerInfo.data.vtc.name
|
|
55
57
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const truckersMpApi = require("../api/truckersMpApi");
|
|
2
|
+
|
|
3
|
+
module.exports = async (ctx) => {
|
|
4
|
+
// 查询版本信息
|
|
5
|
+
let result = await truckersMpApi.version(ctx.http)
|
|
6
|
+
if (result.error) {
|
|
7
|
+
return '查询失败,请稍后再试'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 构建消息返回
|
|
11
|
+
let message = ''
|
|
12
|
+
message += `TMP版本:${result.data.name}\n`;
|
|
13
|
+
message += `欧卡支持版本: ${result.data.supported_game_version}\n`;
|
|
14
|
+
message += `美卡支持版本: ${result.data.supported_ats_game_version}`;
|
|
15
|
+
return message
|
|
16
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const tmpServer = require('./command/tmpServer');
|
|
|
8
8
|
const tmpBind = require('./command/tmpBind');
|
|
9
9
|
const tmpTraffic = require('./command/tmpTraffic/tmpTraffic');
|
|
10
10
|
const tmpPosition = require('./command/tmpPosition');
|
|
11
|
+
const tmpVersion = require('./command/tmpVersion');
|
|
11
12
|
exports.name = 'tmp-bot';
|
|
12
13
|
exports.inject = {
|
|
13
14
|
required: ['database'],
|
|
@@ -37,5 +38,6 @@ function apply(ctx, cfg) {
|
|
|
37
38
|
ctx.command('tmpbind <tmpId>').action(async ({ session }, tmpId) => await tmpBind(ctx, cfg, session, tmpId));
|
|
38
39
|
ctx.command('tmptraffic <serverName>').action(async ({ session }, serverName) => await tmpTraffic(ctx, cfg, serverName));
|
|
39
40
|
ctx.command('tmpposition <tmpId>').action(async ({ session }, tmpId) => await tmpPosition(ctx, cfg, session, tmpId));
|
|
41
|
+
ctx.command('tmpversion').action(async () => await tmpVersion(ctx));
|
|
40
42
|
}
|
|
41
43
|
exports.apply = apply;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-tmp-bot",
|
|
3
3
|
"description": "欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人 QQ:3523283907",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.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",
|