The library for developing systems for messengers and social networks
Project description
Kutana
The library for developing systems for messengers and social networks. Great for developing bots. Refer to example for the showcase of the library abilities.
This library uses generalized attachment types, possible actions e.t.c. for flexibility to use plugins with different backends.
Installation
python -m pip install kutana
Documentation
You can read the extended description of the library in the docs/index.md file. At the moment, the documentation is not in the best condition. If you would like to contribute to its writing, welcome to the issues.
Running
From CLI
Following command will populate application's config, add specified backends and load plugins from specified folder.
python3 -m kutana run example/config.yml
# usage: kutana [-h] {init,run} ...
#
# helpfull cli utility
#
# positional arguments:
# {init,run}
# init initiate kutana project
# run run kutana project using provided config (working directory will be changed to the one with config file)
#
# optional arguments:
# -h, --help show this help message and exit
Refer to the example config.yml for the configuration details.
From code
from kutana import Kutana
from kutana.backends import VkontakteLongpoll
from kutana.loaders import load_plugins_from_path
# Create application
app = Kutana()
# Add manager to application
app.add_backend(VkontakteLongpoll(token="VK-GROUP-TOKEN"))
# Load and register plugins
for plugin in load_plugins_from_path("example/plugins/"):
app.add_plugin(plugin)
if __name__ == "__main__":
# Run application
app.run()
Example plugin (plugins/echo.py)
from kutana import Plugin
plugin = Plugin(name="Echo")
@plugin.on_commands(["echo"])
async def _(msg, ctx):
await ctx.reply(ctx.body, attachments=msg.attachments)
If your function exists only to be decorated, you can use
_to avoid unnecessary names.
Available backends
- Vkontakte (for vk.com groups)
- Telegram (for telegram.org bots)
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 kutana-6.0.1.tar.gz.
File metadata
- Download URL: kutana-6.0.1.tar.gz
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85322124b585c5cfe39a3c2c6c660a367a3d5cb4b6335a3745864eb2d7e38717
|
|
| MD5 |
3afbe683b7ad31b1f99e6806c6625e06
|
|
| BLAKE2b-256 |
b44b6accde4f5bba61aaead1e8b81d0b101d95095946ac6fdc28c1c43444940f
|
File details
Details for the file kutana-6.0.1-py3-none-any.whl.
File metadata
- Download URL: kutana-6.0.1-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce734a54ef9f80200468d33a51c2407b43baba86923d1d2d512b6d0a2f4622c7
|
|
| MD5 |
fe2da7d4fe5b6afe88f9b4a3bc2828fa
|
|
| BLAKE2b-256 |
5123a4d8d97d118739ffe04b14573c75f2c101521e8cfdcf2ee9c34fed7a312f
|