Python @client.event似乎会使整个bot崩溃,除了它本身

Python @client.event似乎会使整个bot崩溃,除了它本身,python,Python,添加第二个@client.event后,除了此事件之外,bot中似乎没有任何其他功能了? 一般来说,我对python中的discord Bot不太熟悉。我不能说是什么破坏了你的代码,因为我想知道更多的信息,比如你尝试运行终端时在终端上显示的内容,但我可以说有一种更好的方法来过滤坏词:用message=message.lower()将消息小写,然后,您可以只存储脏话=['foo',bar',…],而不必担心大小写,同时使过滤器更快/使用更少的内存。 from discord.ext import

添加第二个@client.event后,除了此事件之外,bot中似乎没有任何其他功能了?
一般来说,我对python中的discord Bot不太熟悉。

我不能说是什么破坏了你的代码,因为我想知道更多的信息,比如你尝试运行终端时在终端上显示的内容,但我可以说有一种更好的方法来过滤坏词:用
message=message.lower()将消息小写,然后,您可以只存储
脏话=['foo',bar',…]
,而不必担心大小写,同时使过滤器更快/使用更少的内存。
from discord.ext import commands
import discord
import itertools
import random
from discord.ext.commands import Bot

client = commands.Bot(command_prefix = '*')

swear1 = list(map(''.join, itertools.product(*((c.upper(), c.lower()) for c in '*****'))))
swear2 = list(map(''.join, itertools.product(*((c.upper(), c.lower()) for c in '*****'))))
swear3 = list(map(''.join, itertools.product(*((c.upper(), c.lower()) for c in '*****'))))
swear = list(map(''.join, itertools.product(*((c.upper(), c.lower()) for c in '*****'))))
swear4 = list(map(''.join, itertools.product(*((c.upper(), c.lower()) for c in '****'))))
joinedswear = swear + swear1 + swear2 + swear3 + swear4
@client.event
async def on_ready():
    print('done!')


@client.command()
async def greet(ctx):
    await ctx.send('Hello')


@client.event
async def on_message(message):
    for i in joinedswear:
        if i in message.content:
            await message.delete()
            await message.channel.send('No Swearing!')

client.run('token')