def about_me(update, context): message = update.effective_message # type: Optional[Message] args = context.args user_id = extract_user(message, args) if user_id: user = context.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 + "Information about him is currently unavailable !" ) else: update.effective_message.reply_text( "You have not added any information about yourself yet !" )
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>About user:</b>\n{me}\n\n<b>What others say:</b>\n{bio}".format( me=me, bio=bio) elif bio: return "<b>What others say:</b>\n{bio}\n".format(me=me, bio=bio) elif me: return "<b>About user:</b>\n{me}" "".format(me=me, bio=bio) else: return ""