diff --git a/callbackQuery/data.py b/callbackQuery/data.py index 1fa59ff..584f483 100644 --- a/callbackQuery/data.py +++ b/callbackQuery/data.py @@ -11,6 +11,7 @@ def data(update: Update, context: CallbackContext): u = db.User(update["_effective_user"]["id"]) s.add(u) s.commit() + u = s.query(db.User).get(update["_effective_user"]["id"]) s.close() context.bot.send_message(chat_id=update.effective_chat.id, text=f"*Firstname*: `{u.first_name}`\n" diff --git a/message/edit.py b/message/edit.py index 7ad5637..f164793 100644 --- a/message/edit.py +++ b/message/edit.py @@ -17,6 +17,14 @@ rex = { "address": address_re } +examples = { + "first_name": "Camille", + "last_name": "Dupont", + "birth_date": "01/01/1970", + "birth_city": "Paris", + "address": "999 avenue de France, 75001 Paris" +} + def check_date(date) -> bool: try: @@ -31,7 +39,8 @@ def edit(update: Update, context: CallbackContext, data_edit: str): name = data_edit.replace("edit_", "") if not rex[name].fullmatch(update.message.text) or\ (name == "birth_date" and not check_date(update.message.text)): - context.bot.send_message(chat_id=update.effective_chat.id, text=f"Invalid value for `{local[name]}` \!", + context.bot.send_message(chat_id=update.effective_chat.id, text=f"Invalid value for `{local[name]}` \!\n" + f"*Example*: `{examples[name]}`", parse_mode=ParseMode.MARKDOWN_V2) else: s = db.Session() diff --git a/requirements.txt b/requirements.txt index 135da5b..68c8b85 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,6 @@ cffi==1.14.3 cryptography==3.2.1 decorator==4.4.2 Pillow==8.0.1 -pkg-resources==0.0.0 pycparser==2.20 PyPDF2==1.26.0 python-telegram-bot==13.0