sex_update
This commit is contained in:
parent
8444129896
commit
2e9c715fb8
4 changed files with 27 additions and 1 deletions
1
.env
1
.env
|
|
@ -1 +1,2 @@
|
||||||
BOT_TOKEN=8488665890:AAH7FY5I2xzHhfOdxlzb11ewl2I-MMTH2-o
|
BOT_TOKEN=8488665890:AAH7FY5I2xzHhfOdxlzb11ewl2I-MMTH2-o
|
||||||
|
TZ=Europe/Moscow
|
||||||
|
|
|
||||||
20
.gitignore
vendored
Normal file
20
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*.sqlite3
|
||||||
|
*.log
|
||||||
|
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
|
||||||
|
.env
|
||||||
|
|
||||||
|
media/
|
||||||
|
staticfiles/
|
||||||
|
|
||||||
|
db/
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
.pytest_cache/
|
||||||
|
.mypy_cache/
|
||||||
Binary file not shown.
7
main.py
7
main.py
|
|
@ -13,9 +13,11 @@ from aiogram.types import BufferedInputFile, Message, BotCommand
|
||||||
from aiogram.client.default import DefaultBotProperties
|
from aiogram.client.default import DefaultBotProperties
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
from datetime import datetime, time, timedelta
|
from datetime import datetime, time, timedelta
|
||||||
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).parent
|
BASE_DIR = Path(__file__).parent
|
||||||
FONT_PATH = BASE_DIR / "impact.ttf"
|
FONT_PATH = BASE_DIR / "impact.ttf"
|
||||||
|
DEFAULT_TZ = os.getenv("TZ", "Europe/Moscow")
|
||||||
TEMPLATES = {
|
TEMPLATES = {
|
||||||
"1": {
|
"1": {
|
||||||
"path": BASE_DIR / "maket" / "1.png",
|
"path": BASE_DIR / "maket" / "1.png",
|
||||||
|
|
@ -88,7 +90,10 @@ SCHEDULE: dict[int, list[tuple[time, time, int | None]]] = {
|
||||||
|
|
||||||
|
|
||||||
def minutes_until_break(now: datetime | None = None) -> str:
|
def minutes_until_break(now: datetime | None = None) -> str:
|
||||||
now = now or datetime.now()
|
if now is None:
|
||||||
|
now = datetime.now(ZoneInfo(DEFAULT_TZ))
|
||||||
|
elif now.tzinfo is None:
|
||||||
|
now = now.replace(tzinfo=ZoneInfo(DEFAULT_TZ))
|
||||||
day = now.weekday()
|
day = now.weekday()
|
||||||
today_schedule = SCHEDULE.get(day, [])
|
today_schedule = SCHEDULE.get(day, [])
|
||||||
if not today_schedule:
|
if not today_schedule:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue