A
A
akozlovski972021-07-18 19:30:37
Python
akozlovski97, 2021-07-18 19:30:37

Why is Python's inline function not working?

2021-07-18 19:28:08,956 (__init__.py:649 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: type of file mismatch"

import telebot
from telebot import types
import config

bot = telebot.TeleBot(config.token)

@bot.inline_handler(func=lambda query: True)
def inline_mode(query):
    capibara1 = types.InlineQueryResultCachedPhoto(
        id="1",
        photo_file_id="BQACAgIAAxkBAAMoYPRAz9GzjKmFR0tvHKIit9diWboAAiUPAAJ21qhLkwABXiJOvTRoIAQ",
        caption="Это капибара №1"
    )
    capibara2 = types.InlineQueryResultCachedPhoto(
        id="2",
        photo_file_id="BQACAgIAAxkBAAMqYPRA9BbMsxY4vi9OIhRNPXnsdKQAAiYPAAJ21qhL8b6nteTb3V0gBA",
        caption="Это капибара №2"
    )
    bot.answer_inline_query(query.id, [capibara1, capibara2])

if __name__ == '__main__':
    bot.polling(none_stop=True)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-07-18
@SoreMix

Files with these id's are not images.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question