【问题标题】:Discord Python - bot.wait_for_message in a Private Channel (DM)Discord Python - 私人频道 (DM) 中的 bot.wait_for_message
【发布时间】:2019-03-25 15:22:38
【问题描述】:

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

【问题讨论】:

  • wait_for_message 对私人频道没有任何区别对待。你到底遇到了什么问题?

标签: python python-3.x discord discord.py


【解决方案1】:

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

如果您收到来自私人频道的命令,您可以正常等待该频道

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

【讨论】:

  • 错字。应该是==
猜你喜欢
  • 2020-02-05
  • 2018-07-27
  • 2020-05-22
  • 1970-01-01
  • 1970-01-01
  • 2020-10-18
  • 2019-12-11
  • 2019-02-19
  • 1970-01-01
相关资源
最近更新 更多