Skip to content

Dorukyum/pycord-multicog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pycord-multicog

Downloads Discord

A pycord extension that allows splitting command groups into multiple cogs.

Installation

Requires pycord v2.5 or higher.

$ pip install pycord-multicog

Usage

Initialising bot

from pycord.multicog import Bot

bot = Bot(...)

Creating commands

# cog number 1, a normal cog with a slash command group
class Cog1(Cog):
    group = SlashCommandGroup("group")

    @group.command()
    async def subcommand1(self, ctx):
        await ctx.respond("This is a normal subcommand.")


# cog number 2, has commands decorated with @subcommand
from pycord.multicog import subcommand

class Cog2(Cog):
    @subcommand("group")  # this subcommand depends on the group defined in Cog1
    @slash_command()
    async def subcommand2(self, ctx):
        await ctx.respond("This subcommand is inside a different cog.")

    @subcommand("group", independent=True)  # this subcommand is independent
    @slash_command()
    async def subcommand2(self, ctx):
        await ctx.respond("This subcommand is also inside a different cog.")