mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: 群文件转存永久
This commit is contained in:
@@ -218,6 +218,10 @@ export class NTQQGroupApi {
|
|||||||
return this.context.session.getRichMediaService().deleteGroupFolder(groupCode, folderId);
|
return this.context.session.getRichMediaService().deleteGroupFolder(groupCode, folderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async transGroupFile(groupCode: string, fileId: string) {
|
||||||
|
return this.context.session.getRichMediaService().transGroupFile(groupCode, fileId);
|
||||||
|
}
|
||||||
|
|
||||||
async addGroupEssence(groupCode: string, msgId: string) {
|
async addGroupEssence(groupCode: string, msgId: string) {
|
||||||
const MsgData = await this.context.session.getMsgService().getMsgsIncludeSelf({
|
const MsgData = await this.context.session.getMsgService().getMsgsIncludeSelf({
|
||||||
chatType: 2,
|
chatType: 2,
|
||||||
|
@@ -200,7 +200,17 @@ export interface NodeIKernelRichMediaService {
|
|||||||
|
|
||||||
moveGroupFile(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown, arg5: unknown): unknown;
|
moveGroupFile(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown, arg5: unknown): unknown;
|
||||||
|
|
||||||
transGroupFile(arg1: unknown, arg2: unknown): unknown;
|
transGroupFile(groupCode: string, fileId: string): Promise<GeneralCallResult & {
|
||||||
|
transGroupFileResult: {
|
||||||
|
result: {
|
||||||
|
retCode: number
|
||||||
|
retMsg: string
|
||||||
|
clientWording: string
|
||||||
|
}
|
||||||
|
saveBusId: number
|
||||||
|
saveFilePath: string
|
||||||
|
}
|
||||||
|
}>;
|
||||||
|
|
||||||
searchGroupFile(
|
searchGroupFile(
|
||||||
keywords: Array<string>,
|
keywords: Array<string>,
|
||||||
|
@@ -17,7 +17,7 @@ interface MoveGroupFileResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MoveGroupFile extends GetPacketStatusDepends<Payload, MoveGroupFileResponse> {
|
export class MoveGroupFile extends GetPacketStatusDepends<Payload, MoveGroupFileResponse> {
|
||||||
override actionName = ActionName.GOCQHTTP_MoveGroupFile;
|
override actionName = ActionName.MoveGroupFile;
|
||||||
override payloadSchema = SchemaData;
|
override payloadSchema = SchemaData;
|
||||||
|
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
|
34
src/onebot/action/extends/TransGroupFile.ts
Normal file
34
src/onebot/action/extends/TransGroupFile.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import { ActionName } from '@/onebot/action/router';
|
||||||
|
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||||
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
|
import { Static, Type } from '@sinclair/typebox';
|
||||||
|
|
||||||
|
const SchemaData = Type.Object({
|
||||||
|
group_id: Type.Union([Type.Number(), Type.String()]),
|
||||||
|
file_id: Type.String(),
|
||||||
|
});
|
||||||
|
|
||||||
|
type Payload = Static<typeof SchemaData>;
|
||||||
|
|
||||||
|
interface TransGroupFileResponse {
|
||||||
|
ok: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TransGroupFile extends GetPacketStatusDepends<Payload, TransGroupFileResponse> {
|
||||||
|
override actionName = ActionName.TransGroupFile;
|
||||||
|
override payloadSchema = SchemaData;
|
||||||
|
|
||||||
|
async _handle(payload: Payload) {
|
||||||
|
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file_id) || FileNapCatOneBotUUID.decodeModelId(payload.file_id);
|
||||||
|
if (contextMsgFile?.fileUUID) {
|
||||||
|
const result = await this.core.apis.GroupApi.transGroupFile(payload.group_id.toString(), contextMsgFile.fileUUID);
|
||||||
|
if (result.transGroupFileResult.result.retCode === 0) {
|
||||||
|
return {
|
||||||
|
ok: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
throw new Error(result.transGroupFileResult.result.retMsg);
|
||||||
|
}
|
||||||
|
throw new Error('real fileUUID not found!');
|
||||||
|
}
|
||||||
|
}
|
@@ -110,6 +110,7 @@ import { GetPrivateFileUrl } from './file/GetPrivateFileUrl';
|
|||||||
import { GetUnidirectionalFriendList } from './extends/GetUnidirectionalFriendList';
|
import { GetUnidirectionalFriendList } from './extends/GetUnidirectionalFriendList';
|
||||||
import SetGroupRemark from './extends/SetGroupRemark';
|
import SetGroupRemark from './extends/SetGroupRemark';
|
||||||
import { MoveGroupFile } from './extends/MoveGroupFile';
|
import { MoveGroupFile } from './extends/MoveGroupFile';
|
||||||
|
import { TransGroupFile } from './extends/TransGroupFile';
|
||||||
|
|
||||||
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
||||||
|
|
||||||
@@ -134,6 +135,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
|
|||||||
new SendGroupSign(obContext, core),
|
new SendGroupSign(obContext, core),
|
||||||
new GetClientkey(obContext, core),
|
new GetClientkey(obContext, core),
|
||||||
new MoveGroupFile(obContext, core),
|
new MoveGroupFile(obContext, core),
|
||||||
|
new TransGroupFile(obContext, core),
|
||||||
// onebot11
|
// onebot11
|
||||||
new SendLike(obContext, core),
|
new SendLike(obContext, core),
|
||||||
new GetMsg(obContext, core),
|
new GetMsg(obContext, core),
|
||||||
|
@@ -85,7 +85,6 @@ export const ActionName = {
|
|||||||
GoCQHTTP_GetGroupRootFiles: 'get_group_root_files',
|
GoCQHTTP_GetGroupRootFiles: 'get_group_root_files',
|
||||||
GoCQHTTP_GetGroupFilesByFolder: 'get_group_files_by_folder',
|
GoCQHTTP_GetGroupFilesByFolder: 'get_group_files_by_folder',
|
||||||
GOCQHTTP_GetGroupFileUrl: 'get_group_file_url',
|
GOCQHTTP_GetGroupFileUrl: 'get_group_file_url',
|
||||||
GOCQHTTP_MoveGroupFile: 'move_group_file',
|
|
||||||
GOCQHTTP_UploadPrivateFile: 'upload_private_file',
|
GOCQHTTP_UploadPrivateFile: 'upload_private_file',
|
||||||
// GOCQHTTP_ReloadEventFilter : 'reload_event_filter',
|
// GOCQHTTP_ReloadEventFilter : 'reload_event_filter',
|
||||||
GoCQHTTP_DownloadFile: 'download_file',
|
GoCQHTTP_DownloadFile: 'download_file',
|
||||||
@@ -131,6 +130,9 @@ export const ActionName = {
|
|||||||
GetRkey: 'nc_get_rkey',
|
GetRkey: 'nc_get_rkey',
|
||||||
GetGroupShutList: 'get_group_shut_list',
|
GetGroupShutList: 'get_group_shut_list',
|
||||||
|
|
||||||
|
MoveGroupFile: 'move_group_file',
|
||||||
|
TransGroupFile: 'trans_group_file',
|
||||||
|
|
||||||
GetGuildList: 'get_guild_list',
|
GetGuildList: 'get_guild_list',
|
||||||
GetGuildProfile: 'get_guild_service_profile',
|
GetGuildProfile: 'get_guild_service_profile',
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user