feat: 创建群组后自动关闭【添加成员】快捷条

This commit is contained in:
Clansty 2022-02-24 18:34:48 +08:00
parent ceddf86453
commit f71b04c62b
No known key found for this signature in database
GPG Key ID: 05F8479BA63A8E92
2 changed files with 20 additions and 8 deletions

View File

@ -103,4 +103,12 @@ export default class TelegramChat {
console.log(links);
return links.invites[0];
}
public async hidePeerSettingsBar() {
return await this.client.invoke(
new Api.messages.HidePeerSettingsBar({
peer: this.entity,
}),
);
}
}

View File

@ -137,6 +137,18 @@ export default class ConfigService {
await chat.editAdmin(this.tgBot.me.username, true);
const chatForBot = await this.tgBot.getChat(chat.id);
// 添加到 Filter
await status.edit({ text: '正在将群添加到文件夹…' });
this.filter.includePeers.push(utils.getInputPeer(chat));
await this.tgUser.updateDialogFilter({
id: this.filter.id,
filter: this.filter,
});
// 关闭【添加成员】快捷条
await status.edit({ text: '正在关闭【添加成员】快捷条…' });
await chat.hidePeerSettingsBar();
// 关联写入数据库
await status.edit({ text: '正在写数据库…' });
const dbPair = await forwardPairs.add(qEntity, chatForBot);
@ -151,14 +163,6 @@ export default class ConfigService {
data: { forwardPairId: dbPair.id, hash: avatarHash },
});
// 添加到 Filter
await status.edit({ text: '正在将群添加到文件夹…' });
this.filter.includePeers.push(utils.getInputPeer(chat));
await this.tgUser.updateDialogFilter({
id: this.filter.id,
filter: this.filter,
});
// 更新关于文本
await status.edit({ text: '正在更新关于文本…' });
await chatForBot.editAbout(await this.getAboutText(qEntity));