Answer the question
In order to leave comments, you need to log in
How to make the bot send a random photo to aiogram?
You need a ready-made code to send a random photo to the bot.
There is such a code, it only works on telebot
@dp.message_handler(content_types=['text'])
def get_text_messages(message):
if "привет" in message.text.lower():
photo = open('isxodniki/' + random.choice(os.listdir('isxodniki')), 'rb')
bot.send_photo(message.from_user.id, photo)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question