Open Retul15 opened 5 years ago
import random
from glob import glob
#https://docs.python.org/3/library/glob.html
pic_list = glob('*.jpg')
get_random_pic = random.choice(pic_list)
with open(get_random_pic, 'rb') as photo:
sendPhoto(chat_id, photo)
I have a folder of jpg pictures. I'm trying to make a Telegram bot where each time a user send
roll
, it will send a picture from the folder randomly.