mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4c69c6d9fd | ||
![]() |
920a41acef | ||
![]() |
a89cdef436 | ||
![]() |
881d88f4ad | ||
![]() |
bc8235b209 | ||
![]() |
0087495749 | ||
![]() |
9560afd4a7 | ||
![]() |
56ec8559a0 |
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "2.2.5",
|
"version": "2.2.6",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.2.5",
|
"version": "2.2.6",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:framework": "vite build --mode framework",
|
"build:framework": "vite build --mode framework",
|
||||||
"build:shell": "vite build --mode shell",
|
"build:shell": "vite build --mode shell",
|
||||||
|
@@ -2,7 +2,7 @@ import path, { dirname } from 'path';
|
|||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
export const napcat_version = '2.2.5';
|
export const napcat_version = '2.2.6';
|
||||||
|
|
||||||
export class NapCatPathWrapper {
|
export class NapCatPathWrapper {
|
||||||
binaryPath: string;
|
binaryPath: string;
|
||||||
|
@@ -7,6 +7,8 @@ import {
|
|||||||
GroupNotify,
|
GroupNotify,
|
||||||
GroupRequestOperateTypes,
|
GroupRequestOperateTypes,
|
||||||
InstanceContext,
|
InstanceContext,
|
||||||
|
KickMemberInfo,
|
||||||
|
kickMemberV2Req,
|
||||||
MemberExtSourceType,
|
MemberExtSourceType,
|
||||||
NapCatCore,
|
NapCatCore,
|
||||||
NodeIKernelGroupListener,
|
NodeIKernelGroupListener,
|
||||||
@@ -219,7 +221,17 @@ export class NTQQGroupApi {
|
|||||||
// GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数
|
// GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数
|
||||||
return this.context.session.getGroupService().addGroupEssence(param);
|
return this.context.session.getGroupService().addGroupEssence(param);
|
||||||
}
|
}
|
||||||
|
async kickMemberV2Inner(param: kickMemberV2Req) {
|
||||||
|
return this.context.session.getGroupService().kickMemberV2(param);
|
||||||
|
}
|
||||||
|
async quitGroupV2(GroupCode: string, needDeleteLocalMsg: boolean) {
|
||||||
|
let param = {
|
||||||
|
groupCode: GroupCode,
|
||||||
|
needDeleteLocalMsg: needDeleteLocalMsg
|
||||||
|
};
|
||||||
|
//应该是直接返回不需要Listener的 未经测试 需测试再发布
|
||||||
|
return this.context.session.getGroupService().quitGroupV2(param);
|
||||||
|
}
|
||||||
async removeGroupEssence(GroupCode: string, msgId: string) {
|
async removeGroupEssence(GroupCode: string, msgId: string) {
|
||||||
// 代码没测过
|
// 代码没测过
|
||||||
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
// 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom
|
||||||
|
@@ -20,8 +20,7 @@ export class NTQQWebApi {
|
|||||||
|
|
||||||
async shareDigest(groupCode: string, msgSeq: string, msgRandom: string, targetGroupCode: string) {
|
async shareDigest(groupCode: string, msgSeq: string, msgRandom: string, targetGroupCode: string) {
|
||||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||||
const url = `https://qun.qq.com/cgi-bin/group_digest/share_digest?${
|
const url = `https://qun.qq.com/cgi-bin/group_digest/share_digest?${new URLSearchParams({
|
||||||
new URLSearchParams({
|
|
||||||
bkn: this.getBknFromCookie(cookieObject),
|
bkn: this.getBknFromCookie(cookieObject),
|
||||||
group_code: groupCode,
|
group_code: groupCode,
|
||||||
msg_seq: msgSeq,
|
msg_seq: msgSeq,
|
||||||
@@ -38,8 +37,7 @@ export class NTQQWebApi {
|
|||||||
|
|
||||||
async getGroupEssenceMsg(GroupCode: string, page_start: string) {
|
async getGroupEssenceMsg(GroupCode: string, page_start: string) {
|
||||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||||
const url = `https://qun.qq.com/cgi-bin/group_digest/digest_list?${
|
const url = `https://qun.qq.com/cgi-bin/group_digest/digest_list?${new URLSearchParams({
|
||||||
new URLSearchParams({
|
|
||||||
bkn: this.getBknFromCookie(cookieObject),
|
bkn: this.getBknFromCookie(cookieObject),
|
||||||
group_code: GroupCode,
|
group_code: GroupCode,
|
||||||
page_start,
|
page_start,
|
||||||
@@ -65,8 +63,7 @@ export class NTQQWebApi {
|
|||||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||||
const retList: Promise<WebApiGroupMemberRet>[] = [];
|
const retList: Promise<WebApiGroupMemberRet>[] = [];
|
||||||
const fastRet = await RequestUtil.HttpGetJson<WebApiGroupMemberRet>
|
const fastRet = await RequestUtil.HttpGetJson<WebApiGroupMemberRet>
|
||||||
(`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${
|
(`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${new URLSearchParams({
|
||||||
new URLSearchParams({
|
|
||||||
st: '0',
|
st: '0',
|
||||||
end: '40',
|
end: '40',
|
||||||
sort: '1',
|
sort: '1',
|
||||||
@@ -86,8 +83,7 @@ export class NTQQWebApi {
|
|||||||
//遍历批量请求
|
//遍历批量请求
|
||||||
for (let i = 2; i <= PageNum; i++) {
|
for (let i = 2; i <= PageNum; i++) {
|
||||||
const ret = RequestUtil.HttpGetJson<WebApiGroupMemberRet>
|
const ret = RequestUtil.HttpGetJson<WebApiGroupMemberRet>
|
||||||
(`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${
|
(`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${new URLSearchParams({
|
||||||
new URLSearchParams({
|
|
||||||
st: ((i - 1) * 40).toString(),
|
st: ((i - 1) * 40).toString(),
|
||||||
end: (i * 40).toString(),
|
end: (i * 40).toString(),
|
||||||
sort: '1',
|
sort: '1',
|
||||||
@@ -127,8 +123,7 @@ export class NTQQWebApi {
|
|||||||
let ret: any = undefined;
|
let ret: any = undefined;
|
||||||
try {
|
try {
|
||||||
ret = await RequestUtil.HttpGetJson<any>
|
ret = await RequestUtil.HttpGetJson<any>
|
||||||
(`https://web.qun.qq.com/cgi-bin/announce/add_qun_notice${
|
(`https://web.qun.qq.com/cgi-bin/announce/add_qun_notice${new URLSearchParams({
|
||||||
new URLSearchParams({
|
|
||||||
bkn: this.getBknFromCookie(cookieObject),
|
bkn: this.getBknFromCookie(cookieObject),
|
||||||
qid: GroupCode,
|
qid: GroupCode,
|
||||||
text: Content,
|
text: Content,
|
||||||
@@ -147,15 +142,10 @@ export class NTQQWebApi {
|
|||||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||||
let ret: WebApiGroupNoticeRet | undefined = undefined;
|
let ret: WebApiGroupNoticeRet | undefined = undefined;
|
||||||
try {
|
try {
|
||||||
ret = await RequestUtil.HttpGetJson<WebApiGroupNoticeRet>(`https://web.qun.qq.com/cgi-bin/announce/get_t_list?${
|
const url = 'https://web.qun.qq.com/cgi-bin/announce/get_t_list?bkn=' +
|
||||||
new URLSearchParams({
|
this.getBknFromCookie(cookieObject) + '&qid=' + GroupCode + '&ft=23&ni=1&n=1&i=1&log_read=1&platform=1&s=-1&n=20';
|
||||||
bkn: this.getBknFromCookie(cookieObject),
|
|
||||||
qid: GroupCode,
|
ret = await RequestUtil.HttpGetJson<WebApiGroupNoticeRet>(url, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) });
|
||||||
type: '1',
|
|
||||||
start: '0',
|
|
||||||
num: '1',
|
|
||||||
}).toString()
|
|
||||||
}`, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) });
|
|
||||||
if (ret?.ec !== 0) {
|
if (ret?.ec !== 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -168,8 +158,7 @@ export class NTQQWebApi {
|
|||||||
async getGroupHonorInfo(groupCode: string, getType: WebHonorType) {
|
async getGroupHonorInfo(groupCode: string, getType: WebHonorType) {
|
||||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||||
const getDataInternal = async (Internal_groupCode: string, Internal_type: number) => {
|
const getDataInternal = async (Internal_groupCode: string, Internal_type: number) => {
|
||||||
const url = `https://qun.qq.com/interactive/honorlist?${
|
const url = `https://qun.qq.com/interactive/honorlist?${new URLSearchParams({
|
||||||
new URLSearchParams({
|
|
||||||
gc: Internal_groupCode,
|
gc: Internal_groupCode,
|
||||||
type: Internal_type.toString(),
|
type: Internal_type.toString(),
|
||||||
}).toString()
|
}).toString()
|
||||||
|
@@ -1,5 +1,17 @@
|
|||||||
import { QQLevel, Sex, User } from './user';
|
import { QQLevel, Sex, User } from './user';
|
||||||
|
export interface KickMemberInfo {
|
||||||
|
optFlag: number,
|
||||||
|
optOperate: number,
|
||||||
|
optMemberUid: string,
|
||||||
|
optBytesMsg: string,
|
||||||
|
}
|
||||||
|
export interface kickMemberV2Req{
|
||||||
|
groupCode: string,
|
||||||
|
kickFlag: number,
|
||||||
|
kickList: Array<KickMemberInfo>,
|
||||||
|
kickListUids: Array<string>,
|
||||||
|
kickMsg: string
|
||||||
|
}
|
||||||
export enum GroupListUpdateType {
|
export enum GroupListUpdateType {
|
||||||
REFRESHALL,
|
REFRESHALL,
|
||||||
GETALL,
|
GETALL,
|
||||||
|
@@ -1,40 +1,58 @@
|
|||||||
export enum GroupNotifyTypes {
|
export enum GroupNotifyMsgType {
|
||||||
INVITE_ME = 1,
|
UN_SPECIFIED,
|
||||||
INVITED_JOIN = 4, // 有人接受了邀请入群
|
INVITED_BY_MEMBER,
|
||||||
JOIN_REQUEST = 7,
|
REFUSE_INVITED,
|
||||||
ADMIN_SET = 8,
|
REFUSED_BY_ADMINI_STRATOR,
|
||||||
KICK_MEMBER = 9,
|
AGREED_TOJOIN_DIRECT,// 有人接受了邀请入群
|
||||||
MEMBER_EXIT = 11, // 主动退出
|
INVITED_NEED_ADMINI_STRATOR_PASS,
|
||||||
ADMIN_UNSET = 12,
|
AGREED_TO_JOIN_BY_ADMINI_STRATOR,
|
||||||
ADMIN_UNSET_OTHER = 13, // 其他人取消管理员
|
REQUEST_JOIN_NEED_ADMINI_STRATOR_PASS,
|
||||||
|
SET_ADMIN,
|
||||||
|
KICK_MEMBER_NOTIFY_ADMIN,
|
||||||
|
KICK_MEMBER_NOTIFY_KICKED,
|
||||||
|
MEMBER_LEAVE_NOTIFY_ADMIN,// 主动退出
|
||||||
|
CANCEL_ADMIN_NOTIFY_CANCELED,
|
||||||
|
CANCEL_ADMIN_NOTIFY_ADMIN,// 其他人取消管理员
|
||||||
|
TRANSFER_GROUP_NOTIFY_OLDOWNER,
|
||||||
|
TRANSFER_GROUP_NOTIFY_ADMIN
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GroupNotifies {
|
export interface GroupNotifies {
|
||||||
doubt: boolean;
|
doubt: boolean;
|
||||||
nextStartSeq: string;
|
nextStartSeq: string;
|
||||||
notifies: GroupNotify[];
|
notifies: GroupNotify[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum GroupNotifyStatus {
|
export enum GroupNotifyMsgStatus {
|
||||||
IGNORE = 0,
|
KINIT,//初始化
|
||||||
WAIT_HANDLE = 1,
|
KUNHANDLE,//未处理
|
||||||
APPROVE = 2,
|
KAGREED,//同意
|
||||||
REJECT = 3
|
KREFUSED,//拒绝
|
||||||
|
KIGNORED//忽略
|
||||||
|
}
|
||||||
|
export enum GroupInviteStatus {
|
||||||
|
INIT,
|
||||||
|
WAIT_TO_APPROVE,
|
||||||
|
JOINED,
|
||||||
|
REFUSED_BY_ADMINI_STRATOR
|
||||||
|
}
|
||||||
|
export enum GroupInviteType {
|
||||||
|
BYBUDDY,
|
||||||
|
BYGROUPMEMBER,
|
||||||
|
BYDISCUSSMEMBER
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GroupNotify {
|
export interface GroupNotify {
|
||||||
time: number; // 自己添加的字段,时间戳,毫秒, 用于判断收到短时间内收到重复的notify
|
seq: string; // 通知序列号
|
||||||
seq: string; // 唯一标识符,转成数字再除以1000应该就是时间戳?
|
type: GroupNotifyMsgType;
|
||||||
type: GroupNotifyTypes;
|
status: GroupNotifyMsgStatus;
|
||||||
status: GroupNotifyStatus; // 0是已忽略?,1是未处理,2是已同意
|
|
||||||
group: { groupCode: string; groupName: string };
|
group: { groupCode: string; groupName: string };
|
||||||
user1: { uid: string; nickName: string }; // 被设置管理员的人
|
user1: { uid: string; nickName: string }; // 被设置管理员的人
|
||||||
user2: { uid: string; nickName: string }; // 操作者
|
user2: { uid: string; nickName: string }; // 操作者
|
||||||
actionUser: { uid: string; nickName: string }; //未知
|
actionUser: { uid: string; nickName: string }; //未知
|
||||||
actionTime: string;
|
actionTime: string;
|
||||||
invitationExt: {
|
invitationExt: {
|
||||||
srcType: number; // 0?未知
|
srcType: GroupInviteType; // 邀请来源
|
||||||
groupCode: string; waitStatus: number
|
groupCode: string;
|
||||||
|
waitStatus: GroupInviteStatus
|
||||||
};
|
};
|
||||||
postscript: string; // 加群用户填写的验证信息
|
postscript: string; // 加群用户填写的验证信息
|
||||||
repeatSeqs: [];
|
repeatSeqs: [];
|
||||||
|
@@ -3,14 +3,18 @@ import {
|
|||||||
GroupExtParam,
|
GroupExtParam,
|
||||||
GroupMember,
|
GroupMember,
|
||||||
GroupMemberRole,
|
GroupMemberRole,
|
||||||
GroupNotifyTypes,
|
GroupNotifyMsgType,
|
||||||
GroupRequestOperateTypes,
|
GroupRequestOperateTypes,
|
||||||
|
kickMemberV2Req,
|
||||||
} from '@/core/entities';
|
} from '@/core/entities';
|
||||||
import { GeneralCallResult } from '@/core/services/common';
|
import { GeneralCallResult } from '@/core/services/common';
|
||||||
|
|
||||||
//高版本的接口不应该随意使用 使用应该严格进行pr审核 同时部分ipc中未出现的接口不要过于依赖 应该做好数据兜底
|
//高版本的接口不应该随意使用 使用应该严格进行pr审核 同时部分ipc中未出现的接口不要过于依赖 应该做好数据兜底
|
||||||
|
|
||||||
export interface NodeIKernelGroupService {
|
export interface NodeIKernelGroupService {
|
||||||
|
kickMemberV2(param: kickMemberV2Req): Promise<GeneralCallResult>;
|
||||||
|
quitGroupV2(param: { groupCode: string; needDeleteLocalMsg: boolean; }): Promise<GeneralCallResult>;
|
||||||
|
|
||||||
getMemberCommonInfo(Req: {
|
getMemberCommonInfo(Req: {
|
||||||
groupCode: string,
|
groupCode: string,
|
||||||
startUin: string,
|
startUin: string,
|
||||||
@@ -195,7 +199,7 @@ export interface NodeIKernelGroupService {
|
|||||||
operateType: GroupRequestOperateTypes, // 2 拒绝
|
operateType: GroupRequestOperateTypes, // 2 拒绝
|
||||||
targetMsg: {
|
targetMsg: {
|
||||||
seq: string, // 通知序列号
|
seq: string, // 通知序列号
|
||||||
type: GroupNotifyTypes,
|
type: GroupNotifyMsgType,
|
||||||
groupCode: string,
|
groupCode: string,
|
||||||
postscript: string
|
postscript: string
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { GroupNotifyMsgStatus } from '@/core';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
@@ -28,7 +29,7 @@ export class GetGroupSystemMsg extends BaseAction<void, any> {
|
|||||||
invitor_nick: SSNotify.user1?.nickName,
|
invitor_nick: SSNotify.user1?.nickName,
|
||||||
group_id: SSNotify.group?.groupCode,
|
group_id: SSNotify.group?.groupCode,
|
||||||
group_name: SSNotify.group?.groupName,
|
group_name: SSNotify.group?.groupName,
|
||||||
checked: SSNotify.status === 1 ? false : true,
|
checked: SSNotify.status === GroupNotifyMsgStatus.KUNHANDLE ? false : true,
|
||||||
actor: await NTQQUserApi.getUinByUidV2(SSNotify.user2?.uid) || 0,
|
actor: await NTQQUserApi.getUinByUidV2(SSNotify.user2?.uid) || 0,
|
||||||
});
|
});
|
||||||
} else if (SSNotify.type == 7) {
|
} else if (SSNotify.type == 7) {
|
||||||
@@ -38,7 +39,7 @@ export class GetGroupSystemMsg extends BaseAction<void, any> {
|
|||||||
requester_nick: SSNotify.user1?.nickName,
|
requester_nick: SSNotify.user1?.nickName,
|
||||||
group_id: SSNotify.group?.groupCode,
|
group_id: SSNotify.group?.groupCode,
|
||||||
group_name: SSNotify.group?.groupName,
|
group_name: SSNotify.group?.groupName,
|
||||||
checked: SSNotify.status === 1 ? false : true,
|
checked: SSNotify.status === GroupNotifyMsgStatus.KUNHANDLE ? false : true,
|
||||||
actor: await NTQQUserApi.getUinByUidV2(SSNotify.user2?.uid) || 0,
|
actor: await NTQQUserApi.getUinByUidV2(SSNotify.user2?.uid) || 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -171,7 +171,7 @@ const _handlers: {
|
|||||||
} else {
|
} else {
|
||||||
postData = data;
|
postData = data;
|
||||||
}
|
}
|
||||||
// Mlikiowa V2.2.5 Refactor Todo
|
// Mlikiowa V2.2.6 Refactor Todo
|
||||||
const signUrl = obContext.configLoader.configData.musicSignUrl;
|
const signUrl = obContext.configLoader.configData.musicSignUrl;
|
||||||
if (!signUrl) {
|
if (!signUrl) {
|
||||||
if (data.type === 'qq') {
|
if (data.type === 'qq') {
|
||||||
|
@@ -3,13 +3,14 @@ import {
|
|||||||
BuddyReqType,
|
BuddyReqType,
|
||||||
ChatType,
|
ChatType,
|
||||||
GroupListener,
|
GroupListener,
|
||||||
GroupNotifyTypes,
|
|
||||||
InstanceContext,
|
InstanceContext,
|
||||||
MsgListener,
|
MsgListener,
|
||||||
NapCatCore,
|
NapCatCore,
|
||||||
RawMessage,
|
RawMessage,
|
||||||
SendStatusType,
|
SendStatusType,
|
||||||
GroupMemberRole,
|
GroupMemberRole,
|
||||||
|
GroupNotifyMsgType,
|
||||||
|
GroupNotifyMsgStatus,
|
||||||
} from '@/core';
|
} from '@/core';
|
||||||
import { OB11Config, OB11ConfigLoader } from '@/onebot/helper/config';
|
import { OB11Config, OB11ConfigLoader } from '@/onebot/helper/config';
|
||||||
import { OneBotApiContextType } from '@/onebot/types';
|
import { OneBotApiContextType } from '@/onebot/types';
|
||||||
@@ -321,12 +322,11 @@ export class NapCatOneBot11Adapter {
|
|||||||
groupListener.onGroupNotifiesUpdated = async (_, notifies) => {
|
groupListener.onGroupNotifiesUpdated = async (_, notifies) => {
|
||||||
//console.log('ob11 onGroupNotifiesUpdated', notifies[0]);
|
//console.log('ob11 onGroupNotifiesUpdated', notifies[0]);
|
||||||
if (![
|
if (![
|
||||||
GroupNotifyTypes.ADMIN_SET,
|
GroupNotifyMsgType.SET_ADMIN,
|
||||||
GroupNotifyTypes.ADMIN_UNSET,
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_CANCELED,
|
||||||
GroupNotifyTypes.ADMIN_UNSET_OTHER,
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_ADMIN,
|
||||||
].includes(notifies[0]?.type)) {
|
].includes(notifies[0]?.type)) {
|
||||||
for (const notify of notifies) {
|
for (const notify of notifies) {
|
||||||
notify.time = Date.now();
|
|
||||||
const notifyTime = parseInt(notify.seq) / 1000 / 1000;
|
const notifyTime = parseInt(notify.seq) / 1000 / 1000;
|
||||||
// log(`群通知时间${notifyTime}`, `启动时间${this.bootTime}`);
|
// log(`群通知时间${notifyTime}`, `启动时间${this.bootTime}`);
|
||||||
if (notifyTime < this.bootTime) {
|
if (notifyTime < this.bootTime) {
|
||||||
@@ -337,9 +337,9 @@ export class NapCatOneBot11Adapter {
|
|||||||
this.context.logger.logDebug('收到群通知', notify);
|
this.context.logger.logDebug('收到群通知', notify);
|
||||||
|
|
||||||
if ([
|
if ([
|
||||||
GroupNotifyTypes.ADMIN_SET,
|
GroupNotifyMsgType.SET_ADMIN,
|
||||||
GroupNotifyTypes.ADMIN_UNSET,
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_CANCELED,
|
||||||
GroupNotifyTypes.ADMIN_UNSET_OTHER,
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_ADMIN,
|
||||||
].includes(notify.type)) {
|
].includes(notify.type)) {
|
||||||
const member1 = await this.core.apis.GroupApi.getGroupMember(notify.group.groupCode, notify.user1.uid);
|
const member1 = await this.core.apis.GroupApi.getGroupMember(notify.group.groupCode, notify.user1.uid);
|
||||||
this.context.logger.logDebug('有管理员变动通知');
|
this.context.logger.logDebug('有管理员变动通知');
|
||||||
@@ -348,20 +348,21 @@ export class NapCatOneBot11Adapter {
|
|||||||
this.context.logger.logDebug('开始获取变动的管理员');
|
this.context.logger.logDebug('开始获取变动的管理员');
|
||||||
if (member1) {
|
if (member1) {
|
||||||
this.context.logger.logDebug('变动管理员获取成功');
|
this.context.logger.logDebug('变动管理员获取成功');
|
||||||
// member1.role = notify.type == GroupNotifyTypes.ADMIN_SET ? GroupMemberRole.admin : GroupMemberRole.normal;
|
|
||||||
|
|
||||||
const groupAdminNoticeEvent = new OB11GroupAdminNoticeEvent(
|
const groupAdminNoticeEvent = new OB11GroupAdminNoticeEvent(
|
||||||
this.core,
|
this.core,
|
||||||
parseInt(notify.group.groupCode),
|
parseInt(notify.group.groupCode),
|
||||||
parseInt(member1.uin),
|
parseInt(member1.uin),
|
||||||
[GroupNotifyTypes.ADMIN_UNSET, GroupNotifyTypes.ADMIN_UNSET_OTHER].includes(notify.type) ? 'unset' : 'set',
|
[
|
||||||
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_CANCELED,
|
||||||
|
GroupNotifyMsgType.CANCEL_ADMIN_NOTIFY_ADMIN
|
||||||
|
].includes(notify.type) ? 'unset' : 'set',
|
||||||
);
|
);
|
||||||
this.networkManager.emitEvent(groupAdminNoticeEvent)
|
this.networkManager.emitEvent(groupAdminNoticeEvent)
|
||||||
.catch(e => this.context.logger.logError('处理群管理员变动失败', e));
|
.catch(e => this.context.logger.logError('处理群管理员变动失败', e));
|
||||||
} else {
|
} else {
|
||||||
this.context.logger.logDebug('获取群通知的成员信息失败', notify, this.core.apis.GroupApi.getGroup(notify.group.groupCode));
|
this.context.logger.logDebug('获取群通知的成员信息失败', notify, this.core.apis.GroupApi.getGroup(notify.group.groupCode));
|
||||||
}
|
}
|
||||||
} else if (notify.type == GroupNotifyTypes.MEMBER_EXIT || notify.type == GroupNotifyTypes.KICK_MEMBER) {
|
} else if (notify.type == GroupNotifyMsgType.MEMBER_LEAVE_NOTIFY_ADMIN || notify.type == GroupNotifyMsgType.KICK_MEMBER_NOTIFY_ADMIN) {
|
||||||
this.context.logger.logDebug('有成员退出通知', notify);
|
this.context.logger.logDebug('有成员退出通知', notify);
|
||||||
const member1Uin = (await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid))!;
|
const member1Uin = (await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid))!;
|
||||||
let operatorId = member1Uin;
|
let operatorId = member1Uin;
|
||||||
@@ -385,8 +386,8 @@ export class NapCatOneBot11Adapter {
|
|||||||
.catch(e => this.context.logger.logError('处理群成员退出失败', e));
|
.catch(e => this.context.logger.logError('处理群成员退出失败', e));
|
||||||
// notify.status == 1 表示未处理 2表示处理完成
|
// notify.status == 1 表示未处理 2表示处理完成
|
||||||
} else if ([
|
} else if ([
|
||||||
GroupNotifyTypes.JOIN_REQUEST,
|
GroupNotifyMsgType.REQUEST_JOIN_NEED_ADMINI_STRATOR_PASS,
|
||||||
].includes(notify.type) && notify.status == 1) {
|
].includes(notify.type) && notify.status == GroupNotifyMsgStatus.KUNHANDLE) {
|
||||||
this.context.logger.logDebug('有加群请求');
|
this.context.logger.logDebug('有加群请求');
|
||||||
try {
|
try {
|
||||||
let requestUin = (await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid))!;
|
let requestUin = (await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid))!;
|
||||||
@@ -406,7 +407,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.context.logger.logError('获取加群人QQ号失败 Uid:', notify.user1.uid, e);
|
this.context.logger.logError('获取加群人QQ号失败 Uid:', notify.user1.uid, e);
|
||||||
}
|
}
|
||||||
} else if (notify.type == GroupNotifyTypes.INVITE_ME && notify.status == 1) {
|
} else if (notify.type == GroupNotifyMsgType.INVITED_BY_MEMBER && notify.status == GroupNotifyMsgStatus.KUNHANDLE) {
|
||||||
this.context.logger.logDebug(`收到邀请我加群通知:${notify}`);
|
this.context.logger.logDebug(`收到邀请我加群通知:${notify}`);
|
||||||
const groupInviteEvent = new OB11GroupRequestEvent(
|
const groupInviteEvent = new OB11GroupRequestEvent(
|
||||||
this.core,
|
this.core,
|
||||||
|
@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
undefined,
|
undefined,
|
||||||
SettingButton('V2.2.5', 'napcat-update-button', 'secondary'),
|
SettingButton('V2.2.6', 'napcat-update-button', 'secondary'),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
void 0,
|
void 0,
|
||||||
SettingButton("V2.2.5", "napcat-update-button", "secondary")
|
SettingButton("V2.2.6", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user