style: lint

This commit is contained in:
手瓜一十雪
2024-09-17 13:15:12 +08:00
parent 406deac592
commit 1a67a001c5
8 changed files with 23 additions and 23 deletions

View File

@@ -45,9 +45,9 @@ async function handleWavFile(
): Promise<{input: Buffer, sampleRate: number}> { ): Promise<{input: Buffer, sampleRate: number}> {
const { fmt } = getWavFileInfo(file); const { fmt } = getWavFileInfo(file);
if (!ALLOW_SAMPLE_RATE.includes(fmt.sampleRate)) { if (!ALLOW_SAMPLE_RATE.includes(fmt.sampleRate)) {
return {input: await convert(filePath, pcmPath, logger), sampleRate: 24000}; return { input: await convert(filePath, pcmPath, logger), sampleRate: 24000 };
} }
return {input: file, sampleRate: fmt.sampleRate}; return { input: file, sampleRate: fmt.sampleRate };
} }
export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: LogWrapper) { export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: LogWrapper) {
@@ -59,7 +59,7 @@ export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: Log
const pcmPath = `${pttPath}.pcm`; const pcmPath = `${pttPath}.pcm`;
const { input, sampleRate } = isWav(file) const { input, sampleRate } = isWav(file)
? (await handleWavFile(file, filePath, pcmPath, logger)) ? (await handleWavFile(file, filePath, pcmPath, logger))
: {input: await convert(filePath, pcmPath, logger), sampleRate: 24000}; : { input: await convert(filePath, pcmPath, logger), sampleRate: 24000 };
const silk = await encode(input, sampleRate); const silk = await encode(input, sampleRate);
await fsPromise.writeFile(pttPath, silk.data); await fsPromise.writeFile(pttPath, silk.data);
logger.log(`语音文件${filePath}转换成功!`, pttPath, '时长:', silk.duration); logger.log(`语音文件${filePath}转换成功!`, pttPath, '时长:', silk.duration);

View File

@@ -187,7 +187,7 @@ export class NTEventWrapper {
const id = randomUUID(); const id = randomUUID();
let complete = 0; let complete = 0;
let retData: Parameters<ListenerType> | undefined = undefined; let retData: Parameters<ListenerType> | undefined = undefined;
let retEvent: any = {}; const retEvent: any = {};
function sendDataCallback() { function sendDataCallback() {
if (complete == 0) { if (complete == 0) {

View File

@@ -144,7 +144,7 @@ async function tryDownload(options: string | HttpDownloadOptions, useReferer: bo
} }
if (useReferer && !headers['Referer']) { if (useReferer && !headers['Referer']) {
headers['Referer'] = url; headers['Referer'] = url;
}; }
const fetchRes = await fetch(url, { headers }).catch((err) => { const fetchRes = await fetch(url, { headers }).catch((err) => {
if (err.cause) { if (err.cause) {
throw err.cause; throw err.cause;

View File

@@ -23,7 +23,7 @@ class GetGroupMemberList extends BaseAction<Payload, OB11GroupMember[]> {
async _handle(payload: Payload) { async _handle(payload: Payload) {
const groupMembers = await this.core.apis.GroupApi.getGroupMembersV2(payload.group_id.toString()); const groupMembers = await this.core.apis.GroupApi.getGroupMembersV2(payload.group_id.toString());
const groupMembersArr = Array.from(groupMembers.values()); const groupMembersArr = Array.from(groupMembers.values());
let uids = groupMembersArr.map(item => item.uid); const uids = groupMembersArr.map(item => item.uid);
//let CoreAndBase = await this.core.apis.GroupApi.getCoreAndBaseInfo(uids) //let CoreAndBase = await this.core.apis.GroupApi.getCoreAndBaseInfo(uids)
let _groupMembers = groupMembersArr.map(item => { let _groupMembers = groupMembersArr.map(item => {
return OB11Entities.groupMember(payload.group_id.toString(), item); return OB11Entities.groupMember(payload.group_id.toString(), item);

View File

@@ -609,7 +609,7 @@ export class OneBotMsgApi {
[OB11MessageDataType.miniapp]: async () => undefined, [OB11MessageDataType.miniapp]: async () => undefined,
[OB11MessageDataType.contact]: async ({ data }, context) => { [OB11MessageDataType.contact]: async ({ data }, context) => {
let arkJson = await this.core.apis.UserApi.getBuddyRecommendContactArkJson(data.id.toString(), ''); const arkJson = await this.core.apis.UserApi.getBuddyRecommendContactArkJson(data.id.toString(), '');
return this.ob11ToRawConverters.json({ return this.ob11ToRawConverters.json({
data: { data: arkJson.arkMsg }, data: { data: arkJson.arkMsg },
type: OB11MessageDataType.json type: OB11MessageDataType.json

View File

@@ -77,7 +77,7 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter {
}); });
}); });
await this.wsClientsMutex.runExclusive(async () => { await this.wsClientsMutex.runExclusive(async () => {
if(!isApiConnect){ if (!isApiConnect) {
this.wsClientWithEvent.push(wsClient); this.wsClientWithEvent.push(wsClient);
} }
this.wsClients.push(wsClient); this.wsClients.push(wsClient);

View File

@@ -117,7 +117,7 @@ export async function NCoreInitShell() {
nick: '', // 获取不到 nick: '', // 获取不到
online: true, online: true,
}); });
} };
loginListener.onQRCodeGetPicture = ({ pngBase64QrcodeData, qrcodeUrl }) => { loginListener.onQRCodeGetPicture = ({ pngBase64QrcodeData, qrcodeUrl }) => {
//设置WebuiQrcode //设置WebuiQrcode