telegram-python 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {telegram_python-0.3.2 → telegram_python-0.3.4}/PKG-INFO +1 -1
- {telegram_python-0.3.2 → telegram_python-0.3.4}/pyproject.toml +1 -1
- {telegram_python-0.3.2 → telegram_python-0.3.4}/telegram_python/telegram_send.py +4 -3
- {telegram_python-0.3.2 → telegram_python-0.3.4}/README.md +0 -0
- {telegram_python-0.3.2 → telegram_python-0.3.4}/telegram_python/__init__.py +0 -0
|
@@ -2,15 +2,15 @@ import requests
|
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
import os
|
|
4
4
|
import logging
|
|
5
|
-
from dotenv import load_dotenv
|
|
6
5
|
|
|
7
|
-
# Завантаження змінних середовища з .env файлу
|
|
8
|
-
load_dotenv()
|
|
9
6
|
start_hour = int(os.getenv("TELEGRAM_START_HOUR", 0))
|
|
10
7
|
end_hour = int(os.getenv("TELEGRAM_END_HOUR", 24))
|
|
11
8
|
bot_token = os.getenv("TELEGRAM_BOT_TOKEN")
|
|
12
9
|
chat_id = os.getenv("TELEGRAM_CHAT_ID")
|
|
13
10
|
|
|
11
|
+
if not bot_token or not chat_id:
|
|
12
|
+
raise ValueError("Bot token or chat ID not set. Please check your .env file.")
|
|
13
|
+
|
|
14
14
|
logging.basicConfig(level=logging.INFO, filename="py_log.log",filemode="w",
|
|
15
15
|
format="%(asctime)s %(levelname)s %(message)s")
|
|
16
16
|
|
|
@@ -18,6 +18,7 @@ def send(message: str) -> None:
|
|
|
18
18
|
"""
|
|
19
19
|
Відправляє повідомлення в Telegram в заданий час (від 0 до 24).
|
|
20
20
|
"""
|
|
21
|
+
|
|
21
22
|
now = datetime.now()
|
|
22
23
|
current_hour = now.hour
|
|
23
24
|
telegram_max_symbol = 4096
|
|
File without changes
|
|
File without changes
|