Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def main():
- chat = 'send'
- async def click_button(message, button_text):
- buttons = message.buttons
- if not buttons:
- return
- for row in buttons:
- for btn in row:
- if button_text in btn.text:
- await btn.click()
- print(f'Нажата кнопка: {btn.text}')
- await asyncio.sleep(0.3)
- return await client.get_messages(chat, ids=message.id)
- async def check_announcements():
- async with client.conversation(chat) as conv:
- await conv.send_message('/start')
- response = await conv.get_response()
- message = await click_button(response, 'P2P')
- message = await click_button(message, 'Купить')
- message = await click_button(message, 'Tether (USDT)')
- await click_button(message, 'MONOBANK')
- print('Скрипт запущен. Ожидание новых сообщений...')
- while True:
- await check_announcements()
- await asyncio.sleep(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement