Beispiel #1
0
def view_pray_trend(bot, update):

    try:
        total_mins = get_ind_pray_sum(telegram_id=update.message.chat_id)
        total_mins = round(total_mins, 1)

        ind_mins = get_summ_lhc_praymins(criteria='alltime')

    except Exception as e:
        print "Error:", e
        update.message.reply_sticker("BQADAgADWAADVSx4Cy7LVdEFvQ0gAg")
        update.message.reply_text(
            "I cant seem to find your record on my notes..")

    else:
        update.message.reply_text("Studying your prayer trend...")
        update.message.reply_sticker("BQADAgADVgADVSx4CxWAgMNC_H7UAg")
        update.message.reply_text(
            "LHC has accumulated *{} minutes* of prayer time!".format(
                ind_mins),
            parse_mode=telegram.ParseMode.MARKDOWN)

        update.message.reply_text(
            "And... you have contributed *{} minutes* to the sum. Way to go {} !!"
            .format(total_mins, get_user_nick(update.message.chat_id)),
            parse_mode=telegram.ParseMode.MARKDOWN)

        update.message.reply_text("{}: {} minutes".format(
            get_user_nick(update.message.chat_id), total_mins),
                                  reply_markup=inline_reply_markup_praytrend)
Beispiel #2
0
def done(bot, update, user_data):
    if 'choice' in user_data:
        del user_data['choice']

    update.message.reply_sticker("CAADAgADLgADJQNSD71cxe6Pn5CQAg")
    update.message.reply_text(
        "Thank you! Let me know when you're out evangelizing again!",
        reply_markup=markup)

    print "[{}] {} left conversation".format(
        datetime.datetime.now(), get_user_nick(update.message.chat_id))

    user_data.clear()
    return ConversationHandler.END
Beispiel #3
0
def done(bot, update, user_data):
    # print "{} left conversation".format(get_user_nick(update.message.chat_id))
    print "[{}] {} left conversation".format(
        datetime.datetime.now(), get_user_nick(update.message.chat_id))

    if 'choice' in user_data:
        del user_data['choice']

    update.message.reply_sticker("BQADAgADSgADVSx4C_alFsjOJxXLAg")
    update.message.reply_text(
        "Talk to me again soon!! Pray for me too! Bye bye~")

    user_data.clear()
    return ConversationHandler.END
Beispiel #4
0
def done(bot, update, user_data):
    if 'choice' in user_data:
        del user_data['choice']

    update.message.reply_sticker("CAADAgADIAIAAkcVaAl2jRnriVjUSQI")
    update.message.reply_text(
        "Thank you for praising with me.. Come back when you wanna praise again..",
        reply_markup=markup)

    print "[{}] {} left conversation".format(
        datetime.datetime.now(), get_user_nick(update.message.chat_id))

    user_data.clear()
    return ConversationHandler.END
Beispiel #5
0
def start(bot, update):
    print "[{}] {} starts talking".format(
        datetime.datetime.now(), get_user_nick(update.message.chat_id))
    user_exists = check_for_existing_user(telegram_id=update.message.chat_id)
    if user_exists:
        user_data_dict = get_user_info(telegram_id=update.message.chat_id)
        update.message.reply_sticker("CAADAgADGAADJQNSD144kdv3aKiQAg")
        update.message.reply_text(
            "Hey there *{}*! I am the LHC EvangelismBot. My buddy, AutoBot told me about you. "
            "My mission is to help you in evangelism! Now, what do you need in order evangelize today?\n\n"
            .format(user_data_dict['nick_name']),
            reply_markup=markup,
            parse_mode=telegram.ParseMode.MARKDOWN)

        return CHOOSING

    else:
        update.message.reply_sticker("CAADAgADHgADJQNSDz2IE2RzBSd-Ag")
        update.message.reply_text(
            "I'm not sure who you are.. Perhaps you should talk to my good friend, LHC Autobot first. t.me/RHopeBot"
        )
Beispiel #6
0
def start(bot, update):
    # print "{} starts talking".format(get_user_nick(update.message.chat_id))
    print "[{}] {} starts talking".format(
        datetime.datetime.now(), get_user_nick(update.message.chat_id))
    user_exists = check_for_existing_user(telegram_id=update.message.chat_id)
    if user_exists:
        user_data_dict = get_user_info(telegram_id=update.message.chat_id)
        update.message.reply_sticker("CAADAgADMgADVSx4C49XV6fn89_VAg")
        update.message.reply_text(
            "Hey there *{}*! I am the LHC PrayerBot. My buddy, AutoBot told me about you. I can record your prayer time, remind you to pray, etc..\n\n"
            "What should I do for you today?".format(
                user_data_dict['nick_name']),
            reply_markup=markup,
            parse_mode=telegram.ParseMode.MARKDOWN)

        return CHOOSING
    else:
        update.message.reply_sticker("BQADAgADTAADVSx4C1Euf8V7S5s0Ag")
        update.message.reply_text(
            "I'm not sure who you are.. Perhaps you should talk to my fellow friend, LHC Autobot first. t.me/RHopeBot"
        )
