From 1dba51a40d89776706e7d05b75089d9ad97235c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Tue, 11 Feb 2025 17:26:34 +0100 Subject: [PATCH] Add time and timezone information to message when creating reminder --- discord_reminder_bot/main.py | 5 ++++- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/discord_reminder_bot/main.py b/discord_reminder_bot/main.py index d03ddf4..67d949a 100644 --- a/discord_reminder_bot/main.py +++ b/discord_reminder_bot/main.py @@ -245,6 +245,7 @@ class RemindGroup(discord.app_commands.Group): if not dm_and_current_channel: msg = ( 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"First run in {calculate(user_reminder)} with the message:\n**{message}**." ) @@ -252,10 +253,11 @@ class RemindGroup(discord.app_commands.Group): return # Create channel reminder job + parsed_time: datetime.datetime | None = parse_time(date_to_parse=time) channel_job: Job = scheduler.add_job( func=send_to_discord, trigger="date", - run_date=parse_time(date_to_parse=time), + run_date=parsed_time, kwargs={ "channel_id": channel_id, "message": message, @@ -266,6 +268,7 @@ class RemindGroup(discord.app_commands.Group): msg: str = ( 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"First run in {calculate(channel_job)} with the message:\n**{message}**." ) diff --git a/pyproject.toml b/pyproject.toml index be17139..e6106eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,7 +124,6 @@ lint.ignore = [ "W191", # Checks for indentation that uses tabs. ] - [tool.ruff.format] docstring-code-format = true docstring-code-line-length = 20