Answer the question
In order to leave comments, you need to log in
How to make a bot send a random picture from a folder, Python Aiogram?
How to make a bot send a random picture from a folder, Python Aiogram? You need to make a list of photos that are on the same path, in the same folder (C:\Users\andis\Desktop\Python\EasyBot). As soon as the list appears, you need the bot to send a random photo via random.choice to the chat
Answer the question
In order to leave comments, you need to log in
if the list is flat, then os.listdir
if with subfolders os.walk
then open the folder file as a byte stream and send it with the correct mime (this item can be made easier, but more transparent)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question