Possibly fixed #8 #57

Merged
profitroll merged 10 commits from profitroll/timezones-fix into dev 2024-05-31 00:25:54 +03:00
3 changed files with 10 additions and 21 deletions
Showing only changes of commit 7293cafd2e - Show all commits

View File

@ -1,6 +1,7 @@
import logging
from datetime import datetime, timezone
from datetime import datetime
import pytz
from bson import json_util
from libbot.pyrogram.classes import PyroClient
@ -14,7 +15,7 @@ logger = logging.getLogger(__name__)
async def remind(app: PyroClient) -> None:
utcnow = datetime.now(timezone.utc)
utcnow = datetime.now(pytz.utc)
logger.debug("Performing reminder lookup for %s (UTCNOW)", utcnow)
@ -42,13 +43,7 @@ async def remind(app: PyroClient) -> None:
logger.warning("Skipping reminder for %s due to invalid location", user.id)
continue
try:
user_date = user.get_reminder_date()
except AttributeError:
logger.warning(
"Skipping reminder for %s due to missing attributes", user.id
)
continue
user_date = user.get_reminder_date().replace(tzinfo=None)
entries = await col_entries.find(
{

View File

@ -72,12 +72,9 @@ async def command_setup(app: PyroClient, message: Message):
await user.update_location(location.id)
try:
user_time = user.get_reminder_time().strftime(
app._("time", "formats", locale=user.locale)
)
except AttributeError:
user_time = "N/A"
user_time = user.get_reminder_time().strftime(
app._("time", "formats", locale=user.locale)
)
await message.reply_text(
app._("setup_finished", "messages", locale=user.locale).format(

View File

@ -88,12 +88,9 @@ async def command_start(app: PyroClient, message: Message):
await user.update_location(location.id)
try:
user_time = user.get_reminder_time().strftime(
app._("time", "formats", locale=user.locale)
)
except AttributeError:
user_time = "N/A"
user_time = user.get_reminder_time().strftime(
app._("time", "formats", locale=user.locale)
)
await answer.reply_text(
app._("start_selection_yes", "messages", locale=user.locale).format(