import random
import os
#send_random_picture
all_files_in_directory = os.listdir('path')
file = random.choice(all_files_in_directory)
doc = open('path' + '/' + file, 'rb')
#если нужно подпись к фото
caption = "любой текст"
#send_random_photo
bot.send_photo(chat_id, doc, caption)
Как реализовать реферальную систему в Telegram боте?
Deep linking
Telegram bots have a deep linking mechanism, that allows for passing additional parameters to the bot on startup. It could be a command that launches the bot — or an auth token to connect the user's Telegram account to their account on some external service.
Each bot has a link that opens a conversation with it in Telegram — https://telegram.me/. You can add the parameters start or startgroup to this link, with values up to 64 characters long. For example:https://telegram.me/triviabot?startgroup=test