[FIFO] Fifo Bug with Scheduling
Opened this issue · 0 comments
clovisd commented
Describe the bug
The bug occurs when trying to schedule a command, and providing TZ information.
To Reproduce
- Create Trigger:
[p]fifo add challenge001-in editmessage 1139284242560454756 1141505898930515968 1141501823996407848 1144097475884494970
- Schedule Trigger:
[p]fifo addtrigger date challenge001-in August 24th 4:00AM UTC-5
Get: Uh oh! Looks live I've run into an error. 😦
Expected behavior
- Event gets scheduled per Request
Screenshots or Error Messages
Exception in command 'fifo addtrigger date'
Traceback (most recent call last):
File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
ret = await coro(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/cogs/CogManager/cogs/fifo/fifo.py", line 642, in fifo_trigger_date
delta_from_now: timedelta = job.next_run_time - datetime.now(job.next_run_time.tzinfo)
^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'next_run_time'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
await ctx.command.invoke(ctx)
File "/data/venv/lib/python3.11/site-packages/redbot/core/commands/commands.py", line 825, in invoke
await super().invoke(ctx)
File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1650, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "/data/venv/lib/python3.11/site-packages/redbot/core/commands/commands.py", line 825, in invoke
await super().invoke(ctx)
File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1650, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1029, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 244, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'next_run_time'
Additional context
I've had this specific command work previously (accepting requested Timezone data).
It was actually the only way I could get it to trigger correctly (doing [p]fifo addtrigger date challenge001-in August 24th 4:00AM
and assuming the server time is correct, caused the event to not trigger.
This happened, even when the initial trigger / response message has the correct time (and second till run):
Task challenge001-in added 2023-08-24 04:00:00-05:00 to its scheduled runtimes
Next run time: 2023-08-24 04:00:00-05:00 (22653.09146 seconds)