mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
Merge branch 'main' into pr/22
This commit is contained in:
@@ -3,18 +3,22 @@ import { OB11Constructor } from '../../constructor';
|
||||
import { friends } from '@/core/data';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
import { NTQQUserApi, WebApi } from '@/core/apis';
|
||||
import { NTQQUserApi, WebApi, WebHonorType } from '@/core/apis';
|
||||
interface Payload {
|
||||
group_id: number
|
||||
group_id: number,
|
||||
type?: WebHonorType
|
||||
}
|
||||
export class GetGroupHonorInfo extends BaseAction<Payload, Array<any>> {
|
||||
actionName = ActionName.GetGroupHonorInfo;
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
// console.log(await NTQQUserApi.getRobotUinRange());
|
||||
if(!payload.group_id){
|
||||
if (!payload.group_id) {
|
||||
throw '缺少参数group_id';
|
||||
}
|
||||
return await WebApi.getGroupHonorInfo(payload.group_id.toString());
|
||||
if (!payload.type) {
|
||||
payload.type = WebHonorType.ALL;
|
||||
}
|
||||
return await WebApi.getGroupHonorInfo(payload.group_id.toString(), payload.type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
ChatType,
|
||||
FriendRequest,
|
||||
Group,
|
||||
GroupMember,
|
||||
GroupMemberRole,
|
||||
GroupNotify,
|
||||
GroupNotifyTypes,
|
||||
@@ -131,6 +132,17 @@ export class NapCatOnebot11 {
|
||||
//console.log('ob11 onGroupNotifiesUpdated', notifies[0]);
|
||||
this.postGroupNotifies(notifies).then().catch(e => logError('postGroupNotifies error: ', e));
|
||||
};
|
||||
groupListener.onMemberInfoChange = async (groupCode: string, changeType: number, members: Map<string, GroupMember>) => {
|
||||
// 如果自身是非管理员也许要从这里获取Delete 成员变动 待测试与验证
|
||||
let role = (await getGroupMember(groupCode, selfInfo.uin))?.role;
|
||||
let isPrivilege = role === 3 || role === 4;
|
||||
for (const member of members.values()) {
|
||||
if (member?.isDelete && !isPrivilege) {
|
||||
const groupDecreaseEvent = new OB11GroupDecreaseEvent(parseInt(groupCode), parseInt(member.uin), 0, 'leave');// 不知道怎么出去的
|
||||
postOB11Event(groupDecreaseEvent, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
groupListener.onJoinGroupNotify = (...notify) => {
|
||||
// console.log('ob11 onJoinGroupNotify', notify);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user