Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time, datetime
- import telepot
- from telepot.loop import MessageLoop
- now = datetime.datetime.now()
- def action(msg):
- chat_id = msg['chat']['id']
- command = msg['text']
- print ('Received: ' + command )
- if command == '/start':
- telegram_bot.sendMessage (chat_id, str("Hello! These bot is Developed by 6403_Jagadish , 6409_Vivek , 6415_Shivam"))
- if command == '/hi':
- telegram_bot.sendMessage (chat_id, str("Hi! User "))
- elif command == '/time':
- telegram_bot.sendMessage(chat_id, str(now.hour)+str(":")+str(now.minute))
- elif command == '/logo':
- telegram_bot.sendPhoto (chat_id, photo = "http://images.wikia.com/beyblade/images/8/85/Black_Dranzer.jpg")
- telegram_bot = telepot.Bot('6673269047:AAHxZm6_sOQwjNnQxWOWykG9-NQet4NbPf4')
- print (telegram_bot.getMe())
- MessageLoop(telegram_bot, action).run_as_thread()
- print ('Up and Running....')
- while 1:
- time.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement