【发布时间】:2020-10-20 17:32:03
【问题描述】:
@bot.event
async def on_message(message):
wordfilter = ['badword', 'anotherone', 'and the last one']
if wordfilter in message.content:
await message.delete()
错误:
Traceback (most recent call last):
File "C:path/client.py", line 333, in _run_event
await coro(*args, **kwargs)
File "C:path/combot.py", line 34, in on_message
if wordfilter in message.content:
TypeError: 'in <string>' requires string as left operand, not list
我想要一个单词过滤器,里面有很多单词,所以我希望有一个列表,我可以在其中添加我所有的单词(稍后甚至使用来自 Discord 的命令)。 但我真的不知道如何让它工作。
【问题讨论】:
标签: python discord discord.py