fix:api路径错误

This commit is contained in:
Jerry 2025-06-01 01:05:16 +08:00
parent 38c3a6c232
commit 862e081780
2 changed files with 6 additions and 18 deletions

View File

@ -55,9 +55,9 @@ export default class ReportBots extends plugin {
message: msg.toString(), message: msg.toString(),
}; };
const url = configControl.get('coreConfig')?.coreUrl; const url = configControl.get('coreConfig')?.coreUrl;
const returnData = await axios.post(url, sendData); const returnData = await axios.post(`${url}/api/bot/broadcast`, sendData);
if (returnData?.success) { if (returnData?.data?.success) {
return await e.reply(`操作成功:${returnData?.data.toString()}`); return await e.reply(`操作成功:${returnData?.data.data?.toString()}`);
} else { } else {
return await e.reply(`广播出现错误,请检查日志..`); return await e.reply(`广播出现错误,请检查日志..`);
} }

View File

@ -10,7 +10,6 @@ class Handler {
['error', this.handleError.bind(this)], ['error', this.handleError.bind(this)],
['getGroupInfo', this.handleGetGroupInfo.bind(this)], ['getGroupInfo', this.handleGetGroupInfo.bind(this)],
['sendMessage', this.handleSendMessage.bind(this)], ['sendMessage', this.handleSendMessage.bind(this)],
['broadcastMessage', this.broadcastMessage.bind(this)],
['reportBots', this.reportBots.bind(this)], ['reportBots', this.reportBots.bind(this)],
]); ]);
} }
@ -81,23 +80,12 @@ class Handler {
*/ */
// TODO 测试可用性 // TODO 测试可用性
async handleSendMessage(client, msg) { async handleSendMessage(client, msg) {
const botId = msg.data?.botId; const botId = Number(msg.data?.botId);
const groupId = msg.data?.groupId; const groupId = Number(msg.data?.groupId);
const message = msg.data?.message; const message = msg.data?.message?.toString();
await botControl.sendMessage(botId, message, groupId); await botControl.sendMessage(botId, message, groupId);
} }
/**
* 广播消息感觉没啥用用core的广播代替了
* @param client
* @param msg
* @returns {Promise<void>}
*/
async broadcastMessage(client, msg) {
const message = msg.data?.message;
await botControl.broadcastMessage(message);
}
async reportBots(client, msg) { async reportBots(client, msg) {
await botControl.reportBots(); await botControl.reportBots();
} }