예제 #1
0
def about_me(update, context):
    message = update.effective_message  # type: Optional[Message]
    args = context.args
    user_id = extract_user(message, args)

    if user_id and user_id != "error":
        user = bot.get_chat(user_id)
    else:
        user = message.from_user

    info = sql.get_user_me_info(user.id)

    if info:
        send_message(update.effective_message,
                     "*{}*:\n{}".format(user.first_name,
                                        escape_markdown(info)),
                     parse_mode=ParseMode.MARKDOWN)
    elif message.reply_to_message:
        username = message.reply_to_message.from_user.first_name
        send_message(
            update.effective_message,
            username + tl(update.effective_message,
                          " belum mengatur pesan info tentang diri mereka!"))
    else:
        send_message(
            update.effective_message,
            tl(update.effective_message,
               "Anda belum mengatur pesan info tentang diri Anda!"))
예제 #2
0
def about_me(bot: Bot, update: Update, args: List[str]):
    spam = spamfilters(update.effective_message.text,
                       update.effective_message.from_user.id,
                       update.effective_chat.id, update.effective_message)
    if spam == True:
        return

    message = update.effective_message  # type: Optional[Message]
    user_id = extract_user(message, args)

    if user_id and user_id != "error":
        user = bot.get_chat(user_id)
    else:
        user = message.from_user

    info = sql.get_user_me_info(user.id)

    if info:
        send_message(update.effective_message,
                     "*{}*:\n{}".format(user.first_name,
                                        escape_markdown(info)),
                     parse_mode=ParseMode.MARKDOWN)
    elif message.reply_to_message:
        username = message.reply_to_message.from_user.first_name
        send_message(
            update.effective_message,
            username + tl(update.effective_message,
                          " belum mengatur pesan info tentang diri mereka!"))
    else:
        send_message(
            update.effective_message,
            tl(update.effective_message,
               "Anda belum mengatur pesan info tentang diri Anda!"))
예제 #3
0
def __user_info__(user_id):
    bio = html.escape(sql.get_user_bio(user_id) or "")
    me = html.escape(sql.get_user_me_info(user_id) or "")
    if bio and me:
        return "<b>Tentang pengguna:</b>\n{me}\n<b>Apa yang orang lain katakan:</b>\n{bio}".format(me=me, bio=bio)
    elif bio:
        return "<b>Apa yang orang lain katakan:</b>\n{bio}\n".format(me=me, bio=bio)
    elif me:
        return "<b>Tentang pengguna:</b>\n{me}""".format(me=me, bio=bio)
    else:
        return ""
예제 #4
0
def __user_info__(user_id, chat_id):
    bio = html.escape(sql.get_user_bio(user_id) or "")
    me = html.escape(sql.get_user_me_info(user_id) or "")
    if bio and len(bio) > 500:
        bio = bio[:500]
    if me and len(me) > 500:
        me = me[:500]
    if bio and me:
        return tl(chat_id, "<b>Tentang pengguna:</b>\n{me}\n<b>Apa yang orang lain katakan:</b>\n{bio}").format(me=me, bio=bio)
    elif bio:
        return tl(chat_id, "<b>Apa yang orang lain katakan:</b>\n{bio}\n").format(me=me, bio=bio)
    elif me:
        return tl(chat_id, "<b>Tentang pengguna:</b>\n{me}").format(me=me, bio=bio)
    else:
        return ""
예제 #5
0
def about_me(bot: Bot, update: Update, args: List[str]):
    message = update.effective_message  # type: Optional[Message]
    user_id = extract_user(message, args)

    if user_id:
        user = bot.get_chat(user_id)
    else:
        user = message.from_user

    info = sql.get_user_me_info(user.id)

    if info:
        update.effective_message.reply_text("*{}*:\n{}".format(
            user.first_name, escape_markdown(info)),
                                            parse_mode=ParseMode.MARKDOWN)
    elif message.reply_to_message:
        username = message.reply_to_message.from_user.first_name
        update.effective_message.reply_text(
            username + " belum mengatur pesan info tentang diri mereka!")
    else:
        update.effective_message.reply_text(
            "Anda belum mengatur pesan info tentang diri Anda!")