switched to uv and gitea-actions-based pipeline
All checks were successful
Build container / Build (pull_request) Successful in 43s

This commit is contained in:
2025-07-29 14:28:07 +02:00
parent b12eb62b41
commit 29d951427d
18 changed files with 279 additions and 194 deletions

View File

@@ -38,7 +38,7 @@ class JournalHandler(BaseHandler):
async def entry_point(self, update, context):
await super().entry_point(update, context)
if os.getenv("DOCKERIZED", "false") == "true" and os.getenv("CHAT_ID") != str(update.message.chat_id):
if models.IS_PRODUCTION and os.getenv("CHAT_ID") != str(update.message.chat_id):
await update.message.reply_text("You are not authorized to use this bot")
return ConversationHandler.END
@@ -79,7 +79,7 @@ class JournalHandler(BaseHandler):
else:
await query.edit_message_text(text="An entry already exists for this date")
return ConversationHandler.END
return CONTENT_ENTRY
@@ -113,13 +113,13 @@ class JournalHandler(BaseHandler):
async def date_entry(self, update, context):
date = update.message.text
try:
date = datetime.datetime.strptime(date, "%d%m%Y").date()
except ValueError:
await update.message.reply_text("Please enter the date in the format _DDMMYYYY_", parse_mode=ParseMode.MARKDOWN_V2)
return ENTRY_OPTIONS
if context.chat_data.get("delete", False): # if not set, delete was not chosen
with models.db:
self.current_model = models.JournalEntry.get_or_none(
@@ -158,7 +158,7 @@ class JournalHandler(BaseHandler):
file = await update.message.effective_attachment[-1].get_file()
else:
file = await update.message.effective_attachment.get_file()
file_bytes = await file.download_as_bytearray()
file_path = file.file_path
self.current_model.save_media(file_bytes, file_path)
@@ -211,7 +211,7 @@ def get_names(dates: list):
suffix = ""
if models.JournalEntry.get_or_none(date = d):
suffix = ""
if d == datetime.datetime.now().date():
names.append("Today" + suffix)
elif d == datetime.datetime.now().date() - datetime.timedelta(days = 1):

View File

@@ -3,7 +3,7 @@ from telegram.ext import ConversationHandler, CommandHandler, MessageHandler, fi
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, InputMediaPhoto
import models
from telegram.constants import ParseMode
# ACTION_CHOICE, DATE_ENTRY, ADD_CONTENT = range(3)
MEMORY_CHOICE = range(1)
@@ -28,7 +28,7 @@ class MemoryHandler(BaseHandler):
async def entry_point(self, update: Update, context: CallbackContext):
await super().entry_point(update, context)
if os.getenv("DOCKERIZED", "false") == "true" and os.getenv("CHAT_ID") != str(update.message.chat_id):
if models.IS_PRODUCTION and os.getenv("CHAT_ID") != str(update.message.chat_id):
await update.message.reply_text("You are not authorized to use this bot")
return ConversationHandler.END
@@ -56,9 +56,9 @@ class MemoryHandler(BaseHandler):
await update.message.reply_text(
f"Which moment would you like to remember?", reply_markup=keyboard
)
context.chat_data["kept_matches"] = list(matching_models)
return MEMORY_CHOICE
async def choose_memory(self, update: Update, context: CallbackContext):