fix(aurora): fixed random handle_expiry error

This commit is contained in:
Seaswimmer 2024-01-01 12:37:08 -05:00
parent 0e2d69f106
commit 497c287019
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE
2 changed files with 5 additions and 4 deletions

View file

@ -68,10 +68,10 @@ class Aurora(commands.Cog):
self.bot = bot
register_config(config)
disable_dateutil()
self.handle_expiry.start() # pylint: disable=no-member
async def cog_load(self):
"""This method prepares the database schema for all of the guilds the bot is currently in."""
"""This method prepares the database schema for all of the guilds the bot is currently in, and starts the handle_expiry task."""
await self.handle_expiry.start() # pylint: disable=no-member
guilds: list[discord.Guild] = self.bot.guilds
try:
@ -83,7 +83,7 @@ class Aurora(commands.Cog):
return
async def cog_unload(self):
self.handle_expiry.cancel() # pylint: disable=no-member
await self.handle_expiry.cancel() # pylint: disable=no-member
@commands.Cog.listener('on_guild_join')
async def db_generate_guild_join(self, guild: discord.Guild):
@ -451,7 +451,7 @@ class Aurora(commands.Cog):
await interaction.response.send_message(content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`")
try:
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='tempbanned', response=await interaction.original_response(), duration=parsed_time)
embed = await embed_factory('message', await self.bot.get_embed_color(None) , guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='tempbanned', response=await interaction.original_response(), duration=parsed_time)
await target.send(embed=embed)
except discord.errors.HTTPException:
pass

View file

@ -20,6 +20,7 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
- 'changes'
Required arguments for 'message':
- color
- guild
- reason
- moderation_type