Пример #1
0
class KutanaTest(unittest.TestCase):
    def setUp(self):
        self.kutana = None
        self.target = []

    @contextmanager
    def debug_controller(self, queue):
        if self.kutana is None:
            self.kutana = Kutana()

        self.controller = DebugController(*queue)

        self.kutana.add_controller(self.controller)

        self.plugin = Plugin()

        self.plugins = [self.plugin]

        try:
            yield self.plugin
        finally:
            for plugin in self.plugins:
                self.kutana.executor.register_plugins(plugin)

            self.kutana.run()

        self.assertEqual(self.target, self.controller.replies)
Пример #2
0
from kutana import Kutana, VKController, load_plugins, load_configuration


# Create engine
kutana = Kutana()

# Create VKController
kutana.add_controller(
    VKController(token = "d6842a32a19fefc24f1ac19b17cba1c9243f4bf1ecdf426215d193d96135a111d0d537f6e2df8f1452482")
)

# Load and register plugins
kutana.executor.register_plugins(*load_plugins("/root/bot/example/"))

# Run engine
kutana.run()
Пример #3
0
from kutana import Kutana, VKController, load_plugins, load_configuration

# Create engine
kutana = Kutana()

# Create VKController
kutana.add_controller(VKController(token="Сюда напиши свой токен API"))

# Load and register plugins
kutana.executor.register_plugins(*load_plugins("/root/bot/example/plugins"))

# Run engine
kutana.run()
Пример #4
0
from kutana import Kutana, VKController, load_plugins, \
    load_configuration

# Create engine
kutana = Kutana()

# Create VKController
controller = VKController(load_configuration("vk_token", "configuration.json"))

# Add controller to engine
kutana.add_controller(controller)

# Load and register plugins
kutana.executor.register_plugins(*load_plugins("example/plugins/"))

# Run engine
kutana.run()