M
M
maas992018-11-12 12:27:15
Bots
maas99, 2018-11-12 12:27:15

Why doesn't the pyTelegramBotAPI telegram bot work?

import  telebot
bot = telebot.TeleBot('716117688:AAF3U9QgYPMXL3hpo33_gfERn014An5tvNY')
@bot.message_handler(content_types=['text'])
def handle_text(message):
   if message.text == 'hi':
   	bot.send_message(message.from_user.id, 'Hello ! i am T-101. I KILL U BITCH!!!!')
   elif message.text == 'How are you?' or message.text == 'How are u?':
   	bot.send_message(message.from_user.id, 'status report: systems fuction - 100%, i am ready capture whole world')
   else:
   	bot.send_message(message.from_user.id, 'Sorry u so stupid, get out here!')
   bot.polling(none_stop=True, interval=0) 
# Команды
   @bot.message_handler(commands=['start' , 'help'])
   def handle_start_help(message):
   	pass
#Документы и аудио файлы.
   def handle_document_audio(message):
   	pass
   bot.polling(none_stop=True, interval=0)

5be947196cc66471889718.png
The bot does not want to respond to commands or messages.
The development environment shows that there are no errors in the code.
Tell me what's the problem?
Libraries are all installed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Skull133, 2020-05-17
@Skull133

I feel that bot.polling() needs to be called once at the very end of the file without indents (i.e. not in the body of any function).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question