Skip to main content

The library for developing systems for messengers and social networks

Project description

Kutana

Kutana logo

Documentation Status CodeFactor Coverage Status Codebeat Badge 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

Running

From CLI

Following command will populate application's config, add specified backends and load plugins from specified folder.

python3 -m kutana --config example/config.yml --plugins example/plugins

# usage: python3 -m kutana [-h] [--config CONFIG] [--plugins PLUGINS] [--debug]

# Run kutana application instance using provided config.

# optional arguments:
#   -h, --help         show this help message and exit
#   --config CONFIG    file with config in yaml format (default: config.yml
#   --plugins PLUGINS  folder with plugins to load (default: plugins)
#   --debug            set logging level to debug

Refer to the example config.yml for the configuration details.

From python

import json
from kutana import Kutana, load_plugins
from kutana.backends import Vkontakte

# Import configuration
with open("config.json") as fh:
    config = json.load(fh)

# Create application
app = Kutana()

# Add manager to application
app.add_backend(Vkontakte(token=config["vk_token"]))

# Load and register plugins
app.add_plugins(load_plugins("plugins/"))

if __name__ == "__main__":
    # Run application
    app.run()

Token for Vkontakte is loaded from the file "config.json" and plugins are loaded from folder "plugins/"

Example plugin (plugins/echo.py)

from kutana import Plugin, t

plugin = Plugin(name=t("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. Use __ if you use something like pydash.

Available backends

Authors

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-5.2.0.tar.gz (30.2 kB view details)

Uploaded Source

Built Distributions

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

kutana-5.2.0-py3.10.egg (95.4 kB view details)

Uploaded Egg

kutana-5.2.0-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kutana-5.2.0.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for kutana-5.2.0.tar.gz
Algorithm Hash digest
SHA256 cfebc7faff5b54a7f993b52cde556be19d5ab356562ee4428ae5b19c2cf022c0
MD5 bcfc3b38bfbd448edee12a769100ad6a
BLAKE2b-256 0c5899b315005650f01a1ee29425bba4679e58d61f98cebaf659cc7f22020651

See more details on using hashes here.

File details

Details for the file kutana-5.2.0-py3.10.egg.

File metadata

  • Download URL: kutana-5.2.0-py3.10.egg
  • Upload date:
  • Size: 95.4 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for kutana-5.2.0-py3.10.egg
Algorithm Hash digest
SHA256 3f9a3268c8528397e6fb70f91b309903a891d8487b31de78df6bf91b78156ae6
MD5 d702ded4a33ae5a62f1f4fc5913403c0
BLAKE2b-256 61d48ccc7ef0f5b0a85a298ed131f8c0c7afa94393089378d3316f9591f706a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kutana-5.2.0-py3-none-any.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for kutana-5.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e8bcb5f2757787324314a1d7dc04c30648047fbc6d10643f1855c08cfe07660
MD5 174d7771e929db8b7663e9272b4fb575
BLAKE2b-256 2847ddf4e4a5b7d3a500aaa34c655f7003b275662fadc886f5ede3c70392ea18

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