refactor: 旧代码移除

This commit is contained in:
手瓜一十雪
2024-11-21 11:01:35 +08:00
parent fa70eec3d8
commit de64b03054
12 changed files with 143 additions and 139 deletions

View File

@@ -320,7 +320,7 @@ export class NTQQFileApi {
}
async downloadMedia(msgId: string, chatType: ChatType, peerUid: string, elementId: string, thumbPath: string, sourcePath: string, timeout = 1000 * 60 * 2, force: boolean = false) {
// 用于下载收到的消息中的图片等
// 用于下载文件
if (sourcePath && fs.existsSync(sourcePath)) {
if (force) {
try {

View File

@@ -147,14 +147,11 @@ export class NTQQGroupApi {
if (!members) {
try {
members = await this.getGroupMembers(groupCodeStr);
// 更新群成员列表
this.groupMemberCache.set(groupCodeStr, members);
} catch (e) {
return null;
}
}
// log('getGroupMember', members);
function getMember() {
let member: GroupMember | undefined;
if (isNumeric(memberUinOrUidStr)) {
@@ -367,7 +364,6 @@ export class NTQQGroupApi {
}
}
this.context.session.getGroupService().destroyMemberListScene(sceneId);
//console.log('GetGroupMembersV3 len :', result.result.infos.size, resMode2?.infos.size, groupQQ);
return {
infos: new Map([...(resMode2?.infos ?? []), ...result.result.infos]),
finish: result.result.finish,
@@ -430,7 +426,7 @@ export class NTQQGroupApi {
return this.context.session.getGroupService().operateSysNotify(
false,
{
operateType: operateType, // 2 拒绝
operateType: operateType,
targetMsg: {
seq: seq, // 通知序列号
type: type,

View File

@@ -3,12 +3,7 @@ import { GroupFileInfoUpdateItem, InstanceContext, NapCatCore } from '@/core';
import { GeneralCallResult } from '@/core/services/common';
export class NTQQMsgApi {
getMsgByClientSeqAndTime(peer: Peer, replyMsgClientSeq: string, replyMsgTime: string) {
return this.context.session.getMsgService().getMsgByClientSeqAndTime(peer, replyMsgClientSeq, replyMsgTime);
}
// nt_qq//global//nt_data//Emoji//emoji-resource//sysface_res/apng/ 下可以看到所有QQ表情预览
// nt_qq\global\nt_data\Emoji\emoji-resource\face_config.json 里面有所有表情的id, 自带表情id是QSid, 标准emoji表情id是QCid
// 其实以官方文档为准是最好的https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#EmojiType
context: InstanceContext;
core: NapCatCore;
@@ -17,7 +12,10 @@ export class NTQQMsgApi {
this.context = context;
this.core = core;
}
getMsgByClientSeqAndTime(peer: Peer, replyMsgClientSeq: string, replyMsgTime: string) {
// https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#EmojiType 可以用过特殊方式拉取
return this.context.session.getMsgService().getMsgByClientSeqAndTime(peer, replyMsgClientSeq, replyMsgTime);
}
async getAioFirstViewLatestMsgs(peer: Peer, MsgCount: number) {
return this.context.session.getMsgService().getAioFirstViewLatestMsgs(peer, MsgCount);
}

View File

@@ -1,65 +1,68 @@
import { ChatType } from './msg';
export interface CacheScanResult {
result: number;
size: [ // 单位为字节
string, // 系统总存储空间
string, // 系统可用存储空间
string, // 系统已用存储空间
string, // QQ总大小
string, // 「聊天与文件」大小
string, // 未知
string, // 「缓存数据」大小
string, // 「其他数据」大小
string, // 未知
];
}
/**
* 聊天缓存列表
*/
export interface ChatCacheList {
pageCount: number;
infos: ChatCacheListItem[];
pageCount: number; // 页数
infos: ChatCacheListItem[]; // 聊天缓存项列表
}
/**
* 聊天缓存列表项
*/
export interface ChatCacheListItem {
chatType: ChatType;
basicChatCacheInfo: ChatCacheListItemBasic;
guildChatCacheInfo: unknown[]; // TODO: 没用过频道所以不知道这里边的详细内容
chatType: ChatType; // 聊天类型
basicChatCacheInfo: ChatCacheListItemBasic; // 基本聊天缓存信息
guildChatCacheInfo: unknown[]; // 公会聊天缓存信息
}
/**
* 基本聊天缓存信息
*/
export interface ChatCacheListItemBasic {
chatSize: string;
chatTime: string;
uid: string;
uin: string;
remarkName: string;
nickName: string;
chatType?: ChatType;
isChecked?: boolean;
chatSize: string; // 聊天大小
chatTime: string; // 聊天时间
uid: string; // 用户ID
uin: string; // 用户号码
remarkName: string; // 备注名
nickName: string; // 昵称
chatType?: ChatType; // 聊天类型(可选)
isChecked?: boolean; // 是否已检查(可选)
}
/**
* 缓存文件类型枚举
*/
export enum CacheFileType {
IMAGE = 0,
VIDEO = 1,
AUDIO = 2,
DOCUMENT = 3,
OTHER = 4,
IMAGE = 0, // 图片
VIDEO = 1, // 视频
AUDIO = 2, // 音频
DOCUMENT = 3, // 文档
OTHER = 4, // 其他
}
/**
* 缓存文件列表
*/
export interface CacheFileList {
infos: CacheFileListItem[],
infos: CacheFileListItem[]; // 缓存文件项列表
}
/**
* 缓存文件列表项
*/
export interface CacheFileListItem {
fileSize: string;
fileTime: string;
fileKey: string;
elementId: string;
elementIdStr: string;
fileType: CacheFileType;
path: string;
fileName: string;
senderId: string;
previewPath: string;
senderName: string;
isChecked?: boolean;
}
fileSize: string; // 文件大小
fileTime: string; // 文件时间
fileKey: string; // 文件键
elementId: string; // 元素ID
elementIdStr: string; // 元素ID字符串
fileType: CacheFileType; // 文件类型
path: string; // 路径
fileName: string; // 文件名
senderId: string; // 发送者ID
previewPath: string; // 预览路径
senderName: string; // 发送者名称
isChecked?: boolean; // 是否已检查(可选)
}