diff --git a/bot/commands/img.py b/bot/commands/img.py index 419a656..427c45e 100644 --- a/bot/commands/img.py +++ b/bot/commands/img.py @@ -4,6 +4,7 @@ import random import mimetypes import shutil +from io import BytesIO from discord.ext import commands from utils import config, files @@ -59,6 +60,15 @@ async def fox(self, ctx): await ctx.send(image) + @commands.command(name="raccoon", description="Get a random raccoon picture.", aliases=["rac","racc","racpic","raccpic"], usage="") + async def raccoon(self, ctx): + cfg = self.cfg + resp = requests.get("https://api.racc.lol/raccoon", timeout=15) + resp.raise_for_status() + extension = mimetypes.guess_extension(resp.headers.get("content-type", "image/jpeg").split(";")[0]) or ".jpg" + + await ctx.send(file=discord.File(BytesIO(resp.content), filename=f"raccoon{extension}")) + @commands.command(name="minion", description="Get a random minion meme.", aliases=["minionmeme"], usage="") async def minion(self, ctx): cfg = self.cfg