kiddo42069
kiddo42069

Reputation: 19

Discord.py bot doesn't dm user

If someone says hey in chat I want the bot to dm them, but it gives absolutely no errors an doesnt work either

@client.event
async def on_message(message):
  if message.author == client.user:
    return
  if message.content.lower == "hey":
    await message.author.send("heyo")
    await message.add_reaction(":b:")
  await client.process_commands(message)

Upvotes: 0

Views: 65

Answers (1)

Filming
Filming

Reputation: 239

I tried tinkering with your code and something I noticed was that you weren't calling the lower function correctly. lower should be lower(). That allowed the bot to at least DM me.

(Note: I also fixed the add_reaction error by using the write emoji format needed)

@client.event
async def on_message(message):

    if message.author == client.user:
        return

    if message.content.lower() == "hey":
        await message.author.send("heyo")
        await message.add_reaction("🅱️")

    await client.process_commands(message)

Upvotes: 0

Related Questions