mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a0024c98d5 | ||
![]() |
684a702638 | ||
![]() |
aec4a009d1 | ||
![]() |
822af575c9 | ||
![]() |
485efa7d44 | ||
![]() |
3d09d45423 | ||
![]() |
0cf13a284c | ||
![]() |
a72c96f56d | ||
![]() |
dcf0a06217 | ||
![]() |
3b5e6553cd | ||
![]() |
509390af20 | ||
![]() |
9ad511a9c0 | ||
![]() |
89c102513d |
@@ -4,7 +4,7 @@
|
||||
"name": "NapCatQQ",
|
||||
"slug": "NapCat.Framework",
|
||||
"description": "高性能的 OneBot 11 协议实现",
|
||||
"version": "2.2.6",
|
||||
"version": "2.2.7",
|
||||
"icon": "./logo.png",
|
||||
"authors": [
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"name": "napcat",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "2.2.6",
|
||||
"version": "2.2.7",
|
||||
"scripts": {
|
||||
"build:framework": "vite build --mode framework",
|
||||
"build:shell": "vite build --mode shell",
|
||||
|
@@ -2,7 +2,7 @@ import path, { dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import fs from 'fs';
|
||||
|
||||
export const napcat_version = '2.2.6';
|
||||
export const napcat_version = '2.2.7';
|
||||
|
||||
export class NapCatPathWrapper {
|
||||
binaryPath: string;
|
||||
|
@@ -224,6 +224,10 @@ export class NTQQGroupApi {
|
||||
async kickMemberV2Inner(param: kickMemberV2Req) {
|
||||
return this.context.session.getGroupService().kickMemberV2(param);
|
||||
}
|
||||
async deleteGroupBulletin(GroupCode: string, feedId: string) {
|
||||
const _Pskey = (await this.core.apis.UserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!;
|
||||
return this.context.session.getGroupService().deleteGroupBulletin(GroupCode, _Pskey, feedId);
|
||||
}
|
||||
async quitGroupV2(GroupCode: string, needDeleteLocalMsg: boolean) {
|
||||
let param = {
|
||||
groupCode: GroupCode,
|
||||
@@ -314,7 +318,7 @@ export class NTQQGroupApi {
|
||||
throw ('获取群成员列表出错,' + result.errMsg);
|
||||
}
|
||||
|
||||
//logDebug(`获取群(${groupQQ})成员列表结果:`, `finish: ${result.result.finish}`); //, Array.from(result.result.infos.values()));
|
||||
this.context.logger.logDebug(`获取群(${groupQQ})成员列表结果:`, `members: ${result.result.infos.size}`); //, Array.from(result.result.infos.values()));
|
||||
return result.result.infos;
|
||||
/*
|
||||
console.log(sceneId);
|
||||
|
@@ -197,12 +197,12 @@ export class NapCatCore {
|
||||
}
|
||||
};
|
||||
this.context.session.getGroupService().addKernelGroupListener(
|
||||
proxiedListenerOf(profileListener, this.context.logger) as any
|
||||
proxiedListenerOf(groupListener, this.context.logger) as any
|
||||
);
|
||||
}
|
||||
checkAdminEvent(groupCode: string, memberNew: GroupMember, memberOld: GroupMember | undefined): boolean {
|
||||
if (memberNew.role !== memberOld?.role) {
|
||||
this.context.logger.log(`群 ${groupCode} ${memberNew.nick} 角色变更为 ${memberNew.role === 3 ? '管理员' : '群员'}`);
|
||||
this.context.logger.logDebug(`群 ${groupCode} ${memberNew.nick} 角色变更为 ${memberNew.role === 3 ? '管理员' : '群员'}`);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@@ -43,4 +43,48 @@ export class ProfileListener implements IProfileListener {
|
||||
onStrangerRemarkChanged(...args: unknown[]) {
|
||||
|
||||
}
|
||||
|
||||
onMemberListChange(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onMemberInfoChange(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupListUpdate(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupAllInfoChange(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupDetailInfoChange(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupConfMemberChange(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupExtListUpdate(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupNotifiesUpdated(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupNotifiesUnreadCountUpdated(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupMemberLevelInfoChange(...args: unknown[]){
|
||||
|
||||
}
|
||||
|
||||
onGroupBulletinChange(...args: unknown[]){
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -209,7 +209,7 @@ export interface NodeIKernelGroupService {
|
||||
|
||||
getGroupBulletin(groupCode: string): unknown;
|
||||
|
||||
deleteGroupBulletin(groupCode: string, seq: string): void;
|
||||
deleteGroupBulletin(groupCode: string, seq: string, feedId: string): void;
|
||||
|
||||
publishGroupBulletin(groupCode: string, pskey: string, data: any): Promise<GeneralCallResult>;
|
||||
|
||||
|
28
src/onebot/action/group/DelGroupNotice.ts
Normal file
28
src/onebot/action/group/DelGroupNotice.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { WebApiGroupNoticeFeed } from '@/core';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
group_id: { type: ['number', 'string'] },
|
||||
feed_id: { type: 'string' },
|
||||
},
|
||||
required: ['group_id','feed_id'],
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class DelGroupNotice extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.DelGroupNotice;
|
||||
PayloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const NTQQGroupApi = this.CoreContext.apis.GroupApi;
|
||||
const group = payload.group_id.toString();
|
||||
const feedId = payload.feed_id;
|
||||
return await NTQQGroupApi.deleteGroupBulletin(group, feedId);
|
||||
}
|
||||
}
|
@@ -80,6 +80,7 @@ import GetGuildProfile from './guild/GetGuildProfile';
|
||||
import SetModelShow from './go-cqhttp/SetModelShow';
|
||||
import { SetInputStatus } from './extends/SetInputStatus';
|
||||
import { GetCSRF } from './system/GetCSRF';
|
||||
import { DelGroupNotice } from './group/DelGroupNotice';
|
||||
|
||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||
|
||||
@@ -169,6 +170,7 @@ export function createActionMap(onebotContext: NapCatOneBot11Adapter, coreContex
|
||||
new SetModelShow(onebotContext, coreContext),
|
||||
new SetInputStatus(onebotContext, coreContext),
|
||||
new GetCSRF(onebotContext, coreContext),
|
||||
new DelGroupNotice(onebotContext, coreContext),
|
||||
];
|
||||
const actionMap = new Map();
|
||||
for (const action of actionHandlers) {
|
||||
|
@@ -171,7 +171,7 @@ const _handlers: {
|
||||
} else {
|
||||
postData = data;
|
||||
}
|
||||
// Mlikiowa V2.2.6 Refactor Todo
|
||||
// Mlikiowa V2.2.7 Refactor Todo
|
||||
const signUrl = obContext.configLoader.configData.musicSignUrl;
|
||||
if (!signUrl) {
|
||||
if (data.type === 'qq') {
|
||||
|
@@ -109,4 +109,5 @@ export enum ActionName {
|
||||
SetModelShow = "_set_model_show",
|
||||
SetInputStatus = "set_input_status",
|
||||
GetCSRF = "get_csrf_token",
|
||||
DelGroupNotice = "_del_group_notice",
|
||||
}
|
||||
|
@@ -249,8 +249,9 @@ export class NapCatOneBot11Adapter {
|
||||
}
|
||||
};
|
||||
const msgIdSend = new LRUCache<string, boolean>(100);
|
||||
const recallMsgs = new LRUCache<string, boolean>(100);
|
||||
msgListener.onMsgInfoListUpdate = async msgList => {
|
||||
this.emitRecallMsg(msgList)
|
||||
this.emitRecallMsg(msgList, recallMsgs)
|
||||
.catch(e => this.context.logger.logError('处理消息失败', e));
|
||||
|
||||
for (const msg of msgList.filter(e => e.senderUin == this.core.selfInfo.uin)) {
|
||||
@@ -492,10 +493,11 @@ export class NapCatOneBot11Adapter {
|
||||
}).catch(e => this.context.logger.logError('constructPrivateEvent error: ', e));
|
||||
}
|
||||
|
||||
private async emitRecallMsg(msgList: RawMessage[]) {
|
||||
private async emitRecallMsg(msgList: RawMessage[], cache: LRUCache<string, boolean>) {
|
||||
for (const message of msgList) {
|
||||
// log("message update", message.sendStatus, message.msgId, message.msgSeq)
|
||||
if (message.recallTime != '0') { //todo: 这个判断方法不太好,应该使用灰色消息元素来判断?
|
||||
if (message.recallTime != '0' && !cache.get(message.msgId)) { //todo: 这个判断方法不太好,应该使用灰色消息元素来判断?
|
||||
cache.put(message.msgId, true)
|
||||
// 撤回消息上报
|
||||
const oriMessageId = MessageUnique.getShortIdByMsgId(message.msgId);
|
||||
if (!oriMessageId) {
|
||||
|
@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
SettingItem(
|
||||
'<span id="napcat-update-title">Napcat</span>',
|
||||
undefined,
|
||||
SettingButton('V2.2.6', 'napcat-update-button', 'secondary'),
|
||||
SettingButton('V2.2.7', 'napcat-update-button', 'secondary'),
|
||||
),
|
||||
]),
|
||||
SettingList([
|
||||
|
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
||||
SettingItem(
|
||||
'<span id="napcat-update-title">Napcat</span>',
|
||||
void 0,
|
||||
SettingButton("V2.2.6", "napcat-update-button", "secondary")
|
||||
SettingButton("V2.2.7", "napcat-update-button", "secondary")
|
||||
)
|
||||
]),
|
||||
SettingList([
|
||||
|
Reference in New Issue
Block a user