如何阻止列表成员消息

时间:2020-05-22 20:21:50

标签: 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:
...

1 个答案:

答案 0 :(得分:0)

您应该更换 for message.author in Muted_members:if message.author in Muted_members: 检查作者是否在列表中,然后执行删除操作,而不像现在一样对所有静音成员执行一次删除代码。