From 413c1eff27330fd4b5c165ee6450e529ed6b9c78 Mon Sep 17 00:00:00 2001 From: Anorak_1 Date: Wed, 9 Aug 2023 22:08:23 +0200 Subject: [PATCH] Modified bot to use list, not dict for questions --- bot.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bot.py b/bot.py index ae93c28..385bce9 100644 --- a/bot.py +++ b/bot.py @@ -18,16 +18,16 @@ bot = discord.Bot(intents=discord.Intents.all()) channel_id = int(CHANNEL_ID) -questions = { - 1: "What is your Minecraft username?", - 2: "How did you learn about CraftTopia? (If it was from a friend or a website we would like to know either who or where just to know where credit is due)", - 3: "Have you been a part of a minecraft community before, if so, let us know what your experience was with that community.", - 4: "How old are you?", - 5: "Do you have a good microphone for proximity chat?", - 6: "Do you plan on spending at least 2-3 hours a week on the server (our current definition of active)", - 7: "What will you be able to do to help us grow and build our community?", - 8: "Any other questions or concerns?" -} +questions = [ + "What is your Minecraft username?", + "How did you learn about CraftTopia? (If it was from a friend or a website we would like to know either who or where just to know where credit is due)", + "Have you been a part of a minecraft community before, if so, let us know what your experience was with that community.", + "How old are you?", + "Do you have a good microphone for proximity chat?", + "Do you plan on spending at least 2-3 hours a week on the server (our current definition of active)", + "What will you be able to do to help us grow and build our community?", + "Any other questions or concerns?" +] max_questions = len(questions) @@ -46,8 +46,8 @@ async def apply(ctx): application = {'userId': ctx.author.id} - for i in range(1, max_questions+1): - embed = discord.Embed(title=f'Question [{i}/{max_questions}]', description=questions[i]) + for i in range(0, max_questions): + embed = discord.Embed(title=f'Question [{i+1}/{max_questions}]', description=questions[i]) await user.send(embed=embed) response = await bot.wait_for('message', check=lambda m: m.author == ctx.author and m.channel == user, timeout=300) application[f'question{i}'] = response.content @@ -64,7 +64,7 @@ async def apply(ctx): channel = bot.get_channel(channel_id) embed = discord.Embed(title='Application: ' + ctx.author.display_name) - for i in range(1, max_questions+1): + for i in range(0, max_questions): embed.add_field(name=f'{questions[i]}', value=application[f'question{i}'], inline=False) embed.set_footer(text=f"Applicant ID: {ctx.author.id}") @@ -185,9 +185,9 @@ class ApplicationStartButtonView(discord.ui.View): application = {'userId': interaction.user.id} - for i in range(1, max_questions+1): + for i in range(0, max_questions): try: - embed = discord.Embed(title=f'Question [{i}/{max_questions}]', description=questions[i]) + embed = discord.Embed(title=f'Question [{i+1}/{max_questions}]', description=questions[i]) await user.send(embed=embed) response = await bot.wait_for('message', check=lambda m: m.author == interaction.user and m.channel == user, timeout=300) if response.content.startswith("cancel"): @@ -211,7 +211,7 @@ class ApplicationStartButtonView(discord.ui.View): channel = bot.get_channel(channel_id) embed = discord.Embed(title='Application: ' + interaction.user.display_name) - for i in range(1, max_questions+1): + for i in range(0, max_questions): embed.add_field(name=f'{questions[i]}', value=application[f'question{i}'], inline=False) embed.set_footer(text=f"Applicant ID: {interaction.user.id}")