Beispiel #7
0
def start(bot, update):
    print "[{}] {} starts talking".format(
        datetime.datetime.now(), get_user_nick(update.message.chat_id))
    user_exists = check_for_existing_user(telegram_id=update.message.chat_id)
    if user_exists:
        user_data_dict = get_user_info(telegram_id=update.message.chat_id)
        update.message.reply_sticker("CAADAgADHQIAAkcVaAnKYeyU0qLAgwI")
        update.message.reply_text(
            "Hey there *{}*! I am the LHC PraiseBot. My buddy, AutoBot told me about you. "
            "Praising has been my life! How can I help you praise today?\n\n".
            format(user_data_dict['nick_name']),
            reply_markup=markup,
            parse_mode=telegram.ParseMode.MARKDOWN)

        return CHOOSING

    else:
        update.message.reply_sticker("BQADAgADTAADVSx4C1Euf8V7S5s0Ag")
        update.message.reply_text(
            "I'm not sure who you are.. Perhaps you should talk to my good friend, LHC Autobot first. t.me/RHopeBot"
        )
Beispiel #8
0
def inline_button_press(bot, update):
    query = update.callback_query

    if query.data == 'youtubelinkdead':
        print "{} reported a dead youtube link {}".format(
            get_user_nick(query.message.chat_id), query.message.text)
        bot.editMessageText(
            "Wow! I that's a good catch! I overlooked it.. Thanks for reporting!!",
            chat_id=query.message.chat_id,
            message_id=query.message.message_id)

        list_of_maintainer_tid = get_maintainer_tid()
        # print list_of_maintainer_tid

        # send msg to maintainer
        for chat_id in list_of_maintainer_tid:
            bot.sendMessage(text="{} reported a dead youtube link {}".format(
                get_user_nick(query.message.chat_id), query.message.text),
                            chat_id=chat_id)

    elif query.data == 'outdatedlyrics':
        print "{} reported an outdated lyric {}".format(
            get_user_nick(query.message.chat_id),
            query.message.text.encode('utf-8'))

        bot.editMessageText(
            "Wow! I that's a good catch! I overlooked it.. Thanks for reporting!!",
            chat_id=query.message.chat_id,
            message_id=query.message.message_id)

        list_of_maintainer_tid = get_maintainer_tid()
        # print list_of_maintainer_tid

        # send msg to maintainer
        for chat_id in list_of_maintainer_tid:
            bot.sendMessage(
                text="{} reported an outdated lyric \n\n{}\n".format(
                    get_user_nick(query.message.chat_id),
                    query.message.text.encode('utf-8')),
                chat_id=chat_id)

    elif query.data == 'koreanyoutubelink':
        message = query.message.text
        title = message.split('\n', 1)[0]

        try:
            bot.editMessageText("{}\n\n{}".format(
                search_song_from_title(title)['song_title_kor'].encode(
                    'utf-8'),
                search_song_from_title(title)['youtube_link_kor'].encode(
                    'utf-8')),
                                chat_id=query.message.chat_id,
                                message_id=query.message.message_id,
                                reply_markup=inline_kb_showenglishyoutube)
        except:
            bot.editMessageText(
                "This is embarassing! I can't find the korean youtube video for this song!",
                chat_id=query.message.chat_id,
                message_id=query.message.message_id)

    elif query.data == 'englishyoutubelink':
        message = query.message.text
        title = message.split('\n', 1)[0]

        try:
            bot.editMessageText("{}\n\n{}".format(
                search_song_from_kor_title(title)['song_title_eng'].encode(
                    'utf-8'),
                search_song_from_kor_title(title)['youtube_link_eng'].encode(
                    'utf-8')),
                                chat_id=query.message.chat_id,
                                message_id=query.message.message_id,
                                reply_markup=inline_kb_showkoreanyoutube)
        except:
            bot.editMessageText(
                "This is embarassing! I can't find the English youtube video for this song!",
                chat_id=query.message.chat_id,
                message_id=query.message.message_id)

    elif query.data == 'show_korean_lyrics':
        message = query.message.text
        title = message.split('\n', 1)[0]

        try:
            bot.editMessageText("{}\n\n{}".format(
                search_song_from_title(title)['song_title_kor'].encode(
                    'utf-8'),
                search_song_from_title(title)['song_lyrics_kor'].encode(
                    'utf-8')),
                                chat_id=query.message.chat_id,
                                message_id=query.message.message_id,
                                reply_markup=inline_kb_outdatedlyrics_eng)
        except:
            bot.editMessageText(
                "I'm sorry I can't find the korean lyrics in my collection..",
                chat_id=query.message.chat_id,
                message_id=query.message.message_id)

    elif query.data == 'show_english_lyrics':
        message = query.message.text
        title = message.split('\n', 1)[0]

        try:
            bot.editMessageText("{}\n\n{}".format(
                search_song_from_kor_title(title)['song_title_eng'],
                search_song_from_kor_title(title)['song_lyrics_eng'].encode(
                    'utf-8')),
                                chat_id=query.message.chat_id,
                                message_id=query.message.message_id,
                                reply_markup=inline_kb_outdatedlyrics_kor)
        except Exception as e:
            print e
            bot.editMessageText(
                "I'm sorry I can't find the lyrics in my collection..",
                chat_id=query.message.chat_id,
                message_id=query.message.message_id)