Untitled
unknown
python
3 years ago
1.6 kB
8
Indexable
async def start_unblocking(client: TelegramClient, session_path: str):
unblock_message = random.choice(list(open('assets/unblock-texts.txt'))).rstrip()
async with client:
await client(UnblockRequest('SpamBot'))
await client.send_message('SpamBot', '/start')
@client.on(events.NewMessage())
async def handler(event):
if event.message.chat_id == 178220800:
if hasattr(event.message.reply_markup, 'rows'):
buttons_length = len(event.message.reply_markup.rows)
await sleep(random.randint(1, 30))
if buttons_length == 4:
await event.message.click(3)
if buttons_length == 3:
await event.message.click(0)
message_text = event.message.message
global to_date
to_date = [int(s) for s in message_text.split() if s.isdigit()][0]
print(colored(to_date, 'red'))
if buttons_length == 2:
await event.message.click(0)
else:
try:
await event.reply(unblock_message)
print(colored(f"{session_path} -> The appeal has been submitted for review!", 'green'))
await client.disconnect()
except Exception:
await client.disconnect()
await client.run_until_disconnected()
return [True, to_date]Editor is loading...