I'm making a Discord bot in Python and I want to add a feature when I use the command _throw
and ping a user, the bot will reply depending on the user ping (It's preferred to be a usual text message, not embed). Currently, I have this code:
if message.content == "_throw":
user = message.mentions[0]
await message.channel.send("You threw a hamster to " + f"{user}" + "!")
But my bot doesn't reply to it at all (PyCharm doesn't see any error).
Here's my bot script:
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('_hi'):
await message.channel.send(f'Hello, {message.author.mention}!')
if message.content == "_throw":
user = message.mentions[0]
await message.channel.send("You threw hamster to " + f"{user}" + "!")
if message.content.startswith("_userinfo"):
user = message.mentions[0]
emb14 = discord.Embed(
title=f"@{user} info:",
colour=discord.Colour.dark_blue()
)
emb14.set_image(url=user.avatar_url)
emb14.add_field(name=f"Name", value=f"{user}", inline=True)
emb14.add_field(name=f"Discord Joined date", value=f"{user.created_at}", inline=False)
emb14.add_field(name=f"Server Joined date", value=f"{user.joined_at}", inline=False)
emb14.add_field(name="Profile Picture", value=":arrow_down: :arrow_down: ", inline=False)
await message.channel.send(embed=emb14)
client.run('TOKEN')
Any ideas?