Skip to content Skip to sidebar Skip to footer

How Can I Get My Bot To Dm A Specific User Id Without A Command Given?

When someone DM's my bot, I have it print to the console who messaged, what the message was, and the time the message was sent. I would like the bot to then DM me to either notify

Solution 1:

It seems to me that you're using the old async version of discord.py - I highly recommend moving to the newer rewrite branch as support for the async version has now ceased.

Migrating to v1.0 (rewrite)

client.get_user(ID) is a rewrite method and doesn't exist in the async version of discord.py. You can use client.get_user_info(ID) in this case.

Hope this helps - happy coding!

EDIT: Here's the code you need to use:

user = client.get_user(305508822485827584)
await user.send("Test")

Post a Comment for "How Can I Get My Bot To Dm A Specific User Id Without A Command Given?"