J
J
James_Obry2021-06-02 14:46:07
Bots
James_Obry, 2021-06-02 14:46:07

How to open one fort in different telebots?

The bottom line is this, I have 2 bots in telegrams, 1 user, 2 admin, through the admin I add a product with a photo file_id bark into the database, as far as I understand, in 1 bot I can’t open the photo, because it was added in another bot, enter error code: (__init__.py:515 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: wrong file identifier/HTTP URL specified"

I am using a database SQLite3 and telebot for bot

Question: is it possible to open a photo by file_id in different bots??

Here is another piece of code with which the bot gives out a photo:
elif call.data == 'product_cap':
with sq.connect("database.db") as con:
cur = con.cursor()
photo = cur.execute("SELECT img FROM cap WHERE id = '1'").fetchone()[0]
bot.send_photo(call.message.chat.id, photo, caption='asdfasdfsadf')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-06-02
@James_Obry

file_idunique for each bot.
You can create a group, add two bots there as admins, and send a photo to this general chat so that both bots receive a photo.
Or leave the admin panel, just create a channel, add two bots there, when you send a new photo through the admin panel, your admin bot sends a message with a photo to the channel, there the client bot already receives this message and gets its own from itfile_id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question