Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telepot
- import random
- import time
- BOT_TOKEN = ''
- bot = telepot.Bot(BOT_TOKEN)
- def handle(msg):
- chat_id = msg['chat']['id']
- command = msg['text'].lower()
- user_name = msg['chat']['first_name']
- print('Got command: %s' % command)
- if command.find('привет') != -1:
- bot.sendMessage(chat_id, privet() + user_name)
- def privet():
- slova = ['Привет, ', 'Дарова, ', 'Здравствуй, ', 'Хай, ']
- return slova[random.randint(0, 4)]
- bot.message_loop(handle)
- print('Listening ...')
- # Keep the program running.
- while 1:
- time.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement