Skip to content

Commit

Permalink
Dockerizing telegram bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyutillis committed Dec 18, 2023
1 parent 7c52930 commit 7118980
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions borrowing_service/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def check_overdue_task(self):
users = [borrowing.user for borrowing in borrowings.all()]
for borrowing in borrowings:
try:
telegram_user = TelegramUser.objects.get(user_id=borrowing.user.pk).chat_id
telegram_user = TelegramUser.objects.get(
user_id=borrowing.user.pk
).chat_id
borrowing_info = (
"You have overdue borrowing:\n\n"
f"-Book: {borrowing.book}\n"
Expand All @@ -42,7 +44,9 @@ def check_overdue_task(self):
for user in get_user_model().objects.all():
if user not in users:
try:
telegram_user = TelegramUser.objects.get(user_id=user.pk).chat_id,
telegram_user = TelegramUser.objects.get(
user_id=user.pk
).chat_id,
send_notification(
telegram_user,
"No borrowings overdue today!"
Expand Down

0 comments on commit 7118980

Please sign in to comment.