Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.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
Python 不和谐机器人没有反应_Python_Python 3.x_Discord_Discord.py - Fatal编程技术网

Python 不和谐机器人没有反应

Python 不和谐机器人没有反应,python,python-3.x,discord,discord.py,Python,Python 3.x,Discord,Discord.py,这是我第一次做一个不和谐机器人。我已经遵循了教程的每一步,但是我的机器人没有对错误做出反应!测试命令。我确实在discord服务器中看到了bot。请帮忙 首先,在第15行,if(message.content.startswith(!test):的if语句位于返回后。bot将永远无法到达这些行。您必须将缩进向后移动(python中的缩进很烦人) 其次,wait client.process_commands(message)仅适用于命令客户端,而不适用于基本discord.client()。客户

这是我第一次做一个不和谐机器人。我已经遵循了教程的每一步,但是我的机器人没有对错误做出反应!测试命令。我确实在discord服务器中看到了bot。请帮忙


首先,在第15行,if(message.content.startswith(!test):的if语句位于返回后。bot将永远无法到达这些行。您必须将缩进向后移动(python中的缩进很烦人)

其次,
wait client.process_commands(message)
仅适用于命令客户端,而不适用于基本discord.client()。客户端必须类似于

from discord.ext import commands
client = commands.Bot(command_prefix="!")
有关discord.Client()和commands.Bot()之间的区别,请参阅。

是一个很好的指南,介绍了如何提出一个好的问题,特别是如何显示代码、数据和出错的地方。
from discord.ext import commands
client = commands.Bot(command_prefix="!")