Answer the question
In order to leave comments, you need to log in
How to make a script to remove all people from a channel in tg?
We need a script that will remove all people from the channel using a userbot.
I did this:
api_id = 'api'
api_hash = 'hash'
import time
from pyrogram.errors import FloodWait
from pyrogram import Client
chat = 'chat'
with Client("myacc", api_id, api_hash) as app:
for u in app.get_chat_members(chat):
with app:
try:
app.kick_chat_member(chat, u.id, int(time.time() + 60))
except FloodWait as e:
time.sleep(e.x)
raise ConnectionError("Client is already connected")
ConnectionError: Client is already connected
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question