I tried today to make a python discord.py based bot for a bit of fun, and following some random tutorials and copying code it worked great, and I added a few new commands once I'd gotten the hang of it, but apparently randomly most of the commands stopped working, and for some reason now only the bottom most command actually functions in discord, any ideas why this could be? Code:
import discord
from discord.ext import commands
description = 'Tutorial Bot'
bot_prefix = '!'
client = commands.Bot(description=description, command_prefix=bot_prefix)
list_of_strings = ['hello', 'hi']
@client.event
async def on_ready():
print('Connected')
@client.event
async def on_message(message):
if message.content.startswith('!what'):
await client.send_message(message.channel, 'Huh?')
@client.event
async def on_message(message):
if message.content in list_of_strings:
await client.send_message(message.channel, 'Hey there')
client.run('*set to code before attempting*')
I had set the client.run to the newest code, but whenever I use the bottom list of strings command it works fine, but the !what section doesn't work. I tried reversing them and the same problem persisted, with only the bottom most one working regardless of which order they're in. Is there something obvious I'm probably missing here?