Skip to main content

The library for developing systems for messengers and social networks

Project description

Kutana

Kutana logo

PyPI version

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

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

kutana-6.0.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kutana-6.0.0-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file kutana-6.0.0.tar.gz.

File metadata

  • Download URL: kutana-6.0.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1018-azure

File hashes

Hashes for kutana-6.0.0.tar.gz
Algorithm Hash digest
SHA256 a4ed8d0d56ad183f29d335623b3ddc6603c9a372d14df0a44406e6a8d8276605
MD5 8f20d2ed0156e4852013d70bf4deb4ba
BLAKE2b-256 0ed62043ee1f169ba1c70e715a0883dcbf724b0a5419656b2372728fd740b224

See more details on using hashes here.

File details

Details for the file kutana-6.0.0-py3-none-any.whl.

File metadata

  • Download URL: kutana-6.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1018-azure

File hashes

Hashes for kutana-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8d327214a436ae8427dbf193c8e3f463a2e48b9ee7da10b6ec5e196145398e7
MD5 f3aabbc048e1142bb370d7a625c52f37
BLAKE2b-256 47898f0b53c6e49d7ef1cb7d4c8b9083a401f2544615ee4d4abef1af42861411

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page