def open_defects_send_date(update: Update, context: CallbackContext) -> int: end_date = update.message.text context.user_data[con.DATE].update({con.END_DATE: end_date}) text = "Надіслати" keyboard = Buttons.done_or_cancel() update.message.reply_text(text=text, reply_markup=keyboard) return con.SEND_DATE
def add_defect(update: Update, context: CallbackContext) -> int: photo_file = update.message.photo[-1].get_file() photos_directory = os.environ.get('FILE_CUSTOM_PATH') or con.DEFAULT_PHOTO_FOLDER if not os.path.exists(photos_directory): os.makedirs(photos_directory) custom_path = photos_directory + photo_file.file_unique_id + '.jpg' photo_file.download(custom_path=custom_path) context.user_data[con.DEFECT].update({con.DEFECT_PHOTO: custom_path}) text = "Надіслати" keyboard = Buttons.done_or_cancel() update.message.reply_text(text=text, reply_markup=keyboard) return con.DEFECT_SEND