diff --git a/app/animals.py b/app/animals.py index d757995a..cc0181ed 100755 --- a/app/animals.py +++ b/app/animals.py @@ -5,14 +5,6 @@ import requests import get_from_reddit -def get_corgi(): - return get_from_reddit.get_image( - [ - "corgi", - ] - ) - - def get_red_panda(): red_panda = None while not red_panda: @@ -22,62 +14,12 @@ def get_red_panda(): return red_panda -def get_panda(): - panda = None - while not panda: - panda = requests.get("https://some-random-api.ml/img/panda").json()["link"] - return panda - - -def get_racoon(): - racoon = None - while not racoon: - racoon = requests.get("https://some-random-api.ml/img/racoon").json()["link"] - return racoon - - -def get_fox(): - fox = None - while not fox: - fox = requests.get("https://some-random-api.ml/img/fox").json()["link"] - return fox - - -def get_cat(): - cat = None - while not cat: - cat = requests.get("https://some-random-api.ml/img/cat").json()["link"] - return cat - - -def get_kangaroo(): - kangaroo = None - while not kangaroo: - kangaroo = requests.get("https://some-random-api.ml/img/kangaroo").json()[ - "link" - ] - return kangaroo - - -def get_koala(): - koala = None - while not koala: - koala = requests.get("https://some-random-api.ml/img/koala").json()["link"] - return koala - - 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("http://shibe.online/api/shibes?count=1&urls=true").text.split( - '"' - )[1] + return requests.get("http://shibe.online/api/shibes?count=1&urls=true").json()[0] def random_dog(): @@ -89,15 +31,6 @@ def random_dog(): return 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_dog_reddit(): return get_from_reddit.get_image( [ @@ -119,18 +52,6 @@ def random_dog_reddit(): ) -def random_bird_reddit(): - return get_from_reddit.get_image( - [ - "birbs", - ] - ) - - -def get_rat(): - return get_from_reddit.get_image("rats") - - def dale(): return random.choice(glob.glob("/tmp/dale/*")) diff --git a/app/cogs/animal_functions.py b/app/cogs/animal_functions.py index 77ba8e01..140bfb46 100755 --- a/app/cogs/animal_functions.py +++ b/app/cogs/animal_functions.py @@ -13,42 +13,6 @@ class AnimalFunctions(commands.Cog): async def redpanda(self, ctx: commands.Context): await ctx.respond(animals.get_red_panda()) - @commands.slash_command( - guild_ids=None, name="panda", description="Posts a photo of a panda" - ) - async def panda(self, ctx: commands.Context): - await ctx.respond(animals.get_panda()) - - @commands.slash_command( - guild_ids=None, name="koala", description="Posts a photo of a koala" - ) - async def koala(self, ctx: commands.Context): - await ctx.respond(animals.get_koala()) - - @commands.slash_command( - guild_ids=None, name="racoon", description="Posts a photo of a racoon" - ) - async def racoon(self, ctx: commands.Context): - await ctx.respond(animals.get_racoon()) - - @commands.slash_command( - guild_ids=None, name="fox", description="Posts a photo of a fox" - ) - async def fox(self, ctx: commands.Context): - await ctx.respond(animals.get_fox()) - - @commands.slash_command( - guild_ids=None, name="cat", description="Posts a photo of a cat" - ) - async def cat(self, ctx: commands.Context): - await ctx.respond(animals.get_cat()) - - @commands.slash_command( - guild_ids=None, name="kangaroo", description="Posts a photo of a kangaroo" - ) - async def kangaroo(self, ctx: commands.Context): - await ctx.respond(animals.get_kangaroo()) - @commands.slash_command( guild_ids=None, name="dog", description="Posts a photo of a dog" ) @@ -61,12 +25,6 @@ class AnimalFunctions(commands.Cog): async def sheeb(self, ctx: commands.Context): await ctx.respond(animals.random_sheeb()) - @commands.slash_command( - guild_ids=None, name="birb", description="Posts a photo of a birb" - ) - async def birb(self, ctx: commands.Context): - await ctx.respond(animals.get_birb()) - @commands.slash_command( guild_ids=None, name="cowboy", description="Posts a photo of a bad dog" ) @@ -82,18 +40,6 @@ class AnimalFunctions(commands.Cog): await ctx.defer() await ctx.send_followup(file=discord.File(animals.dale())) - @commands.slash_command( - guild_ids=None, name="rat", description="Posts a photo of a rat" - ) - async def rat(self, ctx: commands.Context): - await ctx.respond(animals.get_rat()) - - @commands.slash_command( - guild_ids=None, name="corgi", description="Posts a photo of a corgi" - ) - async def corgi(self, ctx: commands.Context): - await ctx.respond(animals.get_corgi()) - def setup(bot): bot.add_cog(AnimalFunctions(bot)) diff --git a/app/cogs/canvas_tools.py b/app/cogs/canvas_tools.py deleted file mode 100755 index becb37ef..00000000 --- a/app/cogs/canvas_tools.py +++ /dev/null @@ -1,127 +0,0 @@ -from discord.ext import commands -from discord import option -import discord -import requests -import os - - -class Canvass(commands.Cog): - def __init__(self, bot): - self.bot: commands.Bot = bot - - @commands.slash_command( - guild_ids=None, - name="simp", - description="Takes a URL and returns it embded in a simp card", - ) - @option( - "url", - description="A URL of the image you want to use", - input_type="str", - required=True, - ) - async def simp(self, ctx: commands.Context, url: str): - if not url: - return await ctx.send("You must provide a link to an image") - response = requests.get( - "https://some-random-api.ml/canvas/simpcard/?avatar=%s" % url - ) - with open("/app/simp.jpg", "wb") as f: - f.write(response.content) - await ctx.defer() - await ctx.send_followup(file=discord.File("/app/simp.jpg")) - os.remove("/app/simp.jpg") - - @commands.slash_command( - guild_ids=None, - name="horny", - description="Takes a URL and returns it embded in a license to be horny", - ) - @option( - "url", - description="A URL of the image you want to use", - input_type="str", - required=True, - ) - async def horny(self, ctx: commands.Context, url: str): - if not url: - return await ctx.send("You must provide a link to an image") - response = requests.get( - "https://some-random-api.ml/canvas/horny/?avatar=%s" % url - ) - with open("/app/horny.jpg", "wb") as f: - f.write(response.content) - await ctx.defer() - await ctx.send_followup(file=discord.File("/app/horny.jpg")) - os.remove("/app/horny.jpg") - - @commands.slash_command( - guild_ids=None, - name="wasted", - description="Takes a URL and returns it black and white with wasted text over it", - ) - @option( - "url", - description="A URL of the image you want to use", - input_type="str", - required=True, - ) - async def wasted(self, ctx: commands.Context, url: str): - if not url: - return await ctx.send("You must provide a link to an image") - response = requests.get( - "https://some-random-api.ml/canvas/wasted/?avatar=%s" % url - ) - with open("/app/wasted.jpg", "wb") as f: - f.write(response.content) - await ctx.defer() - await ctx.send_followup(file=discord.File("/app/wasted.jpg")) - os.remove("/app/wasted.jpg") - - @commands.slash_command( - guild_ids=None, - name="pixelate", - description="Takes a URL and returns it pixelated", - ) - @option( - "url", - description="A URL of the image you want to use", - input_type="str", - required=True, - ) - async def pixelate(self, ctx: commands.Context, url: str): - if not url: - return await ctx.send("You must provide a link to an image") - response = requests.get( - "https://some-random-api.ml/canvas/pixelate/?avatar=%s" % url - ) - with open("/app/pixelate.jpg", "wb") as f: - f.write(response.content) - await ctx.defer() - await ctx.send_followup(file=discord.File("/app/pixelate.jpg")) - os.remove("/app/pixelate.jpg") - - @commands.slash_command( - guild_ids=None, name="blur", description="Takes a URL and returns it blurry" - ) - @option( - "url", - description="A URL of the image you want to use", - input_type="str", - required=True, - ) - async def blur(self, ctx: commands.Context, url: str): - if not url: - return await ctx.send("You must provide a link to an image") - response = requests.get( - "https://some-random-api.ml/canvas/blur/?avatar=%s" % url - ) - with open("/app/blur.jpg", "wb") as f: - f.write(response.content) - await ctx.defer() - await ctx.send_followup(file=discord.File("/app/blur.jpg")) - os.remove("/app/blur.jpg") - - -def setup(bot): - bot.add_cog(Canvass(bot))