How to make a dm user command (discord.py)

I’m new to discord.py (and general programming) I want to make a command which dms mentioned user with specified text. Can you please explain how to make it?

Hi @Lemon553311-dev , can you tell me what version of python and discord.py are you using?
sorry for my bad english, i’m spanish xD

I would help, but it was around 2 years ago I tried python bots. They are harder than JavaScript in my opinion.

xD maybe. I program bots in python since 2 months and i have a masterpiece.


This may help a bit.

1 Like

unactualized version of discord. The version of discord used in that link is old and for example bot.get_userinfo doesn’t exist
@RiversideRocks

That sucks. Sorry, I’m not very familiar with python! :grin:

1 Like

no problem, we are for help.
sorry for my bad english, i’m spanish xD

1 Like

im using python 3.7.7
discord.py = 1.2.3

i have found a way to make bot say provided message but now i need to figure out how to make bot DM a specified user.

creating a dm channel in discord.py is explained here: https://discordpy.readthedocs.io/en/latest/api.html#discord.User.dm_channel

so you can simply get a message object, then use await message.author.dm_channel.send("message") to send a message to a user via dms.