我正在为我为朋友服务器制作的机器人制作一个错误的单词过滤器,但是列表区分大小写。我该如何解决?
@client.event async def on_message(message): author = message.author content = message.content channel = message.channel log = client.get_channel(log channel) bad_words=["bad","word","yellow"] if any(bad_word in content for bad_word in bad_words): embed = discord.Embed(title="Bad word detected!", color=discord.Color.red()) embed.add_field(name=f"{author.display_name}, you have said a forbidden word!", value="You have been sent to Jail!") embed2 = discord.Embed(title=f"Bad word sent by {author} in #{channel}.", color=discord.Color.red()) embed2.add_field(name="They said:", value=f"{author.display_name}: {content}") await message.delete() await author.add_roles(discord.utils.get(author.guild.roles, name="jail")) await channel.send(embed=embed) await log.send(embed=embed2) await client.process_commands(message)
答案 0 :(得分:0)
在检查内容之前将其小写
FT = HTnD((Tuple of x,y,z etc.),f(x,y,z), (Tuple of lx,ly,lz etc.))