A pycord extension that allows splitting command groups into multiple cogs
Project description
pycord-multicog
A pycord extension that allows splitting command groups into multiple cogs.
Installation
$ pip install pycord-multicog
Usage
Creating cogs
# 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 a command used with add_to_group
from pycord.multicog import add_to_group
class Cog2(Cog):
@add_to_group("group") # the decorator that does the magic
@slash_command()
async def subcommand2(self, ctx):
await ctx.respond("This subcommand is inside a different cog.")
Applying multicog using apply_multicog
from pycord.multicog import apply_multicog
my_bot.add_cog(Cog1())
my_bot.add_cog(Cog2())
...
apply_multicog(my_bot) # manually apply multicog after cogs are loaded
Applying multicog using Bot subclass
from pycord.multicog import Bot
my_bot = Bot() # will automatically apply multicog when commands are being synchronised
Note that the cog
attribute of the modified command (subcommand2
in the example) will be set to the cog of the slash command group (Cog1
instead of Cog2
).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycord-multicog-1.0.1.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for pycord_multicog-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e905e5e445b952f97218900f741fc1bdcbbd6a53bb84cdef7379fa88700a260 |
|
MD5 | b6b51be24f2ce232336b7d609f8090fd |
|
BLAKE2b-256 | 73ed37d91c690080b7669e5c989c6e3ea345ff59883f57548eaf7433646b80ce |