fix: 补齐 BangDream 在线命令初始化

This commit is contained in:
sunlei 2026-06-05 20:22:44 +08:00
parent 9cbe501ae2
commit 2c833e83f2
2 changed files with 27 additions and 0 deletions

View File

@ -533,6 +533,7 @@ VALUES
(2041700000000300516, 'bangdream_cutoff_all', 'BangDream ycxall', '["ycxall","myycx","全部档线"]', '["/","!",""]', 'bangDream', 'bangdream.cutoff.all', 'plain', 'all', '{}', '', 'BangDream ycxall 失败:{{error}}', 1, 0, 3000, '查询所有档位预测线;格式:/ycxall [活动ID] [服务器]'),
(2041700000000300517, 'bangdream_cutoff_recent', 'BangDream lsycx', '["lsycx","历史档线","近期档线"]', '["/","!",""]', 'bangDream', 'bangdream.cutoff.recent', 'plain', 'all', '{}', '', 'BangDream lsycx 失败:{{error}}', 1, 0, 3000, '查询同类型活动档线;格式:/lsycx 档位 [活动ID] [服务器]')
ON DUPLICATE KEY UPDATE
`code` = VALUES(`code`),
`name` = VALUES(`name`),
`aliases` = VALUES(`aliases`),
`prefixes` = VALUES(`prefixes`),

View File

@ -0,0 +1,26 @@
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { BANGDREAM_OPERATION_DEFS } from '@/qqbot/plugins/bangDream/commands/qqbot-bangdream-command.definitions';
describe('qqbot BangDream command init SQL', () => {
const sql = readFileSync(join(process.cwd(), 'sql/qqbot-init.sql'), 'utf8');
it('keeps every BangDream plugin operation available as an online command', () => {
const sqlOperationKeys = Array.from(
sql.matchAll(/'bangDream', '([^']+)'/g),
).map((match) => match[1]);
const definedOperationKeys = BANGDREAM_OPERATION_DEFS.map(
(operation) => operation.key,
);
expect([...sqlOperationKeys].sort()).toEqual(
[...definedOperationKeys].sort(),
);
expect(sqlOperationKeys).toHaveLength(15);
});
it('overwrites dirty online command metadata on duplicate ids', () => {
expect(sql).toContain('`code` = VALUES(`code`)');
expect(sql).toContain('`is_deleted` = 0');
});
});