crystelf-plugin/apps/reportBots.js
2025-05-04 10:30:20 +08:00

36 lines
795 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import botControl from '../lib/core/botControl.js';
export default class ReportBots extends plugin {
constructor() {
super({
name: 'crystelf Bot状态上报',
dsc: '定时上报botID和群聊列表',
rule: [
{
reg: '^#crystelf同步$',
fnc: 'manualReport',
permission: 'master',
},
],
task: {
name: 'crystelf定时同步',
corn: '*/30 * * * *',
fnc: 'autoReport',
},
});
}
async autoReport() {
await botControl.reportBots();
}
async manualReport(e) {
let success = await botControl.reportBots();
if (success) {
e.reply('crystelf Bot信息已同步到核心..');
} else {
e.reply('crystelf Bot同步失败核心未连接..');
}
}
}