koishi-plugin-ets2-tools-tmp 2.3.0 → 2.3.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.
- package/lib/api/evmOpenApi.js +138 -1
- package/lib/api/truckersMpApi.js +133 -1
- package/lib/api/truckersMpMapApi.js +25 -1
- package/lib/api/truckyAppApi.js +48 -1
- package/lib/command/ets-app/queryPoint.js +96 -1
- package/lib/command/ets-app/resetPassword.js +270 -1
- package/lib/command/tmpActivityService.js +603 -1
- package/lib/command/tmpBind.js +19 -1
- package/lib/command/tmpDlcMap.js +33 -1
- package/lib/command/tmpFootprint.js +109 -1
- package/lib/command/tmpMileageRanking.js +55 -1
- package/lib/command/tmpPosition.js +123 -1
- package/lib/command/tmpQuery/tmpQuery.js +12 -1
- package/lib/command/tmpQuery/tmpQueryImg.js +103 -1
- package/lib/command/tmpQuery/tmpQueryText.js +196 -1
- package/lib/command/tmpServer.js +41 -1
- package/lib/command/tmpTraffic/tmpTraffic.js +15 -1
- package/lib/command/tmpTraffic/tmpTrafficMap.js +163 -1
- package/lib/command/tmpTraffic/tmpTrafficText.js +60 -1
- package/lib/command/tmpVersion.js +14 -1
- package/lib/command/tmpVtc.js +29 -1
- package/lib/database/guildBind.js +41 -1
- package/lib/database/model.js +65 -1
- package/lib/database/translateCache.js +31 -1
- package/lib/index.js +331 -1
- package/lib/resource/dlc.html +1 -1
- package/lib/resource/footprint.html +1 -1
- package/lib/resource/package/ets-map.js +63 -1
- package/lib/resource/package/leaflet/heatmap.min.js +9 -1
- package/lib/resource/package/leaflet/leaflet-heatmap.js +246 -1
- package/lib/resource/position.html +1 -1
- package/lib/resource/traffic.html +1 -1
- package/lib/util/baiduTranslate.js +24 -1
- package/lib/util/common.js +5 -1
- package/lib/util/constant.js +36 -1
- package/package.json +1 -1
|
@@ -1 +1,196 @@
|
|
|
1
|
-
const _0x116882=_0x106b;(function(_0x27f32c,_0x54c2ce){const _0x1ad224=_0x106b,_0x3efcb8=_0x27f32c();while(!![]){try{const _0x17e599=-parseInt(_0x1ad224(0x118))/0x1*(parseInt(_0x1ad224(0x10a))/0x2)+parseInt(_0x1ad224(0xb9))/0x3+-parseInt(_0x1ad224(0xe2))/0x4+parseInt(_0x1ad224(0x115))/0x5+-parseInt(_0x1ad224(0xe6))/0x6*(parseInt(_0x1ad224(0xc6))/0x7)+-parseInt(_0x1ad224(0xf1))/0x8*(-parseInt(_0x1ad224(0x104))/0x9)+parseInt(_0x1ad224(0xe5))/0xa;if(_0x17e599===_0x54c2ce)break;else _0x3efcb8['push'](_0x3efcb8['shift']());}catch(_0x505a9f){_0x3efcb8['push'](_0x3efcb8['shift']());}}}(_0x12b4,0xdc866));const _0x3ed108=(function(){let _0x52cfdf=!![];return function(_0x5f5466,_0xc73fe9){const _0xafc610=_0x52cfdf?function(){if(_0xc73fe9){const _0x24f59b=_0xc73fe9['apply'](_0x5f5466,arguments);return _0xc73fe9=null,_0x24f59b;}}:function(){};return _0x52cfdf=![],_0xafc610;};}()),_0x51997a=_0x3ed108(this,function(){const _0x186822=_0x106b;return _0x51997a[_0x186822(0x12a)]()[_0x186822(0xbb)](_0x186822(0x107))[_0x186822(0x12a)]()['constructor'](_0x51997a)['search'](_0x186822(0x107));});function _0x12b4(){const _0x5b7d1a=['tmpActivityService','point','\x20的V2.0积分','sponsorAmount','\x0a\x0a🌟是否Patreon支持者:\x20','\x0a\x0a🚩历史里程:\x20','该用户没有绑定玩家编号','\x20的V1.0积分','游戏管理员','49zoSlgd','\x0a💼所属分组:\x20','get','&tmpName=&teamId=&qq=&state=0&teamRole=','exception','dayjs','/api/user/info/list?token=','avatarUrl','substring','isBan','response','api','day','离线⚫','serverDetails','extend','../../api/truckyAppApi','country','post','banHide','realName','isSponsor','dayjs/locale/zh-cn','dayjs/plugin/relativeTime','\x0a🚚车队角色:\x20','lastOnlineTime','joinDate','\x0a🚩今日里程:\x20','5842412MMCwim','mainSettings','online','25689920WxEOQK','1533822gARFGb','startsWith','\x0a💰全部赞助金额:\x20','indexOf','&tmpId=','YYYY年MM月DD日','apply','附加组件团队','积分查询过程出错:\x20','return\x20(function()\x20','code','40pseBeI','\x0a📑注册日期:\x20','groupName','[TMP_BOT]\x20V1.0用户信息响应:\x20','info','warn','vtcId','platform','null','list','\x0a🚫封禁次数:\x20','\x20-\x20','locale','bind','游戏开发者','tmp_id','fromNow','[TMP_BOT]\x20请求V1.0用户信息:\x20','vtcName','2162007wnAukQ','\x0a😀玩家名称:\x20','vtcHistory','(((.+)+)+)+$','length','退休团队成员','31298ndjnfX','rewardPoints','__proto__','registerTime','banUntil','database','todayMileage','<at\x20','http','[TMP_BOT]\x20V2.0用户信息响应:\x20','{}.constructor(\x22return\x20this\x22)(\x20)','553550bSsgre','stringify','quitDate','34wQlZfe','查询玩家信息失败,请重试','format','tmpId','\x0a📶上次在线:\x20','location','\x0a🚫封禁截止:\x20','logger','id=\x22','constructor','banCount','showAvatar','log','map','../../util/baiduTranslate','<img\x20src=\x22','\x22/>\x0a','[TMP_BOT]\x20请求V2.0用户信息:\x20','toString','\x0a🚫封禁原因:\x20','\x0a🎮SteamID:\x20','\x0a🚚所属车队:\x20','mileage','name','error','&page=0&limit=7&tmpId=','toFixed','https://','exports','0美金','prototype','toLowerCase','trace','[TMP_BOT]\x20tmpQuery:开始查询TmpID\x20','poi','sponsorCumulativeAmount','isJoinVtc','data','../../database/guildBind','2413743QRieFW','console','search','steamId'];_0x12b4=function(){return _0x5b7d1a;};return _0x12b4();}_0x51997a();const _0x2828e1=(function(){let _0x4606dd=!![];return function(_0x4f04ad,_0x17659a){const _0x41c1fc=_0x4606dd?function(){const _0x5e7107=_0x106b;if(_0x17659a){const _0xb453d6=_0x17659a[_0x5e7107(0xec)](_0x4f04ad,arguments);return _0x17659a=null,_0xb453d6;}}:function(){};return _0x4606dd=![],_0x41c1fc;};}()),_0x4ce3c2=_0x2828e1(this,function(){const _0x4bde76=_0x106b,_0x367332=function(){const _0x96d4d1=_0x106b;let _0x402b35;try{_0x402b35=Function(_0x96d4d1(0xef)+_0x96d4d1(0x114)+');')();}catch(_0x2e1951){_0x402b35=window;}return _0x402b35;},_0x3792ba=_0x367332(),_0x1e22e3=_0x3792ba[_0x4bde76(0xba)]=_0x3792ba[_0x4bde76(0xba)]||{},_0x119959=[_0x4bde76(0x124),_0x4bde76(0xf6),_0x4bde76(0xf5),_0x4bde76(0xaa),_0x4bde76(0xca),'table',_0x4bde76(0xb2)];for(let _0x1c2ede=0x0;_0x1c2ede<_0x119959[_0x4bde76(0x108)];_0x1c2ede++){const _0x1744a0=_0x2828e1[_0x4bde76(0x121)][_0x4bde76(0xb0)][_0x4bde76(0xfe)](_0x2828e1),_0x28bddc=_0x119959[_0x1c2ede],_0x2c9cbd=_0x1e22e3[_0x28bddc]||_0x1744a0;_0x1744a0[_0x4bde76(0x10c)]=_0x2828e1['bind'](_0x2828e1),_0x1744a0['toString']=_0x2c9cbd[_0x4bde76(0x12a)][_0x4bde76(0xfe)](_0x2c9cbd),_0x1e22e3[_0x28bddc]=_0x1744a0;}});_0x4ce3c2();const dayjs=require(_0x116882(0xcb)),dayjsRelativeTime=require(_0x116882(0xdd)),dayjsLocaleZhCn=require(_0x116882(0xdc)),guildBind=require(_0x116882(0xb8)),truckyAppApi=require(_0x116882(0xd6)),evmOpenApi=require('../../api/evmOpenApi'),baiduTranslate=require(_0x116882(0x126));function _0x106b(_0x497721,_0x1c19bd){const _0xf1b987=_0x12b4();return _0x106b=function(_0x4ce3c2,_0x2828e1){_0x4ce3c2=_0x4ce3c2-0xa6;let _0x58de4b=_0xf1b987[_0x4ce3c2];return _0x58de4b;},_0x106b(_0x497721,_0x1c19bd);}dayjs[_0x116882(0xd5)](dayjsRelativeTime),dayjs[_0x116882(0xfd)](dayjsLocaleZhCn);const userGroup={'Player':'玩家','Retired\x20Legend':'退役','Game\x20Developer':_0x116882(0xff),'Retired\x20Team\x20Member':_0x116882(0x109),'Add-On\x20Team':_0x116882(0xed),'Game\x20Moderator':_0x116882(0xc5)};module[_0x116882(0xae)]=async(_0x3637ea,_0x38c64a,_0x41a5ad,_0x3ab787)=>{const _0x73ec41=_0x116882,{vtcId:_0x35fe05}=_0x38c64a[_0x73ec41(0xbd)]?.[_0x73ec41(0xd1)]||{};if(_0x3ab787&&_0x3ab787[_0x73ec41(0xe7)](_0x73ec41(0x111))){_0x3ab787[_0x73ec41(0xe7)](_0x73ec41(0x111))&&(queryQQ=_0x3ab787['replace']('<at\x20',''));let _0x36721c='';const _0x1ab23d=queryQQ[_0x73ec41(0xe9)](_0x73ec41(0x120));if(_0x1ab23d!==-0x1){const _0xb228e0=_0x1ab23d+0x4,_0x2ffeee=queryQQ[_0x73ec41(0xe9)]('\x22',_0xb228e0);_0x2ffeee!==-0x1&&(_0x36721c=queryQQ[_0x73ec41(0xce)](_0xb228e0,_0x2ffeee));}queryQQ=_0x36721c;let _0xa7e422=await guildBind[_0x73ec41(0xc8)](_0x3637ea[_0x73ec41(0x10f)],_0x41a5ad[_0x73ec41(0xf8)],queryQQ);if(!_0xa7e422)return _0x73ec41(0xc3);_0x3ab787=_0xa7e422[_0x73ec41(0x100)];}if(!_0x3ab787){let _0xe0fdf3=await guildBind[_0x73ec41(0xc8)](_0x3637ea[_0x73ec41(0x10f)],_0x41a5ad[_0x73ec41(0xf8)],_0x41a5ad['userId']);if(!_0xe0fdf3)return'请输入正确的玩家编号';_0x3ab787=_0xe0fdf3[_0x73ec41(0x100)];}let _0x277081=await evmOpenApi['playerInfo'](_0x3637ea[_0x73ec41(0x112)],_0x3ab787);if(_0x277081[_0x73ec41(0xaa)]&&_0x277081['code']===0x2711)return'玩家不存在';else{if(_0x277081[_0x73ec41(0xaa)])return _0x73ec41(0x119);}let _0x39d542=await truckyAppApi[_0x73ec41(0xe4)](_0x3637ea[_0x73ec41(0x112)],_0x3ab787),_0x1c4e9a='';_0x38c64a['tmpQuery']?.[_0x73ec41(0x123)]&&(_0x1c4e9a+=_0x73ec41(0x127)+_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xcd)]+_0x73ec41(0x128));_0x1c4e9a+='🆔TMP编号:\x20'+_0x277081[_0x73ec41(0xb7)][_0x73ec41(0x11b)],_0x1c4e9a+=_0x73ec41(0x105)+_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xa9)],_0x1c4e9a+=_0x73ec41(0xa6)+_0x277081['data'][_0x73ec41(0xbc)];let _0x3ad140=dayjs(_0x277081['data'][_0x73ec41(0x10d)]);_0x1c4e9a+=_0x73ec41(0xf2)+_0x3ad140['format'](_0x73ec41(0xeb))+('\x20('+dayjs()['diff'](_0x3ad140,_0x73ec41(0xd2))+'天)'),_0x1c4e9a+=_0x73ec41(0xc7)+(userGroup[_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xf3)]]||_0x277081['data']['groupName']);if(_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xb6)]){_0x1c4e9a+=_0x73ec41(0xa7)+_0x277081[_0x73ec41(0xb7)][_0x73ec41(0x103)];_0x38c64a['commands']?.['tmpQueryHistory']&&(_0x277081[_0x73ec41(0xb7)]['vtcHistory']&&_0x277081['data']['vtcHistory']['length']>0x0&&(_0x1c4e9a+='\x0a📜历史车队:\x0a'+_0x277081['data'][_0x73ec41(0x106)][_0x73ec41(0x125)](_0x2d45b2=>'-\x20'+_0x2d45b2[_0x73ec41(0x103)]+'\x0a(加入时间:\x20'+dayjs(_0x2d45b2[_0x73ec41(0xe0)])['format']('YYYY年MM月DD日')+',\x20离开日期:\x20'+dayjs(_0x2d45b2[_0x73ec41(0x117)])[_0x73ec41(0x11a)](_0x73ec41(0xeb))+')')['join']('\x0a')));_0x1c4e9a+=_0x73ec41(0xde)+_0x277081[_0x73ec41(0xb7)]['vtcRole'];if(_0x277081['data'][_0x73ec41(0xf7)]==_0x35fe05){const {url:_0x5c00d1,token:_0xaea03f,logOutput:_0x368ac9,platformVersion:_0x2bbd31}=_0x38c64a[_0x73ec41(0xe3)]?.['settings']||{},_0x138b32=(_0x2bbd31||'v1')[_0x73ec41(0xb1)]();try{let _0x539761=0x0;if(_0x138b32==='v2'){const _0x589bc5=_0x5c00d1,_0x537039=_0x73ec41(0xad)+_0x589bc5+'/members/get?token='+_0xaea03f+_0x73ec41(0xea)+_0x3ab787;_0x368ac9&&(_0x3637ea[_0x73ec41(0x11f)]['info'](_0x73ec41(0xb3)+_0x3ab787+_0x73ec41(0xbf)),_0x3637ea[_0x73ec41(0x11f)][_0x73ec41(0xf5)](_0x73ec41(0x129)+_0x537039));const _0x31155c=await _0x3637ea[_0x73ec41(0x112)]['get'](_0x537039);_0x368ac9&&_0x3637ea[_0x73ec41(0x11f)]['info'](_0x73ec41(0x113)+JSON[_0x73ec41(0x116)](_0x31155c)),_0x31155c[_0x73ec41(0xf0)]===0xc8&&_0x31155c[_0x73ec41(0xb7)]&&(_0x539761=_0x31155c['data'][_0x73ec41(0xbe)]||0x0);}else{_0x368ac9&&_0x3637ea[_0x73ec41(0x11f)][_0x73ec41(0xf5)](_0x73ec41(0xb3)+_0x3ab787+_0x73ec41(0xc4));const _0x22600a=_0x73ec41(0xad)+_0x5c00d1+_0x73ec41(0xcc)+_0xaea03f+_0x73ec41(0xab)+_0x3ab787+_0x73ec41(0xc9);_0x368ac9&&_0x3637ea[_0x73ec41(0x11f)]['info'](_0x73ec41(0x102)+_0x22600a);const _0x15f2bf=await _0x3637ea[_0x73ec41(0x112)][_0x73ec41(0xd8)](_0x22600a);_0x368ac9&&_0x3637ea[_0x73ec41(0x11f)]['info'](_0x73ec41(0xf4)+JSON[_0x73ec41(0x116)](_0x15f2bf));const _0xfc1c86=_0x15f2bf['page']?.[_0x73ec41(0xfa)]||[],_0x26fe0b=_0xfc1c86[0x0];_0x539761=_0x26fe0b[_0x73ec41(0x10b)]||0x0;}_0x1c4e9a+='\x0a⭐\x20当前车队积分:\x20'+_0x539761;}catch(_0x5e612f){_0x3637ea[_0x73ec41(0x11f)][_0x73ec41(0xaa)](_0x73ec41(0xee)+_0x5e612f),_0x5e612f[_0x73ec41(0xd0)]&&(_0x1c4e9a+='查询出错');}}}_0x1c4e9a+='\x0a\x0a🚫是否封禁:\x20'+(_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xcf)]?'是':'否');_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xcf)]&&(_0x1c4e9a+=_0x73ec41(0x11e),_0x277081['data'][_0x73ec41(0xd9)]?_0x1c4e9a+='隐藏':(!_0x277081['data'][_0x73ec41(0x10e)]?_0x1c4e9a+='永久':_0x1c4e9a+=dayjs(_0x277081[_0x73ec41(0xb7)][_0x73ec41(0x10e)])['format']('YYYY年MM月DD日\x20HH:mm'),_0x1c4e9a+=_0x73ec41(0x12b)+(_0x277081[_0x73ec41(0xb7)]['banReasonZh']||_0x277081[_0x73ec41(0xb7)]['banReason'])));_0x1c4e9a+=_0x73ec41(0xfb)+(_0x277081['data'][_0x73ec41(0x122)]||0x0);if(_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xa8)]){let _0x543e51=_0x277081[_0x73ec41(0xb7)]['mileage'],_0x458ba1='米';_0x543e51>0x3e8&&(_0x543e51=(_0x543e51/0x3e8)[_0x73ec41(0xac)](0x1),_0x458ba1='公里'),_0x1c4e9a+=_0x73ec41(0xc2)+_0x543e51+_0x458ba1;}if(_0x277081['data'][_0x73ec41(0x110)]){let _0x6b9a49=_0x277081[_0x73ec41(0xb7)][_0x73ec41(0x110)],_0x277893='米';_0x6b9a49>0x3e8&&(_0x6b9a49=(_0x6b9a49/0x3e8)[_0x73ec41(0xac)](0x1),_0x277893='公里'),_0x1c4e9a+=_0x73ec41(0xe1)+_0x6b9a49+_0x277893;}if(_0x39d542&&!_0x39d542[_0x73ec41(0xaa)]){_0x1c4e9a+='\x0a📶在线状态:\x20'+(_0x39d542[_0x73ec41(0xb7)][_0x73ec41(0xe4)]?'在线🟢\x20('+_0x39d542[_0x73ec41(0xb7)][_0x73ec41(0xd4)][_0x73ec41(0xa9)]+')':_0x73ec41(0xd3));if(_0x39d542[_0x73ec41(0xb7)]['online'])_0x1c4e9a+='\x0a🌍线上位置:\x20',_0x1c4e9a+=await baiduTranslate(_0x3637ea,_0x38c64a,_0x39d542[_0x73ec41(0xb7)][_0x73ec41(0x11d)]['poi'][_0x73ec41(0xd7)]),_0x1c4e9a+=_0x73ec41(0xfc),_0x1c4e9a+=await baiduTranslate(_0x3637ea,_0x38c64a,_0x39d542['data'][_0x73ec41(0x11d)][_0x73ec41(0xb4)][_0x73ec41(0xda)]);else _0x277081[_0x73ec41(0xb7)][_0x73ec41(0xdf)]&&(_0x1c4e9a+=_0x73ec41(0x11c)+dayjs(_0x277081['data'][_0x73ec41(0xdf)])[_0x73ec41(0x101)](![]));}return _0x1c4e9a+=_0x73ec41(0xc1),_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xdb)]?_0x1c4e9a+='是':_0x1c4e9a+='否',_0x1c4e9a+='\x0a💰当前赞助金额:\x20',_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xc0)]==_0x73ec41(0xf9)?_0x1c4e9a+=_0x73ec41(0xaf):_0x1c4e9a+=_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xc0)]/0x64+'美金',_0x1c4e9a+=_0x73ec41(0xe8),_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xb5)]==_0x73ec41(0xf9)?_0x1c4e9a+=_0x73ec41(0xaf):_0x1c4e9a+=_0x277081[_0x73ec41(0xb7)][_0x73ec41(0xb5)]/0x64+'美金',_0x1c4e9a;};
|
|
1
|
+
const dayjs = require('dayjs');
|
|
2
|
+
const dayjsRelativeTime = require('dayjs/plugin/relativeTime');
|
|
3
|
+
const dayjsLocaleZhCn = require('dayjs/locale/zh-cn');
|
|
4
|
+
const guildBind = require('../../database/guildBind');
|
|
5
|
+
const truckyAppApi = require('../../api/truckyAppApi');
|
|
6
|
+
const evmOpenApi = require('../../api/evmOpenApi');
|
|
7
|
+
const baiduTranslate = require('../../util/baiduTranslate');
|
|
8
|
+
dayjs.extend(dayjsRelativeTime);
|
|
9
|
+
dayjs.locale(dayjsLocaleZhCn);
|
|
10
|
+
/**
|
|
11
|
+
* 用户组
|
|
12
|
+
*/
|
|
13
|
+
const userGroup = {
|
|
14
|
+
'Player': '玩家',
|
|
15
|
+
'Retired Legend': '退役',
|
|
16
|
+
'Game Developer': '游戏开发者',
|
|
17
|
+
'Retired Team Member': '退休团队成员',
|
|
18
|
+
'Add-On Team': '附加组件团队',
|
|
19
|
+
'Game Moderator': '游戏管理员'
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 查询玩家信息
|
|
23
|
+
*/
|
|
24
|
+
module.exports = async (ctx, cfg, session, tmpId) => {
|
|
25
|
+
const { vtcId } = cfg.tmpActivityService?.api || {};
|
|
26
|
+
if (tmpId && tmpId.startsWith("<at ")) {
|
|
27
|
+
if (tmpId.startsWith('<at ')) {
|
|
28
|
+
queryQQ = tmpId.replace('<at ', '');
|
|
29
|
+
}
|
|
30
|
+
let id = '';
|
|
31
|
+
const idStart = queryQQ.indexOf('id="');
|
|
32
|
+
if (idStart !== -1) {
|
|
33
|
+
const valueStart = idStart + 4;
|
|
34
|
+
const valueEnd = queryQQ.indexOf('"', valueStart);
|
|
35
|
+
if (valueEnd !== -1) {
|
|
36
|
+
id = queryQQ.substring(valueStart, valueEnd);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
queryQQ = id;
|
|
40
|
+
let guildBindData = await guildBind.get(ctx.database, session.platform, queryQQ);
|
|
41
|
+
if (!guildBindData) {
|
|
42
|
+
return `该用户没有绑定玩家编号`;
|
|
43
|
+
}
|
|
44
|
+
tmpId = guildBindData.tmp_id;
|
|
45
|
+
}
|
|
46
|
+
// 如果没有传入tmpId,尝试从数据库查询绑定信息
|
|
47
|
+
if (!tmpId) {
|
|
48
|
+
let guildBindData = await guildBind.get(ctx.database, session.platform, session.userId);
|
|
49
|
+
if (!guildBindData) {
|
|
50
|
+
return `请输入正确的玩家编号`;
|
|
51
|
+
}
|
|
52
|
+
tmpId = guildBindData.tmp_id;
|
|
53
|
+
}
|
|
54
|
+
// 查询玩家信息
|
|
55
|
+
let playerInfo = await evmOpenApi.playerInfo(ctx.http, tmpId);
|
|
56
|
+
if (playerInfo.error && playerInfo.code === 10001) {
|
|
57
|
+
return '玩家不存在';
|
|
58
|
+
}
|
|
59
|
+
else if (playerInfo.error) {
|
|
60
|
+
return '查询玩家信息失败,请重试';
|
|
61
|
+
}
|
|
62
|
+
// 查询线上信息
|
|
63
|
+
let playerMapInfo = await truckyAppApi.online(ctx.http, tmpId);
|
|
64
|
+
// 拼接消息模板
|
|
65
|
+
let message = '';
|
|
66
|
+
if (cfg.tmpQuery?.showAvatar) {
|
|
67
|
+
message += `<img src="${playerInfo.data.avatarUrl}"/>\n`;
|
|
68
|
+
}
|
|
69
|
+
message += '🆔TMP编号: ' + playerInfo.data.tmpId;
|
|
70
|
+
message += '\n😀玩家名称: ' + playerInfo.data.name;
|
|
71
|
+
message += '\n🎮SteamID: ' + playerInfo.data.steamId;
|
|
72
|
+
let registerDate = dayjs(playerInfo.data.registerTime);
|
|
73
|
+
message += '\n📑注册日期: ' + registerDate.format('YYYY年MM月DD日') + ` (${dayjs().diff(registerDate, 'day')}天)`;
|
|
74
|
+
message += '\n💼所属分组: ' + (userGroup[playerInfo.data.groupName] || playerInfo.data.groupName);
|
|
75
|
+
if (playerInfo.data.isJoinVtc) {
|
|
76
|
+
message += '\n🚚所属车队: ' + playerInfo.data.vtcName;
|
|
77
|
+
if(cfg.commands?.tmpQueryHistory){
|
|
78
|
+
if (playerInfo.data.vtcHistory && playerInfo.data.vtcHistory.length > 0) {
|
|
79
|
+
message += `\n📜历史车队:\n${playerInfo.data.vtcHistory.map(vtc => `- ${vtc.vtcName}\n(加入时间: ${dayjs(vtc.joinDate).format('YYYY年MM月DD日')}, 离开日期: ${dayjs(vtc.quitDate).format('YYYY年MM月DD日')})`).join('\n')}`
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
message += '\n🚚车队角色: ' + playerInfo.data.vtcRole;
|
|
83
|
+
if (playerInfo.data.vtcId == vtcId) {
|
|
84
|
+
const { url, token, logOutput, platformVersion } = cfg.mainSettings?.settings || {};
|
|
85
|
+
const platform = (platformVersion || "v1").toLowerCase();
|
|
86
|
+
try {
|
|
87
|
+
let rewardPoints = 0;
|
|
88
|
+
if (platform === "v2") {
|
|
89
|
+
const baseUrl = url;
|
|
90
|
+
const userInfoUrl = `https://${baseUrl}/members/get?token=${token}&tmpId=${tmpId}`;
|
|
91
|
+
if (logOutput) {
|
|
92
|
+
ctx.logger.info(`[TMP_BOT] tmpQuery:开始查询TmpID ${tmpId} 的V2.0积分`);
|
|
93
|
+
ctx.logger.info(`[TMP_BOT] 请求V2.0用户信息: ${userInfoUrl}`);
|
|
94
|
+
}
|
|
95
|
+
const userInfoResponse = await ctx.http.get(userInfoUrl);
|
|
96
|
+
if (logOutput) {
|
|
97
|
+
ctx.logger.info(`[TMP_BOT] V2.0用户信息响应: ${JSON.stringify(userInfoResponse)}`);
|
|
98
|
+
}
|
|
99
|
+
if (userInfoResponse.code === 200 && userInfoResponse.data) {
|
|
100
|
+
rewardPoints = userInfoResponse.data.point || 0;
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
if (logOutput) {
|
|
104
|
+
ctx.logger.info(`[TMP_BOT] tmpQuery:开始查询TmpID ${tmpId} 的V1.0积分`);
|
|
105
|
+
}
|
|
106
|
+
const userInfoUrl = `https://${url}/api/user/info/list?token=${token}&page=0&limit=7&tmpId=${tmpId}&tmpName=&teamId=&qq=&state=0&teamRole=`;
|
|
107
|
+
if (logOutput) {
|
|
108
|
+
ctx.logger.info(`[TMP_BOT] 请求V1.0用户信息: ${userInfoUrl}`);
|
|
109
|
+
}
|
|
110
|
+
const userInfoResponse = await ctx.http.post(userInfoUrl);
|
|
111
|
+
if (logOutput) {
|
|
112
|
+
ctx.logger.info(`[TMP_BOT] V1.0用户信息响应: ${JSON.stringify(userInfoResponse)}`);
|
|
113
|
+
}
|
|
114
|
+
const userList = userInfoResponse.page?.list || [];
|
|
115
|
+
const userInfo = userList[0];
|
|
116
|
+
rewardPoints = userInfo.rewardPoints || 0;
|
|
117
|
+
}
|
|
118
|
+
message += `\n⭐ 当前车队积分: ${rewardPoints}`;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
ctx.logger.error(`积分查询过程出错: ${error}`);
|
|
121
|
+
if (error.response) {
|
|
122
|
+
message += '查询出错';
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
message += '\n\n🚫是否封禁: ' + (playerInfo.data.isBan ? '是' : '否');
|
|
128
|
+
if (playerInfo.data.isBan) {
|
|
129
|
+
message += '\n🚫封禁截止: ';
|
|
130
|
+
if (playerInfo.data.banHide) {
|
|
131
|
+
message += '隐藏';
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
if (!playerInfo.data.banUntil) {
|
|
135
|
+
message += '永久';
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
message += dayjs(playerInfo.data.banUntil).format('YYYY年MM月DD日 HH:mm');
|
|
139
|
+
}
|
|
140
|
+
message += "\n🚫封禁原因: " + (playerInfo.data.banReasonZh || playerInfo.data.banReason);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
message += '\n🚫封禁次数: ' + (playerInfo.data.banCount || 0);
|
|
144
|
+
if (playerInfo.data.mileage) {
|
|
145
|
+
let mileage = playerInfo.data.mileage;
|
|
146
|
+
let mileageUnit = '米';
|
|
147
|
+
if (mileage > 1000) {
|
|
148
|
+
mileage = (mileage / 1000).toFixed(1);
|
|
149
|
+
mileageUnit = '公里';
|
|
150
|
+
}
|
|
151
|
+
message += '\n\n🚩历史里程: ' + mileage + mileageUnit;
|
|
152
|
+
}
|
|
153
|
+
if (playerInfo.data.todayMileage) {
|
|
154
|
+
let todayMileage = playerInfo.data.todayMileage;
|
|
155
|
+
let mileageUnit = '米';
|
|
156
|
+
if (todayMileage > 1000) {
|
|
157
|
+
todayMileage = (todayMileage / 1000).toFixed(1);
|
|
158
|
+
mileageUnit = '公里';
|
|
159
|
+
}
|
|
160
|
+
message += '\n🚩今日里程: ' + todayMileage + mileageUnit;
|
|
161
|
+
}
|
|
162
|
+
if (playerMapInfo && !playerMapInfo.error) {
|
|
163
|
+
message += '\n📶在线状态: ' + (playerMapInfo.data.online ? `在线🟢 (${playerMapInfo.data.serverDetails.name})` : '离线⚫');
|
|
164
|
+
if (playerMapInfo.data.online) {
|
|
165
|
+
message += '\n🌍线上位置: ';
|
|
166
|
+
message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.country);
|
|
167
|
+
message += ' - ';
|
|
168
|
+
message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName);
|
|
169
|
+
}
|
|
170
|
+
else if (playerInfo.data.lastOnlineTime) {
|
|
171
|
+
message += '\n📶上次在线: ' + dayjs(playerInfo.data.lastOnlineTime).fromNow(false);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
message += '\n\n🌟是否Patreon支持者: '
|
|
175
|
+
if (playerInfo.data.isSponsor) {
|
|
176
|
+
message += '是'
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
message += '否'
|
|
180
|
+
}
|
|
181
|
+
message += '\n💰当前赞助金额: '
|
|
182
|
+
if (playerInfo.data.sponsorAmount == 'null') {
|
|
183
|
+
message += '0美金'
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
message += playerInfo.data.sponsorAmount / 100 + '美金'
|
|
187
|
+
}
|
|
188
|
+
message += '\n💰全部赞助金额: '
|
|
189
|
+
if (playerInfo.data.sponsorCumulativeAmount == 'null') {
|
|
190
|
+
message += '0美金'
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
message += playerInfo.data.sponsorCumulativeAmount / 100 + '美金'
|
|
194
|
+
}
|
|
195
|
+
return message;
|
|
196
|
+
};
|
package/lib/command/tmpServer.js
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
const truckersMpApi = require('../api/truckersMpApi')
|
|
2
|
+
|
|
3
|
+
module.exports = async (ctx, cfg, game) => {
|
|
4
|
+
// 查询服务器信息
|
|
5
|
+
let serverData = await truckersMpApi.servers(ctx.http)
|
|
6
|
+
if (serverData.error) {
|
|
7
|
+
return '查询服务器失败,请稍后重试'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 过滤服务器
|
|
11
|
+
let etsServerList = serverData.data.filter(server => server.game === game)
|
|
12
|
+
|
|
13
|
+
// 构建消息
|
|
14
|
+
let message = ''
|
|
15
|
+
for (let server of etsServerList) {
|
|
16
|
+
// 如果前面有内容,换行
|
|
17
|
+
if (message) {
|
|
18
|
+
message += '\n\n'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message += '服务器: ' + ( server.online ? '🟢' : '⚫' ) + server.name
|
|
22
|
+
message += `\n服务器ID: ${server.id}`
|
|
23
|
+
message += `\n服务器IP: ${server.ip}`
|
|
24
|
+
message += `\n玩家人数: ${server.players}/${server.maxplayers}`
|
|
25
|
+
if (server.queue) {
|
|
26
|
+
message += ` (队列: ${server.queue})`
|
|
27
|
+
}
|
|
28
|
+
// 服务器特性
|
|
29
|
+
let characteristicList = []
|
|
30
|
+
if (!server.afkenabled) {
|
|
31
|
+
characteristicList.push('⏱挂机')
|
|
32
|
+
}
|
|
33
|
+
if (server.collisions) {
|
|
34
|
+
characteristicList.push('💥碰撞')
|
|
35
|
+
}
|
|
36
|
+
if (characteristicList && characteristicList.length > 0) {
|
|
37
|
+
message += '\n服务器特性: ' + characteristicList.join(' ')
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return message
|
|
41
|
+
}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
const
|
|
1
|
+
const tmpTrafficMap = require("./tmpTrafficMap");
|
|
2
|
+
const tmpTrafficText = require("./tmpTrafficText");
|
|
3
|
+
/**
|
|
4
|
+
* 查询路况
|
|
5
|
+
*/
|
|
6
|
+
module.exports = async (ctx, cfg, serverName) => {
|
|
7
|
+
switch (cfg.tmpTraffic?.type) {
|
|
8
|
+
case 1:
|
|
9
|
+
return await tmpTrafficText(ctx, cfg, serverName);
|
|
10
|
+
case 2:
|
|
11
|
+
return await tmpTrafficMap(ctx, cfg, serverName);
|
|
12
|
+
default:
|
|
13
|
+
return '指令配置错误';
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -1 +1,163 @@
|
|
|
1
|
-
const
|
|
1
|
+
const truckyAppApi = require('../../api/truckyAppApi');
|
|
2
|
+
const evmOpenApi = require('../../api/evmOpenApi');
|
|
3
|
+
const baiduTranslate = require('../../util/baiduTranslate');
|
|
4
|
+
const { resolve } = require("path");
|
|
5
|
+
const common = require("../../util/common");
|
|
6
|
+
const { segment } = require("koishi");
|
|
7
|
+
/**
|
|
8
|
+
* 服务器别名
|
|
9
|
+
*/
|
|
10
|
+
const serverAlias = {
|
|
11
|
+
's1': {
|
|
12
|
+
name: 'sim1',
|
|
13
|
+
mapType: 'ets',
|
|
14
|
+
serverId: 2,
|
|
15
|
+
bounds: [[-94189, 93775], [79264, -78999]]
|
|
16
|
+
},
|
|
17
|
+
's2': {
|
|
18
|
+
name: 'sim2',
|
|
19
|
+
mapType: 'ets',
|
|
20
|
+
serverId: 41,
|
|
21
|
+
bounds: [[-94189, 93775], [79264, -78999]]
|
|
22
|
+
},
|
|
23
|
+
'p': {
|
|
24
|
+
name: 'eupromods1',
|
|
25
|
+
mapType: 'promods',
|
|
26
|
+
serverId: 50,
|
|
27
|
+
bounds: [[-96355, 16381], [205581, -70750]]
|
|
28
|
+
},
|
|
29
|
+
'a': {
|
|
30
|
+
name: 'arc1',
|
|
31
|
+
mapType: 'ets',
|
|
32
|
+
serverId: 7,
|
|
33
|
+
bounds: [[-94189, 93775], [79264, -78999]]
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 路况程度转中文
|
|
38
|
+
*/
|
|
39
|
+
const severityToZh = {
|
|
40
|
+
'Fluid': {
|
|
41
|
+
text: '畅通',
|
|
42
|
+
color: '#00d26a'
|
|
43
|
+
},
|
|
44
|
+
'Moderate': {
|
|
45
|
+
text: '正常',
|
|
46
|
+
color: '#ff6723'
|
|
47
|
+
},
|
|
48
|
+
'Congested': {
|
|
49
|
+
text: '缓慢',
|
|
50
|
+
color: '#f8312f'
|
|
51
|
+
},
|
|
52
|
+
'Heavy': {
|
|
53
|
+
text: '拥堵',
|
|
54
|
+
color: '#8d67c5'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 位置类型转中文
|
|
59
|
+
*/
|
|
60
|
+
const typeToZh = {
|
|
61
|
+
'City': '城市',
|
|
62
|
+
'Road': '公路',
|
|
63
|
+
'Intersection': '十字路口'
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* 查询路况
|
|
67
|
+
*/
|
|
68
|
+
module.exports = async (ctx, cfg, serverName) => {
|
|
69
|
+
if (!ctx.puppeteer) {
|
|
70
|
+
return '未启用 puppeteer 服务';
|
|
71
|
+
}
|
|
72
|
+
// 根据别名获取服务器信息
|
|
73
|
+
let serverInfo = serverAlias[serverName];
|
|
74
|
+
if (!serverInfo) {
|
|
75
|
+
return '请输入正确的服务器名称 (s1, s2, p, a)';
|
|
76
|
+
}
|
|
77
|
+
// 查询路况信息
|
|
78
|
+
let trafficData = await truckyAppApi.trafficTop(ctx.http, serverInfo.name);
|
|
79
|
+
if (trafficData.error) {
|
|
80
|
+
return '查询路况信息失败';
|
|
81
|
+
}
|
|
82
|
+
// 查询地图玩家数据
|
|
83
|
+
let mapData = await evmOpenApi.mapPlayerList(ctx.http, serverInfo.serverId, serverInfo.bounds[0][0], serverInfo.bounds[0][1], serverInfo.bounds[1][0], serverInfo.bounds[1][1]);
|
|
84
|
+
|
|
85
|
+
switch (serverName) {
|
|
86
|
+
case 's1':
|
|
87
|
+
case 's2':
|
|
88
|
+
case 'a': {
|
|
89
|
+
let data = {
|
|
90
|
+
mapType: serverInfo.mapType,
|
|
91
|
+
trafficList: [],
|
|
92
|
+
playerCoordinateList: mapData.error && mapData.data ? [] : mapData.data.map(item => [item.axisX, item.axisY])
|
|
93
|
+
};
|
|
94
|
+
for (const traffic of trafficData.data) {
|
|
95
|
+
data.trafficList.push({
|
|
96
|
+
country: await baiduTranslate(ctx, cfg, traffic.country),
|
|
97
|
+
province: await baiduTranslate(ctx, cfg, traffic.name.substring(0, traffic.name.lastIndexOf('(') - 1)),
|
|
98
|
+
playerCount: traffic.players,
|
|
99
|
+
severity: severityToZh[traffic.newSeverity] || { text: '未知', color: '#ffffff' }
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
let page;
|
|
103
|
+
try {
|
|
104
|
+
page = await ctx.puppeteer.page();
|
|
105
|
+
await page.setViewport({ width: 1000, height: 1000 });
|
|
106
|
+
await page.goto(`file:///${resolve(__dirname, '../../resource/traffic.html')}`);
|
|
107
|
+
await page.evaluate(`setData(${JSON.stringify(data)})`);
|
|
108
|
+
await common.sleep(100);
|
|
109
|
+
await page.waitForNetworkIdle();
|
|
110
|
+
const element = await page.$("#container");
|
|
111
|
+
return (segment.image(await element.screenshot({
|
|
112
|
+
encoding: "binary"
|
|
113
|
+
}), "image/jpg"));
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return '渲染异常,请重试';
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
if (page) {
|
|
120
|
+
await page.close();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case 'p': {
|
|
126
|
+
let data = {
|
|
127
|
+
mapType: serverInfo.mapType,
|
|
128
|
+
trafficList: [],
|
|
129
|
+
playerCoordinateList: mapData.error && mapData.data ? [] : mapData.data.map(item => [item.axisX, item.axisY])
|
|
130
|
+
};
|
|
131
|
+
for (const traffic of trafficData.data) {
|
|
132
|
+
data.trafficList.push({
|
|
133
|
+
country: await baiduTranslate(ctx, cfg, traffic.country),
|
|
134
|
+
province: await baiduTranslate(ctx, cfg, traffic.name.substring(0, traffic.name.lastIndexOf('(') - 1)),
|
|
135
|
+
playerCount: traffic.players,
|
|
136
|
+
severity: severityToZh[traffic.newSeverity] || { text: '未知', color: '#ffffff' }
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
let page;
|
|
140
|
+
try {
|
|
141
|
+
page = await ctx.puppeteer.page();
|
|
142
|
+
await page.setViewport({ width: 1200, height: 1200 });
|
|
143
|
+
await page.goto(`file:///${resolve(__dirname, '../../resource/traffic.html')}`);
|
|
144
|
+
await page.evaluate(`setData(${JSON.stringify(data)})`);
|
|
145
|
+
await common.sleep(100);
|
|
146
|
+
await page.waitForNetworkIdle();
|
|
147
|
+
const element = await page.$("#container");
|
|
148
|
+
return (segment.image(await element.screenshot({
|
|
149
|
+
encoding: "binary"
|
|
150
|
+
}), "image/jpg"));
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return '渲染异常,请重试';
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
if (page) {
|
|
157
|
+
await page.close();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
@@ -1 +1,60 @@
|
|
|
1
|
-
const
|
|
1
|
+
const truckyAppApi = require('../../api/truckyAppApi');
|
|
2
|
+
const baiduTranslate = require('../../util/baiduTranslate');
|
|
3
|
+
/**
|
|
4
|
+
* 服务器别名
|
|
5
|
+
*/
|
|
6
|
+
const serverNameAlias = {
|
|
7
|
+
's1': 'sim1',
|
|
8
|
+
's2': 'sim2',
|
|
9
|
+
'p': 'eupromods1',
|
|
10
|
+
'a': 'arc1',
|
|
11
|
+
'S1': 'sim1',
|
|
12
|
+
'S2': 'sim2',
|
|
13
|
+
'P': 'eupromods1',
|
|
14
|
+
'A': 'arc1'
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 路况程度转中文
|
|
18
|
+
*/
|
|
19
|
+
const severityToZh = {
|
|
20
|
+
'Fluid': '🟢畅通',
|
|
21
|
+
'Moderate': '🟠正常',
|
|
22
|
+
'Congested': '🔴缓慢',
|
|
23
|
+
'Heavy': '🟣拥堵'
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 位置类型转中文
|
|
27
|
+
*/
|
|
28
|
+
const typeToZh = {
|
|
29
|
+
'City': '城市',
|
|
30
|
+
'Road': '公路',
|
|
31
|
+
'Intersection': '十字路口'
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 查询路况
|
|
35
|
+
*/
|
|
36
|
+
module.exports = async (ctx, cfg, serverName) => {
|
|
37
|
+
let serverQueryName = serverNameAlias[serverName];
|
|
38
|
+
if (!serverQueryName) {
|
|
39
|
+
return '请输入正确的服务器名称 (s1, s2, p, a)';
|
|
40
|
+
}
|
|
41
|
+
let trafficData = await truckyAppApi.trafficTop(ctx.http, serverQueryName);
|
|
42
|
+
if (trafficData.error) {
|
|
43
|
+
return '查询路况信息失败';
|
|
44
|
+
}
|
|
45
|
+
// 构建消息
|
|
46
|
+
let message = '';
|
|
47
|
+
for (const traffic of trafficData.data) {
|
|
48
|
+
if (message) {
|
|
49
|
+
message += '\n\n';
|
|
50
|
+
}
|
|
51
|
+
message += await baiduTranslate(ctx, cfg, traffic.country);
|
|
52
|
+
message += ' - ';
|
|
53
|
+
let name = traffic.name.substring(0, traffic.name.lastIndexOf('(') - 1);
|
|
54
|
+
let type = traffic.name.substring(traffic.name.lastIndexOf('(') + 1, traffic.name.lastIndexOf(')'));
|
|
55
|
+
message += await baiduTranslate(ctx, cfg, name) + ` (${typeToZh[type] || type})`;
|
|
56
|
+
message += '\n路况: ' + (severityToZh[traffic.newSeverity] || traffic.color);
|
|
57
|
+
message += ' | 人数: ' + traffic.players;
|
|
58
|
+
}
|
|
59
|
+
return message;
|
|
60
|
+
};
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const truckersMpApi = require("../api/truckersMpApi");
|
|
2
|
+
module.exports = async (ctx) => {
|
|
3
|
+
// 查询版本信息
|
|
4
|
+
let result = await truckersMpApi.version(ctx.http);
|
|
5
|
+
if (result.error) {
|
|
6
|
+
return '查询失败,请稍后再试';
|
|
7
|
+
}
|
|
8
|
+
// 构建消息返回
|
|
9
|
+
let message = '';
|
|
10
|
+
message += `TMP版本:${result.data.name}\n`;
|
|
11
|
+
message += `欧卡支持版本: ${result.data.supported_game_version}\n`;
|
|
12
|
+
message += `美卡支持版本: ${result.data.supported_ats_game_version}`;
|
|
13
|
+
return message;
|
|
14
|
+
};
|
package/lib/command/tmpVtc.js
CHANGED
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
const truckersMpApi = require('../api/truckersMpApi')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 查询玩家信息
|
|
5
|
+
*/
|
|
6
|
+
module.exports = async (ctx, cfg, session, vtcid) => {
|
|
7
|
+
if (!vtcid || isNaN(vtcid)) {
|
|
8
|
+
return `请输入正确的vtc编号`
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// 查询玩家信息
|
|
12
|
+
let vtcInfo = await truckersMpApi.vtc(ctx.http, vtcid)
|
|
13
|
+
if (vtcInfo.error) {
|
|
14
|
+
return '查询vtc信息失败,请重试'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 拼接消息模板
|
|
18
|
+
let message = ''
|
|
19
|
+
message += `<img src="${vtcInfo.data.logo}"/>\n`
|
|
20
|
+
message += '🆔VTC编号: ' + vtcInfo.data.id
|
|
21
|
+
message += '\n📑VTC名称: ' + vtcInfo.data.name
|
|
22
|
+
message += '\n📑VTC所有者id: ' + vtcInfo.data.owner_id
|
|
23
|
+
message += '\n📑VTC所有者名称: ' + vtcInfo.data.owner_username
|
|
24
|
+
message += '\n📑VTC创建日期: ' + vtcInfo.data.created + `(UTC)`
|
|
25
|
+
message += '\n🎮VTC人数: ' + vtcInfo.data.members_count
|
|
26
|
+
message += '\n🎮VTC前缀: ' + vtcInfo.data.tag
|
|
27
|
+
message += `\n💼VTC主页: ${vtcInfo.data.website}`
|
|
28
|
+
return message
|
|
29
|
+
}
|