Add some pylance settings. Fix some pylance smells in submission.py.
This commit is contained in:
Vendored
+6
-1
@@ -2,5 +2,10 @@
|
|||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"highscore",
|
"highscore",
|
||||||
"highscores"
|
"highscores"
|
||||||
]
|
],
|
||||||
|
"python.analysis.diagnosticSeverityOverrides": {
|
||||||
|
"reportOptionalMemberAccess": false,
|
||||||
|
"reportArgumentType": "information",
|
||||||
|
"reportAttributeAccessIssue": "information"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -57,27 +57,27 @@ class SubmissionCog(commands.Cog):
|
|||||||
category: Category = session.scalar(stmt)
|
category: Category = session.scalar(stmt)
|
||||||
|
|
||||||
# check if verification is required. if no picture, deny
|
# 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(
|
await interaction.response.send_message(
|
||||||
"This category required verification. Please attach a picture and re-submit.", ephemeral=True
|
"This category required verification. Please attach a picture and re-submit.", ephemeral=True
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
# check with regex if score is in correct format
|
# 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.
|
# check if verify_score was successful. It replies with corrections required itself.
|
||||||
if score is None:
|
if verified_score is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Create submission verification request or submit score if verification not needed.
|
# Create submission verification request or submit score if verification not needed.
|
||||||
if not category.IsValidated:
|
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)
|
await interaction.response.send_message("Score has been submitted!", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
stmt = select(Guild.VerificationChannel).where(Guild.GuildId == interaction.guild_id)
|
stmt = select(Guild).where(Guild.GuildId == interaction.guild_id)
|
||||||
verification_channel_id = session.scalar(stmt)
|
verification_channel_id: int = session.scalar(stmt).VerificationChannel
|
||||||
|
|
||||||
channel = interaction.guild.get_channel(verification_channel_id)
|
channel = interaction.guild.get_channel(verification_channel_id)
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ class SubmissionCog(commands.Cog):
|
|||||||
verification_message = await channel.send(
|
verification_message = await channel.send(
|
||||||
files=[await attach.to_file() for attach in interaction.message.attachments],
|
files=[await attach.to_file() for attach in interaction.message.attachments],
|
||||||
view=VerificationView(),
|
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}>.",
|
content=f"Submission from <@{interaction.user.id}>.",
|
||||||
)
|
)
|
||||||
await interaction.response.send_message(content="Score submitted!", ephemeral=True)
|
await interaction.response.send_message(content="Score submitted!", ephemeral=True)
|
||||||
@@ -102,7 +102,7 @@ class SubmissionCog(commands.Cog):
|
|||||||
GroupId=group_id,
|
GroupId=group_id,
|
||||||
GuildId=interaction.guild_id,
|
GuildId=interaction.guild_id,
|
||||||
MessageId=verification_message.id,
|
MessageId=verification_message.id,
|
||||||
Score=score,
|
Score=verified_score,
|
||||||
UserName=username,
|
UserName=username,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user