diff --git a/cogs/loops/bot_presence.py b/cogs/loops/bot_presence.py index f64cfd9..a236fb5 100644 --- a/cogs/loops/bot_presence.py +++ b/cogs/loops/bot_presence.py @@ -13,23 +13,22 @@ class BotPresence(commands.Cog, name="Bot Presence"): self.bot = bot @commands.Cog.listener() - async def on_guild_join(self, guild: nextcord.Guild): # pylint: disable=unused-argument + async def on_guild_join(self, guild: nextcord.Guild) -> None: # noqa: ARG002 """Listener for Guild Join. Updated presence on guild join.""" await self.change_presence() @commands.Cog.listener() - async def on_ready(self): + async def on_ready(self) -> None: """Starts the loop when bot is ready.""" await self.bot.wait_until_ready() - # pylint doesn't recognize that periodic_change_presense is subclassed from tasks.loop. - self.periodic_change_presence.start() # pylint: disable=no-member + self.periodic_change_presence.start() @tasks.loop(minutes=2) - async def periodic_change_presence(self): + async def periodic_change_presence(self) -> None: """Loops every 2 minutes and changes presence.""" await self.change_presence() - async def change_presence(self): + async def change_presence(self) -> None: """Randomly chooses a presence and updates bot's presence.""" statuses = [ "Now with slash commands!", @@ -39,7 +38,7 @@ class BotPresence(commands.Cog, name="Bot Presence"): "That's a lot of damage!", ] - status = random.choice(statuses) + status = random.choice(statuses) # noqa: S311 status += f" | {len(self.bot.guilds)} servers" diff --git a/cogs/loops/guild_data.py b/cogs/loops/guild_data.py index 356a4c9..8ed6c83 100644 --- a/cogs/loops/guild_data.py +++ b/cogs/loops/guild_data.py @@ -3,6 +3,7 @@ from nextcord.ext import commands, tasks from sqlalchemy import select from sqlalchemy.orm import Session +from sqlmodel import col from database.db import engine from database.models import Guild @@ -11,7 +12,7 @@ from database.models import Guild class GuildData(commands.Cog, name="Guild Data"): """Class to contain loop.""" - def __init__(self, bot: commands.bot) -> None: + def __init__(self, bot: commands.Bot) -> None: self.bot = bot @commands.Cog.listener() @@ -30,7 +31,7 @@ class GuildData(commands.Cog, name="Guild Data"): with Session(engine) as session: for guild in self.bot.guilds: # update given guild name for guild id - stmt = select(Guild).where(Guild.id == guild.id) + stmt = select(Guild).where(col(Guild.id == guild.id)) guild_data = session.scalar(stmt) # just in case checking if the guild doesn't exist.