https://github.com/allanchain/command4bot
A general purpose library for command-based iteraction made for bots
https://github.com/allanchain/command4bot
bot command
Last synced: 12 months ago
JSON representation
A general purpose library for command-based iteraction made for bots
- Host: GitHub
- URL: https://github.com/allanchain/command4bot
- Owner: AllanChain
- Created: 2020-10-29T01:37:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-24T13:12:44.000Z (over 4 years ago)
- Last Synced: 2025-03-06T19:44:31.611Z (over 1 year ago)
- Topics: bot, command
- Language: Python
- Homepage: https://command4bot.readthedocs.io/en/latest/
- Size: 423 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Command For Bot




[](https://codecov.io/gh/AllanChain/command4bot)




[](https://github.com/pre-commit/pre-commit)
[](https://github.com/psf/black)
[](https://pycqa.github.io/isort/)
`command4bot` is a general purpose library for command-based iteraction made for bots.
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Features](#features)
- [Documentation](#documentation)
- [Todo](#todo)
## Installation
```shell
pip install command4bot
```
## Quick Start
```python
from command4bot import CommandsManager
mgr = CommandsManager()
@mgr.command
def greet(payload):
return f"Hello, {payload}!"
mgr.exec('greet John') # 'Hello, John!'
```
## Features
- Register command with a simple decorator
- Managing command open and closed status with ease
- Automatically manage command's dependency (a.k.a. `context`) with its status
- Fallback handlers if no command found
## Documentation
:warning: The documentation is still working in progress!
## Todo
- [ ] Support for commands need interaction