Removed unnecessary checks
This commit is contained in:
parent
b5bfbcd375
commit
7293cafd2e
@ -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(
|
||||
{
|
||||
|
@ -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"
|
||||
|
||||
await message.reply_text(
|
||||
app._("setup_finished", "messages", locale=user.locale).format(
|
||||
|
@ -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"
|
||||
|
||||
await answer.reply_text(
|
||||
app._("start_selection_yes", "messages", locale=user.locale).format(
|
||||
|
Reference in New Issue
Block a user