diff options
| author | 2021-09-06 13:11:27 +0100 | |
|---|---|---|
| committer | 2021-09-06 13:11:27 +0100 | |
| commit | 5e136d9aadcdb334f502cebb6e85981394802324 (patch) | |
| tree | 58abafa6a5acd9938fd291947c7c9ce8bd949938 /bot/exts/evergreen/wonder_twins.py | |
| parent | Set logging level for async-rediscache to warning (diff) | |
| parent | Merge pull request #853 from python-discord/post-restructure-fix (diff) | |
Merge branch 'main' into async-redisache-logs
Diffstat (limited to 'bot/exts/evergreen/wonder_twins.py')
| -rw-r--r-- | bot/exts/evergreen/wonder_twins.py | 49 | 
1 files changed, 0 insertions, 49 deletions
| diff --git a/bot/exts/evergreen/wonder_twins.py b/bot/exts/evergreen/wonder_twins.py deleted file mode 100644 index 40edf785..00000000 --- a/bot/exts/evergreen/wonder_twins.py +++ /dev/null @@ -1,49 +0,0 @@ -import random -from pathlib import Path - -import yaml -from discord.ext.commands import Cog, Context, command - -from bot.bot import Bot - - -class WonderTwins(Cog): -    """Cog for a Wonder Twins inspired command.""" - -    def __init__(self): -        with open(Path.cwd() / "bot" / "resources" / "evergreen" / "wonder_twins.yaml", "r", encoding="utf-8") as f: -            info = yaml.load(f, Loader=yaml.FullLoader) -            self.water_types = info["water_types"] -            self.objects = info["objects"] -            self.adjectives = info["adjectives"] - -    @staticmethod -    def append_onto(phrase: str, insert_word: str) -> str: -        """Appends one word onto the end of another phrase in order to format with the proper determiner.""" -        if insert_word.endswith("s"): -            phrase = phrase.split() -            del phrase[0] -            phrase = " ".join(phrase) - -        insert_word = insert_word.split()[-1] -        return " ".join([phrase, insert_word]) - -    def format_phrase(self) -> str: -        """Creates a transformation phrase from available words.""" -        adjective = random.choice((None, random.choice(self.adjectives))) -        object_name = random.choice(self.objects) -        water_type = random.choice(self.water_types) - -        if adjective: -            object_name = self.append_onto(adjective, object_name) -        return f"{object_name} of {water_type}" - -    @command(name="formof", aliases=("wondertwins", "wondertwin", "fo")) -    async def form_of(self, ctx: Context) -> None: -        """Command to send a Wonder Twins inspired phrase to the user invoking the command.""" -        await ctx.send(f"Form of {self.format_phrase()}!") - - -def setup(bot: Bot) -> None: -    """Load the WonderTwins cog.""" -    bot.add_cog(WonderTwins()) | 
