Skip to content

Commit 157880d

Browse files
committed
Only move bot embeds.
A better way to do this would be `(e for e in m.embeds if e.url not in m.content)`, but that breaks in the presence of redirects, which is very common with YouTube links.
1 parent 77eb3b9 commit 157880d

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

app/utils/webhooks.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,7 @@ async def _format_reply(reply: discord.Message) -> discord.Embed:
182182
else:
183183
description = "> *Some forwarded content elided.*"
184184
return (
185-
discord.Embed(
186-
description=f"{description_prefix}{truncate(description, 100)}",
187-
url=reply.jump_url,
188-
)
185+
discord.Embed(description=f"{description_prefix}{truncate(description, 100)}")
189186
.set_author(
190187
name=f"↪️ Replying to {reply.author.display_name}",
191188
icon_url=reply.author.display_avatar,
@@ -213,12 +210,11 @@ async def _format_forward(
213210

214211
msg_data = await MessageData.scrape(forward)
215212
embeds = [
216-
*forward.embeds,
213+
*(e for e in forward.embeds if not e.url),
217214
*await asyncio.gather(*map(_get_sticker_embed, forward.stickers)),
218215
]
219-
embed = discord.Embed(
220-
description=content, timestamp=forward.created_at, url=forward.jump_url
221-
).set_author(name="➜ Forwarded")
216+
embed = discord.Embed(description=content, timestamp=forward.created_at)
217+
embed.set_author(name="➜ Forwarded")
222218

223219
if hasattr(forward.channel, "name"):
224220
# Some channel types don't have a `name` and Pyright can't figure out
@@ -408,7 +404,7 @@ async def move_message_via_webhook(
408404
msg_data = await MessageData.scrape(message)
409405

410406
embeds = [
411-
*message.embeds,
407+
*(e for e in message.embeds if not e.url),
412408
*await asyncio.gather(*map(_get_sticker_embed, message.stickers)),
413409
]
414410

0 commit comments

Comments
 (0)