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

Method applyBanLikeAction

aban/aban.ts:741–770  ·  view source on GitHub ↗
(
    client: TelegramClient,
    chatId: any,
    resolvedParticipant: any,
    bannedRights: Api.ChatBannedRights,
    action: 'ban' | 'unban' | 'mute'
  )

Source from the content-addressed store, hash-verified

739 return false;
740 }
741
742 const meParticipant = participants.find((p: any) => Number(p?.userId) === Number((me as any).id));
743 return meParticipant instanceof Api.ChatParticipantCreator || meParticipant instanceof Api.ChatParticipantAdmin;
744 }
745
746 const participant = await client.invoke(
747 new Api.channels.GetParticipant({
748 channel: chatId,
749 participant: me.id
750 })
751 );
752
753 const p = participant.participant;
754 if (p instanceof Api.ChannelParticipantCreator) return true;
755 if (p instanceof Api.ChannelParticipantAdmin) {
756 return !!p.adminRights?.deleteMessages;
757 }
758 return false;
759 } catch {
760 return false;
761 }
762 }
763}
764
765// ==================== 群组管理器 ====================
766class GroupManager {
767 private static cache = CacheManager.getInstance();
768
769 private static async getAllManageableDialogs(client: TelegramClient): Promise<any[]> {
770 const dialogMap = new Map<number, any>();
771
772 const collectDialogs = async (params: Record<string, any>) => {
773 const dialogs = await client.getDialogs(params);

Callers 3

banUserMethod · 0.95
unbanUserMethod · 0.95
muteUserMethod · 0.95

Calls 2

getChatKindMethod · 0.95
getBasicGroupChatIdMethod · 0.95

Tested by

no test coverage detected