Lukemul69
Lukemul69

Reputation: 187

I can not figure out how to have the bot DM a user that I tag

I want to send a user a reminder in DM that their subscription is due for renewal in 3 days. At the moment it sends in the channel but not everyone sees it so I want it to DM them. I want the command to be like this

!subreminder 10 @user

here is my current code that sends to the channel but does not DM

@client.command()
async def subreminder(ctx, arg1):
    amt = arg1
    # Discord Embed Setup   
    embed = Embed(
        description="This is a reminder that your subscription payment of **$"+amt+"** is due in 3 days. If you wish to cancel please let one of the owners know.",
        color=DiscordEmbedColor,
        timestamp='now'  # sets the timestamp to current time
        )

    embed.set_title(title="**Subscription Reminder**", url=Link)


    embed.set_footer(text=DiscordFooterText, icon_url=DiscordFooterIcon)


    await ctx.message.delete()
    await ctx.send(embed=embed)

Upvotes: 0

Views: 54

Answers (1)

stijndcl
stijndcl

Reputation: 5651

here is my current code that sends to the channel but does not DM

Well yes, because you're using ctx.send(). In order to DM a user, you can just use user.send(). Getting the discord.User instance can be achieved with a converter.

async def subreminder(ctx, amt, user: discord.User):
    # code that creates the embed
    await user.send(embed=embed)

Upvotes: 1

Related Questions