Skip to content Skip to sidebar Skip to footer

Send A Pm From Discord.py Rewrite

I'm trying to figure out how to send a pm from a discord.py rewrite bot. I can't do ctx.author.send('context') because it messaging someone other than the author of the message. he

Solution 1:

You can use a converter to resolve the User object of your victim automatically.

@bot.command()asyncdefspam(ctx, victim: discord.User, amount, *, message):
    for _ inrange(amount):
        await victim.send(message)

You can then use their name, id, or a mention to specify them:

!spamDenard1spamspamspam!spam@Denard1spamspamspam!spam1234 1spamspamspam

Post a Comment for "Send A Pm From Discord.py Rewrite"