Ejemplo n.º 1
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 me:
        return tld(chat_id, "userinfo_what_i_and_other_say").format(me, bio)
    elif bio:
        return tld(chat_id, "userinfo_what_other_say").format(bio)
    elif me:
        return tld(chat_id, "userinfo_what_i_say").format(me)
    else:
        return ""
Ejemplo n.º 2
0
def my_bio(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_bio(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 + " hasn't set an info message about themselves  yet!")
    else:
        update.effective_message.reply_text("You haven't set an info message about yourself yet!")
Ejemplo n.º 3
0
def about_bio(bot: Bot, update: Update, args: List[str]):
    message = update.effective_message
    chat = update.effective_chat
    user_id = extract_user(message, args)
    if user_id:
        user = bot.get_chat(user_id)
    else:
        user = message.from_user

    info = sql.get_user_bio(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 = user.first_name
        update.effective_message.reply_text(
            tld(chat.id, 'userinfo_bio_none_they').format(username))
    else:
        update.effective_message.reply_text(
            tld(chat.id, 'userinfo_bio_none_you'))
Ejemplo n.º 4
0
def __user_info__(user_id, chat_id):
    bio = html.escape(sql.get_user_bio(user_id) or "")
    if bio:
        return "<b>About user:</b>\n{bio}\n".format(bio=bio)
    else:
        return ""
Ejemplo n.º 5
0
            message.reply_text(
                tld(chat.id,
                    'userinfo_about_too_long').format(MAX_MESSAGE_LENGTH // 4,
                                                      len(info[1])))


@run_async
def about_bio(bot: Bot, update: Update, args: List[str]):
    message = update.effective_message
    chat = update.effective_chat
    if user_id := extract_user(message, args):
        user = bot.get_chat(user_id)
    else:
        user = message.from_user

    if info := sql.get_user_bio(user.id):
        update.effective_message.reply_text("*{}*:\n{}".format(
            user.first_name, escape_markdown(info)),
                                            parse_mode=ParseMode.MARKDOWN)
    elif message.reply_to_message:
        username = user.first_name
        update.effective_message.reply_text(
            tld(chat.id, 'userinfo_bio_none_they').format(username))
    else:
        update.effective_message.reply_text(
            tld(chat.id, 'userinfo_bio_none_you'))


@run_async
def set_about_bio(bot: Bot, update: Update):
    chat = update.effective_chat