Compare commits

..

No commits in common. "eb1cd6aada0785cb18c5a3ac1bdf7047ede6617e" and "819b36d2677f4f3efcc482153c4da8302eb7fd50" have entirely different histories.

View file

@ -25,7 +25,7 @@ class Moderation(commands.Cog):
ignore_other_bots = True
)
disable_dateutil()
self.handle_expiry.start() # pylint: disable=no-member
self.handle_expiry.start()
async def cog_load(self):
"""This method prepares the database schema for all of the guilds the bot is currently in."""
@ -45,8 +45,8 @@ class Moderation(commands.Cog):
except ConnectionRefusedError:
return
async def cog_unload(self):
self.handle_expiry.cancel() # pylint: disable=no-member
def cog_unload(self):
self.handle_expiry.cancel()
@commands.Cog.listener('on_guild_join')
async def db_generate_guild_join(self, guild: discord.Guild):
@ -381,36 +381,16 @@ class Moderation(commands.Cog):
}
try:
target = await interaction.client.fetch_user(case["target_id"])
target_user = {
'id': target.id,
'name': target.name,
'discriminator': target.discriminator
}
except discord.errors.NotFound:
target = discord.User(id=case["target_id"], name="Deleted User", discriminator="0") # pylint: disable=unexpected-keyword-arg, missing-kwoa
target_user = {
'id': case['target_id'],
'name': 'Deleted User',
'discriminator': '0'
}
target = discord.User(id=case["target_id"], name="Deleted User", discriminator="0")
try:
moderator = await interaction.client.fetch_user(case["moderator_id"])
moderator_user = {
'id': moderator.id,
'name': moderator.name,
'discriminator': moderator.discriminator
}
except discord.errors.NotFound:
moderator = discord.User(id=case["moderator_id"], name="Deleted User", discriminator="0") # pylint: disable=unexpected-keyword-arg, missing-kwoa
moderator_user = {
'id': case['moderator_id'],
'name': 'Deleted User',
'discriminator': '0'
}
target_name = target_user['name'] if target_user['discriminator'] == "0" else f"{target_user['name']}#{target_user['discriminator']}"
moderator_name = moderator_user['name'] if moderator_user['discriminator'] == "0" else f"{moderator_user['name']}#{moderator_user['discriminator']}"
moderator = discord.User(id=case["moderator_id"], name="Deleted User", discriminator="0")
target_name = target.name if target.discriminator == "0" else f"{target.name}#{target.discriminator}"
moderator_name = moderator.name if moderator.discriminator == "0" else f"{moderator.name}#{moderator.discriminator}"
embed = discord.Embed(title=f"📕 Case #{case['moderation_id']}", color=await self.bot.get_embed_color(None))
embed.description = f"**Type:** {str.title(case['moderation_type'])}\n**Target:** {target_name} ({target_user['id']})\n**Moderator:** {moderator_name} ({moderator_user['id']})\n**Resolved:** {bool(case['resolved'])}\n**Timestamp:** <t:{case['timestamp']}> | <t:{case['timestamp']}:R>"
embed.description = f"**Type:** {str.title(case['moderation_type'])}\n**Target:** {target_name} ({target.id})\n**Moderator:** {moderator_name} ({moderator.id})\n**Resolved:** {bool(case['resolved'])}\n**Timestamp:** <t:{case['timestamp']}> | <t:{case['timestamp']}:R>"
if case['duration'] != 'NULL':
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case["duration"].split(":"))})
duration_embed = f"{humanize.precisedelta(td)} | <t:{case['end_timestamp']}:R>" if case["expired"] == '0' else str(humanize.precisedelta(td))