fix: event.prevParticipant 为 null 时报错

This commit is contained in:
Clansty 2022-03-08 14:53:17 +08:00
parent 15a45eb85f
commit 7477979bd1
No known key found for this signature in database
GPG Key ID: 05F8479BA63A8E92
1 changed files with 2 additions and 1 deletions

View File

@ -95,7 +95,8 @@ export default class ConfigController {
};
private handleChannelParticipant = async (event: Api.UpdateChannelParticipant) => {
if ('userId' in event.prevParticipant && event.prevParticipant.userId.eq(this.tgBot.me.id) &&
if (event.prevParticipant && 'userId' in event.prevParticipant &&
event.prevParticipant.userId.eq(this.tgBot.me.id) &&
!event.newParticipant) {
this.log.warn(`${event.channelId.toString()} 删除了`);
const pair = this.instance.forwardPairs.find(event.channelId);