#Use Subgroups inside of a cog

1 messages · Page 1 of 1 (latest)

rose cloakBOT
dense ferry
#

bruh

rocky hornet
#

bruh

#

so stupid

#

okay let me re-send it

#

I am trying to use a subgroup in a file, but the subgroup got declared in a different file. Unfortunatly it doesnt work, only the test command gets synced. Does anyone know a solution 😄

bot.py

import discord, os

client = discord.Bot(intents=discord.Intents.all(), debug_guilds=[1225048869101109350])

welcomeGroup = discord.SlashCommandGroup(name="welcome", description="All welcome commands")
setupWelcomeGroup = welcomeGroup.create_subgroup(name="setup", description="All welcome setup commands")


for file in os.listdir("cogs"):
    if file.endswith(".py"):
        client.load_extension("cogs." + file[:-3])

@client.event
async def on_ready():
    await client.change_presence(activity=discord.Game(name="with Apfeltroll"))
    await client.sync_commands(guild_ids=[1225048869101109350])
    print("Synced and Online!")

@setupWelcomeGroup.command(name="test", description="Test!")
async def welcometest(ctx: discord.ApplicationContext):
    await ctx.respond("hi!")


client.add_application_command(welcomeGroup)

if __name__ == "__main__":
    client.run("TOKEN")

cogs/welcome.py

import discord
from discord.ext import commands

from bot import welcomeGroup, setupWelcomeGroup

class Welcome(commands.Cog):
    def __init__(self, client):
        self.client = client

    @setupWelcomeGroup.command(name="start", description="Start the Welcome System Setup Wizard!")
    async def start(self, ctx: discord.ApplicationContext):
        await ctx.respond("hi")

def setup(client):
    client.add_cog(Welcome(client=client))
dense ferry
#

i believe you're looking for multicog, but that's about all i can say, i have no idea what multicog really is

rocky hornet
#

Hmm alright thank you!

dense ferry
#

I've never seen this tho, what is it for?

rocky hornet
#

To add the group. Otherwise it wont show up in the commands

dense ferry
#

i dont have that lol

rocky hornet
#

Are you using discord.SlashCommandGroup too?

dense ferry
#

yes

#

wait dumb screenshot

rocky hornet
#

hmm okay...