Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 411
TheOneMusic Avatar asked Mar 22 '26 12:03

TheOneMusic


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"
like image 157
Patrick Haugh Avatar answered Mar 24 '26 10:03

Patrick Haugh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!