Из за команды antiinvite перестал работать весь код

Из за команды бота которая будет удалять приглашения на сервера только если человек отправивший сообщение не создатель сервера перестал работать бот Вот мой код:

antiinvite = False
@bot.event
async def on_message(message):
        if "discord.gg" in message.content.lower():
            if message.author == discord.Guild.owner:
                pass
            else:
                if antiinvite == True:
                    await message.delete()
                    await message.channel.send("No invites allowed!")


@bot.command()
async def antiinvite(ctx):
    global antiinvite
    if antiinvite == True:
        antiinvite = False
        await ctx.send('Anti invite has been Enabled.')
        await ctx.message.add_reaction('✅')
    else:
        antiinvite = True
        await ctx.send('Anti invite has been Disabled.')
        await ctx.message.add_reaction('✅')

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