Search code examples
pythonpycord

How does the discord.SlashCommandGroup work?


I'm trying out the SlashCommandGropus right now. However, I don't understand how exactly these work. After reading the Docs and reading some Tutorials, I came up with the following solution

import discord
from discord.ext import commands
from discord.commands import Option, slash_command, SlashCommandGroup

class testcog(commands.Cog):

    test = discord.SlashCommandGroup(name = "test", description = "for testing", guild_ids = [907216584341348373])

    def __init__(self, client):
        self.client = client

    @test.subgroup(description='This is one Testing command!')
    async def testcmd1(self, ctx):
        await ctx.respond("✅")

def setup(client):
    client.add_cog(testcog(client))

But when I run the code I get the following Error: TypeError: testcmd1() got an unexpected keyword argument 'guild_ids'

after watching some tutorials, I tried changing the @test.subgroup(description='This is one Testing command!') to @test.command(description='This is one Testing command!') even though its not mentioned in the docs. I even got another Error: TypeError: discord.commands.core.SlashCommandGroup() got multiple values for keywort argument 'name'

I have absolutly no Idea what I made wrong and how I can Fix this. I would be verry gratefull if anyone can help me.

I'm using Pycord Version 2.0.5b


Solution

  • Ok test = SlashCommandGroup("test", "This is just for testing") Works.