Is there a way to send a message to a user without making him type anything with a discord py bot?

72 views Asked by At

I know that you can send a private message to someone with await client.send_message(user). But as i know it only works if the person u wanna send a message to typed a command. I want my bot to send a message to someone who isn’t even in a server with him. I want my command like this: -send private message name#0000. I wonder if it’s even possible to do that.

2

There are 2 answers

0
Noel G On BEST ANSWER

i dont think its possible to message someone who doesnt share a same server as the bot

but you can use

await client.get_user(userid).send(msg)

to send a message to the user even if they didnt invoke a command

0
user6293020 On

you could add that to your on_ready function by defining user and passing it to the function

user = "user#1234"

and then using the same method but that would only work if you restart your bot.