diff --git a/.vscode/settings.json b/.vscode/settings.json index 5ad200b..a0b6d48 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,10 @@ "cSpell.words": [ "highscore", "highscores" - ] + ], + "python.analysis.diagnosticSeverityOverrides": { + "reportOptionalMemberAccess": false, + "reportArgumentType": "information", + "reportAttributeAccessIssue": "information" + } } \ No newline at end of file diff --git a/cogs/commands/submission.py b/cogs/commands/submission.py index 2266e71..93e310d 100644 --- a/cogs/commands/submission.py +++ b/cogs/commands/submission.py @@ -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, )