Skip to content

Commit

Permalink
fix: multiple logs tried to create a thread
Browse files Browse the repository at this point in the history
  • Loading branch information
MSchmoecker committed Jul 2, 2024
1 parent 1fa1998 commit 9363842
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ async def on_checkmods(message: Message, original_message: Message, logs: List[s
await message.channel.send("No logs found")
return

thread = None

for log in logs:
logging.info("Parse attached file ... ")
game_name = get_game_name(log)
Expand Down Expand Up @@ -206,10 +208,11 @@ async def on_checkmods(message: Message, original_message: Message, logs: List[s
can_create_threads = permissions and permissions.create_public_threads

if can_create_threads and hasattr(channel, "create_thread"):
thread = await channel.create_thread(name="Log Check",
message=original_message,
type=ChannelType.public_thread,
auto_archive_duration=60)
if thread is None:
thread = await channel.create_thread(name="Log Check",
message=original_message,
type=ChannelType.public_thread,
auto_archive_duration=60)
await thread.send(msg, files=response_files)
else:
await channel.send(msg, files=response_files, reference=original_message)
Expand Down

0 comments on commit 9363842

Please sign in to comment.