0
votes

I want to send a private message to a specific user with my discord bot. I am using discord==1.0.1 discord.py==1.3.1. I already tried using the docs (https://discordpy.readthedocs.io/en/latest/api.html?highlight=private%20message#discord.DMChannel) but i dont understand that. I tried following code, which didnt worked:

@client.command()
async def cmds(ctx):
    embed = discord.Embed(title='Discord Server Befehle',
                          description='Description',
                          color=0x374883)

    [...]

    msg = await ctx.send(embed=embed)
    await ctx.author.create_dm('Hi')
    print(f'{command_prefix}help ausgeführt von {ctx.author}')
1

1 Answers

1
votes

Try using the send function instead of the create_dm. create_dm only creates the channel between two users which discord does automatically as far as i know.

according to documentation

This should be rarely called, as this is done transparently for most people.

so it should be

ctx.author.send('Hi')