#Use Subgroups inside of a cog
1 messages · Page 1 of 1 (latest)
bruh
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 😄
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))
i believe you're looking for multicog, but that's about all i can say, i have no idea what multicog really is
Hmm alright thank you!
I've never seen this tho, what is it for?
To add the group. Otherwise it wont show up in the commands
i dont have that lol
Are you using discord.SlashCommandGroup too?
hmm okay...