Compare commits

...
2 Commits
3 changed files with 17 additions and 10 deletions
+1 -1
View File
@@ -6,6 +6,6 @@
"python.analysis.diagnosticSeverityOverrides": { "python.analysis.diagnosticSeverityOverrides": {
"reportOptionalMemberAccess": false, "reportOptionalMemberAccess": false,
"reportArgumentType": "information", "reportArgumentType": "information",
"reportAttributeAccessIssue": "information" "reportAttributeAccessIssue": "warning"
} }
} }
+5 -7
View File
@@ -1,6 +1,4 @@
""" """Cog loader. Adds all command cogs to the bot."""
Cog loader. Adds all command cogs to the bot.
"""
from nextcord.ext import commands from nextcord.ext import commands
@@ -9,20 +7,20 @@ from .delete import DeleteCog
from .help import HelpCog from .help import HelpCog
from .refresh import RefreshCog from .refresh import RefreshCog
from .set import SetCog from .set import SetCog
from .submission import SubmissionCog
from .update import UpdateCog from .update import UpdateCog
from .view import ViewCog from .view import ViewCog
# This function will be called when this extension is loaded. # This function will be called when this extension is loaded.
# It is necessary to add these functions to the bot. # It is necessary to add these functions to the bot.
def setup(bot: commands.Bot): def setup(bot: commands.Bot) -> None:
""" """Adds all command classes to bot."""
Adds all command classes to bot.
"""
bot.add_cog(CreateCog(bot)) bot.add_cog(CreateCog(bot))
bot.add_cog(DeleteCog()) bot.add_cog(DeleteCog())
bot.add_cog(HelpCog()) bot.add_cog(HelpCog())
bot.add_cog(RefreshCog(bot)) bot.add_cog(RefreshCog(bot))
bot.add_cog(SetCog()) bot.add_cog(SetCog())
bot.add_cog(SubmissionCog())
bot.add_cog(UpdateCog(bot)) bot.add_cog(UpdateCog(bot))
bot.add_cog(ViewCog()) bot.add_cog(ViewCog())
+11 -2
View File
@@ -9,6 +9,7 @@ from sqlalchemy.orm import Session
from cogs.submission.verification_view import VerificationView from cogs.submission.verification_view import VerificationView
from database_setup.sql_data_classes import Category, CategoryGroup, Guild, Submission, engine from database_setup.sql_data_classes import Category, CategoryGroup, Guild, Submission, engine
from main import logger
from utilities.utils import GUILDS, autofill_categories, autofill_groups, submit_score from utilities.utils import GUILDS, autofill_categories, autofill_groups, submit_score
@@ -22,9 +23,9 @@ class SubmissionCog(commands.Cog):
async def submit( async def submit(
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."),
category_id: str = nextcord.SlashOption( category_id: str = nextcord.SlashOption(
name="Category", required=True, description="Category to submit score to." name="category", required=True, description="Category to submit score to."
), ),
score: str = nextcord.SlashOption(required=True, description="Score to submit"), score: str = nextcord.SlashOption(required=True, description="Score to submit"),
username: str = nextcord.SlashOption( username: str = nextcord.SlashOption(
@@ -86,6 +87,14 @@ class SubmissionCog(commands.Cog):
"Registered Verification channel does not exist or was never registered. Contact server admins." "Registered Verification channel does not exist or was never registered. Contact server admins."
) )
await interaction.response.send_message(error_response, ephemeral=True) await interaction.response.send_message(error_response, ephemeral=True)
return
if not isinstance(channel, nextcord.TextChannel):
await interaction.response.send_message("An error happened with submission.")
logger.error(
"Channel id %s in guild %s is does not correspond to a TextChannel.", channel.id, channel.guild.id
)
return
# Send the verification message to admins # Send the verification message to admins
verification_message = await channel.send( verification_message = await channel.send(