mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: NTGroupMemberRole
This commit is contained in:
parent
cd212abd5f
commit
7ce95bca04
@ -2,7 +2,7 @@ import {
|
|||||||
GeneralCallResult,
|
GeneralCallResult,
|
||||||
Group,
|
Group,
|
||||||
GroupMember,
|
GroupMember,
|
||||||
GroupMemberRole,
|
NTGroupMemberRole,
|
||||||
GroupRequestOperateTypes,
|
GroupRequestOperateTypes,
|
||||||
InstanceContext,
|
InstanceContext,
|
||||||
KickMemberV2Req,
|
KickMemberV2Req,
|
||||||
@ -457,7 +457,7 @@ export class NTQQGroupApi {
|
|||||||
return this.context.session.getGroupService().modifyMemberCardName(groupQQ, memberUid, cardName);
|
return this.context.session.getGroupService().modifyMemberCardName(groupQQ, memberUid, cardName);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setMemberRole(groupQQ: string, memberUid: string, role: GroupMemberRole) {
|
async setMemberRole(groupQQ: string, memberUid: string, role: NTGroupMemberRole) {
|
||||||
return this.context.session.getGroupService().modifyMemberRole(groupQQ, memberUid, role);
|
return this.context.session.getGroupService().modifyMemberRole(groupQQ, memberUid, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export interface FSABRecentContactParams {
|
export interface FSABRecentContactParams {
|
||||||
anchorPointContact: {
|
anchorPointContact: {
|
||||||
contactId: string;
|
contactId: string;
|
||||||
|
@ -113,14 +113,13 @@ export interface Group {
|
|||||||
memberUid: string;
|
memberUid: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
export enum NTGroupMemberRole {
|
||||||
// 群成员角色类型
|
KUNSPECIFIED = 0,
|
||||||
export enum GroupMemberRole {
|
KSTRANGER = 1,
|
||||||
normal = 2,
|
KMEMBER = 2,
|
||||||
admin = 3,
|
KADMIN = 3,
|
||||||
owner = 4
|
KOWNER = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GroupMember {
|
export interface GroupMember {
|
||||||
memberRealLevel: number | undefined;
|
memberRealLevel: number | undefined;
|
||||||
memberSpecialTitle?: string;
|
memberSpecialTitle?: string;
|
||||||
@ -131,7 +130,7 @@ export interface GroupMember {
|
|||||||
nick: string;
|
nick: string;
|
||||||
qid: string;
|
qid: string;
|
||||||
remark: string;
|
remark: string;
|
||||||
role: GroupMemberRole;
|
role: NTGroupMemberRole;
|
||||||
shutUpTime: number; // 禁言时间(S)
|
shutUpTime: number; // 禁言时间(S)
|
||||||
uid: string;
|
uid: string;
|
||||||
uin: string;
|
uin: string;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { GroupMemberRole } from '@/core';
|
import { NTGroupMemberRole } from '@/core';
|
||||||
import { ActionBarElement, ArkElement, AvRecordElement, CalendarElement, FaceBubbleElement, FaceElement, FileElement, GiphyElement, GrayTipElement, MarketFaceElement, PicElement, PttElement, RecommendedMsgElement, ReplyElement, ShareLocationElement, StructLongMsgElement, TaskTopMsgElement, TextElement, TofuRecordElement, VideoElement, YoloGameResultElement } from './element';
|
import { ActionBarElement, ArkElement, AvRecordElement, CalendarElement, FaceBubbleElement, FaceElement, FileElement, GiphyElement, GrayTipElement, MarketFaceElement, PicElement, PttElement, RecommendedMsgElement, ReplyElement, ShareLocationElement, StructLongMsgElement, TaskTopMsgElement, TextElement, TofuRecordElement, VideoElement, YoloGameResultElement } from './element';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -420,13 +420,13 @@ export interface TipGroupElement {
|
|||||||
uid: string;
|
uid: string;
|
||||||
card: string;
|
card: string;
|
||||||
name: string;
|
name: string;
|
||||||
role: GroupMemberRole
|
role: NTGroupMemberRole
|
||||||
};
|
};
|
||||||
member: {
|
member: {
|
||||||
uid: string
|
uid: string
|
||||||
card: string;
|
card: string;
|
||||||
name: string;
|
name: string;
|
||||||
role: GroupMemberRole
|
role: NTGroupMemberRole
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ export interface FriendRequest {
|
|||||||
isDecide: boolean;
|
isDecide: boolean;
|
||||||
friendUid: string;
|
friendUid: string;
|
||||||
reqType: BuddyReqType,
|
reqType: BuddyReqType,
|
||||||
reqTime: string; // 时间戳;秒
|
reqTime: string; // 时间戳 秒
|
||||||
extWords: string; // 申请人填写的验证消息
|
extWords: string; // 申请人填写的验证消息
|
||||||
isUnread: boolean;
|
isUnread: boolean;
|
||||||
friendNick: string;
|
friendNick: string;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { GroupMemberRole } from '@/core/entities';
|
import { NTGroupMemberRole } from '@/core/entities';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ export default class SetGroupAdmin extends OneBotAction<Payload, null> {
|
|||||||
const enable = typeof payload.enable === 'string' ? payload.enable === 'true' : !!payload.enable;
|
const enable = typeof payload.enable === 'string' ? payload.enable === 'true' : !!payload.enable;
|
||||||
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||||
if (!uid) throw new Error('get Uid Error');
|
if (!uid) throw new Error('get Uid Error');
|
||||||
await this.core.apis.GroupApi.setMemberRole(payload.group_id.toString(), uid, enable ? GroupMemberRole.admin : GroupMemberRole.normal);
|
await this.core.apis.GroupApi.setMemberRole(payload.group_id.toString(), uid, enable ? NTGroupMemberRole.KADMIN : NTGroupMemberRole.KMEMBER);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import {
|
|||||||
BuddyReqType,
|
BuddyReqType,
|
||||||
ChatType,
|
ChatType,
|
||||||
DataSource,
|
DataSource,
|
||||||
GroupMemberRole,
|
NTGroupMemberRole,
|
||||||
GroupNotifyMsgStatus,
|
GroupNotifyMsgStatus,
|
||||||
GroupNotifyMsgType,
|
GroupNotifyMsgType,
|
||||||
InstanceContext,
|
InstanceContext,
|
||||||
@ -524,7 +524,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
this.core,
|
this.core,
|
||||||
parseInt(groupCode),
|
parseInt(groupCode),
|
||||||
parseInt(member.uin),
|
parseInt(member.uin),
|
||||||
member.role === GroupMemberRole.admin ? 'set' : 'unset'
|
member.role === NTGroupMemberRole.KADMIN ? 'set' : 'unset'
|
||||||
);
|
);
|
||||||
this.networkManager
|
this.networkManager
|
||||||
.emitEvent(groupAdminNoticeEvent)
|
.emitEvent(groupAdminNoticeEvent)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user