Exemple #1
0
def run(message, matches, chat_id, step):
    get_params = urlencode({'q': matches})
    return [
        Message(chat_id).set_text(
            "*Click On The Bottom Link :*\n\n👇👇👇👇👇👇👇👇\n"
            "[{}](http://lmgtfy.com/?{})".format(markdown_escape(matches),
                                                 markdown_escape(get_params)),
            disable_web_page_preview=True,
            parse_mode="Markdown")
    ]
Exemple #2
0
def inline(message, matches, chat_id, step):
    get_params = urlencode({'q': matches})
    return [
        InlineQueryResultArticle(
            id=str(uuid.uuid4()),
            title="Let Me Google That For You",
            description=matches,
            input_message_content=InputTextMessageContent(
                message_text="[{}](http://lmgtfy.com/?{})".format(
                    markdown_escape(matches), markdown_escape(get_params)),
                parse_mode="Markdown",
                disable_web_page_preview=True),
            thumb_url=
            "http://www.ultimobyte.org/wp-content/uploads/2010/08/lmgtfy.png")
    ]
Exemple #3
0
def inline(message, matches, chat_id, step):
    get_params = urlencode({'q': matches})
    return [InlineQueryResultArticle(
        id=str(uuid.uuid4()), title="Let Me Google That For You", description=matches,
        input_message_content=InputTextMessageContent(
            message_text="[{}](http://lmgtfy.com/?{})".format(markdown_escape(matches), markdown_escape(get_params)),
            parse_mode="Markdown", disable_web_page_preview=True),
        thumb_url="http://www.ultimobyte.org/wp-content/uploads/2010/08/lmgtfy.png")]
Exemple #4
0
def run(message, matches, chat_id, step):
    get_params = urlencode({'q': matches})
    return [Message(chat_id).set_text("*Click On The Bottom Link :*\n\n👇👇👇👇👇👇👇👇\n"
                                      "[{}](http://lmgtfy.com/?{})".format(markdown_escape(matches),
                                                                           markdown_escape(get_params)),
                                      disable_web_page_preview=True, parse_mode="Markdown")]
Exemple #5
0
def run(message, matches, chat_id, step):
    content_type, chat_type, chat_id = telepot.glance(message)
    if 'reply_to_message' in message:
        if 'forward_from' in message['reply_to_message']:
            response = ""
            if 'last_name' in message['reply_to_message']['forward_from']:
                response = str(text['name']).format(
                    markdown_escape(message['reply_to_message']['forward_from']
                                    ['first_name']),
                    markdown_escape(message['reply_to_message']['forward_from']
                                    ['last_name']))
            else:
                response = str(text['name']).format(
                    markdown_escape(message['reply_to_message']['forward_from']
                                    ['first_name']), "")
            response += "\n" + text['id'].format(
                message['reply_to_message']['forward_from']['id'])
            if 'username' in message['reply_to_message']['forward_from']:
                response += "\n" + text['username'].format(
                    markdown_escape(message['reply_to_message']['forward_from']
                                    ['username']))
            return [Message(chat_id).set_text(response, parse_mode="markdown")]
        else:
            response = ""
            if 'last_name' in message['reply_to_message']['from']:
                response = str(text['name']).format(
                    markdown_escape(
                        message['reply_to_message']['from']['first_name']),
                    markdown_escape(
                        message['reply_to_message']['from']['last_name']))
            else:
                response = str(text['name']).format(
                    markdown_escape(
                        message['reply_to_message']['from']['first_name']), "")
            response += "\n" + text['id'].format(
                message['reply_to_message']['from']['id'])
            if 'username' in message['reply_to_message']['from']:
                response += "\n" + text['username'].format(
                    markdown_escape(
                        message['reply_to_message']['from']['username']))
            return [Message(chat_id).set_text(response, parse_mode="markdown")]
    if chat_type == "private":
        response = ""
        if 'last_name' in message['from']:
            response = str(text['name']).format(
                markdown_escape(message['from']['first_name']),
                markdown_escape(message['from']['last_name']))
        else:
            response = str(text['name']).format(
                markdown_escape(message['from']['first_name']), "")
        response += "\n" + text['id'].format(message['from']['id'])
        if 'username' in message['from']:
            response += "\n" + text['username'].format(
                markdown_escape(message['from']['username']))
        return [Message(chat_id).set_text(response, parse_mode="markdown")]
    else:
        response = ""
        response += str(text['group']).format(
            markdown_escape(message['chat']['title']))
        response += "\n" + str(text['id']).format(
            str(abs(message['chat']['id'])))
        response += "\n➖➖➖➖➖➖➖➖"
        if 'last_name' in message['from']:
            response += "\n" + str(text['name']).format(
                markdown_escape(message['from']['first_name']),
                markdown_escape(message['from']['last_name']))
        else:
            response += "\n" + str(text['name']).format(
                markdown_escape(message['from']['first_name']), "")
        response += "\n" + text['id'].format(message['from']['id'])
        if 'username' in message['from']:
            response += "\n" + text['username'].format(
                markdown_escape(message['from']['username']))
        return [Message(chat_id).set_text(response, parse_mode="markdown")]