koishi-plugin-tmp-bot 1.18.4 → 1.18.6

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.
@@ -1,5 +1,4 @@
1
- const BASE_API_V3 = 'https://api.truckyapp.com/v3';
2
- const BASE_API_V2 = 'https://api.truckyapp.com/v2';
1
+ const BASE_API = 'https://api.codetabs.com/v1/proxy/?quest=https://api.truckyapp.com';
3
2
  module.exports = {
4
3
  /**
5
4
  * 查询线上信息
@@ -7,7 +6,7 @@ module.exports = {
7
6
  async online(http, tmpId) {
8
7
  let result = null;
9
8
  try {
10
- result = await http.get(`${BASE_API_V3}/map/online?playerID=${tmpId}`);
9
+ result = await http.get(`${BASE_API}/v3/map/online?playerID=${tmpId}`);
11
10
  }
12
11
  catch {
13
12
  return {
@@ -29,7 +28,7 @@ module.exports = {
29
28
  async trafficTop(http, serverName) {
30
29
  let result = null;
31
30
  try {
32
- result = await http.get(`${BASE_API_V2}/traffic/top?game=ets2&server=${serverName}`);
31
+ result = await http.get(`${BASE_API}/v2/traffic/top?game=ets2&server=${serverName}`);
33
32
  }
34
33
  catch {
35
34
  return {
@@ -1,8 +1,12 @@
1
1
  const dayjs = require('dayjs');
2
+ const dayjsRelativeTime = require('dayjs/plugin/relativeTime');
3
+ const dayjsLocaleZhCn = require('dayjs/locale/zh-cn');
2
4
  const guildBind = require('../../database/guildBind');
3
5
  const truckyAppApi = require('../../api/truckyAppApi');
4
6
  const evmOpenApi = require('../../api/evmOpenApi');
5
7
  const baiduTranslate = require('../../util/baiduTranslate');
8
+ dayjs.extend(dayjsRelativeTime);
9
+ dayjs.locale(dayjsLocaleZhCn);
6
10
  /**
7
11
  * 用户组
8
12
  */
@@ -97,6 +101,9 @@ module.exports = async (ctx, cfg, session, tmpId) => {
97
101
  message += ' - ';
98
102
  message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName);
99
103
  }
104
+ else if (playerInfo.data.lastOnlineTime) {
105
+ message += '\n📶上次在线: ' + dayjs(playerInfo.data.lastOnlineTime).fromNow(false);
106
+ }
100
107
  }
101
108
  if (playerInfo.data.isSponsor) {
102
109
  message += '\n🎁赞助用户';
Binary file
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.18.4",
4
+ "version": "1.18.6",
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
@@ -5,16 +5,18 @@
5
5
  欧洲卡车模拟2 TMP查询机器人
6
6
 
7
7
  ### 指令说明
8
- | 指令名称 | 指令介绍 | 使用示例 |
9
- |--------------|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
10
- | tmpbind | 绑定 TMPID,绑定后使用其他指令时可省略输入 | tmpbind 123 |
11
- | tmpquery | 查询TMP玩家信息 | tmpquery 123 |
12
- | tmpposition | 查询玩家位置信息 | tmpposition 123 |
13
- | tmptraffic | 查询服务器热门地点路况信息,仅支持使用服务器简称查询,具体支持查询的服务器和服务器简称信息如下</br>Simulation 1 (简称: s1)</br>Simulation 2 (简称: s2)</br>ProMods (简称: p)</br>Arcade (简称: a) | tmptraffic s1 |
14
- | tmpserverats | 查询美卡服务器信息列表 | tmpserverats |
15
- | tmpserverets | 查询欧卡服务器信息列表 | tmpserverets |
16
- | tmpversion | 查询版本信息 | tmpversion |
17
- | tmpdlcmap | 地图DLC列表 | tmpdlcmap |
8
+ | 指令名称 | 指令介绍 | 使用示例 |
9
+ |------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|------------------------|
10
+ | tmpbind | 绑定 TMPID,绑定后使用其他指令时可省略输入 | tmpbind 123 |
11
+ | tmpquery | 查询TMP玩家信息 | tmpquery 123 |
12
+ | tmpposition | 查询玩家位置信息 | tmpposition 123 |
13
+ | tmptraffic | 查询服务器热门地点路况信息,仅支持使用服务器简称查询,具体支持查询的服务器和服务器简称信息如下</br>Simulation 1 (简称: s1)</br>Simulation 2 (简称: s2)</br>ProMods (简称: p)</br>Arcade (简称: a) | tmptraffic s1 |
14
+ | tmpserverats | 查询美卡服务器信息列表 | tmpserverats |
15
+ | tmpserverets | 查询欧卡服务器信息列表 | tmpserverets |
16
+ | tmpversion | 查询版本信息 | tmpversion |
17
+ | tmpdlcmap | 地图DLC列表 | tmpdlcmap |
18
+ | tmpmileageranking | 总里程排行榜,数据从 2025年8月23日20:00 开始统计,绑定ID后可查看自己的排名 | tmpmileageranking |
19
+ | tmptodaymileageranking | 今日里程排行榜,每日0点重置数据,绑定ID后可查看自己的排名 | tmptodaymileageranking |
18
20
 
19
21
  ### TMP数据接口文档
20
22
  https://apifox.com/apidoc/shared/38508a88-5ff4-4b29-b724-41f9d3d3336a