From 923173ebe8eabd6e4a8d90fcba4691af1cd4ef48 Mon Sep 17 00:00:00 2001 From: profitroll Date: Sun, 27 Apr 2025 22:05:34 +0200 Subject: [PATCH] Added a stub for #11 and slightly improved typing --- classes/errors/pycord_event_stage.py | 2 +- classes/errors/pycord_guild.py | 2 +- cogs/cog_utility.py | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/classes/errors/pycord_event_stage.py b/classes/errors/pycord_event_stage.py index 4e3d519..1d4b4d0 100644 --- a/classes/errors/pycord_event_stage.py +++ b/classes/errors/pycord_event_stage.py @@ -5,7 +5,7 @@ class EventStageNotFoundError(Exception): """PycordEventStage could not find event with such an ID in the database""" def __init__(self, stage_id: str | ObjectId) -> None: - self.stage_id = stage_id + self.stage_id: str | ObjectId = stage_id super().__init__(f"Stage with id {self.stage_id} was not found") diff --git a/classes/errors/pycord_guild.py b/classes/errors/pycord_guild.py index 21a89b7..83f1c48 100644 --- a/classes/errors/pycord_guild.py +++ b/classes/errors/pycord_guild.py @@ -2,6 +2,6 @@ class GuildNotFoundError(Exception): """PycordGuild could not find guild with such an ID in the database""" def __init__(self, guild_id: int) -> None: - self.guild_id = guild_id + self.guild_id: int = guild_id super().__init__(f"Guild with id {self.guild_id} was not found") diff --git a/cogs/cog_utility.py b/cogs/cog_utility.py index 33695f8..5f021c0 100644 --- a/cogs/cog_utility.py +++ b/cogs/cog_utility.py @@ -1,7 +1,6 @@ from logging import Logger -from discord import Activity, ActivityType, Cog -from discord.ext import commands +from discord import Activity, ActivityType, Cog, Member from classes.pycord_bot import PycordBot from modules.utils import get_logger @@ -13,7 +12,7 @@ class CogUtility(Cog): def __init__(self, bot: PycordBot): self.bot: PycordBot = bot - @commands.Cog.listener() + @Cog.listener() async def on_ready(self) -> None: """Listener for the event when bot connects to Discord and becomes "ready".""" logger.info("Logged in as %s", self.bot.user) @@ -42,6 +41,11 @@ class CogUtility(Cog): logger.info("Set activity type to %s with message %s", activity_type, activity_message) + # TODO Implement #11 + @Cog.listener() + async def on_member_join(self, member: Member) -> None: + pass + def setup(bot: PycordBot) -> None: bot.add_cog(CogUtility(bot))