diff --git a/main.py b/main.py index c7a43d4..8d3b491 100644 --- a/main.py +++ b/main.py @@ -8,6 +8,13 @@ import locale from time import sleep import urllib.parse +# Modify the links and data below: +DEADLINES_URL = "https://m3104.nawinds.dev/api-deadlines" +ADD_DEADLINE_LINK = "https://m3104.nawinds.dev/deadlines-editing-instructions/" +BOT_NAME = "Дединсайдер M3104" +BOT_USERNAME = "m3104_deadliner_bot" + +# Environment variables that should be available: TOKEN = os.getenv("TOKEN") MAIN_GROUP_ID = int(os.getenv("MAIN_GROUP_ID")) @@ -34,7 +41,7 @@ def get_dt_obj_from_string(time: str) -> dt.datetime: def generate_link(event_name: str, event_time: str) -> str: dt_obj = get_dt_obj_from_string(event_time) formatted_time = dt_obj.strftime("%Y%m%d T%H%M%S%z") - description = "Дедлайн добавлен ботом Дединсайдер M3104 (https://t.me/m3104_deadliner_bot)" + description = f"Дедлайн добавлен ботом {BOT_NAME} (https://t.me/{BOT_USERNAME})" link = f"https://calendar.google.com/calendar/u/0/r/eventedit?" \ f"text={urllib.parse.quote(event_name)}&" \ f"dates={formatted_time}/{formatted_time}&details={urllib.parse.quote(description)}&" \ @@ -91,7 +98,7 @@ def deadlines_filter_func(d: dict) -> float: def get_message_text() -> str: try: - response = requests.get("https://m3104.nawinds.dev/api-deadlines").json() + response = requests.get(DEADLINES_URL).json() except Exception: return "" deadlines = response["deadlines"] @@ -134,7 +141,7 @@ def get_message_text() -> str: text += f"\n(" text += get_human_time(tests[i]["time"]) + ")\n\n" - text += f"\n🆕 " \ + text += f"\n🆕 " \ f"Добавить дедлайн/тест" return text