chore: clean-up

This commit is contained in:
Wesley F. Young 2024-08-12 01:13:10 +08:00
parent e6c93ab1c0
commit a7fb18d5c0

View File

@ -26,7 +26,6 @@ import qrcode from 'qrcode-terminal';
import { NapCatOneBot11Adapter } from '@/onebot'; import { NapCatOneBot11Adapter } from '@/onebot';
import { InitWebUi } from '@/webui'; import { InitWebUi } from '@/webui';
import { WebUiDataRuntime } from '@/webui/src/helper/Data'; import { WebUiDataRuntime } from '@/webui/src/helper/Data';
import { promisify } from 'util';
program.option('-q, --qq [number]', 'QQ号').parse(process.argv); program.option('-q, --qq [number]', 'QQ号').parse(process.argv);
const cmdOptions = program.opts(); const cmdOptions = program.opts();
@ -151,7 +150,7 @@ export async function NCoreInitShell() {
}); });
WebUiDataRuntime.setQQQuickLoginCall(async (uin: string) => { WebUiDataRuntime.setQQQuickLoginCall(async (uin: string) => {
const QuickLogin: Promise<{ result: boolean, message: string }> = new Promise((resolve, reject) => { return await new Promise((resolve) => {
if (uin) { if (uin) {
logger.log('正在快速登录 ', uin); logger.log('正在快速登录 ', uin);
loginService.quickLoginWithUin(uin).then(res => { loginService.quickLoginWithUin(uin).then(res => {
@ -167,8 +166,6 @@ export async function NCoreInitShell() {
resolve({ result: false, message: '快速登录失败' }); resolve({ result: false, message: '快速登录失败' });
} }
}); });
const result = await QuickLogin;
return result;
}); });
if (quickLoginUin && historyLoginList.some(u => u.uin === quickLoginUin)) { if (quickLoginUin && historyLoginList.some(u => u.uin === quickLoginUin)) {
@ -186,7 +183,9 @@ export async function NCoreInitShell() {
} else { } else {
logger.log('没有 -q 指令指定快速登录,或未曾登录过这个 QQ将使用二维码登录方式'); logger.log('没有 -q 指令指定快速登录,或未曾登录过这个 QQ将使用二维码登录方式');
if (historyLoginList.length > 0) { if (historyLoginList.length > 0) {
logger.log(`可用于快速登录的 QQ\n${historyLoginList.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`) logger.log(`可用于快速登录的 QQ\n${
historyLoginList
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
.join('\n') .join('\n')
}`); }`);
} }