不和Pythonbot.wait_等待消息在专用频道(DM)

2024-09-30 16:40:31 发布

您现在位置:Python中文网/ 问答频道 /正文

有人知道如何在专用频道(DM)中使用bot.wait_for_message吗?在


Tags: messageforbotdm频道专用wait
1条回答
网友
1楼 · 发布于 2024-09-30 16:40:31

假设您只想接受来自特定用户的直接私有消息(而不是组私有消息),您可以编写一个检查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")

如果从专用通道接收到命令,则可以正常等待该通道

^{pr2}$

相关问题 更多 >