@client.event
async def on_message(message):
if message.content == "help me":
user = client.get(My_id)
if user is not None:
await user.send("Someone needs help")
Is there any way to make bot dm me when someone sends a specific text like they type help me in channel and I get dm that "Hi someone needs help" I tried the code above but didnt work it shows user = client.get(My_id) AttributeError: 'Bot' object has no attribute 'get' please give the answer in python and Thanks in advance for the answer and I I'm making the bot for discord
try it:
@client.event
async def on_message(message):
if message.content == "help me":
user = await client.fetch_user(12345678909876543) # id goes here
if user is not None: # if id is correct
if user.dm_channel is None:
# if DM channel is not created
await user.create_dm()
await user.dm_channel.send("Someone needs help")