mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: new api
This commit is contained in:
@@ -9,12 +9,17 @@ QQ Version: Windows 9.9.12-26000 / Linux 3.2.9-26000
|
||||
启动方式: WayBoot.03 (Electron Main进程为Node 直接注入代码 同理项目: LiteLoader)
|
||||
|
||||
## 修复与优化
|
||||
1. 尝试修复卡顿问题
|
||||
2. 修复 精华消息被设置/一起听 接受时的报错
|
||||
1. 尝试 修复 卡顿问题
|
||||
2. 尝试 修复 精华消息被设置/一起听 接受时的报错
|
||||
3. 优化 Uin与Uid 转换速度
|
||||
4. 修复CQCode可能存在的解码问题
|
||||
|
||||
## 新增与调整
|
||||
1. 戳一戳上报raw
|
||||
2. 精华消息设置通知事件
|
||||
3. 新增设置/删除群精华API
|
||||
4. 新增最近联系列表API(RAW 不稳定)
|
||||
5. 上报群精华设置事件
|
||||
6. 新增设置所有消息已读API(非标准)
|
||||
|
||||
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)
|
||||
|
@@ -228,4 +228,7 @@ export class NTQQMsgApi {
|
||||
}
|
||||
);
|
||||
}
|
||||
static async markallMsgAsRead() {
|
||||
return napCatCore.session.getMsgService().setAllC2CAndGroupMsgRead();
|
||||
}
|
||||
}
|
||||
|
@@ -299,7 +299,7 @@ export interface NodeIKernelMsgService {
|
||||
|
||||
setMsgRead(peer: Peer): Promise<GeneralCallResult>;
|
||||
|
||||
setAllC2CAndGroupMsgRead(...args: unknown[]): unknown;
|
||||
setAllC2CAndGroupMsgRead(): Promise<unknown>;
|
||||
|
||||
setGuildMsgRead(...args: unknown[]): unknown;
|
||||
|
||||
@@ -355,8 +355,8 @@ export interface NodeIKernelMsgService {
|
||||
getFileThumbSavePathForSend(...args: unknown[]): unknown;
|
||||
|
||||
getFileThumbSavePath(...args: unknown[]): unknown;
|
||||
|
||||
translatePtt2Text(j2: string, e2: {}, e3: {}): unknown;
|
||||
//猜测居多
|
||||
translatePtt2Text(MsgId: string, Peer: {}, MsgElement: {}): unknown;
|
||||
|
||||
setPttPlayedState(...args: unknown[]): unknown;
|
||||
|
||||
@@ -406,7 +406,7 @@ export interface NodeIKernelMsgService {
|
||||
|
||||
getEmojiResourcePath(...args: unknown[]): unknown;
|
||||
|
||||
JoinDragonGroupEmoji(...args: unknown[]): unknown;
|
||||
JoinDragonGroupEmoji(JoinDragonGroupEmojiReq: any/*joinDragonGroupEmojiReq*/): unknown;
|
||||
|
||||
getMsgAbstracts(...args: unknown[]): unknown;
|
||||
|
||||
|
@@ -34,7 +34,7 @@ import SetGroupAdmin from './group/SetGroupAdmin';
|
||||
import SetGroupCard from './group/SetGroupCard';
|
||||
import GetImage from './file/GetImage';
|
||||
import GetRecord from './file/GetRecord';
|
||||
import { GoCQHTTPMarkMsgAsRead, MarkGroupMsgAsRead, MarkPrivateMsgAsRead } from './msg/MarkMsgAsRead';
|
||||
import { GoCQHTTPMarkMsgAsRead, MarkAllMsgAsRead, MarkGroupMsgAsRead, MarkPrivateMsgAsRead } from './msg/MarkMsgAsRead';
|
||||
import CleanCache from './system/CleanCache';
|
||||
import GoCQHTTPUploadGroupFile from './go-cqhttp/UploadGroupFile';
|
||||
import { GetConfigAction, SetConfigAction } from '@/onebot11/action/extends/Config';
|
||||
@@ -153,7 +153,8 @@ export const actionHandlers = [
|
||||
new GetGroupSystemMsg(),
|
||||
new DelEssenceMsg(),
|
||||
new SetEssenceMsg(),
|
||||
new GetRecentContact()
|
||||
new GetRecentContact(),
|
||||
new MarkAllMsgAsRead()
|
||||
];
|
||||
|
||||
function initActionMap() {
|
||||
|
@@ -60,3 +60,12 @@ export class GoCQHTTPMarkMsgAsRead extends BaseAction<Payload, null> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export class MarkAllMsgAsRead extends BaseAction<Payload, null> {
|
||||
actionName = ActionName._MarkAllMsgAsRead;
|
||||
|
||||
protected async _handle(payload: Payload): Promise<null> {
|
||||
await NTQQMsgApi.markallMsgAsRead();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -96,5 +96,6 @@ export enum ActionName {
|
||||
SetLongNick = 'set_self_longnick',
|
||||
SetEssenceMsg = "set_essence_msg",
|
||||
DelEssenceMsg = "delete_essence_msg",
|
||||
GetRecentContact = "get_recent_contact"
|
||||
GetRecentContact = "get_recent_contact",
|
||||
_MarkAllMsgAsRead = "_mark_all_as_read"
|
||||
}
|
||||
|
@@ -67,6 +67,14 @@ export function encodeCQCode(data: OB11MessageData) {
|
||||
let result = '[CQ:' + data.type;
|
||||
for (const name in data.data) {
|
||||
const value = data.data[name];
|
||||
try {
|
||||
// Check if the value can be converted to a string
|
||||
value.toString();
|
||||
} catch (error) {
|
||||
// If it can't be converted, skip this name-value pair
|
||||
// console.warn(`Skipping problematic name-value pair. Name: ${name}, Value: ${value}`);
|
||||
continue;
|
||||
}
|
||||
result += `,${name}=${CQCodeEscape(value)}`;
|
||||
}
|
||||
result += ']';
|
||||
|
Reference in New Issue
Block a user