feat: bind

This commit is contained in:
手瓜一十雪
2024-09-22 16:59:45 +08:00
parent 742e9f9493
commit 2ba1ef56e3
17 changed files with 82 additions and 86 deletions

View File

@@ -145,7 +145,7 @@ export class NTQQFileApi {
try {
videoInfo = await getVideoInfo(filePath, logger);
} catch (e) {
logger.logError('获取视频信息失败,将使用默认值', e);
logger.logError.bind(logger)('获取视频信息失败,将使用默认值', e);
}
let fileExt = 'mp4';
@@ -153,7 +153,7 @@ export class NTQQFileApi {
const tempExt = (await fileType.fileTypeFromFile(filePath))?.ext;
if (tempExt) fileExt = tempExt;
} catch (e) {
this.context.logger.logError('获取文件类型失败', e);
this.context.logger.logError.bind(logger)('获取文件类型失败', e);
}
const newFilePath = filePath + '.' + fileExt;
fs.copyFileSync(filePath, newFilePath);
@@ -227,7 +227,7 @@ export class NTQQFileApi {
}
if (converted) {
fsPromises.unlink(silkPath).then().catch(
(e) => this.context.logger.logError('删除临时文件失败', e)
(e) => this.context.logger.logError.bind(this.context.logger)('删除临时文件失败', e)
);
}
return {

View File

@@ -264,7 +264,7 @@ export class NTQQWebApi {
});
}
} else {
this.context.logger.logError('获取龙王信息失败');
this.context.logger.logError.bind(this.context.logger)('获取龙王信息失败');
}
}
if (getType === WebHonorType.PERFORMER || getType === WebHonorType.ALL) {
@@ -280,7 +280,7 @@ export class NTQQWebApi {
});
}
} else {
this.context.logger.logError('获取群聊之火失败');
this.context.logger.logError.bind(this.context.logger)('获取群聊之火失败');
}
}
if (getType === WebHonorType.PERFORMER || getType === WebHonorType.ALL) {
@@ -296,7 +296,7 @@ export class NTQQWebApi {
});
}
} else {
this.context.logger.logError('获取群聊炽焰失败');
this.context.logger.logError.bind(this.context.logger)('获取群聊炽焰失败');
}
}
if (getType === WebHonorType.EMOTION || getType === WebHonorType.ALL) {
@@ -312,7 +312,7 @@ export class NTQQWebApi {
});
}
} else {
this.context.logger.logError('获取快乐源泉失败');
this.context.logger.logError.bind(this.context.logger)('获取快乐源泉失败');
}
}