Exemple #1
0
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))
Exemple #2
0
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)
Exemple #3
0
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)
Exemple #4
0
def pong(event_name, value):
    if value.text and value.text.startswith('/ping'):
        bot.sendMessage(chat_id=value.chat_id, text='pong')