UNPKG

koishi-plugin-tmp-bot

Version:

欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人->QQ:3523283907

50 lines (49 loc) 2.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Config = exports.inject = exports.name = void 0; exports.apply = apply; const koishi_1 = require("koishi"); const model = require('./database/model'); const tmpQuery = require('./command/tmpQuery/tmpQuery'); const tmpServer = require('./command/tmpServer'); const tmpBind = require('./command/tmpBind'); const tmpTraffic = require('./command/tmpTraffic/tmpTraffic'); const tmpPosition = require('./command/tmpPosition'); const tmpVersion = require('./command/tmpVersion'); const tmpDlcMap = require('./command/tmpDlcMap'); exports.name = 'tmp-bot'; exports.inject = { required: ['database'], optional: ['puppeteer'] }; exports.Config = koishi_1.Schema.intersect([ koishi_1.Schema.object({ baiduTranslateEnable: koishi_1.Schema.boolean().default(false).description('启用百度翻译'), baiduTranslateAppId: koishi_1.Schema.string().description('百度翻译APP ID'), baiduTranslateKey: koishi_1.Schema.string().description('百度翻译秘钥'), baiduTranslateCacheEnable: koishi_1.Schema.boolean().default(false).description('启用百度翻译缓存') }).description('基本配置'), koishi_1.Schema.object({ queryShowAvatarEnable: koishi_1.Schema.boolean().default(false).description('查询指令展示头像,部分玩家的擦边头像可能导致封号'), tmpTrafficType: koishi_1.Schema.union([ koishi_1.Schema.const(1).description('文字'), koishi_1.Schema.const(2).description('热力图') ]).default(1).description('路况信息展示方式'), tmpQueryType: koishi_1.Schema.union([ koishi_1.Schema.const(1).description('文字'), koishi_1.Schema.const(2).description('图片') ]).default(1).description('玩家信息展示方式'), }).description('指令配置'), ]); function apply(ctx, cfg) { // 初始化数据表 model(ctx); // 注册指令 ctx.command('tmpquery <tmpId>').action(async ({ session }, tmpId) => await tmpQuery(ctx, cfg, session, tmpId)); ctx.command('tmpserverets').action(async () => await tmpServer(ctx)); ctx.command('tmpbind <tmpId>').action(async ({ session }, tmpId) => await tmpBind(ctx, cfg, session, tmpId)); ctx.command('tmptraffic <serverName>').action(async ({ session }, serverName) => await tmpTraffic(ctx, cfg, serverName)); ctx.command('tmpposition <tmpId>').action(async ({ session }, tmpId) => await tmpPosition(ctx, cfg, session, tmpId)); ctx.command('tmpversion').action(async () => await tmpVersion(ctx)); ctx.command('tmpdlcmap').action(async ({ session }) => await tmpDlcMap(ctx, session)); }