As Scott said, result is defined inside the flip function. I haven’t really used async before, but probably this will work for you.
- Take out the return statement
-
Tab the following lines.
elif message.content.startswith(config.prefix + 'coinflip'): result = random.randint(0, 1) if result == 1: print('Heads!') await client.send_message(message.channel, content="Heads!") else: print('Tails!') await client.send_message(message.channel, content="Tails!")
1
solved Simple head and tails bot [closed]