Ejemplo n.º 1
0
def create_dialog(config):
    add_command(config['command'], config['description'])
    entry = config['entrypoint']
    entry.command = config['command']

    disp_conf = {'': entry}

    for handler in config['handlers']:
        disp_conf[_fname(handler)] = handler

    disp = get_dialog_dispatcher(disp_conf)

    subscibe('ybot.telegram.message', disp, _run=False)
Ejemplo n.º 2
0
Archivo: ping.py Proyecto: l0kix2/ybot
# coding: utf-8

from ybot.events import listener
from ybot.modules.commands import add_command
from ..telegram import bot


@listener('ybot.telegram.command')
def pong(event_name, value):
    if value.text and value.text.startswith('/ping'):
        bot.sendMessage(chat_id=value.chat_id, text='pong')

add_command('/ping', 'Checks that bot is still here')