Не работает @client.event

class muteForBadWords(commands.Cog, name='bad words'):
    def __init__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_message(self, message):
        guild = message.guild
        if message.content.startswith('BadWord'):
            await message.channel.send(f'%s, ou, you said bad word. I have to mute you for 1 hour.')
            mutedRole = discord.utils.get(guild.roles, name='Muted')
            await message.author.add_role(mutedRole)
            await asyncio.sleep(3600)
            await message.author.remove_roles(mutedRole)

Выше написанный код должен давать мут тем людям, которые написали какое-то плохое слово(В нашем случи это BadWord), но бот отказывается давать эту роль и выдает ошибку... Что я тут не так написал? Буду благодарен за помощь.


Ответы (0 шт):