diff options
| author | 2021-09-05 19:46:37 +0100 | |
|---|---|---|
| committer | 2021-09-05 19:46:37 +0100 | |
| commit | 8a410f3abd39a1b48c514d32651a50d4bdced492 (patch) | |
| tree | 17fbb917adec0a1283d3d2456d8b09eee0334371 /bot/exts/evergreen/coinflip.py | |
| parent | Merge pull request #845 from python-discord/Pin-platform-in-Dockerfile (diff) | |
| parent | Merge branch 'main' into lance-restructure (diff) | |
Merge pull request #851 from python-discord/lance-restructure
Restructure Sir Lancebot
Diffstat (limited to 'bot/exts/evergreen/coinflip.py')
| -rw-r--r-- | bot/exts/evergreen/coinflip.py | 53 | 
1 files changed, 0 insertions, 53 deletions
| diff --git a/bot/exts/evergreen/coinflip.py b/bot/exts/evergreen/coinflip.py deleted file mode 100644 index 804306bd..00000000 --- a/bot/exts/evergreen/coinflip.py +++ /dev/null @@ -1,53 +0,0 @@ -import random - -from discord.ext import commands - -from bot.bot import Bot -from bot.constants import Emojis - - -class CoinSide(commands.Converter): -    """Class used to convert the `side` parameter of coinflip command.""" - -    HEADS = ("h", "head", "heads") -    TAILS = ("t", "tail", "tails") - -    async def convert(self, ctx: commands.Context, side: str) -> str: -        """Converts the provided `side` into the corresponding string.""" -        side = side.lower() -        if side in self.HEADS: -            return "heads" - -        if side in self.TAILS: -            return "tails" - -        raise commands.BadArgument(f"{side!r} is not a valid coin side.") - - -class CoinFlip(commands.Cog): -    """Cog for the CoinFlip command.""" - -    @commands.command(name="coinflip", aliases=("flip", "coin", "cf")) -    async def coinflip_command(self, ctx: commands.Context, side: CoinSide = None) -> None: -        """ -        Flips a coin. - -        If `side` is provided will state whether you guessed the side correctly. -        """ -        flipped_side = random.choice(["heads", "tails"]) - -        message = f"{ctx.author.mention} flipped **{flipped_side}**. " -        if not side: -            await ctx.send(message) -            return - -        if side == flipped_side: -            message += f"You guessed correctly! {Emojis.lemon_hyperpleased}" -        else: -            message += f"You guessed incorrectly. {Emojis.lemon_pensive}" -        await ctx.send(message) - - -def setup(bot: Bot) -> None: -    """Loads the coinflip cog.""" -    bot.add_cog(CoinFlip()) | 
