Add type checking to beginning of integer submit.
build_develop / build (push) Successful in 39s

This commit is contained in:
2025-04-09 10:09:38 -04:00
parent 7f7af124fe
commit af0f5c6eba
2 changed files with 8 additions and 3 deletions
+2 -1
View File
@@ -7,7 +7,8 @@
"imcompiling", "imcompiling",
"iterrows", "iterrows",
"nextcord", "nextcord",
"ondelete" "ondelete",
"pylance's"
], ],
"python.analysis.diagnosticSeverityOverrides": { "python.analysis.diagnosticSeverityOverrides": {
"reportOptionalMemberAccess": "warning", "reportOptionalMemberAccess": "warning",
+5 -1
View File
@@ -23,7 +23,7 @@ class SubmissionCog(commands.Cog):
"""Parent slash command for submitting scores. Never called.""" """Parent slash command for submitting scores. Never called."""
@submit.subcommand(name="int", description="Submit an integer type score.") @submit.subcommand(name="int", description="Submit an integer type score.")
async def integer( async def integer( # noqa: PLR0911, PLR0913
self, self,
interaction: nextcord.Interaction, interaction: nextcord.Interaction,
group_id: str = nextcord.SlashOption(name="group", required=True, description="Group to submit score to."), group_id: str = nextcord.SlashOption(name="group", required=True, description="Group to submit score to."),
@@ -53,6 +53,10 @@ class SubmissionCog(commands.Cog):
proof (nextcord.Attachment): Is SlashOption. Picture to provide proof of score. proof (nextcord.Attachment): Is SlashOption. Picture to provide proof of score.
username (str, optional): Is SlashOption. Username to associate with the score. username (str, optional): Is SlashOption. Username to associate with the score.
""" """
if interaction.guild is None or interaction.user is None or interaction.guild_id is None:
# Type checking for pylance's sake.
await interaction.response.send_message("Error with guild or user.", ephemeral=True)
return
# fill out username if not passed in # fill out username if not passed in
if username is None: if username is None:
username = interaction.user.display_name username = interaction.user.display_name