diff options
| author | 2020-07-11 10:16:55 -0700 | |
|---|---|---|
| committer | 2020-07-11 10:16:55 -0700 | |
| commit | 8bdf68bc67115e09a4456a82e9c8e9bca06928ab (patch) | |
| tree | 746ef5299bd5c63b098690c41b7198c7536b2938 /bot/exts/evergreen | |
| parent | Outdated badge in README.md was upsetting me (diff) | |
Created the statuscat command.
Diffstat (limited to 'bot/exts/evergreen')
| -rw-r--r-- | bot/exts/evergreen/status_cats.py | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/bot/exts/evergreen/status_cats.py b/bot/exts/evergreen/status_cats.py new file mode 100644 index 00000000..e28b0213 --- /dev/null +++ b/bot/exts/evergreen/status_cats.py @@ -0,0 +1,33 @@ +import logging + +from discord.ext import commands +from http import HTTPStatus +import discord + +log = logging.getLogger(__name__) + + +class StatusCats(commands.Cog): +    """Commands that give statuses described and visualized by cats.""" + +    def __init__(self, bot: commands.Bot): +        self.bot = bot + +    @commands.command(aliases=['statuscat']) +    async def http_cat(self, ctx, code: int) -> None: +        """Sends an embed with an image of a cat, potraying the status code.""" +        embed = discord.Embed(title=f'**Status: {code}**') +        embed.set_image(url=f'https://http.cat/{code}.jpg') + +        try: +            HTTPStatus(code) + +        except ValueError: +            embed.set_footer(text='Inputted status code does not exist.') + +        await ctx.send(embed=embed) + + +def setup(bot: commands.Bot) -> None: +    """Load the StatusCats cog.""" +    bot.add_cog(StatusCats(bot)) | 
