Konstantin18ko
@Konstantin18ko
Стоматолог

Как использовать callback и send media group?

@bot.callback_query_handler(func=lambda call: True)
def longname(call):
    if re.search(r'order_yes_\d', call.data):
        room = rooms[int((str(call.data)).split('_')[-1]) - 1]
        bot.send_media_group(call.message.from_user.id,
                             [telebot.types.InputMediaPhoto(open(photo, 'rb')) for photo in room['images']])
        bot.send_message(call.message.chat.id,
                         text='*Lot:* ' + room['about'] + '\n' +
                              '*Price:* ' + str(rooms[0]['price']) + ' руб. в час' + '\n',
                         parse_mode='Markdown')

Ошибка:

telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 403 Forbidden. Response body:
[b'{"ok":false,"error_code":403,"description":"Forbidden: bot can\'t send messages to bots"}']

2019-07-02 22:27:42,013 (__init__.py:417 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 403 Forbidden. Response body:
[b'{"ok":false,"error_code":403,"description":"Forbidden: bot can\'t send messages to bots"}']"
2019-07-02 22:27:42,013 - TeleBot - ERROR - A request to the Telegram API was unsuccessful. The server returned HTTP 403 Forbidden. Response body:
[b'{"ok":false,"error_code":403,"description":"Forbidden: bot can\'t send messages to bots"}']

Бот не может отправлять боту. Так я же не боту отправляю, а пользователю.
  • Вопрос задан
  • 5421 просмотр
Пригласить эксперта
Ответы на вопрос 1
Konstantin18ko
@Konstantin18ko Автор вопроса
Стоматолог
Меняем call.message.from_user.id на call.message.chat.id.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы