aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2021-05-03 13:36:26 -0400
committerGravatar ToxicKidz <[email protected]>2021-05-03 13:36:26 -0400
commite9f33306b5344c5d7e0877b0bf63ff9c914e6f85 (patch)
tree3584c00627bbf498ab6673dfd9807ee219501dba
parentchore: Clean Up the Valentines Season (diff)
Clean Up the Easter Season
- Keep Consistent setup docstrings - Type hint to bot.Bot instead of commands.Bot - Don't set Cog.bot if it isn't used
-rw-r--r--bot/exts/easter/april_fools_vids.py8
-rw-r--r--bot/exts/easter/bunny_name_generator.py9
-rw-r--r--bot/exts/easter/earth_photos.py5
-rw-r--r--bot/exts/easter/easter_riddle.py5
-rw-r--r--bot/exts/easter/egg_decorating.py8
-rw-r--r--bot/exts/easter/egg_facts.py2
-rw-r--r--bot/exts/easter/egghead_quiz.py10
-rw-r--r--bot/exts/easter/save_the_planet.py10
-rw-r--r--bot/exts/easter/traditions.py11
9 files changed, 33 insertions, 35 deletions
diff --git a/bot/exts/easter/april_fools_vids.py b/bot/exts/easter/april_fools_vids.py
index c7a3c014..84aa2913 100644
--- a/bot/exts/easter/april_fools_vids.py
+++ b/bot/exts/easter/april_fools_vids.py
@@ -4,6 +4,8 @@ from json import load
from discord.ext import commands
+from bot.bot import Bot
+
log = logging.getLogger(__name__)
with open("bot/resources/easter/april_fools_vids.json", encoding="utf-8") as f:
@@ -23,6 +25,6 @@ class AprilFoolVideos(commands.Cog):
await ctx.send(f"Check out this April Fools' video by {channel}.\n\n{url}")
-def setup(bot: commands.Bot) -> None:
- """April Fools' Cog load."""
- bot.add_cog(AprilFoolVideos(bot))
+def setup(bot: Bot) -> None:
+ """Load the April Fools' Cog."""
+ bot.add_cog(AprilFoolVideos())
diff --git a/bot/exts/easter/bunny_name_generator.py b/bot/exts/easter/bunny_name_generator.py
index 3ecf9be9..6d9e2a57 100644
--- a/bot/exts/easter/bunny_name_generator.py
+++ b/bot/exts/easter/bunny_name_generator.py
@@ -7,6 +7,8 @@ from typing import List, Union
from discord.ext import commands
+from bot.bot import Bot
+
log = logging.getLogger(__name__)
with Path("bot/resources/easter/bunny_names.json").open("r", encoding="utf8") as f:
@@ -16,9 +18,6 @@ with Path("bot/resources/easter/bunny_names.json").open("r", encoding="utf8") as
class BunnyNameGenerator(commands.Cog):
"""Generate a random bunny name, or bunnify your Discord username!"""
- def __init__(self, bot: commands.Bot):
- self.bot = bot
-
def find_separators(self, displayname: str) -> Union[List[str], None]:
"""Check if Discord name contains spaces so we can bunnify an individual word in the name."""
new_name = re.split(r'[_.\s]', displayname)
@@ -87,6 +86,6 @@ class BunnyNameGenerator(commands.Cog):
await ctx.send(bunnified_name)
-def setup(bot: commands.Bot) -> None:
- """Bunny Name Generator Cog load."""
+def setup(bot: Bot) -> None:
+ """Load the Bunny Name Generator Cog."""
bot.add_cog(BunnyNameGenerator(bot))
diff --git a/bot/exts/easter/earth_photos.py b/bot/exts/easter/earth_photos.py
index bf658391..d7e7ccc3 100644
--- a/bot/exts/easter/earth_photos.py
+++ b/bot/exts/easter/earth_photos.py
@@ -3,6 +3,7 @@ import logging
import discord
from discord.ext import commands
+from bot.bot import Bot
from bot.constants import Colours
from bot.constants import Tokens
@@ -12,7 +13,7 @@ log = logging.getLogger(__name__)
class EarthPhotos(commands.Cog):
"""This cog contains the command for earth photos."""
- def __init__(self, bot: commands.Bot):
+ def __init__(self, bot: Bot):
self.bot = bot
@commands.command(aliases=["earth"])
@@ -55,7 +56,7 @@ class EarthPhotos(commands.Cog):
await ctx.send(embed=embed)
-def setup(bot: commands.Bot) -> None:
+def setup(bot: Bot) -> None:
"""Load the Earth Photos cog."""
if not Tokens.unsplash_access_key:
log.warning("No Unsplash access key found. Cog not loading.")
diff --git a/bot/exts/easter/easter_riddle.py b/bot/exts/easter/easter_riddle.py
index a93b3745..da66edf5 100644
--- a/bot/exts/easter/easter_riddle.py
+++ b/bot/exts/easter/easter_riddle.py
@@ -7,6 +7,7 @@ from pathlib import Path
import discord
from discord.ext import commands
+from bot.bot import Bot
from bot.constants import Colours, NEGATIVE_REPLIES
log = logging.getLogger(__name__)
@@ -20,7 +21,7 @@ TIMELIMIT = 10
class EasterRiddle(commands.Cog):
"""This cog contains the command for the Easter quiz!"""
- def __init__(self, bot: commands.Bot):
+ def __init__(self, bot: Bot):
self.bot = bot
self.winners = set()
self.correct = ""
@@ -106,6 +107,6 @@ class EasterRiddle(commands.Cog):
self.winners.add(message.author.mention)
-def setup(bot: commands.Bot) -> None:
+def setup(bot: Bot) -> None:
"""Easter Riddle Cog load."""
bot.add_cog(EasterRiddle(bot))
diff --git a/bot/exts/easter/egg_decorating.py b/bot/exts/easter/egg_decorating.py
index a847388d..b8a8c6a7 100644
--- a/bot/exts/easter/egg_decorating.py
+++ b/bot/exts/easter/egg_decorating.py
@@ -10,6 +10,7 @@ import discord
from PIL import Image
from discord.ext import commands
+from bot.bot import Bot
from bot.utils import helpers
log = logging.getLogger(__name__)
@@ -33,9 +34,6 @@ IRREPLACEABLE = [
class EggDecorating(commands.Cog):
"""Decorate some easter eggs!"""
- def __init__(self, bot: commands.Bot) -> None:
- self.bot = bot
-
@staticmethod
def replace_invalid(colour: str) -> Union[int, None]:
"""Attempts to match with HTML or XKCD colour names, returning the int value."""
@@ -115,6 +113,6 @@ class EggDecorating(commands.Cog):
return new_im
-def setup(bot: commands.bot) -> None:
- """Egg decorating Cog load."""
+def setup(bot: Bot) -> None:
+ """Load the Egg decorating Cog."""
bot.add_cog(EggDecorating(bot))
diff --git a/bot/exts/easter/egg_facts.py b/bot/exts/easter/egg_facts.py
index 761e9059..78a5e592 100644
--- a/bot/exts/easter/egg_facts.py
+++ b/bot/exts/easter/egg_facts.py
@@ -57,5 +57,5 @@ class EasterFacts(commands.Cog):
def setup(bot: Bot) -> None:
- """Easter Egg facts cog load."""
+ """Load the Easter Egg facts Cog."""
bot.add_cog(EasterFacts(bot))
diff --git a/bot/exts/easter/egghead_quiz.py b/bot/exts/easter/egghead_quiz.py
index 0498d9db..e950bc2e 100644
--- a/bot/exts/easter/egghead_quiz.py
+++ b/bot/exts/easter/egghead_quiz.py
@@ -8,6 +8,7 @@ from typing import Union
import discord
from discord.ext import commands
+from bot.bot import Bot
from bot.constants import Colours
log = logging.getLogger(__name__)
@@ -31,8 +32,7 @@ TIMELIMIT = 30
class EggheadQuiz(commands.Cog):
"""This cog contains the command for the Easter quiz!"""
- def __init__(self, bot: commands.Bot) -> None:
- self.bot = bot
+ def __init__(self) -> None:
self.quiz_messages = {}
@commands.command(aliases=["eggheadquiz", "easterquiz"])
@@ -114,6 +114,6 @@ class EggheadQuiz(commands.Cog):
return await reaction.message.remove_reaction(reaction, user)
-def setup(bot: commands.Bot) -> None:
- """Egghead Quiz Cog load."""
- bot.add_cog(EggheadQuiz(bot))
+def setup(bot: Bot) -> None:
+ """Load the Egghead Quiz Cog."""
+ bot.add_cog(EggheadQuiz())
diff --git a/bot/exts/easter/save_the_planet.py b/bot/exts/easter/save_the_planet.py
index 8f644259..db9d3498 100644
--- a/bot/exts/easter/save_the_planet.py
+++ b/bot/exts/easter/save_the_planet.py
@@ -4,6 +4,7 @@ from pathlib import Path
from discord import Embed
from discord.ext import commands
+from bot.bot import Bot
from bot.utils.randomization import RandomCycle
@@ -14,9 +15,6 @@ with Path("bot/resources/easter/save_the_planet.json").open('r', encoding='utf8'
class SaveThePlanet(commands.Cog):
"""A cog that teaches users how they can help our planet."""
- def __init__(self, bot: commands.Bot) -> None:
- self.bot = bot
-
@commands.command(aliases=('savetheearth', 'saveplanet', 'saveearth'))
async def savetheplanet(self, ctx: commands.Context) -> None:
"""Responds with a random tip on how to be eco-friendly and help our planet."""
@@ -24,6 +22,6 @@ class SaveThePlanet(commands.Cog):
await ctx.send(embed=return_embed)
-def setup(bot: commands.Bot) -> None:
- """Save the Planet Cog load."""
- bot.add_cog(SaveThePlanet(bot))
+def setup(bot: Bot) -> None:
+ """Load the Save the Planet Cog."""
+ bot.add_cog(SaveThePlanet())
diff --git a/bot/exts/easter/traditions.py b/bot/exts/easter/traditions.py
index 85b4adfb..19e69b98 100644
--- a/bot/exts/easter/traditions.py
+++ b/bot/exts/easter/traditions.py
@@ -5,6 +5,8 @@ from pathlib import Path
from discord.ext import commands
+from bot.bot import Bot
+
log = logging.getLogger(__name__)
with open(Path("bot/resources/easter/traditions.json"), "r", encoding="utf8") as f:
@@ -14,9 +16,6 @@ with open(Path("bot/resources/easter/traditions.json"), "r", encoding="utf8") as
class Traditions(commands.Cog):
"""A cog which allows users to get a random easter tradition or custom from a random country."""
- def __init__(self, bot: commands.Bot):
- self.bot = bot
-
@commands.command(aliases=('eastercustoms',))
async def easter_tradition(self, ctx: commands.Context) -> None:
"""Responds with a random tradition or custom."""
@@ -25,6 +24,6 @@ class Traditions(commands.Cog):
await ctx.send(f"{random_country}:\n{traditions[random_country]}")
-def setup(bot: commands.Bot) -> None:
- """Traditions Cog load."""
- bot.add_cog(Traditions(bot))
+def setup(bot: Bot) -> None:
+ """Load the Traditions Cog."""
+ bot.add_cog(Traditions())