fix: at all when member isn't admin

This commit is contained in:
linyuchen 2024-04-04 12:26:28 +08:00
parent ec073da3f6
commit b34c7f045c
2 changed files with 15 additions and 15 deletions

View File

@ -1,20 +1,16 @@
import { import {
AtType, AtType,
ChatType, ChatType,
ElementType, Friend, ElementType,
Group, PicSubType, Friend,
Group,
GroupMemberRole,
PicSubType,
RawMessage, RawMessage,
SendArkElement, SendArkElement,
SendMessageElement SendMessageElement
} from "../../../ntqqapi/types"; } from "../../../ntqqapi/types";
import { import {friends, getFriend, getGroup, getGroupMember, getUidByUin, selfInfo,} from "../../../common/data";
friends,
getFriend,
getGroup,
getGroupMember,
getUidByUin,
selfInfo,
} from "../../../common/data";
import { import {
OB11MessageCustomMusic, OB11MessageCustomMusic,
OB11MessageData, OB11MessageData,
@ -23,7 +19,7 @@ import {
OB11MessageNode, OB11MessageNode,
OB11PostSendMsg OB11PostSendMsg
} from '../../types'; } from '../../types';
import {Peer} from "../../../ntqqapi/api/msg"; import {NTQQMsgApi, Peer} from "../../../ntqqapi/api/msg";
import {SendMsgElementConstructor} from "../../../ntqqapi/constructor"; import {SendMsgElementConstructor} from "../../../ntqqapi/constructor";
import BaseAction from "../BaseAction"; import BaseAction from "../BaseAction";
import {ActionName, BaseCheckResult} from "../types"; import {ActionName, BaseCheckResult} from "../types";
@ -31,7 +27,6 @@ import * as fs from "node:fs";
import {decodeCQCode} from "../../cqcode"; import {decodeCQCode} from "../../cqcode";
import {dbUtil} from "../../../common/db"; import {dbUtil} from "../../../common/db";
import {ALLOW_SEND_TEMP_MSG} from "../../../common/config"; import {ALLOW_SEND_TEMP_MSG} from "../../../common/config";
import {NTQQMsgApi} from "../../../ntqqapi/api/msg";
import {log} from "../../../common/utils/log"; import {log} from "../../../common/utils/log";
import {sleep} from "../../../common/utils/helper"; import {sleep} from "../../../common/utils/helper";
import {uri2local} from "../../../common/utils"; import {uri2local} from "../../../common/utils";
@ -117,7 +112,12 @@ export async function createSendElements(messageData: OB11MessageData[], target:
if (atQQ) { if (atQQ) {
atQQ = atQQ.toString() atQQ = atQQ.toString()
if (atQQ === "all") { if (atQQ === "all") {
sendElements.push(SendMsgElementConstructor.at(atQQ, atQQ, AtType.atAll, "全体成员")) // todo查询剩余的at全体次数
const self = await getGroupMember((target as Group)?.groupCode, selfInfo.uin);
const isAdmin = self.role === GroupMemberRole.admin || self.role === GroupMemberRole.owner;
if(!isAdmin) {
sendElements.push(SendMsgElementConstructor.at(atQQ, atQQ, AtType.atAll, "全体成员"))
}
} else { } else {
// const atMember = group?.members.find(m => m.uin == atQQ) // const atMember = group?.members.find(m => m.uin == atQQ)
const atMember = await getGroupMember((target as Group)?.groupCode, atQQ); const atMember = await getGroupMember((target as Group)?.groupCode, atQQ);

View File

@ -133,8 +133,8 @@ async function onSettingWindowCreated(view: Element) {
]), ]),
SettingList([ SettingList([
SettingItem( SettingItem(
'接收戳一戳消息, 暂时只支持Windows版的LLOneBot', '戳一戳消息, 暂时只支持Windows版的LLOneBot',
`重启QQ后生效如果导致QQ崩溃请勿开启此项`, `重启QQ后生效如果导致QQ崩溃请勿开启此项, 群戳一戳只能收到群号`,
SettingSwitch('enablePoke', config.enablePoke), SettingSwitch('enablePoke', config.enablePoke),
), ),
SettingItem( SettingItem(