a standalone library to bring discord.py developer experience to your python applications, focus on building your logic rather then an event manager or command manager
Project description
commandkit
a standalone library to bring discord.py developer experience to your python applications, focus on building your logic rather then an event manager or command manager
Features
- Familiar Decorator API – Leverages the intuitive
discord.pypattern for registering commands and events. - Automatic Type Conversion – Uses Python type hints to automatically convert input strings into integers, floats, or custom objects.
- Asynchronous by Design – Built from the ground up for
asyncio, allowing command and event handlers to run concurrently within your existing event loop. - Zero Bloat – A focused codebase with zero dependencies.
Installation
been tested in python 3.10
Run the following to install:
pip install commandkit
or
python -m pip install commandkit
if that didn't work, try replacing pip with pip3.
need help? or have bugs to report, let me know in here
Quick Examples
import asyncio
from commandkit import CommandLine, Greedy
cmder = CommandLine(prefix="!")
@cmder.command()
def add(a: int, b: int):
"""Adds two numbers."""
return a + b
@cmder.command()
async def announce(title: str, *, message: str):
"""Capture the rest of the string as a single argument."""
await asyncio.sleep(0.1)
return f"[{title}] {message}"
async def main():
# Sync command call
res = await cmder.process_command("!add 10 20")
print(res) # 30
# Rest capture
res = await cmder.process_command('!announce "System Alert" This is a test message.')
print(res) # [System Alert] This is a test message.
if __name__ == "__main__":
asyncio.run(main())
Event Management
CommandKit includes a standalone EventManager for dispatching async events.
from commandkit import EventManager
import asyncio
em = EventManager()
@em.event
async def on_message(arg):
print(f"Event received: {arg}")
async def run_events():
# dispatch("test") will trigger all "on_message" events
await em.dispatch("message", "Hello World!")
asyncio.run(run_events())
Documentation
you can check commandkit docs here
Contributing
We value technical contributions and bug reports.
- Issues: Open a ticket for bugs or feature requests.
- PRs: Pull requests are welcome. Please ensure code follows PEP 8 standards.
License
CommandKit is distributed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commandkit-0.3.1.tar.gz.
File metadata
- Download URL: commandkit-0.3.1.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86bf780692e6d8de87172bd847469581c78d345d0ad76074d95dc094bf469bd0
|
|
| MD5 |
092f4e5a98b42f45ceecee4ae01ca261
|
|
| BLAKE2b-256 |
b57447b6d8e75b996dbecd4787f2f8daa2054dae0c8facb24bee29156bee89ce
|
File details
Details for the file commandkit-0.3.1-py3-none-any.whl.
File metadata
- Download URL: commandkit-0.3.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
731d802b298aa6913a723a8c233dd185158c954b2870913ba58a4aeab2ee54ad
|
|
| MD5 |
e71016325545f5bcc997d4ad435886ce
|
|
| BLAKE2b-256 |
09e95f6e15abbbb3949ac7c4acf9b9246574fde74dc86ab4169a044bf99b44ee
|