bot executes next command without waiting for message

Hello I have been trying to create a application bot for my server the bot sends you a questions then the person answers then its noted down ect but my problem is that sometimes the next question would send without waiting for the answer to the previous question. this only happens most of the time. try i might i have not been able to fix the problem. I’m pretty new to python and at the end of my wits. my code for reference:

import os       
from discord.ext import commands    
from discord.utils import get 
BOT_PREFIX = ("!")
client = commands.Bot(command_prefix=BOT_PREFIX)    
a_list = []   
async def on_ready():
    print ("------------------------------------")
    print ("Bot Name: " +
    print ("------------------------------------")        
submit_wait = False
a_list = []
b_list = []
c_list = []
d_list = []      
async def app(ctx):
    a_list = []
    b_list = []
    c_list = []
    d_list = []
    submit_wait = False    
    submit_channel = client.get_channel(806404345830047744)
    channel = await
    await channel.send("starting applaction!")
    await ctx.send( + "check your dms!")
    def check(m):
        return m.content is not None and == channel        
    await channel.send("Do you have any prior milli sim experiance?")
    msg = await client.wait_for('message', check=check)
    await channel.send("What time zone are you in?")        
    msg2 = await client.wait_for('message', check=check)
    await channel.send("If a officer ordered you to break the genva convention would you do it?")        
    msg3 = await client.wait_for('message', check=check)
    await channel.send("Is there any particular dvision you want to be in?")    
    msg4 = await client.wait_for('message', check=check)
    await channel.send('thank you for applying! a officer will do your application as soon as they can - respound with "submit" to submit your application')
    msg = await client.wait_for('message', check=check)
    if "submit" in msg.content.lower():
      submit_wait = False
      answers = "\n".join(f'{a}. {b}' for a, b in enumerate(a_list, 1))
      answer = "\n".join(f'{a}. {b}' for a, b in enumerate(b_list, 2))
      answerr = "\n".join(f'{a}. {b}' for a, b in enumerate(c_list, 3))
      answerss = "\n".join(f'{a}. {b}' for a, b in enumerate(d_list, 4))                
      submit_msg = f'Application from {} \nThe answers are:\n{answers}'
      submit_msg2 = f'{answer}'
      submit_msg3 = f'{answerr}'
      submit_msg4 = f'{answerss}'
      await submit_channel.send(submit_msg)
      await submit_channel.send(submit_msg2)   
      await submit_channel.send(submit_msg3)
      await submit_channel.send(submit_msg4)'TOKEN'))

Read more here:

Content Attribution

This content was originally published by alex cole at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: