mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: support essence
This commit is contained in:
parent
3f7a85d80b
commit
557864395b
@ -10,12 +10,11 @@ QQ Version: Windows 9.9.12-26000 / Linux 3.2.9-26000
|
|||||||
|
|
||||||
## 修复与优化
|
## 修复与优化
|
||||||
1. 尝试修复卡顿问题
|
1. 尝试修复卡顿问题
|
||||||
2. 修复精华消息设置时的报错
|
2. 修复 精华消息被设置/一起听 接受时的报错
|
||||||
|
|
||||||
## 新增与调整
|
## 新增与调整
|
||||||
1. 戳一戳上报raw
|
1. 戳一戳上报raw
|
||||||
2. 精华消息设置通知事件
|
2. 精华消息设置通知事件
|
||||||
3. 新增设置/删除群精华API
|
3. 新增设置/删除群精华API
|
||||||
4. 表情回应事件
|
|
||||||
|
|
||||||
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)
|
新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api)
|
||||||
|
31
src/onebot11/action/group/DelEssenceMsg.ts
Normal file
31
src/onebot11/action/group/DelEssenceMsg.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
import { dbUtil } from '@/common/utils/db';
|
||||||
|
import BaseAction from '../BaseAction';
|
||||||
|
import { ActionName } from '../types';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
import { NTQQGroupApi } from '@/core';
|
||||||
|
|
||||||
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
message_id: { type: ['number', 'string'] }
|
||||||
|
},
|
||||||
|
required: ['message_id']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
|
export default class DelEssenceMsg extends BaseAction<Payload, any> {
|
||||||
|
actionName = ActionName.DelEssenceMsg;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
|
protected async _handle(payload: Payload): Promise<any> {
|
||||||
|
const msg = await dbUtil.getMsgByShortId(parseInt(payload.message_id.toString()));
|
||||||
|
if (!msg) {
|
||||||
|
throw new Error('msg not found');
|
||||||
|
}
|
||||||
|
return await NTQQGroupApi.removeGroupEssence(
|
||||||
|
msg.peerUin,
|
||||||
|
msg.msgId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
30
src/onebot11/action/group/SetEssenceMsg.ts
Normal file
30
src/onebot11/action/group/SetEssenceMsg.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { dbUtil } from '@/common/utils/db';
|
||||||
|
import BaseAction from '../BaseAction';
|
||||||
|
import { ActionName } from '../types';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
import { NTQQGroupApi, NTQQMsgApi } from '@/core';
|
||||||
|
|
||||||
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
message_id: { type: ['number', 'string'] }
|
||||||
|
},
|
||||||
|
required: ['message_id']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
|
export default class SetEssenceMsg extends BaseAction<Payload, any> {
|
||||||
|
actionName = ActionName.SetEssenceMsg;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
|
protected async _handle(payload: Payload): Promise<any> {
|
||||||
|
const msg = await dbUtil.getMsgByShortId(parseInt(payload.message_id.toString()));
|
||||||
|
if (!msg) {
|
||||||
|
throw new Error('msg not found');
|
||||||
|
}
|
||||||
|
return await NTQQGroupApi.addGroupEssence(
|
||||||
|
msg.peerUin,
|
||||||
|
msg.msgId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -93,5 +93,7 @@ export enum ActionName {
|
|||||||
SetSelfProfile = 'set_self_profile',
|
SetSelfProfile = 'set_self_profile',
|
||||||
CreateCollection = 'create_collection',
|
CreateCollection = 'create_collection',
|
||||||
GetCollectionList = 'get_collection_list',
|
GetCollectionList = 'get_collection_list',
|
||||||
SetLongNick = 'set_self_longnick'
|
SetLongNick = 'set_self_longnick',
|
||||||
|
SetEssenceMsg = "set_essence_msg",
|
||||||
|
DelEssenceMsg = "delete_essence_msg"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user