Modified bot to use list, not dict for questions

main
Anorak_1 2023-08-09 22:08:23 +02:00
parent fcc409dd37
commit 413c1eff27
1 changed files with 16 additions and 16 deletions

32
bot.py
View File

@ -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}")