Hotfix scheduling snowflake issue

lseen_develop
bobloy 4 years ago
parent 1f1d116a56
commit 8015e4a46d

@ -27,6 +27,7 @@ async def _execute_task(task_state):
task = Task(**task_state)
if await task.load_from_config():
return await task.execute()
log.warning(f"Failed to load data on {task_state=}")
return False

@ -253,15 +253,15 @@ class Task:
actual_message = await author.history(limit=1).flatten()
if not actual_message: # Okay, the *author* has never sent a message?
log.warning("No message found in channel cache yet, skipping execution")
return
return False
actual_message = actual_message[0]
message = FakeMessage(actual_message)
# message = FakeMessage2
message.author = author
message.guild = guild # Just in case we got desperate
message.guild = guild # Just in case we got desperate, see above
message.channel = channel
message.id = time_snowflake(datetime.now()) # Pretend to be now
message.id = time_snowflake(datetime.utcnow(), high=False) # Pretend to be now
message = neuter_message(message)
# absolutely weird that this takes a message object instead of guild
@ -273,7 +273,12 @@ class Task:
message.content = f"{prefix}{self.get_command_str()}"
if not message.guild or not message.author or not message.content:
if (
not message.guild
or not message.author
or not message.content
or message.content == prefix
):
log.warning(f"Could not execute task due to message problem: {message}")
return False

Loading…
Cancel
Save