Nevermind, bad idea. Just add the checks
This commit is contained in:
parent
ce41c80c3b
commit
d5bc5993ea
29
fifo/task.py
29
fifo/task.py
@ -272,20 +272,21 @@ class Task:
|
||||
actual_message: Optional[discord.Message] = channel.last_message
|
||||
# I'd like to present you my chain of increasingly desperate message fetching attempts
|
||||
if actual_message is None:
|
||||
# Skip this one, never goes well
|
||||
# try:
|
||||
# actual_message = await channel.fetch_message(channel.last_message_id)
|
||||
# except discord.NotFound:
|
||||
# actual_message = None
|
||||
# if actual_message is None: # last_message_id was an invalid message I guess
|
||||
|
||||
actual_message = await channel.history(limit=1).flatten()
|
||||
if not actual_message: # Basically only happens if the channel has no messages
|
||||
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 False
|
||||
actual_message = actual_message[0]
|
||||
# log.warning("No message found in channel cache yet, skipping execution")
|
||||
# return
|
||||
if channel.last_message_id is not None:
|
||||
try:
|
||||
actual_message = await channel.fetch_message(channel.last_message_id)
|
||||
except discord.NotFound:
|
||||
actual_message = None
|
||||
if actual_message is None: # last_message_id was an invalid message I guess
|
||||
actual_message = await channel.history(limit=1).flatten()
|
||||
if not actual_message: # Basically only happens if the channel has no messages
|
||||
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 False
|
||||
actual_message = actual_message[0]
|
||||
|
||||
message = FakeMessage(actual_message)
|
||||
# message = FakeMessage2
|
||||
|
Loading…
x
Reference in New Issue
Block a user