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 FOSSA Status

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

Usage

  • Create Kutana application and add managers.
  • Register your plugins in the executor. You can import plugin from folders with function load_plugins. Files should be a valid python modules with available plugin field with your plugin (Plugin) or field plugins with list of instances of Plugin class.
  • Start the application.

Example run.py

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

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()

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

Authors

License

FOSSA Status

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-4.0.0.tar.gz (18.1 kB view hashes)

Uploaded Source

Built Distributions

kutana-4.0.0-py3.7.egg (56.4 kB view hashes)

Uploaded Source

kutana-4.0.0-py3-none-any.whl (24.2 kB view hashes)

Uploaded Python 3

Supported by

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