MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / runFailActions

Function runFailActions

pmcaptcha/pmcaptcha.ts:478–495  ·  view source on GitHub ↗
(client: TelegramClient, userId: number)

Source from the content-addressed store, hash-verified

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
494async 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);

Callers 2

sendCaptchaFunction · 0.85
handleReplyFunction · 0.85

Calls 5

archiveChatFunction · 0.85
muteChatFunction · 0.85
blockUserFunction · 0.85
logFunction · 0.85
reportSpamFunction · 0.85

Tested by

no test coverage detected