Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Discord.python message.content_Python_Discord.py - Fatal编程技术网

Discord.python message.content

Discord.python message.content,python,discord.py,Python,Discord.py,我正在制作一个rpgbot,在创建一个新角色时,它应该通过DMs问一些问题,但我遇到了一个问题。 当我使用message.content获取信息时,bot从服务器而不是DMs读取消息。有人能帮忙吗?使用 if not message.guild: <do stuff> 如果不是message.guild: 若要忽略公会中的消息,请忽略公会中的消息。公会只需确保它不会从服务器读取消息,但不会使bot从DMs读取消息。若您在邮件上使用,则它应接收所有消息,包括DMs,请将您的

我正在制作一个rpgbot,在创建一个新角色时,它应该通过DMs问一些问题,但我遇到了一个问题。 当我使用
message.content
获取信息时,bot从服务器而不是DMs读取消息。有人能帮忙吗?

使用

if not message.guild:
    <do stuff>
如果不是message.guild:

若要忽略公会中的消息,请忽略公会中的消息。公会只需确保它不会从服务器读取消息,但不会使bot从DMs读取消息。若您在邮件上使用
,则它应接收所有消息,包括DMs,请将您的代码添加到您的帖子中。