示例#1
0
文件: __init__.py 项目: zubchick/ybot
def help(name, value):
    if '/help' in value.text.lower():
        text = u'You can control me by sending these commands:\n\n%s'
        cmds = []
        for name, description in sorted(__commands.items()):
            cmds.append('%s - %s' % (name, description))

        bot.sendMessage(chat_id=value.chat_id, text=text % '\n'.join(cmds))
示例#2
0
文件: github.py 项目: zubchick/ybot
def notify_about_new_pr(name, pr):
    text = 'Github. %s new pull request %s:\n%s (by %s)' % (
        pr['base']['repo']['full_name'],
        pr['html_url'],
        pr['title'],
        pr['user']['login'],
    )

    for chat_id in pr.get('chat_ids', []):
        bot.sendMessage(chat_id, text=text)
示例#3
0
文件: dialog.py 项目: l0kix2/ybot
def _reply(chat_id, text, force_reply):
    if force_reply:
        kwargs = {'reply_markup': telegram.ForceReply()}
    else:
        kwargs = {}

    return bot.sendMessage(chat_id=chat_id, text=text, **kwargs)
示例#4
0
文件: ping.py 项目: zubchick/ybot
def pong(event_name, value):
    if value.text and value.text.startswith('/ping'):
        bot.sendMessage(chat_id=value.chat_id, text='pong')