Hardik Kumar Sinha
Hardik Kumar Sinha

Reputation: 37

How to get dm in discord.py

I want to know that to get the user who send dm, the idea is to stop people using the bot in dm and then ping them in #bot-lab so that they can use it there

i havn't tried anything yet, but would begreat if anyone tell me how to do

thank you

Upvotes: 0

Views: 598

Answers (1)

user9321739
user9321739

Reputation:

In discord.py you can use the isinstance(ctx.channel, discord.channel.DMChannel) to check if a message is a DM or not.

@client.command()
async def check(ctx, arg):
    if isinstance(ctx.channel, discord.channel.DMChannel):
        await ctx.send(arg)

Upvotes: 2

Related Questions