koishi-plugin-tmp-bot
Version:
欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人->QQ:3523283907
58 lines (57 loc) • 3.49 kB
JavaScript
;
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 { MileageRankingType } = require('./util/constant');
const tmpQuery = require('./command/tmpQuery');
const tmpServer = require('./command/tmpServer/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');
const tmpMileageRanking = require('./command/tmpMileageRanking');
const tmpFootprint = require('./command/tmpFootprint');
const { ServerType } = require('./util/constant');
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('路况信息展示方式'),
tmpServerType: 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, cfg));
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));
ctx.command('tmpmileageranking').action(async ({ session }) => await tmpMileageRanking(ctx, session, MileageRankingType.total));
ctx.command('tmptodaymileageranking').action(async ({ session }) => await tmpMileageRanking(ctx, session, MileageRankingType.today));
ctx.command('tmpfootprints').action(async ({ session }, tmpId) => await tmpFootprint(ctx, session, ServerType.ets, tmpId));
ctx.command('tmpfootprintp').action(async ({ session }, tmpId) => await tmpFootprint(ctx, session, ServerType.promods, tmpId));
}