mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
commit
52e99a2175
@ -5,9 +5,9 @@ import { ActionName } from '../types';
|
|||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import { OB11MessageImage, OB11MessageVideo } from '@/onebot/types';
|
import { OB11MessageImage, OB11MessageVideo } from '@/onebot/types';
|
||||||
|
|
||||||
export interface GetFilePayload {
|
// interface GetFilePayload {
|
||||||
file: string; // 文件名或者fileUuid
|
// file: string; // 文件名或者fileUuid
|
||||||
}
|
// }
|
||||||
|
|
||||||
export interface GetFileResponse {
|
export interface GetFileResponse {
|
||||||
file?: string; // path
|
file?: string; // path
|
||||||
@ -16,19 +16,25 @@ export interface GetFileResponse {
|
|||||||
file_name?: string;
|
file_name?: string;
|
||||||
base64?: string;
|
base64?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GetFileBase_PayloadSchema = {
|
const GetFileBase_PayloadSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
file: { type: 'string' },
|
file: { type: 'string' },
|
||||||
|
file_id: { type: 'string' }
|
||||||
},
|
},
|
||||||
required: ['file'],
|
oneOf: [
|
||||||
|
{ required: ['file'] },
|
||||||
|
{ required: ['file_id'] }
|
||||||
|
]
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
export type GetFilePayload = FromSchema<typeof GetFileBase_PayloadSchema>;
|
||||||
|
|
||||||
export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
|
export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
|
||||||
payloadSchema: any = GetFileBase_PayloadSchema;
|
payloadSchema = GetFileBase_PayloadSchema;
|
||||||
|
|
||||||
async _handle(payload: GetFilePayload): Promise<GetFileResponse> {
|
async _handle(payload: GetFilePayload): Promise<GetFileResponse> {
|
||||||
|
payload.file ||= payload.file_id || '';
|
||||||
//接收消息标记模式
|
//接收消息标记模式
|
||||||
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file);
|
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file);
|
||||||
if (contextMsgFile) {
|
if (contextMsgFile) {
|
||||||
@ -115,27 +121,6 @@ export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const GetFile_PayloadSchema = {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
file_id: { type: 'string' },
|
|
||||||
file: { type: 'string' },
|
|
||||||
},
|
|
||||||
required: ['file_id'],
|
|
||||||
} as const satisfies JSONSchema;
|
|
||||||
|
|
||||||
type GetFile_Payload_Internal = FromSchema<typeof GetFile_PayloadSchema>;
|
|
||||||
|
|
||||||
interface GetFile_Payload extends GetFile_Payload_Internal {
|
|
||||||
file: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class GetFile extends GetFileBase {
|
export default class GetFile extends GetFileBase {
|
||||||
actionName = ActionName.GetFile;
|
actionName = ActionName.GetFile;
|
||||||
payloadSchema = GetFile_PayloadSchema;
|
|
||||||
|
|
||||||
async _handle(payload: GetFile_Payload): Promise<GetFileResponse> {
|
|
||||||
payload.file = payload.file_id;
|
|
||||||
return super._handle(payload);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ChatType, Peer } from '@/core/entities';
|
import { ChatType, Peer } from '@/core/entities';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
@ -49,23 +49,14 @@ export class MarkGroupMsgAsRead extends MarkMsgAsRead {
|
|||||||
actionName = ActionName.MarkGroupMsgAsRead;
|
actionName = ActionName.MarkGroupMsgAsRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class GoCQHTTPMarkMsgAsRead extends MarkMsgAsRead {
|
||||||
interface Payload {
|
|
||||||
message_id: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GoCQHTTPMarkMsgAsRead extends BaseAction<Payload, null> {
|
|
||||||
actionName = ActionName.GoCQHTTP_MarkMsgAsRead;
|
actionName = ActionName.GoCQHTTP_MarkMsgAsRead;
|
||||||
|
|
||||||
async _handle(payload: Payload): Promise<null> {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MarkAllMsgAsRead extends BaseAction<Payload, null> {
|
export class MarkAllMsgAsRead extends BaseAction<any, null> {
|
||||||
actionName = ActionName._MarkAllMsgAsRead;
|
actionName = ActionName._MarkAllMsgAsRead;
|
||||||
|
|
||||||
async _handle(payload: Payload): Promise<null> {
|
async _handle(): Promise<null> {
|
||||||
await this.core.apis.MsgApi.markAllMsgAsRead();
|
await this.core.apis.MsgApi.markAllMsgAsRead();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user