(client: TelegramClient, userId: number)
| 476 | await archiveChat(client, userId); |
| 477 | await muteChat(client, userId); |
| 478 | |
| 479 | for (const a of cfg.failActions()) { |
| 480 | if (a === FailAction.BLOCK) await blockUser(client, userId); |
| 481 | if (a === FailAction.DELETE) { |
| 482 | try { |
| 483 | const peer = await client.getInputEntity(userId); |
| 484 | await client.invoke(new Api.messages.DeleteHistory({ peer, revoke: true, maxId: 0 })); |
| 485 | log(LogLevel.INFO, `Deleted history (revoke both sides) ${userId}`); |
| 486 | } catch (e) { log(LogLevel.ERROR, `delete failed ${userId}`, e); } |
| 487 | } |
| 488 | if (a === FailAction.REPORT) await reportSpam(client, userId); |
| 489 | if (a === FailAction.MUTE) await muteChat(client, userId); |
| 490 | if (a === FailAction.ARCHIVE) await archiveChat(client, userId); |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | async function runPassActions(client: TelegramClient, userId: number) { |
| 495 | for (const a of cfg.passActions()) { |
| 496 | if (a === PassAction.UNMUTE) await unmuteChat(client, userId); |
| 497 | if (a === PassAction.UNARCHIVE) await unarchiveChat(client, userId); |
| 498 | if (a === PassAction.WL) wl.add(userId); |
no test coverage detected