mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: @全体的时候判断剩余次数
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"manifest_version": 4,
|
||||
"type": "extension",
|
||||
"name": "LLOneBot v3.20.7",
|
||||
"name": "LLOneBot v3.21.0",
|
||||
"slug": "LLOneBot",
|
||||
"description": "使你的NTQQ支持OneBot11协议进行QQ机器人开发, 不支持商店在线更新",
|
||||
"version": "3.20.7",
|
||||
"version": "3.21.0",
|
||||
"icon": "./icon.jpg",
|
||||
"authors": [
|
||||
{
|
||||
|
@@ -186,6 +186,17 @@ export class NTQQGroupApi{
|
||||
})
|
||||
}
|
||||
|
||||
static async getGroupAtAllRemainCount(groupCode: string){
|
||||
return await callNTQQApi<GeneralCallResult & {"atInfo":{"canAtAll": boolean,"RemainAtAllCountForUin": number,"RemainAtAllCountForGroup": number,"atTimesMsg": string,"canNotAtAllMsg":""}}>({
|
||||
methodName: NTQQApiMethod.GROUP_AT_ALL_REMAIN_COUNT,
|
||||
args: [
|
||||
{
|
||||
groupCode
|
||||
}, null
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
// 头衔不可用
|
||||
static async setGroupTitle(groupQQ: string, uid: string, title: string) {
|
||||
return await callNTQQApi<GeneralCallResult>({
|
||||
|
@@ -50,6 +50,7 @@ export enum NTQQApiMethod {
|
||||
GET_GROUP_NOTICE = "nodeIKernelGroupService/getSingleScreenNotifies",
|
||||
HANDLE_GROUP_REQUEST = "nodeIKernelGroupService/operateSysNotify",
|
||||
QUIT_GROUP = "nodeIKernelGroupService/quitGroup",
|
||||
GROUP_AT_ALL_REMAIN_COUNT = "nodeIKernelGroupService/getGroupRemainAtTimes",
|
||||
// READ_FRIEND_REQUEST = "nodeIKernelBuddyListener/onDoubtBuddyReqUnreadNumChange"
|
||||
HANDLE_FRIEND_REQUEST = "nodeIKernelBuddyService/approvalFriendRequest",
|
||||
KICK_MEMBER = "nodeIKernelGroupService/kickMember",
|
||||
|
@@ -31,6 +31,7 @@ import {log} from "../../../common/utils/log";
|
||||
import {sleep} from "../../../common/utils/helper";
|
||||
import {uri2local} from "../../../common/utils";
|
||||
import {crychic} from "../../../ntqqapi/external/crychic";
|
||||
import {NTQQGroupApi} from "../../../ntqqapi/api";
|
||||
|
||||
function checkSendMessage(sendMsgList: OB11MessageData[]) {
|
||||
function checkUri(uri: string): boolean {
|
||||
@@ -113,9 +114,18 @@ export async function createSendElements(messageData: OB11MessageData[], target:
|
||||
atQQ = atQQ.toString()
|
||||
if (atQQ === "all") {
|
||||
// todo:查询剩余的at全体次数
|
||||
const self = await getGroupMember((target as Group)?.groupCode, selfInfo.uin);
|
||||
const isAdmin = self.role === GroupMemberRole.admin || self.role === GroupMemberRole.owner;
|
||||
if(!isAdmin) {
|
||||
const groupCode = (target as Group)?.groupCode;
|
||||
let remainAtAllCount = 1
|
||||
let isAdmin: boolean = true;
|
||||
if (groupCode) {
|
||||
try {
|
||||
remainAtAllCount = (await NTQQGroupApi.getGroupAtAllRemainCount(groupCode)).atInfo.RemainAtAllCountForUin
|
||||
log(`群${groupCode}剩余at全体次数`, remainAtAllCount);
|
||||
const self = await getGroupMember((target as Group)?.groupCode, selfInfo.uin);
|
||||
isAdmin = self.role === GroupMemberRole.admin || self.role === GroupMemberRole.owner;
|
||||
} catch (e) {}
|
||||
}
|
||||
if(isAdmin && remainAtAllCount > 0) {
|
||||
sendElements.push(SendMsgElementConstructor.at(atQQ, atQQ, AtType.atAll, "全体成员"))
|
||||
}
|
||||
} else {
|
||||
|
@@ -1 +1 @@
|
||||
export const version = "3.20.7"
|
||||
export const version = "3.21.0"
|
Reference in New Issue
Block a user