Users cannot move to next step without completing current step.
This commit is contained in:
@@ -31,31 +31,19 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
|
||||
|
||||
# need check if correct user and correct channel
|
||||
if message.channel.id == highscores_data["submission_channel_id"]:
|
||||
|
||||
if (
|
||||
submission_objects[message.author.id]["submission_state"]
|
||||
== SubmissionState.SCORE
|
||||
and message.content
|
||||
):
|
||||
state = submission_objects[message.author.id]["submission_state"]
|
||||
if state == SubmissionState.SCORE and message.content:
|
||||
# TODO add score format verification
|
||||
submission_objects[message.author.id]["score"] = message.content
|
||||
embed = get_submission_embed(message.author.id)
|
||||
await submission_message.edit(
|
||||
embed=embed,
|
||||
)
|
||||
elif (
|
||||
submission_objects[message.author.id]["submission_state"]
|
||||
== SubmissionState.PROOF
|
||||
and len(message.attachments) > 0
|
||||
):
|
||||
elif state == SubmissionState.PROOF and len(message.attachments) > 0:
|
||||
await submission_message.edit(
|
||||
files=[await attch.to_file() for attch in message.attachments],
|
||||
)
|
||||
elif (
|
||||
submission_objects[message.author.id]["submission_state"]
|
||||
== SubmissionState.NAME
|
||||
and message.content
|
||||
):
|
||||
elif state == SubmissionState.NAME and message.content:
|
||||
submission_objects[message.author.id]["username"] = message.content[:12]
|
||||
embed = get_submission_embed(message.author.id)
|
||||
await submission_message.edit(
|
||||
|
||||
@@ -121,7 +121,20 @@ class NextButton(nextcord.ui.Button):
|
||||
|
||||
# TODO verify proper information has been gathered
|
||||
async def callback(self, interaction: nextcord.Interaction):
|
||||
# check if fields have been filled out for each state
|
||||
state: SubmissionState = submission_objects[interaction.user.id]["submission_state"]
|
||||
if (
|
||||
state == SubmissionState.CATEGORY
|
||||
and not submission_objects[interaction.user.id]["category"]
|
||||
):
|
||||
await interaction.send("Please choose a category.", ephemeral=True)
|
||||
elif (
|
||||
state == SubmissionState.SCORE and not submission_objects[interaction.user.id]["score"]
|
||||
):
|
||||
await interaction.send("Please send a score.", ephemeral=True)
|
||||
elif state == SubmissionState.PROOF and not len(interaction.message.attachments) > 0:
|
||||
await interaction.send("Please attach picture for proof.", ephemeral=True)
|
||||
else:
|
||||
state = SubmissionState(state.value + 1)
|
||||
submission_objects[interaction.user.id]["submission_state"] = state
|
||||
embed = get_submission_embed(interaction.user.id)
|
||||
|
||||
Reference in New Issue
Block a user