mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 21:10:23 +00:00
feat: partly impl UploadForwardMsg
This commit is contained in:
39
src/onebot/action/extends/UploadForwardMsg.ts
Normal file
39
src/onebot/action/extends/UploadForwardMsg.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import {PacketMsgTextElement} from "@/core/helper/packet/msg/element";
|
||||
import {SendTextElement} from "@/core";
|
||||
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
group_id: { type: ['number', 'string'] },
|
||||
},
|
||||
required: ['group_id'],
|
||||
}as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class UploadForwardMsg extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.UploadForwardMsg;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
if (!this.core.apis.PacketApi.packetClient?.isConnected) {
|
||||
throw new Error('PacketClient is not init');
|
||||
}
|
||||
throw new Error('Not implemented');
|
||||
// return await this.core.apis.PacketApi.sendUploadForwardMsg([{
|
||||
// groupId: 0,
|
||||
// senderId: 0,
|
||||
// senderName: "NapCat",
|
||||
// time: Math.floor(Date.now() / 1000),
|
||||
// msg: [new PacketMsgTextElement({
|
||||
// textElement: {
|
||||
// content: "Nya~"
|
||||
// }
|
||||
// } as SendTextElement)]
|
||||
// }], 0);
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,7 @@ import { GroupPoke } from './group/GroupPoke';
|
||||
import { GetUserStatus } from './extends/GetUserStatus';
|
||||
import { GetRkey } from './extends/GetRkey';
|
||||
import { SetSpecialTittle } from './extends/SetSpecialTittle';
|
||||
import { UploadForwardMsg } from "@/onebot/action/extends/UploadForwardMsg";
|
||||
|
||||
|
||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||
@@ -188,6 +189,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
|
||||
new GetUserStatus(obContext, core),
|
||||
new GetRkey(obContext, core),
|
||||
new SetSpecialTittle(obContext, core),
|
||||
new UploadForwardMsg(obContext, core),
|
||||
];
|
||||
const actionMap = new Map();
|
||||
for (const action of actionHandlers) {
|
||||
|
||||
@@ -69,7 +69,7 @@ export enum ActionName {
|
||||
GetRecord = 'get_record',
|
||||
CleanCache = 'clean_cache',
|
||||
GetCookies = 'get_cookies',
|
||||
// 以下为go-cqhttp api
|
||||
// 以下为go-cqhttp api
|
||||
GoCQHTTP_HandleQuickAction = '.handle_quick_operation',
|
||||
GetGroupHonorInfo = 'get_group_honor_info',
|
||||
GoCQHTTP_GetEssenceMsg = 'get_essence_msg_list',
|
||||
@@ -123,4 +123,5 @@ export enum ActionName {
|
||||
GetUserStatus = "nc_get_user_status",
|
||||
GetRkey = "nc_get_rkey",
|
||||
SetSpecialTittle = "set_group_special_title",
|
||||
UploadForwardMsg = "upload_forward_msg",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user