crystelf-plugin/lib/core/botControl.js
2025-04-28 13:40:56 +08:00

34 lines
700 B
JavaScript

import wsClient from '../../models/ws/wsClient.js';
const botControl = {
async reportBots() {
const bots = [];
for (const bot of Object.values(Bot)) {
if (!bot || !bot.uin) continue;
const botInfo = {
uin: bot.uin,
groups: [],
};
let groupsMap = bot.gl;
if (groupsMap) {
for (const [groupId, groupInfo] of groupsMap) {
botInfo.groups.push({
group_id: groupId,
group_name: groupInfo.group_name || '未知',
});
}
}
bots.push(botInfo);
}
return await wsClient.sendMessage({
type: 'reportBots',
data: bots,
});
},
};
export default botControl;