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:
@@ -10,11 +10,16 @@ QQ Version: Windows 9.9.12-26000 / Linux 3.2.9-26000
|
|||||||
|
|
||||||
## 修复与优化
|
## 修复与优化
|
||||||
1. 尝试 修复 卡顿问题
|
1. 尝试 修复 卡顿问题
|
||||||
2. 修复 精华消息被设置/一起听 接受时的报错
|
2. 尝试 修复 精华消息被设置/一起听 接受时的报错
|
||||||
|
3. 优化 Uin与Uid 转换速度
|
||||||
|
4. 修复CQCode可能存在的解码问题
|
||||||
|
|
||||||
## 新增与调整
|
## 新增与调整
|
||||||
1. 戳一戳上报raw
|
1. 戳一戳上报raw
|
||||||
2. 精华消息设置通知事件
|
2. 精华消息设置通知事件
|
||||||
3. 新增设置/删除群精华API
|
3. 新增设置/删除群精华API
|
||||||
|
4. 新增最近联系列表API(RAW 不稳定)
|
||||||
|
5. 上报群精华设置事件
|
||||||
|
6. 新增设置所有消息已读API(非标准)
|
||||||
|
|
||||||
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_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>;
|
setMsgRead(peer: Peer): Promise<GeneralCallResult>;
|
||||||
|
|
||||||
setAllC2CAndGroupMsgRead(...args: unknown[]): unknown;
|
setAllC2CAndGroupMsgRead(): Promise<unknown>;
|
||||||
|
|
||||||
setGuildMsgRead(...args: unknown[]): unknown;
|
setGuildMsgRead(...args: unknown[]): unknown;
|
||||||
|
|
||||||
@@ -355,8 +355,8 @@ export interface NodeIKernelMsgService {
|
|||||||
getFileThumbSavePathForSend(...args: unknown[]): unknown;
|
getFileThumbSavePathForSend(...args: unknown[]): unknown;
|
||||||
|
|
||||||
getFileThumbSavePath(...args: unknown[]): unknown;
|
getFileThumbSavePath(...args: unknown[]): unknown;
|
||||||
|
//猜测居多
|
||||||
translatePtt2Text(j2: string, e2: {}, e3: {}): unknown;
|
translatePtt2Text(MsgId: string, Peer: {}, MsgElement: {}): unknown;
|
||||||
|
|
||||||
setPttPlayedState(...args: unknown[]): unknown;
|
setPttPlayedState(...args: unknown[]): unknown;
|
||||||
|
|
||||||
@@ -406,7 +406,7 @@ export interface NodeIKernelMsgService {
|
|||||||
|
|
||||||
getEmojiResourcePath(...args: unknown[]): unknown;
|
getEmojiResourcePath(...args: unknown[]): unknown;
|
||||||
|
|
||||||
JoinDragonGroupEmoji(...args: unknown[]): unknown;
|
JoinDragonGroupEmoji(JoinDragonGroupEmojiReq: any/*joinDragonGroupEmojiReq*/): unknown;
|
||||||
|
|
||||||
getMsgAbstracts(...args: unknown[]): unknown;
|
getMsgAbstracts(...args: unknown[]): unknown;
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ import SetGroupAdmin from './group/SetGroupAdmin';
|
|||||||
import SetGroupCard from './group/SetGroupCard';
|
import SetGroupCard from './group/SetGroupCard';
|
||||||
import GetImage from './file/GetImage';
|
import GetImage from './file/GetImage';
|
||||||
import GetRecord from './file/GetRecord';
|
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 CleanCache from './system/CleanCache';
|
||||||
import GoCQHTTPUploadGroupFile from './go-cqhttp/UploadGroupFile';
|
import GoCQHTTPUploadGroupFile from './go-cqhttp/UploadGroupFile';
|
||||||
import { GetConfigAction, SetConfigAction } from '@/onebot11/action/extends/Config';
|
import { GetConfigAction, SetConfigAction } from '@/onebot11/action/extends/Config';
|
||||||
@@ -153,7 +153,8 @@ export const actionHandlers = [
|
|||||||
new GetGroupSystemMsg(),
|
new GetGroupSystemMsg(),
|
||||||
new DelEssenceMsg(),
|
new DelEssenceMsg(),
|
||||||
new SetEssenceMsg(),
|
new SetEssenceMsg(),
|
||||||
new GetRecentContact()
|
new GetRecentContact(),
|
||||||
|
new MarkAllMsgAsRead()
|
||||||
];
|
];
|
||||||
|
|
||||||
function initActionMap() {
|
function initActionMap() {
|
||||||
|
@@ -60,3 +60,12 @@ export class GoCQHTTPMarkMsgAsRead extends BaseAction<Payload, null> {
|
|||||||
return 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',
|
SetLongNick = 'set_self_longnick',
|
||||||
SetEssenceMsg = "set_essence_msg",
|
SetEssenceMsg = "set_essence_msg",
|
||||||
DelEssenceMsg = "delete_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;
|
let result = '[CQ:' + data.type;
|
||||||
for (const name in data.data) {
|
for (const name in data.data) {
|
||||||
const value = data.data[name];
|
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 += `,${name}=${CQCodeEscape(value)}`;
|
||||||
}
|
}
|
||||||
result += ']';
|
result += ']';
|
||||||
|
Reference in New Issue
Block a user