chore: 小调整

This commit is contained in:
手瓜一十雪 2024-08-10 17:29:24 +08:00
parent 84e5417a8c
commit 76d58af4d8
6 changed files with 8 additions and 12 deletions

View File

@ -1,6 +1,6 @@
import path from 'node:path'; import path from 'node:path';
import fs from 'node:fs'; import fs from 'node:fs';
import { NapCatCore } from '@/core'; import type { NapCatCore } from '@/core';
export class ConfigBase<T> { export class ConfigBase<T> {
public name: string = 'default_config'; public name: string = 'default_config';
private pathName: string | null = null; // 本次读取的文件路径 private pathName: string | null = null; // 本次读取的文件路径

View File

@ -7,8 +7,6 @@ import * as fileType from 'file-type';
import { randomUUID } from 'crypto'; import { randomUUID } from 'crypto';
import { LogWrapper } from './log'; import { LogWrapper } from './log';
export function isGIF(path: string) { export function isGIF(path: string) {
const buffer = Buffer.alloc(4); const buffer = Buffer.alloc(4);
const fd = fs.openSync(path, 'r'); const fd = fs.openSync(path, 'r');

View File

@ -3,6 +3,7 @@ import path from "node:path";
import fs from "fs"; import fs from "fs";
import * as fsPromise from "node:fs/promises"; import * as fsPromise from "node:fs/promises";
import os from "node:os"; import os from "node:os";
import { QQLevel } from "@/core";
//下面这个类是用于将uid+msgid合并的类 //下面这个类是用于将uid+msgid合并的类
@ -152,3 +153,7 @@ export async function deleteOldFiles(directoryPath: string, daysThreshold: numbe
//console.error('Error deleting files:', error); //console.error('Error deleting files:', error);
} }
} }
export function calcQQLevel(level: QQLevel) {
const { crownNum, sunNum, moonNum, starNum } = level;
return crownNum * 64 + sunNum * 16 + moonNum * 4 + starNum;
}

View File

@ -1,7 +0,0 @@
// QQ等级换算
import { QQLevel } from '@/core/entities';
export function calcQQLevel(level: QQLevel) {
const { crownNum, sunNum, moonNum, starNum } = level;
return crownNum * 64 + sunNum * 16 + moonNum * 4 + starNum;
}

View File

@ -3,7 +3,7 @@ import { OB11User, OB11UserSex } from '../../types';
import { OB11Constructor } from '../../helper/data'; import { OB11Constructor } from '../../helper/data';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { calcQQLevel } from '@/common/utils/qqlevel'; import { calcQQLevel } from '@/common/utils/helper';
const SchemaData = { const SchemaData = {
type: 'object', type: 'object',
properties: { properties: {

View File

@ -32,7 +32,7 @@ import { OB11GroupIncreaseEvent } from '../event/notice/OB11GroupIncreaseEvent';
import { OB11GroupBanEvent } from '../event/notice/OB11GroupBanEvent'; import { OB11GroupBanEvent } from '../event/notice/OB11GroupBanEvent';
import { OB11GroupUploadNoticeEvent } from '../event/notice/OB11GroupUploadNoticeEvent'; import { OB11GroupUploadNoticeEvent } from '../event/notice/OB11GroupUploadNoticeEvent';
import { OB11GroupNoticeEvent } from '../event/notice/OB11GroupNoticeEvent'; import { OB11GroupNoticeEvent } from '../event/notice/OB11GroupNoticeEvent';
import { calcQQLevel } from '@/common/utils/qqlevel'; import { calcQQLevel } from '@/common/utils/helper';
import { sleep, UUIDConverter } from '@/common/utils/helper'; import { sleep, UUIDConverter } from '@/common/utils/helper';
import { OB11GroupTitleEvent } from '../event/notice/OB11GroupTitleEvent'; import { OB11GroupTitleEvent } from '../event/notice/OB11GroupTitleEvent';
import { OB11GroupCardEvent } from '../event/notice/OB11GroupCardEvent'; import { OB11GroupCardEvent } from '../event/notice/OB11GroupCardEvent';