Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.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 Rewrite - Fatal编程技术网

Python 如何在列表中阻止成员消息

Python 如何在列表中阻止成员消息,python,python-3.x,discord,discord.py-rewrite,Python,Python 3.x,Discord,Discord.py Rewrite,我想创建一个静音成员列表并删除他们写的每封邮件,但我做了一些错误的事情,因为该命令适用于所有成员: Muted_members = ["muted member id"] @bot.event async def on_message(message): for message.author in Muted_members: ... 你应该替换 对于禁用成员中的message.author: 具有 if message.author在静音成员中: 检查作者是否在列表中,然后执行删除操作,而

我想创建一个静音成员列表并删除他们写的每封邮件,但我做了一些错误的事情,因为该命令适用于所有成员:

Muted_members = ["muted member id"]

@bot.event
async def on_message(message):
for message.author in Muted_members:
...
你应该替换
对于禁用成员中的message.author:
具有
if message.author在静音成员中:

检查作者是否在列表中,然后执行删除操作,而不是像您当前所做的那样对所有静音成员执行一次删除代码。

IndentationError
-并且不完整。请修改一下,也许读一遍,还有第一个链接。