Attempt to work around timezones
This commit is contained in:
@@ -7,6 +7,7 @@ from pyrogram.types import ForceReply, Message, ReplyKeyboardRemove
|
||||
|
||||
from classes.pyroclient import PyroClient
|
||||
from modules import custom_filters
|
||||
from modules.utils import from_utc
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -17,6 +18,12 @@ logger = logging.getLogger(__name__)
|
||||
async def command_set_offset(app: PyroClient, message: Message):
|
||||
user = await app.find_user(message.from_user)
|
||||
|
||||
if user.location is None:
|
||||
await message.reply_text(
|
||||
app._("location_empty", "messages", locale=user.locale)
|
||||
)
|
||||
return
|
||||
|
||||
await message.reply_text(
|
||||
app._("set_offset", "messages", locale=user.locale),
|
||||
reply_markup=ForceReply(
|
||||
@@ -58,8 +65,9 @@ async def command_set_offset(app: PyroClient, message: Message):
|
||||
|
||||
logger.info("User %s has set offset to %s", user.id, offset)
|
||||
|
||||
garbage_time = datetime(
|
||||
1970, 1, 1, hour=user.time_hour, minute=user.time_minute
|
||||
garbage_time = from_utc(
|
||||
datetime(1970, 1, 1, user.time_hour, user.time_minute),
|
||||
None if user.location is None else user.location.timezone.zone,
|
||||
).strftime(app._("time", "formats"))
|
||||
|
||||
await answer.reply_text(
|
||||
|
Reference in New Issue
Block a user