S
S
Sonicarh2020-05-05 22:47:55
Python
Sonicarh, 2020-05-05 22:47:55

Why does the Telegram bot not work and give a TypeError?

bot = telebot.TeleBot ( 'TOKEN' )

@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
  bot.reply_to(message, "Howdy, how are you doing?")

@bot.message_handler(func=lambda message: True)
def echo_all(message):
  bot.reply_to(message, message.text)

bot.polling()

Here's an error...
Traceback (most recent call last):
  File "C:/Users/Vibe/PycharmProjects/untitled1/TelBot1/Telo.py", line 9, in <module>
    def send_welcome(message):
TypeError: 'NoneType' object is not callable


I can’t understand what he doesn’t like ... help, point to the truth!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kolza2008, 2020-05-06
@kolza2008

You didn't put tabs in the team

A
Andrey Barbolin, 2020-05-06
@dronmaxman

What does the space before the parenthesis do here?
bot = telebot.TeleBot ( 'TOKEN' )

S
Sonicarh, 2020-05-08
@Sonicarh

This problem remains....
402 (util.py:68 PollingThread) ERROR - TeleBot: "ConnectionError occurred, args=(MaxRetryError("SOCKSHTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /botTOKEN/getUpdates?offset=1&timeout=20 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))")),)
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\contrib\socks.py", line 99, in _new_conn
**extra_kw
File "C:\ProgramData\Anaconda3\lib\site-packages\socks.py" , line 180, in create_connection
for r in socket.getaddrinfo(proxy_addr, proxy_port, 0, socket.SOCK_STREAM):
File "C:\ProgramData\Anaconda3\lib\socket.py", line 752, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question