Advertisement
alphauser420

Telegram

Oct 15th, 2023
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import time, datetime
  2. import telepot
  3. from telepot.loop import MessageLoop
  4.  
  5. now = datetime.datetime.now()
  6.  
  7. def action(msg):
  8. chat_id = msg['chat']['id']
  9. command = msg['text']
  10.  
  11. print ('Received: ' + command )
  12. if command == '/start':
  13. telegram_bot.sendMessage (chat_id, str("Hello! These bot is Developed by 6403_Jagadish , 6409_Vivek , 6415_Shivam"))
  14.  
  15. if command == '/hi':
  16. telegram_bot.sendMessage (chat_id, str("Hi! User "))
  17.  
  18. elif command == '/time':
  19. telegram_bot.sendMessage(chat_id, str(now.hour)+str(":")+str(now.minute))
  20.  
  21. elif command == '/logo':
  22. telegram_bot.sendPhoto (chat_id, photo = "http://images.wikia.com/beyblade/images/8/85/Black_Dranzer.jpg")
  23.  
  24. telegram_bot = telepot.Bot('6673269047:AAHxZm6_sOQwjNnQxWOWykG9-NQet4NbPf4')
  25.  
  26. print (telegram_bot.getMe())
  27.  
  28. MessageLoop(telegram_bot, action).run_as_thread()
  29. print ('Up and Running....')
  30.  
  31. while 1:
  32. time.sleep(10)
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement