Advertisement
Guest User

Untitled

a guest
Feb 16th, 2022
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. import asyncio
  2. import time
  3. import random
  4.  
  5. from telethon import TelegramClient, events
  6.  
  7.  
  8. #https://my.telegram.org/auth
  9. api_id =
  10. api_hash = ""
  11. session_name = ""
  12.  
  13. async def start():
  14. async with TelegramClient(session_name, api_id, api_hash) as client:
  15. @client.on(events.NewMessage())
  16. async def handler(event):
  17. if 'Наш канал: @bibinto' in event.text:
  18. #Время задержки можно указаать меньше
  19. time.sleep(5)
  20. await client.send_message("bibinto_bot", message=f'{random.randint(1, 10)}')
  21. elif 'К сожалению, мы не смогли подобрать для вас новое фото' in event.text:
  22. time.sleep(5)
  23. await client.send_message("bibinto_bot", message=f'/start')
  24. time.sleep(5)
  25. await client.send_message("bibinto_bot", message=f'🚀Оценивать')
  26.  
  27. await client.run_until_disconnected()
  28.  
  29. async def main():
  30. await start()
  31.  
  32. if __name__ == "__main__":
  33. asyncio.run(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement