feat: 默认解除私聊的静音

This commit is contained in:
Clansty 2022-03-01 21:37:01 +08:00
parent ffdfc90b96
commit 93113fe343
No known key found for this signature in database
GPG Key ID: 05F8479BA63A8E92
2 changed files with 15 additions and 0 deletions

View File

@ -115,4 +115,13 @@ export default class TelegramChat {
}),
);
}
public async setNotificationSettings(params: { showPreviews?: boolean, silent?: boolean, muteUntil?: number, sound?: string }) {
return await this.client.invoke(
new Api.account.UpdateNotifySettings({
peer: new Api.InputNotifyPeer({ peer: this.inputPeer }),
settings: new Api.InputPeerNotifySettings(params),
}),
);
}
}

View File

@ -149,6 +149,12 @@ export default class ConfigService {
status && await status.edit({ text: '正在关闭【添加成员】快捷条…' });
await chat.hidePeerSettingsBar();
// 对于私聊,默认解除静音
if (roomId > 0) {
status && await status.edit({ text: '正在解除静音…' });
await chat.setNotificationSettings({ silent: false, showPreviews: true });
}
// 关联写入数据库
status && await status.edit({ text: '正在写数据库…' });
const dbPair = await forwardPairs.add(qEntity, chatForBot);