diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..dd7c2f8 --- /dev/null +++ b/.env.template @@ -0,0 +1 @@ +TELEGRAM_TOKEN= diff --git a/src/beebot.py b/src/beebot.py index 300142d..b18f660 100644 --- a/src/beebot.py +++ b/src/beebot.py @@ -14,13 +14,26 @@ from bs4 import BeautifulSoup from telegram import Update from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes +log_dir = os.getenv("BEEBOT_LOGS") +if not log_dir: + log_dir = "/mnt/logs" +if not os.path.exists(log_dir): + os.mkdir(log_dir) logging.basicConfig( format="[%(asctime)s] %(name)s/%(levelname)s - %(message)s", - level=logging.INFO + level=logging.INFO, + handlers=[ + logging.FileHandler( + os.path.join( + log_dir, + datetime.datetime.today().strftime("%Y%m%d-%H%M%S.log") + ) + ), + logging.StreamHandler() + ] ) logging.getLogger("httpx").setLevel(logging.WARNING) logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) class BeeBot: MENU_URL = "https://www.epfl.ch/campus/restaurants-shops-hotels/fr/industrie21-epfl-valais-wallis/?date={date}" @@ -142,7 +155,7 @@ class BeeBot: def save_cache(self): with open(self.CACHE_PATH, "w") as f: - json.dump(self.cache, f) + json.dump(self.cache, f, indent=4) @staticmethod def get_img_id(today_only: bool, categories: set[str]) -> str: diff --git a/src/fonts/LiberationSans-Bold.ttf b/src/fonts/LiberationSans-Bold.ttf new file mode 100644 index 0000000..52edeb2 Binary files /dev/null and b/src/fonts/LiberationSans-Bold.ttf differ diff --git a/src/fonts/LiberationSans-BoldItalic.ttf b/src/fonts/LiberationSans-BoldItalic.ttf new file mode 100644 index 0000000..541f409 Binary files /dev/null and b/src/fonts/LiberationSans-BoldItalic.ttf differ diff --git a/src/fonts/LiberationSans-Italic.ttf b/src/fonts/LiberationSans-Italic.ttf new file mode 100644 index 0000000..d83f505 Binary files /dev/null and b/src/fonts/LiberationSans-Italic.ttf differ diff --git a/src/fonts/LiberationSans-Regular.ttf b/src/fonts/LiberationSans-Regular.ttf new file mode 100644 index 0000000..cc01210 Binary files /dev/null and b/src/fonts/LiberationSans-Regular.ttf differ