Slash commands in cog aren't visible on discord pycord

75 views Asked by At

I have a moderation cog, it is loaded correctly but the slash commands aren't visible, while every listener on the cog works

Here is a command I wrote in moderation cog:

class Moderation(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    servers = ["My serv Id here"]

    @commands.slash_command(name="clear", guild_ids=servers)
    @default_permissions(manage_messages=True)
    async def clear_cmd(self, ctx, number: discord.Option(discord.SlashCommandOptionType.integer, required=True)):
        await ctx.channel.purge(limit=number)

I don't see this command when i type "/" on discord, I only see the ones i wrote in the main.py file, the load function is correctly called and when i tried to add a Cog.listener on_message in the moderation cog, it was working. Also, the on_ready listener doesn't work in the cog.

0

There are 0 answers