koishi-plugin-tmp-bot 1.2.2 → 1.3.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.
@@ -1,14 +1,14 @@
1
1
  const truckersMpApi = require('../api/TruckersMpApi')
2
2
 
3
- module.exports = async (ctx, cfg) => {
3
+ module.exports = async (ctx, cfg, game) => {
4
4
  // 查询服务器信息
5
5
  let serverData = await truckersMpApi.servers(ctx.http)
6
6
  if (serverData.error) {
7
7
  return '查询服务器失败,请稍后重试'
8
8
  }
9
9
 
10
- // 过滤非欧卡2服务器
11
- let etsServerList = serverData.data.filter(server => server.game === 'ETS2')
10
+ // 过滤服务器
11
+ let etsServerList = serverData.data.filter(server => server.game === game)
12
12
 
13
13
  // 构建消息
14
14
  let message = ''
package/lib/index.js CHANGED
@@ -24,7 +24,8 @@ function apply(ctx, cfg) {
24
24
  model(ctx);
25
25
  // 注册指令
26
26
  ctx.command('tmpquery <tmpId>').action(async ({ session }, tmpId) => await tmpQuery(ctx, cfg, session, tmpId));
27
- ctx.command('tmpserver').action(async () => await tmpServer(ctx, cfg));
27
+ ctx.command('tmpserverats').action(async () => await tmpServer(ctx, cfg, 'ATS'));
28
+ ctx.command('tmpserverets').action(async () => await tmpServer(ctx, cfg, 'ETS2'));
28
29
  ctx.command('tmpbind <tmpId>').action(async ({ session }, tmpId) => await tmpBind(ctx, cfg, session, tmpId));
29
30
  ctx.command('tmptraffic <serverName>').action(async ({ session }, serverName) => await tmpTraffic(ctx, cfg, serverName));
30
31
  ctx.command('tmpposition <tmpId>').action(async ({ session }, tmpId) => await tmpPosition(ctx, cfg, session, tmpId));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-tmp-bot",
3
3
  "description": "欧洲卡车模拟2 TMP查询机器人",
4
- "version": "1.2.2",
4
+ "version": "1.3.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [