Py.Cafe

iscienc/

shiny-slider-interactivity

Enhanced Slider Interactivity with Shiny

DocsPricing
  • app.py
  • masih.py
  • requirements.txt
masih.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from telethon import TelegramClient

from telethon.errors import FloodWaitError

import time
api_id = 'masihpy01_bot'
api_hash = '7735415769:AAFK8RlG_dd4pS7RoWRWgOlmiuvgI9CLGeM'
channel_username = 'masihpy_test'
client = TelegramClient('session_name', api_id, api_hash)
async def remove_all_members(channel):
channel_entity = await client.get_entity(channel)
async for member in client.iter_participants(channel_entity):

try:

print(f'Removing member: {member.first_name} (ID: {member.id})')

await client.kick_participant(channel_entity, member)
time.sleep(1)  # Wait for 1 second between removals

except FloodWaitError as e:

print(f'Flood wait error, sleeping for {e.seconds} seconds')

time.sleep(e.seconds)

except Exception as e:

print(f'Failed to remove {member.first_name}: {e}')


async def main():

async with client:

await remove_all_members(channel_username)


if name == 'main':

import asyncio

asyncio.run(main())