Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dorukyum/pycord-multicog
Pycord extension for splitting command groups into multiple cogs
https://github.com/dorukyum/pycord-multicog
discord pycord
Last synced: 2 months ago
JSON representation
Pycord extension for splitting command groups into multiple cogs
- Host: GitHub
- URL: https://github.com/dorukyum/pycord-multicog
- Owner: Dorukyum
- License: mit
- Created: 2022-09-02T11:46:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-18T04:34:58.000Z (8 months ago)
- Last Synced: 2024-10-31T21:51:40.296Z (3 months ago)
- Topics: discord, pycord
- Language: Python
- Homepage: https://discord.gg/8JsMVhBP4W
- Size: 24.4 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# pycord-multicog
[![Downloads](https://img.shields.io/pypi/dm/pycord-multicog?logo=pypi&logoColor=white)](https://pypi.org/project/pycord-multicog/)
[![Discord](https://img.shields.io/discord/789829818547175446?label=discord&logo=discord&color=5865F2&logoColor=white)](https://discord.com/invite/8JsMVhBP4W)A pycord extension that allows splitting command groups into multiple cogs.
## Installation
Requires pycord v2.5 or higher.```sh
$ pip install pycord-multicog
```## Usage
### Initialising bot
```py
from pycord.multicog import Botbot = Bot(...)
```### Creating commands
```py
# 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 subcommandclass 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.")
```