Skip to content

Commit 85d062f

Browse files
committed
public threads
1 parent 91c37a2 commit 85d062f

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

cogs/modmail.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,22 @@ async def handle_dm_message(self, message: discord.Message):
156156
if not session:
157157
# Create new session
158158
try:
159-
thread = await main_channel.create_thread(name=f"ModMail - {message.author.name} ({user_id})", type=discord.ChannelType.private_thread)
160-
except discord.HTTPException:
161-
# Fallback to public thread if private threads fail
162-
thread = await main_channel.create_thread(name=f"ModMail - {message.author.name} ({user_id})")
163-
164-
# Log to main channel
165-
try:
159+
# Log to main channel first
166160
log_embed = discord.Embed(
167161
title="📨 New ModMail Created",
168-
description=f"**User:** {message.author.mention} (`{message.author.id}`)\n**Thread:** {thread.mention}",
162+
description=f"**User:** {message.author.mention} (`{message.author.id}`)",
169163
color=discord.Color.gold(),
170164
timestamp=datetime.utcnow()
171165
)
172166
log_embed.set_thumbnail(url=message.author.display_avatar.url)
173-
await main_channel.send(content="@here", embed=log_embed)
167+
starter_msg = await main_channel.send(content="@here", embed=log_embed)
168+
169+
# Create public thread from the log message
170+
thread = await starter_msg.create_thread(name=f"ModMail - {message.author.name} ({user_id})")
174171
except Exception as e:
175-
logger.error(f"Failed to send modmail log: {e}")
172+
logger.error(f"Failed to create modmail session: {e}")
173+
await message.channel.send("An error occurred while starting the modmail session.")
174+
return
176175

177176
# Notify user
178177
await self._send_dm_safe(message.author, embed=discord.Embed(

0 commit comments

Comments
 (0)