Skip to content

Commit 9b83841

Browse files
committed
update tjviisi timezone
1 parent f8bd345 commit 9b83841

File tree

4 files changed

+136
-122
lines changed

4 files changed

+136
-122
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ requests = "*"
1010
bs4 = "*"
1111
python-dotenv = "*"
1212
python-telegram-bot = "*"
13+
pytz = "*"
1314

1415
[requires]
1516
python_version = "3.6"

Pipfile.lock

Lines changed: 110 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.txt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@
66
#
77

88
-i https://pypi.org/simple
9-
asn1crypto==0.24.0
10-
beautifulsoup4==4.7.1
9+
apscheduler==3.6.3
10+
beautifulsoup4==4.11.1; python_version >= '3.6'
1111
bs4==0.0.1
12-
certifi==2019.3.9
13-
cffi==1.12.3
14-
chardet==3.0.4
15-
cryptography==2.7
16-
future==0.17.1
17-
idna==2.8
18-
pycparser==2.19
19-
python-dotenv==0.10.3
20-
python-telegram-bot==11.1.0
21-
requests==2.22.0
22-
six==1.12.0
23-
soupsieve==1.9.1
24-
urllib3==1.25.3
12+
cachetools==4.2.2; python_version ~= '3.5'
13+
certifi==2022.6.15; python_version >= '3.6'
14+
charset-normalizer==2.1.1; python_version >= '3.6'
15+
idna==3.3; python_version >= '3.5'
16+
python-dotenv==0.20.0
17+
python-telegram-bot==13.13
18+
pytz-deprecation-shim==0.1.0.post0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
19+
pytz==2022.2.1
20+
requests==2.28.1
21+
setuptools==65.3.0; python_version >= '3.7'
22+
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
23+
soupsieve==2.3.2.post1; python_version >= '3.6'
24+
tornado==6.2; python_version >= '3.7'
25+
tzdata==2022.2; python_version >= '3.6'
26+
tzlocal==4.2; python_version >= '3.6'
27+
urllib3==1.26.12; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'

telegram_bot/bot.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from .menu import get_todays_menu, get_weeks_menu
2-
from datetime import date
2+
from datetime import datetime, date
3+
from pytz import timezone
4+
5+
tz = timezone('Europe/Helsinki')
36

47

58
def __send_message(bot, update, message):
@@ -21,7 +24,9 @@ def __janitor_form(bot, update, args):
2124
__send_message(bot, update, "[Huoltoilmoituslomake](https://asuntola.satakuntatalo.fi/huoltoilmoitus)")
2225

2326
def __tj_viisi(bot, update, args):
24-
tj = (date(2022, 9, 1) - date.today()).days
27+
today = datetime.now(tz).date()
28+
opening = tz.localize(datetime(2022, 9, 1)).date()
29+
tj = (opening - today).days
2530
__send_message(bot, update, f"Viisi-TJ on {tj}!")
2631

2732
__commands = {

0 commit comments

Comments
 (0)