def set_about_me(bot: Bot, update: Update): message = update.effective_message # type: Optional[Message] user_id = message.from_user.id text = message.text info = text.split(None, 1) # use python's maxsplit to only remove the cmd, hence keeping newlines. if len(info) == 2: if len(info[1]) < MAX_MESSAGE_LENGTH // 4: sql.set_user_me_info(user_id, info[1]) message.reply_text("Updated your info!") else: message.reply_text( "Your info needs to be under {} characters! You have {}.".format(MAX_MESSAGE_LENGTH // 4, len(info[1])))
def set_about_me(bot: Bot, update: Update): chat = update.effective_chat # type: Optional[Chat] message = update.effective_message # type: Optional[Message] user_id = message.from_user.id text = message.text info = text.split( None, 1 ) # use python's maxsplit to only remove the cmd, hence keeping newlines. if len(info) == 2: if len(info[1]) < MAX_MESSAGE_LENGTH // 4: sql.set_user_me_info(user_id, info[1]) message.reply_text(tld(chat.id, 'userinfo_about_set_success')) else: message.reply_text(tld(chat.id, 'userinfo_about_too_long'). format(MAX_MESSAGE_LENGTH // 4, len(info[1])))