Skip to content

Commit

Permalink
feat: 初始化未完成在 /alive 中增加提示
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Dec 12, 2024
1 parent e13b6b3 commit b970a83
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
25 changes: 17 additions & 8 deletions main/src/constants/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,32 @@ const preSetupCommands = [
}),
];

const commonPrivateCommands = [
new Api.BotCommand({
command: 'login',
description: '当 QQ 处于下线状态时,使用此命令重新登录 QQ',
}),
new Api.BotCommand({
command: 'flags',
description: 'WARNING: EXPERIMENTAL FEATURES AHEAD!',
}),
new Api.BotCommand({
command: 'alive',
description: '状态信息',
}),
]

// 这里的 group 指群组模式,Private 指在与机器人的私聊会话中
const groupPrivateCommands = [
...commonPrivateCommands,
new Api.BotCommand({
command: 'add',
description: '添加新的群转发',
}),
];

const personalPrivateCommands = [
...commonPrivateCommands,
new Api.BotCommand({
command: 'addfriend',
description: '添加新的好友转发',
Expand All @@ -24,14 +41,6 @@ const personalPrivateCommands = [
command: 'addgroup',
description: '添加新的群转发',
}),
new Api.BotCommand({
command: 'login',
description: '当 QQ 处于下线状态时,使用此命令重新登录 QQ',
}),
new Api.BotCommand({
command: 'flags',
description: 'WARNING: EXPERIMENTAL FEATURES AHEAD!',
}),
];

// 服务器零号实例的管理员
Expand Down
2 changes: 1 addition & 1 deletion main/src/controllers/AliveCheckController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class AliveCheckController {
const tgUserName = (tgUser.me.username || tgUser.me.usernames.length) ?
'@' + (tgUser.me.username || tgUser.me.usernames[0].username) : tgUser.me.firstName;
messageParts.push([
`Instance #${instance.id}`,
`Instance #${instance.id} (${instance.workMode}) ${instance.isInit ? '' : '初始化未完成'}`,

`QQ <code>${instance.qqUin}</code> (${oicq.constructor.name})\t` +
`${boolToStr(await oicq.isOnline())}`,
Expand Down
2 changes: 2 additions & 0 deletions main/src/models/Instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class Instance {
public tgBot: Telegram;
public tgUser: Telegram;
public oicq: QQClient;
public isInit = false;

private _ownerChat: TelegramChat;

Expand Down Expand Up @@ -165,6 +166,7 @@ export default class Instance {
this.hugController = new HugController(this, this.tgBot, this.oicq);
}
this.fileAndFlashPhotoController = new FileAndFlashPhotoController(this, this.tgBot, this.oicq);
this.isInit = true;
})()
.then(() => this.log.info('初始化已完成'));
}
Expand Down

0 comments on commit b970a83

Please sign in to comment.