• Как на питоне сделать так что-бы телеграмм-бот отвечал на команды /start и т.д?

    @Slava_Wagner-prom Автор вопроса
    Анатолий, У меня не вышло, вот весь скрипт.
    import telebot
    import requests
    from telebot import types

    token = "токен моего бота"

    bot = telebot.TeleBot(token)

    markup_menu = types.ReplyKeyboardMarkup (resize_keyboard=True, row_width=3)
    btn_contant = types.KeyboardButton('Контент')
    btn_price = types.KeyboardButton('Цена')
    btn_Works = types.KeyboardButton ('Работы')
    btn_call = types.KeyboardButton ('Связаться', request_location=True, request_contact=True)
    markup_menu.add(btn_contant, btn_price, btn_Works, btn_call)

    @bot.message_handler(commands=['start'])
    def start(message):
    bot.send_message(message.from_user.id, reply_markup=markup)

    bot.polling(none_stop=True)

    И сама ошибка.

    Traceback (most recent call last):
    File "D:\python\telebot\util.py", line 59, in run
    task(*args, **kwargs)
    File "D:\python\telebot\__init__.py", line 158, in __retrieve_updates
    updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
    File "D:\python\telebot\__init__.py", line 128, in get_updates
    json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
    File "D:\python\telebot\apihelper.py", line 180, in get_updates
    return _make_request(token, method_url, params=payload)
    File "D:\python\telebot\apihelper.py", line 56, in _make_request
    return _check_result(method_name, result)['result']
    File "D:\python\telebot\apihelper.py", line 75, in _check_result
    raise ApiException(msg, method_name, result)
    telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:
    [b'{"ok":false,"error_code":409,"description":"Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}']
    "
    2018-07-14 17:15:56,933 (__init__.py:299 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:
    [b'{"ok":false,"error_code":409,"description":"Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}']"
    2018-07-14 17:16:00,833 (util.py:65 PollingThread) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:\n[b\'{"ok":false,"error_code":409,"description":"Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}\']',)
  • Как на питоне сделать так что-бы телеграмм-бот отвечал на команды /start и т.д?

    @Slava_Wagner-prom Автор вопроса
    Анатолий мне скинуть весь код целиком ?