Ask coding questions

← Back to all posts
How can I make a Discord quiz
JamesWyatt (0)

I've got the code below but I just wanted to know why the answer is not working. When I run the code on replit and type the command on discord, it doesn't do anything.

Code:

if message.content.startswith("Programme Game") or message.content.startswith("programme game") or message.content.startswith("programme Game"):
  game_1 = await message.channel.send("Is 5.09 a Variable or a float?")

  if message.content.startswith("Float") or message.content.startswith("float"):
   await message.channel.send("You Are Correct!!!")
   print("Command executed successfully!")
Comments
hotnewtop
ryanbrwr (33)

Do you have the whole file for the bot? If this is the only code you're running, you need to start the discord bot with a bot.on('message') or something like that. Here's a link to a tutorial on hosting discord bots on replit, hope it helps! https://www.freecodecamp.org/news/create-a-discord-bot-with-python/

JamesWyatt (0)

@ryanbrwr Yes, I have a whole file. I'll check out the link but thanks.