dragon-bot/app/animals.py

39 lines
802 B
Python

import random
import requests
import get_from_reddit
def get_dog():
return random.choice([random_sheeb, random_dog, random_dog_reddit])()
def random_sheeb():
return requests.get(
'http://shibe.online/api/shibes?count=1&urls=true'
).text.split('"')[1]
def random_dog():
dog_url = None
while not dog_url:
dog_url = requests.get('https://random.dog/woof').text
if 'mp4' in dog_url[-3:]:
dog_url = None
return "https://random.dog/{}".format(dog_url)
def random_dog_reddit():
return get_from_reddit.get_image(
[
'AustralianCattleDog',
'GSP',
'corgi',
'dogpictures',
'rarepuppers',
'tippytaps',
'vizsla',
'zoomies',
]
)