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

Method banUser

aban/aban.ts:772–799  ·  view source on GitHub ↗
(
    client: TelegramClient,
    chatId: any,
    userId: number,
    until: number = 0,
    participant?: any
  )

Source from the content-addressed store, hash-verified

770 const dialogMap = new Map<number, any>();
771
772 const collectDialogs = async (params: Record<string, any>) => {
773 const dialogs = await client.getDialogs(params);
774 for (const dialog of dialogs || []) {
775 if (dialog.isChannel || dialog.isGroup) {
776 dialogMap.set(Number(dialog.id), dialog);
777 }
778 }
779 };
780
781 await collectDialogs({});
782 await collectDialogs({ folderId: 1 });
783
784 return Array.from(dialogMap.values());
785 }
786
787 /**
788 * teleproto Dialog.entity(Channel/Chat)自带 creator/adminRights,
789 * 比逐群 GetParticipant 更稳:无 RPC、无 accessHash 假阴性。
790 */
791 private static dialogHasManageRights(dialog: any): boolean {
792 const entity = dialog?.entity;
793 if (!entity) return false;
794 if (entity.creator) return true;
795 const rights = entity.adminRights;
796 if (!rights) return false;
797 return !!(rights.banUsers || rights.deleteMessages);
798 }
799
800 static async getManagedGroups(
801 client: TelegramClient
802 ): Promise<ManagedGroup[]> {

Callers 2

kickUserMethod · 0.95
handleBasicCommandMethod · 0.80

Calls 3

resolveParticipantMethod · 0.95
applyBanLikeActionMethod · 0.95
errorMethod · 0.80

Tested by

no test coverage detected