Add isinstance check for text channel.
This commit is contained in:
Vendored
+1
-1
@@ -6,6 +6,6 @@
|
|||||||
"python.analysis.diagnosticSeverityOverrides": {
|
"python.analysis.diagnosticSeverityOverrides": {
|
||||||
"reportOptionalMemberAccess": false,
|
"reportOptionalMemberAccess": false,
|
||||||
"reportArgumentType": "information",
|
"reportArgumentType": "information",
|
||||||
"reportAttributeAccessIssue": "information"
|
"reportAttributeAccessIssue": "warning"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|
||||||
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user