From 1ed857d9093481387720ac1dc4041a64a2c9c593 Mon Sep 17 00:00:00 2001 From: vcokltfre Date: Mon, 19 Apr 2021 20:20:48 +0100 Subject: chore: switch commands.Bot typehints to bot.bot's Bot --- bot/exts/evergreen/latex.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bot/exts/evergreen/latex.py') diff --git a/bot/exts/evergreen/latex.py b/bot/exts/evergreen/latex.py index c4a8597c..3a93907a 100644 --- a/bot/exts/evergreen/latex.py +++ b/bot/exts/evergreen/latex.py @@ -9,6 +9,8 @@ import discord import matplotlib.pyplot as plt from discord.ext import commands +from bot.bot import Bot + # configure fonts and colors for matplotlib plt.rcParams.update( { @@ -89,6 +91,6 @@ class Latex(commands.Cog): await ctx.send(file=discord.File(image, "latex.png")) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Load the Latex Cog.""" bot.add_cog(Latex(bot)) -- cgit v1.2.3 From 6d31315fa72ca9e6ccd7553e78548fed6e5e4829 Mon Sep 17 00:00:00 2001 From: ToxicKidz <78174417+ToxicKidz@users.noreply.github.com> Date: Tue, 4 May 2021 15:44:31 -0400 Subject: fix: Pass bot only when __init__ is defined --- bot/exts/easter/bunny_name_generator.py | 2 +- bot/exts/easter/egg_decorating.py | 2 +- bot/exts/evergreen/avatar_modification/avatar_modify.py | 5 +++-- bot/exts/evergreen/bookmark.py | 2 +- bot/exts/evergreen/catify.py | 8 +++----- bot/exts/evergreen/conversationstarters.py | 2 +- bot/exts/evergreen/emoji.py | 2 +- bot/exts/evergreen/error_handler.py | 2 +- bot/exts/evergreen/latex.py | 2 +- bot/exts/evergreen/pythonfacts.py | 2 +- bot/exts/evergreen/snakes/__init__.py | 5 ++--- bot/exts/evergreen/source.py | 2 +- bot/exts/evergreen/speedrun.py | 2 +- bot/exts/evergreen/timed.py | 2 +- bot/exts/evergreen/uptime.py | 2 +- bot/exts/halloween/timeleft.py | 5 +---- bot/exts/valentines/be_my_valentine.py | 4 ++-- bot/exts/valentines/lovecalculator.py | 2 +- bot/exts/valentines/movie_generator.py | 4 ++-- bot/exts/valentines/myvalenstate.py | 7 ++----- bot/exts/valentines/pickuplines.py | 2 +- bot/exts/valentines/savethedate.py | 2 +- bot/exts/valentines/valentine_zodiac.py | 2 +- bot/exts/valentines/whoisvalentine.py | 2 +- 24 files changed, 32 insertions(+), 40 deletions(-) (limited to 'bot/exts/evergreen/latex.py') diff --git a/bot/exts/easter/bunny_name_generator.py b/bot/exts/easter/bunny_name_generator.py index 23f85226..19a0b0f6 100644 --- a/bot/exts/easter/bunny_name_generator.py +++ b/bot/exts/easter/bunny_name_generator.py @@ -88,4 +88,4 @@ class BunnyNameGenerator(commands.Cog): def setup(bot: Bot) -> None: """Load the Bunny Name Generator Cog.""" - bot.add_cog(BunnyNameGenerator(bot)) + bot.add_cog(BunnyNameGenerator()) diff --git a/bot/exts/easter/egg_decorating.py b/bot/exts/easter/egg_decorating.py index 1432fa31..3744989d 100644 --- a/bot/exts/easter/egg_decorating.py +++ b/bot/exts/easter/egg_decorating.py @@ -118,4 +118,4 @@ class EggDecorating(commands.Cog): def setup(bot: Bot) -> None: """Load the Egg decorating Cog.""" - bot.add_cog(EggDecorating(bot)) + bot.add_cog(EggDecorating()) diff --git a/bot/exts/evergreen/avatar_modification/avatar_modify.py b/bot/exts/evergreen/avatar_modification/avatar_modify.py index 0baee8b2..2304e459 100644 --- a/bot/exts/evergreen/avatar_modification/avatar_modify.py +++ b/bot/exts/evergreen/avatar_modification/avatar_modify.py @@ -11,6 +11,7 @@ from aiohttp import client_exceptions from discord.ext import commands from discord.ext.commands.errors import BadArgument +from bot.bot import Bot from bot.constants import Client, Colours, Emojis from bot.exts.evergreen.avatar_modification._effects import PfpEffects from bot.utils.extensions import invoke_help_command @@ -58,7 +59,7 @@ def file_safe_name(effect: str, display_name: str) -> str: class AvatarModify(commands.Cog): """Various commands for users to apply affects to their own avatars.""" - def __init__(self, bot: commands.Bot) -> None: + def __init__(self, bot: Bot) -> None: self.bot = bot async def _fetch_member(self, member_id: int) -> t.Optional[discord.Member]: @@ -309,6 +310,6 @@ class AvatarModify(commands.Cog): await ctx.send(file=file, embed=embed) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Load the PfpModify cog.""" bot.add_cog(AvatarModify(bot)) diff --git a/bot/exts/evergreen/bookmark.py b/bot/exts/evergreen/bookmark.py index 6a272784..f0fad0ea 100644 --- a/bot/exts/evergreen/bookmark.py +++ b/bot/exts/evergreen/bookmark.py @@ -60,4 +60,4 @@ class Bookmark(commands.Cog): def setup(bot: Bot) -> None: """Load the Bookmark cog.""" - bot.add_cog(Bookmark(bot)) + bot.add_cog(Bookmark()) diff --git a/bot/exts/evergreen/catify.py b/bot/exts/evergreen/catify.py index d8a7442d..b4ae4a25 100644 --- a/bot/exts/evergreen/catify.py +++ b/bot/exts/evergreen/catify.py @@ -5,6 +5,7 @@ from typing import Optional from discord import AllowedMentions, Embed, Forbidden from discord.ext import commands +from bot.bot import Bot from bot.constants import Cats, Colours, NEGATIVE_REPLIES from bot.utils import helpers @@ -12,9 +13,6 @@ from bot.utils import helpers class Catify(commands.Cog): """Cog for the catify command.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - @commands.command(aliases=["ᓚᘏᗢify", "ᓚᘏᗢ"]) async def catify(self, ctx: commands.Context, *, text: Optional[str]) -> None: """ @@ -82,6 +80,6 @@ class Catify(commands.Cog): ) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Loads the catify cog.""" - bot.add_cog(Catify(bot)) + bot.add_cog(Catify()) diff --git a/bot/exts/evergreen/conversationstarters.py b/bot/exts/evergreen/conversationstarters.py index 4fe8c47c..fdc4467a 100644 --- a/bot/exts/evergreen/conversationstarters.py +++ b/bot/exts/evergreen/conversationstarters.py @@ -66,4 +66,4 @@ class ConvoStarters(commands.Cog): def setup(bot: Bot) -> None: """Load the ConvoStarters cog.""" - bot.add_cog(ConvoStarters(bot)) + bot.add_cog(ConvoStarters()) diff --git a/bot/exts/evergreen/emoji.py b/bot/exts/evergreen/emoji.py index e7452a15..11615214 100644 --- a/bot/exts/evergreen/emoji.py +++ b/bot/exts/evergreen/emoji.py @@ -120,4 +120,4 @@ class Emojis(commands.Cog): def setup(bot: Bot) -> None: """Load the Emojis cog.""" - bot.add_cog(Emojis(bot)) + bot.add_cog(Emojis()) diff --git a/bot/exts/evergreen/error_handler.py b/bot/exts/evergreen/error_handler.py index 5cd8d28d..62529f52 100644 --- a/bot/exts/evergreen/error_handler.py +++ b/bot/exts/evergreen/error_handler.py @@ -135,4 +135,4 @@ class CommandErrorHandler(commands.Cog): def setup(bot: Bot) -> None: """Load the ErrorHandler cog.""" - bot.add_cog(CommandErrorHandler(bot)) + bot.add_cog(CommandErrorHandler()) diff --git a/bot/exts/evergreen/latex.py b/bot/exts/evergreen/latex.py index 3a93907a..54d25267 100644 --- a/bot/exts/evergreen/latex.py +++ b/bot/exts/evergreen/latex.py @@ -93,4 +93,4 @@ class Latex(commands.Cog): def setup(bot: Bot) -> None: """Load the Latex Cog.""" - bot.add_cog(Latex(bot)) + bot.add_cog(Latex()) diff --git a/bot/exts/evergreen/pythonfacts.py b/bot/exts/evergreen/pythonfacts.py index 2dc4996f..c0086c20 100644 --- a/bot/exts/evergreen/pythonfacts.py +++ b/bot/exts/evergreen/pythonfacts.py @@ -28,4 +28,4 @@ class PythonFacts(commands.Cog): def setup(bot: Bot) -> None: """Load the PythonFacts Cog.""" - bot.add_cog(PythonFacts(bot)) + bot.add_cog(PythonFacts()) diff --git a/bot/exts/evergreen/snakes/__init__.py b/bot/exts/evergreen/snakes/__init__.py index bc42f0c2..049bc964 100644 --- a/bot/exts/evergreen/snakes/__init__.py +++ b/bot/exts/evergreen/snakes/__init__.py @@ -1,12 +1,11 @@ import logging -from discord.ext import commands - +from bot.bot import Bot from bot.exts.evergreen.snakes._snakes_cog import Snakes log = logging.getLogger(__name__) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Snakes Cog load.""" bot.add_cog(Snakes(bot)) diff --git a/bot/exts/evergreen/source.py b/bot/exts/evergreen/source.py index 2f25e4cb..685b3111 100644 --- a/bot/exts/evergreen/source.py +++ b/bot/exts/evergreen/source.py @@ -104,4 +104,4 @@ class BotSource(commands.Cog): def setup(bot: Bot) -> None: """Load the BotSource cog.""" - bot.add_cog(BotSource(bot)) + bot.add_cog(BotSource()) diff --git a/bot/exts/evergreen/speedrun.py b/bot/exts/evergreen/speedrun.py index 110d5c13..d9820287 100644 --- a/bot/exts/evergreen/speedrun.py +++ b/bot/exts/evergreen/speedrun.py @@ -23,4 +23,4 @@ class Speedrun(commands.Cog): def setup(bot: Bot) -> None: """Load the Speedrun cog.""" - bot.add_cog(Speedrun(bot)) + bot.add_cog(Speedrun()) diff --git a/bot/exts/evergreen/timed.py b/bot/exts/evergreen/timed.py index 42a77346..491231cc 100644 --- a/bot/exts/evergreen/timed.py +++ b/bot/exts/evergreen/timed.py @@ -45,4 +45,4 @@ class TimedCommands(commands.Cog): def setup(bot: Bot) -> None: """Load the Timed cog.""" - bot.add_cog(TimedCommands(bot)) + bot.add_cog(TimedCommands()) diff --git a/bot/exts/evergreen/uptime.py b/bot/exts/evergreen/uptime.py index d2509e6f..b390e7f7 100644 --- a/bot/exts/evergreen/uptime.py +++ b/bot/exts/evergreen/uptime.py @@ -28,4 +28,4 @@ class Uptime(commands.Cog): def setup(bot: Bot) -> None: """Load the Uptime cog.""" - bot.add_cog(Uptime(bot)) + bot.add_cog(Uptime()) diff --git a/bot/exts/halloween/timeleft.py b/bot/exts/halloween/timeleft.py index f4ab9284..e80025dc 100644 --- a/bot/exts/halloween/timeleft.py +++ b/bot/exts/halloween/timeleft.py @@ -12,9 +12,6 @@ log = logging.getLogger(__name__) class TimeLeft(commands.Cog): """A Cog that tells you how long left until Hacktober is over!""" - def __init__(self, bot: Bot): - self.bot = bot - def in_hacktober(self) -> bool: """Return True if the current time is within Hacktoberfest.""" _, end, start = self.load_date() @@ -68,4 +65,4 @@ class TimeLeft(commands.Cog): def setup(bot: Bot) -> None: """Load the Time Left Cog.""" - bot.add_cog(TimeLeft(bot)) + bot.add_cog(TimeLeft()) diff --git a/bot/exts/valentines/be_my_valentine.py b/bot/exts/valentines/be_my_valentine.py index e94efda0..cf6099d2 100644 --- a/bot/exts/valentines/be_my_valentine.py +++ b/bot/exts/valentines/be_my_valentine.py @@ -21,7 +21,7 @@ HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_hea class BeMyValentine(commands.Cog): """A cog that sends Valentines to other users!""" - def __init__(self, bot: commands.Bot): + def __init__(self, bot: Bot): self.bot = bot self.valentines = self.load_json() @@ -198,5 +198,5 @@ class BeMyValentine(commands.Cog): def setup(bot: Bot) -> None: - """Be my Valentine Cog load.""" + """Load the Be my Valentine Cog.""" bot.add_cog(BeMyValentine(bot)) diff --git a/bot/exts/valentines/lovecalculator.py b/bot/exts/valentines/lovecalculator.py index c2a5da26..e55dc128 100644 --- a/bot/exts/valentines/lovecalculator.py +++ b/bot/exts/valentines/lovecalculator.py @@ -93,5 +93,5 @@ class LoveCalculator(Cog): def setup(bot: Bot) -> None: - """Love calculator Cog load.""" + """Load the Love calculator Cog.""" bot.add_cog(LoveCalculator()) diff --git a/bot/exts/valentines/movie_generator.py b/bot/exts/valentines/movie_generator.py index 461255ff..4508c3b2 100644 --- a/bot/exts/valentines/movie_generator.py +++ b/bot/exts/valentines/movie_generator.py @@ -16,7 +16,7 @@ log = logging.getLogger(__name__) class RomanceMovieFinder(commands.Cog): """A Cog that returns a random romance movie suggestion to a user.""" - def __init__(self, bot: commands.Bot): + def __init__(self, bot: Bot): self.bot = bot @commands.command(name="romancemovie") @@ -62,5 +62,5 @@ class RomanceMovieFinder(commands.Cog): def setup(bot: Bot) -> None: - """Romance movie Cog load.""" + """Load the Romance movie Cog.""" bot.add_cog(RomanceMovieFinder(bot)) diff --git a/bot/exts/valentines/myvalenstate.py b/bot/exts/valentines/myvalenstate.py index 7a0f8318..1c67984b 100644 --- a/bot/exts/valentines/myvalenstate.py +++ b/bot/exts/valentines/myvalenstate.py @@ -19,9 +19,6 @@ with open(Path("bot/resources/valentines/valenstates.json"), "r", encoding="utf8 class MyValenstate(commands.Cog): """A Cog to find your most likely Valentine's vacation destination.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - def levenshtein(self, source: str, goal: str) -> int: """Calculates the Levenshtein Distance between source and goal.""" if len(source) < len(goal): @@ -83,5 +80,5 @@ class MyValenstate(commands.Cog): def setup(bot: Bot) -> None: - """Valenstate Cog load.""" - bot.add_cog(MyValenstate(bot)) + """Load the Valenstate Cog.""" + bot.add_cog(MyValenstate()) diff --git a/bot/exts/valentines/pickuplines.py b/bot/exts/valentines/pickuplines.py index 216ee13b..909169e6 100644 --- a/bot/exts/valentines/pickuplines.py +++ b/bot/exts/valentines/pickuplines.py @@ -38,5 +38,5 @@ class PickupLine(commands.Cog): def setup(bot: Bot) -> None: - """Pickup lines Cog load.""" + """Load the Pickup lines Cog.""" bot.add_cog(PickupLine()) diff --git a/bot/exts/valentines/savethedate.py b/bot/exts/valentines/savethedate.py index ed2d2c5f..cc16f5c9 100644 --- a/bot/exts/valentines/savethedate.py +++ b/bot/exts/valentines/savethedate.py @@ -35,5 +35,5 @@ class SaveTheDate(commands.Cog): def setup(bot: Bot) -> None: - """Save the date Cog Load.""" + """Load the Save the date Cog.""" bot.add_cog(SaveTheDate()) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 72fd93fe..a444a355 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -142,5 +142,5 @@ class ValentineZodiac(commands.Cog): def setup(bot: Bot) -> None: - """Valentine zodiac Cog load.""" + """Load the Valentine zodiac Cog.""" bot.add_cog(ValentineZodiac()) diff --git a/bot/exts/valentines/whoisvalentine.py b/bot/exts/valentines/whoisvalentine.py index 3789fad5..3f23201f 100644 --- a/bot/exts/valentines/whoisvalentine.py +++ b/bot/exts/valentines/whoisvalentine.py @@ -46,5 +46,5 @@ class ValentineFacts(commands.Cog): def setup(bot: Bot) -> None: - """Who is Valentine Cog load.""" + """Load the Who is Valentine Cog.""" bot.add_cog(ValentineFacts()) -- cgit v1.2.3 From 85733251d46151dc76378fad253c1d45e49eb9a0 Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Sat, 15 May 2021 20:07:10 +0200 Subject: Latex: temporarily disable loading of the cog As we are currently working on restricting resources on the latex cog, this commit will prevent it from loading. It will be reverted once solved. --- bot/exts/evergreen/latex.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bot/exts/evergreen/latex.py') diff --git a/bot/exts/evergreen/latex.py b/bot/exts/evergreen/latex.py index c4a8597c..8f42da90 100644 --- a/bot/exts/evergreen/latex.py +++ b/bot/exts/evergreen/latex.py @@ -91,4 +91,9 @@ class Latex(commands.Cog): def setup(bot: commands.Bot) -> None: """Load the Latex Cog.""" + # As we have resource issues on this cog, + # we have it currently disabled while we fix it. + import logging + logging.info("Latex cog is currently disabled. It won't be loaded.") + return bot.add_cog(Latex(bot)) -- cgit v1.2.3