Linkachus 17
Linkachus 17

Reputation: 33

Discord BOT Send DM to someone using the person ID's

I want to send a DM to someone using their ID, i tried this code and it says Instance of 'Client' has no 'get_user_info' member pylint(no-member)

here's the code, i put this code on @client.event so it triggers when i say something to the BOT

    if message.content.lower() == 'dm':
        user = await client.get_user_info(user_id="USER'S ID")
        await client.send_message(user, "Your message")

I need help for this!

Upvotes: 1

Views: 941

Answers (2)

Linkachus 17
Linkachus 17

Reputation: 33

Thank you so much!, this code works for me

if message.content.lower() == 'dm':
     user = await client.fetch_user(ID goes here)
     await user.send("Your message here")

Upvotes: 0

Abdulaziz
Abdulaziz

Reputation: 3426

Inside your on_message

    if message.content.lower() == 'dm':
        user = await client.fetch_user(message.author.id) #you can also just type the id
        await user.send("Your message")

Upvotes: 1

Related Questions