Adding birb and red panda

This commit is contained in:
Luke Robles 2020-03-21 17:16:12 -07:00
parent f206dd39af
commit 668e72d295
3 changed files with 49 additions and 3 deletions

View File

@ -7,6 +7,9 @@ import get_from_reddit
def get_dog():
return random.choice([random_sheeb, random_dog, random_dog_reddit])()
def get_birb():
return random.choice([random_bird, random_bird_reddit])()
def random_sheeb():
return requests.get(
@ -22,6 +25,22 @@ def random_dog():
dog_url = None
return "https://random.dog/{}".format(dog_url)
def random_bird():
bird = None
while not bird:
bird = requests.get('https://some-random-api.ml/img/birb').json()['link']
if 'mp4' in bird[-3:]:
bird = None
return bird
def random_red_panda():
red_panda = None
while not red_panda:
red_panda = requests.get('https://some-random-api.ml/img/red_panda').json()['link']
if 'mp4' in red_panda[-3:]:
red_panda = None
return red_panda
def random_dog_reddit():
return get_from_reddit.get_image(
@ -36,3 +55,10 @@ def random_dog_reddit():
'zoomies',
]
)
def random_bird_reddit():
return get_from_reddit.get_image(
[
'birbs',
]
)

View File

@ -9,7 +9,7 @@ import os
import random
import requests
from urllib import parse, request
import re
import re
import animals
import core_utils
@ -172,6 +172,18 @@ async def on_message(message):
embed=generate_embed(embed_url=animals.get_dog())
)
if message.content.startswith('!birb'):
await client.send_message(
message.channel,
embed=generate_embed(embed_url=animals.get_birb())
)
if message.content.startswith('!redpanda'):
await client.send_message(
message.channel,
embed=generate_embed(embed_url=animals.random_red_panda())
)
if message.content.startswith('!excuse'):
await client.send_message(message.channel, excuse.get_excuse())
@ -366,7 +378,7 @@ async def on_message(message):
embed=generate_embed(embed_url=wallpaper.get_wall(message.content))
)
if message.content.startswith('!youtube'):
query_string = parse.urlencode({'search_query': message.content.split()[1:]})
html_content = request.urlopen('http://www.youtube.com/results?' + query_string)

View File

@ -17,6 +17,14 @@ def get_help_message(method):
'Returns the avatar for the mentioned user',
'\nUsage: !avatar @somebody'
],
'birb': [
'Returns a random bird photo',
'\nUsage: !birb'
],
'redpanda': [
'Returns a random red panda photo',
'\nUsage: !redpanda'
],
'clap': [
'Returns the shittiest meme created by sassy girls on twitter this century',
'Usage: !clap some text to be meme\'mt'
@ -145,7 +153,7 @@ def get_help_message(method):
def get_help_embed(client):
categories = {
'fun': ['clap', 'youtube', 'dog', 'excuse', 'greentext', 'lewd', 'message', 'meme', 'homepage', 'pout', 'roll', 'smug', 'quake'],
'fun': ['clap', 'redanda', 'birb', 'youtube', 'dog', 'excuse', 'greentext', 'lewd', 'message', 'meme', 'homepage', 'pout', 'roll', 'smug', 'quake'],
'util': ['8ball', 'decide', 'icon', 'wallpaper', 'weather', 'stock', 'tts', 'issue'],
'users': ['help', 'invite', 'purge', 'roles', 'source', 'minecraft'],
'admin': ['emoji', 'cleanup']