0
votes

Again, I am very new to programming so please be patient. I was hoping to have my bot save what you say and use it in a message later. The problem I'm having is the bot is saving the message that's supposed to prompt it to save the next message.

I have tried separating the different sections into different on_message commands, but since I'm using global booleans to help the bot recognize where it should be in the conversation so, separating the commands means the bot doesn't rely on the true/false assignments from the on_message command before it. I was also going to try assigning the message contents to different variables so the bot has a way of knowing which message to save but there's no way to incorporate these variables into the await message.channel.send() part.

async def on_message(message):
    global branch1
    global branch2
    if message.author == client.user:
        return
    if message.content.startswith("!ml"):
        message.content = message.content.lower().replace(' ', '')
        if message.content in command2 and not branch1:
            branch1 = True
            response2 = "Choose one or two"
            await message.channel.send(response2)
        if branch1:
            if message.content in one and branch1:
                branch1 = False
                response3 = "yay"
                await message.channel.send(response3)
                branch2 = True
        if branch2:
            var1 = message.content
            response4 = "hey " + var1
            await message.channel.send(response4)

I expected the bot to wait until after the command that set branch2 to true to store the message. Instead, the bot prints out: "yay" "hey!mlone"

1

1 Answers

-1
votes

Fixed by adding a letter and number to the !ml prefix for each question