mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
style: lint
This commit is contained in:
parent
f063cf4a16
commit
535720d0fe
@ -4,7 +4,7 @@ import crypto, { randomUUID } from 'crypto';
|
|||||||
import util from 'util';
|
import util from 'util';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import * as fileType from 'file-type';
|
import * as fileType from 'file-type';
|
||||||
import { solveAsyncProblem, solveProblem } from './helper';
|
import { solveProblem } from './helper';
|
||||||
|
|
||||||
export function isGIF(path: string) {
|
export function isGIF(path: string) {
|
||||||
const buffer = Buffer.alloc(4);
|
const buffer = Buffer.alloc(4);
|
||||||
|
@ -24,11 +24,11 @@ export async function getVideoInfo(filePath: string, logger: LogWrapper) {
|
|||||||
if (videoStream) {
|
if (videoStream) {
|
||||||
logger.log(`视频尺寸: ${videoStream.width}x${videoStream.height}`);
|
logger.log(`视频尺寸: ${videoStream.width}x${videoStream.height}`);
|
||||||
} else {
|
} else {
|
||||||
return reject('未找到视频流信息。');
|
return reject(new Error('未找到视频流信息。'));
|
||||||
}
|
}
|
||||||
resolve({
|
resolve({
|
||||||
width: videoStream.width!, height: videoStream.height!,
|
width: videoStream.width!, height: videoStream.height!,
|
||||||
time: parseInt(videoStream.duration!),
|
time: +(videoStream.duration ?? 10),
|
||||||
format: metadata.format.format_name!,
|
format: metadata.format.format_name!,
|
||||||
size,
|
size,
|
||||||
filePath,
|
filePath,
|
||||||
@ -38,7 +38,7 @@ export async function getVideoInfo(filePath: string, logger: LogWrapper) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkFfmpeg(newPath: string | null = null, logger: LogWrapper): Promise<boolean> {
|
export function checkFfmpeg(logger: LogWrapper,newPath: string | null = null): Promise<boolean> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
logger.log('开始检查ffmpeg', newPath);
|
logger.log('开始检查ffmpeg', newPath);
|
||||||
if (newPath) {
|
if (newPath) {
|
||||||
|
@ -1,17 +1,4 @@
|
|||||||
interface IDependsAdapter {
|
export class NodeIDependsAdapter {
|
||||||
onMSFStatusChange(arg1: number, arg2: number): void;
|
|
||||||
|
|
||||||
onMSFSsoError(args: unknown): void;
|
|
||||||
|
|
||||||
getGroupCode(args: unknown): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface NodeIDependsAdapter extends IDependsAdapter {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-new
|
|
||||||
new(adapter: IDependsAdapter): NodeIDependsAdapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class DependsAdapter implements IDependsAdapter {
|
|
||||||
onMSFStatusChange(arg1: number, arg2: number) {
|
onMSFStatusChange(arg1: number, arg2: number) {
|
||||||
// console.log(arg1, arg2);
|
// console.log(arg1, arg2);
|
||||||
// if (arg1 == 2 && arg2 == 2) {
|
// if (arg1 == 2 && arg2 == 2) {
|
||||||
|
@ -1,17 +1,4 @@
|
|||||||
interface IDispatcherAdapter {
|
export class NodeIDispatcherAdapter {
|
||||||
dispatchRequest(arg: unknown): void;
|
|
||||||
|
|
||||||
dispatchCall(arg: unknown): void;
|
|
||||||
|
|
||||||
dispatchCallWithJson(arg: unknown): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface NodeIDispatcherAdapter extends IDispatcherAdapter {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-new
|
|
||||||
new(adapter: IDispatcherAdapter): NodeIDispatcherAdapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class DispatcherAdapter implements IDispatcherAdapter {
|
|
||||||
dispatchRequest(arg: unknown) {
|
dispatchRequest(arg: unknown) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,77 +2,6 @@ import { RequestUtil } from '@/common/utils/request';
|
|||||||
import { MiniAppLuaJsonType } from '@/core';
|
import { MiniAppLuaJsonType } from '@/core';
|
||||||
import { InstanceContext, NapCatCore } from '..';
|
import { InstanceContext, NapCatCore } from '..';
|
||||||
|
|
||||||
// let t = await napCatCore.session.getGroupService().shareDigest({
|
|
||||||
// appId: "100497308",
|
|
||||||
// appType: 1,
|
|
||||||
// msgStyle: 0,
|
|
||||||
// recvUin: "726067488",
|
|
||||||
// sendType: 1,
|
|
||||||
// clientInfo: {
|
|
||||||
// platform: 1
|
|
||||||
// },
|
|
||||||
// richMsg: {
|
|
||||||
// usingArk: true,
|
|
||||||
// title: "Bot测试title",
|
|
||||||
// summary: "Bot测试summary",
|
|
||||||
// url: "https://www.bilibili.com",
|
|
||||||
// pictureUrl: "https://y.qq.com/music/photo_new/T002R300x300M0000035DC6W4ZpSqf_1.jpg?max_age=2592000",
|
|
||||||
// brief: "Bot测试brief",
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// {
|
|
||||||
// errCode: 0,
|
|
||||||
// errMsg: '',
|
|
||||||
// rsp: {
|
|
||||||
// sendType: 1,
|
|
||||||
// recvUin: '726067488',
|
|
||||||
// recvOpenId: '',
|
|
||||||
// errCode: 901501,
|
|
||||||
// errMsg: 'imagent service_error:150_OIDB_NO_PRIV',
|
|
||||||
// extInfo: {
|
|
||||||
// wording: '消息下发失败(错误码:901501)',
|
|
||||||
// jumpResult: 0,
|
|
||||||
// jumpUrl: '',
|
|
||||||
// level: 0,
|
|
||||||
// subLevel: 0,
|
|
||||||
// developMsg: 'imagent error'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export class MusicSign {
|
|
||||||
// private readonly url: string;
|
|
||||||
|
|
||||||
// constructor(url: string) {
|
|
||||||
// this.url = url;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// sign(postData: CustomMusicSignPostData | IdMusicSignPostData): Promise<any> {
|
|
||||||
// return new Promise((resolve, reject) => {
|
|
||||||
// fetch(this.url, {
|
|
||||||
// method: 'POST', // 指定请求方法为 POST
|
|
||||||
// headers: {
|
|
||||||
// 'Content-Type': 'application/json' // 设置请求头,指明发送的数据类型为 JSON
|
|
||||||
// },
|
|
||||||
// body: JSON.stringify(postData) // 将 JavaScript 对象转换为 JSON 字符串作为请求体
|
|
||||||
// })
|
|
||||||
// .then(response => {
|
|
||||||
// if (!response.ok) {
|
|
||||||
// reject(response.statusText); // 请求失败,返回错误信息
|
|
||||||
// }
|
|
||||||
// return response.json(); // 解析 JSON 格式的响应体
|
|
||||||
// })
|
|
||||||
// .then(data => {
|
|
||||||
// logDebug('音乐消息生成成功', data);
|
|
||||||
// resolve(data);
|
|
||||||
// })
|
|
||||||
// .catch(error => {
|
|
||||||
// reject(error);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
export class NTQQMusicSignApi {
|
export class NTQQMusicSignApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
core: NapCatCore;
|
core: NapCatCore;
|
||||||
|
@ -1,23 +1,4 @@
|
|||||||
export interface ISessionListener {
|
export class NodeIKernelSessionListener {
|
||||||
onNTSessionCreate(args: unknown): void;
|
|
||||||
|
|
||||||
onGProSessionCreate(args: unknown): void;
|
|
||||||
|
|
||||||
onSessionInitComplete(args: unknown): void;
|
|
||||||
|
|
||||||
onOpentelemetryInit(args: unknown): void;
|
|
||||||
|
|
||||||
onUserOnlineResult(args: unknown): void;
|
|
||||||
|
|
||||||
onGetSelfTinyId(args: unknown): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface NodeIKernelSessionListener extends ISessionListener {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-new
|
|
||||||
new(adapter: ISessionListener): NodeIKernelSessionListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SessionListener implements ISessionListener {
|
|
||||||
onNTSessionCreate(args: unknown) {
|
onNTSessionCreate(args: unknown) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import type { SelfInfo } from '@/core/entities';
|
import type { SelfInfo } from '@/core/entities';
|
||||||
|
|
||||||
import { LogWrapper } from '@/common/utils/log';
|
import { LogWrapper } from '@/common/utils/log';
|
||||||
import { LoginListener, SessionListener } from '@/core/listeners';
|
import { LoginListener, NodeIKernelSessionListener } from '@/core/listeners';
|
||||||
import { DependsAdapter, DispatcherAdapter, GlobalAdapter } from '@/core/adapters';
|
import { NodeIDispatcherAdapter, GlobalAdapter, NodeIDependsAdapter } from '@/core/adapters';
|
||||||
import { NapCatPathWrapper } from '@/common/framework/napcat';
|
import { NapCatPathWrapper } from '@/common/framework/napcat';
|
||||||
import {
|
import {
|
||||||
InstanceContext,
|
InstanceContext,
|
||||||
@ -208,7 +208,7 @@ export async function NCoreInitShell() {
|
|||||||
selfInfo.uid,
|
selfInfo.uid,
|
||||||
dataPath,
|
dataPath,
|
||||||
);
|
);
|
||||||
const sessionListener = new SessionListener();
|
const sessionListener = new NodeIKernelSessionListener();
|
||||||
sessionListener.onSessionInitComplete = (r: unknown) => {
|
sessionListener.onSessionInitComplete = (r: unknown) => {
|
||||||
if (r === 0) {
|
if (r === 0) {
|
||||||
resolve();
|
resolve();
|
||||||
@ -218,8 +218,8 @@ export async function NCoreInitShell() {
|
|||||||
};
|
};
|
||||||
session.init(
|
session.init(
|
||||||
sessionConfig,
|
sessionConfig,
|
||||||
new DependsAdapter() as any,
|
new NodeIDependsAdapter(),
|
||||||
new DispatcherAdapter() as any,
|
new NodeIDispatcherAdapter(),
|
||||||
sessionListener as any,
|
sessionListener as any,
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user