diff options
| author | 2021-04-19 17:04:11 -0400 | |
|---|---|---|
| committer | 2021-04-19 17:04:11 -0400 | |
| commit | ae64ddd3e7d731a44a1684c93d67ea6334b120d2 (patch) | |
| tree | 8373f0171385d4065157ce0a4db5e686769ef272 /bot/exts/halloween/8ball.py | |
| parent | Merge pull request #673 from janine9vn/int-eval (diff) | |
Clean Up the Halloween Season
- Change commands.Bot type hints to bot.Bot
- Remove the setting of Cog.bot if it isn't being used
- Use Bot.http_session instead of creating new ones
- Keep string quotes and Doc-Strings consistant
- Remove redundant/outdated code
Ignored spookyavatar.py as it is being moved in another PR.
Diffstat (limited to 'bot/exts/halloween/8ball.py')
| -rw-r--r-- | bot/exts/halloween/8ball.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/bot/exts/halloween/8ball.py b/bot/exts/halloween/8ball.py index 1df48fbf..59d4acc5 100644 --- a/bot/exts/halloween/8ball.py +++ b/bot/exts/halloween/8ball.py @@ -6,28 +6,27 @@ from pathlib import Path from discord.ext import commands +from bot.bot import Bot + log = logging.getLogger(__name__) -with open(Path("bot/resources/halloween/responses.json"), "r", encoding="utf8") as f: - responses = json.load(f) +with Path("bot/resources/halloween/responses.json").open("r", encoding="utf8") as f: + RESPONSES = json.load(f) class SpookyEightBall(commands.Cog): """Spooky Eightball answers.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - @commands.command(aliases=('spooky8ball',)) async def spookyeightball(self, ctx: commands.Context, *, question: str) -> None: """Responds with a random response to a question.""" - choice = random.choice(responses['responses']) + choice = random.choice(RESPONSES["responses"]) msg = await ctx.send(choice[0]) if len(choice) > 1: await asyncio.sleep(random.randint(2, 5)) await msg.edit(content=f"{choice[0]} \n{choice[1]}") -def setup(bot: commands.Bot) -> None: - """Spooky Eight Ball Cog Load.""" - bot.add_cog(SpookyEightBall(bot)) +def setup(bot: Bot) -> None: + """Load the Spooky Eight Ball Cog.""" + bot.add_cog(SpookyEightBall()) |