fix: report self

This commit is contained in:
linyuchen
2024-02-06 15:17:01 +08:00
parent 7fd37fe137
commit e545d8d1cd
5 changed files with 12 additions and 6 deletions

View File

@@ -4,7 +4,7 @@
"name": "LLOneBot",
"slug": "LLOneBot",
"description": "LiteLoaderQQNT的OneBotApi",
"version": "2.4.1",
"version": "2.5.0",
"thumbnail": "./icon.png",
"authors": [{
"name": "linyuchen",

View File

@@ -171,7 +171,7 @@ function onLoad() {
for (const message of payload.msgList) {
OB11Construct.constructMessage(message).then((msg) => {
postMsg(msg);
});
}).catch(e=>log("constructMessage error: ", e.toString()));
}
})
}

View File

@@ -34,7 +34,7 @@ export function hookNTQQApiReceive(window: BrowserWindow) {
if (args?.[1] instanceof Array) {
for (let receiveData of args?.[1]) {
const ntQQApiMethodName = receiveData.cmdName;
log(`received ntqq api message: ${channel} ${ntQQApiMethodName}`, JSON.stringify(receiveData))
// log(`received ntqq api message: ${channel} ${ntQQApiMethodName}`, JSON.stringify(receiveData))
for (let hook of receiveHooks) {
if (hook.method === ntQQApiMethodName) {
hook.hookFunc(receiveData.payload);

View File

@@ -58,10 +58,10 @@ export class OB11Construct {
message_data["data"]["mention"] = "all"
message_data["data"]["qq"] = "all"
} else {
let uid = element.textElement.atNtUid
let uid = element.textElement.atUid
let atMember = getGroupMember(msg.peerUin, uid)
message_data["data"]["mention"] = atMember!.uin
message_data["data"]["qq"] = atMember!.uin
message_data["data"]["mention"] = atMember?.uin
message_data["data"]["qq"] = atMember?.uin
}
} else if (element.textElement) {
message_data["type"] = "text"

View File

@@ -267,6 +267,12 @@ export function startExpress(port: number) {
export function postMsg(msg: OB11Message) {
const {reportSelfMessage} = getConfigUtil().getConfig()
if (!reportSelfMessage) {
if (msg.user_id == selfInfo.user_id) {
return
}
}
for (const host of getConfigUtil().getConfig().hosts) {
fetch(host, {
method: "POST",