Skip to content

Commit 48e9df3

Browse files
committed
Fix jump_url not being displayed
1 parent 9452017 commit 48e9df3

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

core/thread.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,16 +1200,20 @@ async def send(
12001200
content = snap.content or ""
12011201

12021202
# Get jump_url from cached_message, fetch if not cached
1203-
if hasattr(snap, "cached_message") and snap.cached_message:
1203+
if hasattr(snap, "cached_message") and snap.cached_message is not None:
12041204
forwarded_jump_url = snap.cached_message.jump_url
1205-
elif hasattr(snap, "message") and snap.message:
1206-
# Try to fetch the original message to get the correct jump_url
1207-
try:
1208-
original_msg = await snap.message.channel.fetch_message(snap.message.id)
1209-
forwarded_jump_url = original_msg.jump_url
1210-
except (discord.NotFound, discord.Forbidden, AttributeError):
1211-
# If we can't fetch the message, we'll proceed without the jump_url
1212-
pass
1205+
else:
1206+
if (
1207+
hasattr(message, "reference")
1208+
and message.reference
1209+
and message.reference.type == discord.MessageReferenceType.forward
1210+
):
1211+
try:
1212+
original_msg_channel = self.bot.get_channel(message.reference.channel_id)
1213+
original_msg = await original_msg_channel.fetch_message(message.reference.message_id)
1214+
forwarded_jump_url = original_msg.jump_url
1215+
except (discord.NotFound, discord.Forbidden, AttributeError):
1216+
pass
12131217

12141218
content = f"📨 **Forwarded message:**\n{content}" if content else "📨 **Forwarded message:**"
12151219
else:

0 commit comments

Comments
 (0)