Add time and timezone information to message when creating reminder

This commit is contained in:
2025-02-11 17:26:34 +01:00
parent 39ecf4bb6c
commit 1dba51a40d
2 changed files with 4 additions and 2 deletions

View File

@ -245,6 +245,7 @@ class RemindGroup(discord.app_commands.Group):
if not dm_and_current_channel: if not dm_and_current_channel:
msg = ( msg = (
f"Hello {interaction.user.display_name},\n" f"Hello {interaction.user.display_name},\n"
f"I parsed `{time}` as `{parsed_time}`. Timezone: `{scheduler.timezone}`\n"
f"I will send a DM to {user.display_name} at:\n" f"I will send a DM to {user.display_name} at:\n"
f"First run in {calculate(user_reminder)} with the message:\n**{message}**." f"First run in {calculate(user_reminder)} with the message:\n**{message}**."
) )
@ -252,10 +253,11 @@ class RemindGroup(discord.app_commands.Group):
return return
# Create channel reminder job # Create channel reminder job
parsed_time: datetime.datetime | None = parse_time(date_to_parse=time)
channel_job: Job = scheduler.add_job( channel_job: Job = scheduler.add_job(
func=send_to_discord, func=send_to_discord,
trigger="date", trigger="date",
run_date=parse_time(date_to_parse=time), run_date=parsed_time,
kwargs={ kwargs={
"channel_id": channel_id, "channel_id": channel_id,
"message": message, "message": message,
@ -266,6 +268,7 @@ class RemindGroup(discord.app_commands.Group):
msg: str = ( msg: str = (
f"Hello {interaction.user.display_name},\n" f"Hello {interaction.user.display_name},\n"
f"I parsed `{time}` as `{parsed_time}`. Timezone: `{scheduler.timezone}`\n"
f"I will notify you in <#{channel_id}>{dm_message}.\n" f"I will notify you in <#{channel_id}>{dm_message}.\n"
f"First run in {calculate(channel_job)} with the message:\n**{message}**." f"First run in {calculate(channel_job)} with the message:\n**{message}**."
) )

View File

@ -124,7 +124,6 @@ lint.ignore = [
"W191", # Checks for indentation that uses tabs. "W191", # Checks for indentation that uses tabs.
] ]
[tool.ruff.format] [tool.ruff.format]
docstring-code-format = true docstring-code-format = true
docstring-code-line-length = 20 docstring-code-line-length = 20