Discord Python - bot.wait_for_message in a Private Channel (DM)

Viewed 2459

Do anyone know how to use the bot.wait_for_message in a private channel (DM) ?

1 Answers

Assuming that you only want to accept direct private messages (not group private messages) from a specific user, you can write a check that checks message.channel.type

def check(message):
    return message.channel.type == discord.ChannelType.private

await bot.wait_for_message(timeout = 30, author = ctx.message.author, check=check, content="SSM")

If you received the command from a private channel, you can wait for that channel normally

await bot.wait_for_message(timeout = 30, author = ctx.message.author, channel=ctx.message.channel, content="SSM"
Related