Answer the question
In order to leave comments, you need to log in
How to make a telegram bot send photos randomly from an album?
I did it so far to send a specific photo, it remains to figure out how to randomly send a photo:
@bot.message_handler(content_types=['text'])
def send_text(message):
if message.text.lower() == 'hentai':
bot. send_photo(message.chat.id, (
' https://4.bp.blogspot.com/-3swYE12k-pE/VR_5OzkX74I... '))
elif message.text.lower() == 'mom is nearby':
bot .send_photo(message.chat.id, (
' https://pbs.twimg.com/media/EhODS02WoAEsQZI.jpg '))
Answer the question
In order to leave comments, you need to log in
import random
pics_1 = [
'https://pbs.twimg.com/media/EhODS02WoAEsQZI.jpg',
'https://pbs.twimg.com/media/EhODS02WoAEsQZI.jpg',
'https://pbs.twimg.com/media/EhODS02WoAEsQZI.jpg'
]
pics_2 = [
'https://pbs.twimg.com/media/EhODS02WoAEsQZI.jpg',
'https://pbs.twimg.com/media/EhODS02WoAEsQZI.jpg',
'https://pbs.twimg.com/media/EhODS02WoAEsQZI.jpg'
]
@bot.message_handler(content_types=['text'])
def send_text(message):
pics = None
text = message.text.lower()
if text == 'hentai':
pics = pics_1
elif text == 'мама рядом':
pics = pics_2
// ...
if pics is not None:
pic = random.choice(pics)
bot.send_photo(message.chat.id, (pic))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question