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 = 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 f"\n<b>About user:</b>\n{me}\n<b>What others say:</b>\n{bio}\n" elif bio: return f"\n<b>What others say:</b>\n{bio}\n" elif me: return f"\n<b>About user:</b>\n{me}\n" else: return "\n"
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 ""
def about_me(update: Update, context: CallbackContext): args = context.args bot = context.bot message = update.effective_message user_id = extract_user(message, args) user = bot.get_chat(user_id) if user_id else message.from_user info = sql.get_user_me_info(user.id) if info: update.effective_message.reply_text( f"*{user.first_name}*:\n{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( f"{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!")
def about_me(bot: Bot, update: Update, args: List[str]): message = update.effective_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( f"*{user.first_name}*:\n{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( f"{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!")