(client: TelegramClient, userId: number)
| 476 | log(LogLevel.INFO, `Deleted history ${userId}`); |
| 477 | } catch (e) { log(LogLevel.ERROR, `delete history failed ${userId}`, e); } |
| 478 | } |
| 479 | |
| 480 | async function reportSpam(client: TelegramClient, userId: number) { |
| 481 | try { |
| 482 | const peer = await resolveInputPeer(client, userId); |
| 483 | await client.invoke(new Api.account.ReportPeer({ |
| 484 | peer, reason: new Api.InputReportReasonSpam(), message: "spam" |
| 485 | })); |
| 486 | log(LogLevel.INFO, `Reported ${userId}`); |
| 487 | } catch (e) { log(LogLevel.ERROR, `report failed ${userId}`, e); } |
| 488 | } |
| 489 | |
| 490 | async function unmuteChat(client: TelegramClient, userId: number) { |
| 491 | try { |
| 492 | const peer = await resolveInputPeer(client, userId); |
| 493 | await client.invoke(new Api.account.UpdateNotifySettings({ |
| 494 | peer: new Api.InputNotifyPeer({ peer }), |
| 495 | settings: new Api.InputPeerNotifySettings({ muteUntil: 0, showPreviews: true, silent: false }) |
| 496 | })); |
| 497 | } catch (e) { log(LogLevel.ERROR, `unmute failed ${userId}`, e); } |
| 498 | } |
no test coverage detected