Add some pylance settings. Fix some pylance smells in submission.py.

This commit is contained in:
2025-02-18 23:30:01 -05:00
parent 279d3f4885
commit 7e90e7c819
2 changed files with 14 additions and 9 deletions
+8 -8
View File
@@ -57,27 +57,27 @@ class SubmissionCog(commands.Cog):
category: Category = session.scalar(stmt)
# check if verification is required. if no picture, deny
if category.IsValidated and not interaction.message.attachments > 0:
if category.IsValidated and not len(interaction.message.attachments) > 0:
await interaction.response.send_message(
"This category required verification. Please attach a picture and re-submit.", ephemeral=True
)
return
# check with regex if score is in correct format
score = await self.verify_score(interaction, score, is_time_record=category.IsTimeRecord)
verified_score = await self.verify_score(interaction, score, is_time_record=category.IsTimeRecord)
# check if verify_score was successful. It replies with corrections required itself.
if score is None:
if verified_score is None:
return
# Create submission verification request or submit score if verification not needed.
if not category.IsValidated:
await submit_score(interaction, group_id, category_id, username, score)
await submit_score(interaction, int(group_id), int(category_id), username, verified_score)
await interaction.response.send_message("Score has been submitted!", ephemeral=True)
return
stmt = select(Guild.VerificationChannel).where(Guild.GuildId == interaction.guild_id)
verification_channel_id = session.scalar(stmt)
stmt = select(Guild).where(Guild.GuildId == interaction.guild_id)
verification_channel_id: int = session.scalar(stmt).VerificationChannel
channel = interaction.guild.get_channel(verification_channel_id)
@@ -91,7 +91,7 @@ class SubmissionCog(commands.Cog):
verification_message = await channel.send(
files=[await attach.to_file() for attach in interaction.message.attachments],
view=VerificationView(),
embeds=self.create_embed(interaction, group_id, category_id, score, username, session),
embeds=[self.create_embed(interaction, group_id, category_id, verified_score, username, session)],
content=f"Submission from <@{interaction.user.id}>.",
)
await interaction.response.send_message(content="Score submitted!", ephemeral=True)
@@ -102,7 +102,7 @@ class SubmissionCog(commands.Cog):
GroupId=group_id,
GuildId=interaction.guild_id,
MessageId=verification_message.id,
Score=score,
Score=verified_score,
UserName=username,
)