Discord.py Translate message contents from Channel to Specific User ID's DMS

Question:

I am working on a Discord Bot that if the Prefix (In this case, $) is called, the entire following message is sent to a User’s Direct Messages.
(user id removed for security)

async def on_message(message):
 if message.content.startswith('$ '):
      CONTENT = message.content
      async def sendDm():
         user = await client.fetch_user("USERID")
         await user.send(CONTENT)

However, upon doing this, The bot is unresponsive. I would like to know why this is happening, and what is wrong with my code.

Asked By: KniteRite

||

Answers:

I got assistance from the Discord.py Discord.

@client.event
async def on_message(message):
    if message.content and message.content.startswith("$") and not message.author.bot:
        user = await client.fetch_user(user_id)
        await user.send(message.content)
Answered By: KniteRite
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.