Traceback, когда я меняю токен на боте telegram, он работает, но до этого выдает ошибку - PullRequest
0 голосов
/ 22 апреля 2020

вот кусок кода

#token and set proxy
token = 'token'
bot = telebot.TeleBot(token, threaded= False)
apihelper.proxy = {'https':'socks5://'}

@bot.message_handler(commands=('start'))
def start_message(message):
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
    Showcase = types.KeyboardButton('---')
    Vakancy = types.KeyboardButton('---')
    City = types.KeyboardButton('---')
    Account = types.KeyboardButton('---')
    markup.add(Showcase,Vakancy)
    markup.add(City)
    markup.add(Account)
    bot.send_message(message.chat.id,'Приветсвую тебя'),reply_markup=markup)


if __name__ == "__main__":
    bot.polling()

если я меняю токен, все работает нормально, но с подходящим для меня, это не работает, токен, который работает не совсем верно. Я не знаю, что случилось, потому что я добавил последнюю кнопку, и она перестала работать, чтобы не делать

Ошибка

Traceback (most recent call last):
  File "c:\Users\admin\Desktop\My Projects\Python\Shop bot\main.py", line 31, in <module>
    bot.polling()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 394, in polling
    self.__non_threaded_polling(none_stop, interval, timeout)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 445, in __non_threaded_polling
    self.__retrieve_updates(timeout)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 280, in __retrieve_updates
    self.process_new_updates(updates)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 317, in process_new_updates
    self.process_new_messages(new_messages)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 339, in process_new_messages
    self._notify_command_handlers(self.message_handlers, new_messages)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1801, in _notify_command_handlers
    if self._test_message_handler(message_handler, message):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1769, in _test_message_handler
    if not self._test_filter(filter, filter_value, message):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1790, in _test_filter
    return test_cases.get(filter, lambda msg: False)(message)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1801, in _notify_command_handlers
    if self._test_message_handler(message_handler, message):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1769, in _test_message_handler
    if not self._test_filter(filter, filter_value, message):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1790, in _test_filter
    return test_cases.get(filter, lambda msg: False)(message)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 1786, in <lambda>
    'commands': lambda msg: msg.content_type == 'text' and util.extract_command(msg.text) in filter_value,
TypeError: 'in <string>' requires string as left operand, not NoneType

...