add preliminary support for webhook embeds

This commit is contained in:
rambros 2026-03-07 00:14:47 +05:30
parent 90438513a5
commit 832dd722c6
5 changed files with 12 additions and 5 deletions

1
.gitignore vendored
View file

@ -44,6 +44,7 @@ test_release/
DiscoReaper-* DiscoReaper-*
REAPER-*/ REAPER-*/
ReaperFiles-*/
Reaper-*/ Reaper-*/
DISCORD-*/ DISCORD-*/
FLUXER-*/ FLUXER-*/

View file

@ -231,7 +231,8 @@ async def migrate_messages(
timestamp=msg.created_at.strftime("%Y-%m-%d %H:%M:%S"), timestamp=msg.created_at.strftime("%Y-%m-%d %H:%M:%S"),
files=files if files else None, files=files if files else None,
reply_to_message_id=reply_to_fluxer_id, reply_to_message_id=reply_to_fluxer_id,
is_forwarded=is_forwarded is_forwarded=is_forwarded,
embeds=msg.embeds
) )
if fluxer_msg_id: if fluxer_msg_id:

View file

@ -224,7 +224,7 @@ class FluxerWriter:
assert self.client is not None assert self.client is not None
return await self.client.get_guild_channels(self.community_id) return await self.client.get_guild_channels(self.community_id)
async def send_message(self, channel_id: str, author_name: str, content: str, timestamp: str, author_avatar_url: Optional[str] = None, files: Optional[List[Dict[str, Any]]] = None, reply_to_message_id: Optional[str] = None, is_forwarded: bool = False) -> Optional[str]: async def send_message(self, channel_id: str, author_name: str, content: str, timestamp: str, author_avatar_url: Optional[str] = None, files: Optional[List[Dict[str, Any]]] = None, reply_to_message_id: Optional[str] = None, is_forwarded: bool = False, embeds: Optional[List[Dict[str, Any]]] = None) -> Optional[str]:
""" """
Sends a message to the target channel. Sends a message to the target channel.
Uses a webhook to mimic the original author if possible. Uses a webhook to mimic the original author if possible.
@ -268,6 +268,7 @@ class FluxerWriter:
username=f"{author_name} (discord)", username=f"{author_name} (discord)",
avatar_url=author_avatar_url, avatar_url=author_avatar_url,
files=fluxer_files, files=fluxer_files,
embeds=embeds,
wait=True wait=True
) )
return str(msg.id) if msg else None return str(msg.id) if msg else None
@ -289,6 +290,7 @@ class FluxerWriter:
channel_id=channel_id, channel_id=channel_id,
content=final_bot_content, content=final_bot_content,
files=fluxer_files, files=fluxer_files,
embeds=embeds,
message_reference=message_reference message_reference=message_reference
) )
return str(msg_data["id"]) if msg_data else None return str(msg_data["id"]) if msg_data else None

View file

@ -234,7 +234,8 @@ async def migrate_messages(
timestamp=msg.created_at.strftime("%Y-%m-%d %H:%M:%S"), timestamp=msg.created_at.strftime("%Y-%m-%d %H:%M:%S"),
files=files if files else None, files=files if files else None,
reply_to_message_id=reply_to_stoat_id, reply_to_message_id=reply_to_stoat_id,
is_forwarded=is_forwarded is_forwarded=is_forwarded,
embeds=msg.embeds
) )
if stoat_msg_id: if stoat_msg_id:

View file

@ -217,7 +217,8 @@ class StoatWriter:
async def send_message(self, channel_id: str, author_name: str, content: str, timestamp: str, async def send_message(self, channel_id: str, author_name: str, content: str, timestamp: str,
author_avatar_url: Optional[str] = None, files: Optional[List[Dict[str, Any]]] = None, author_avatar_url: Optional[str] = None, files: Optional[List[Dict[str, Any]]] = None,
reply_to_message_id: Optional[str] = None, is_forwarded: bool = False) -> Optional[str]: reply_to_message_id: Optional[str] = None, is_forwarded: bool = False,
embeds: Optional[List[Dict[str, Any]]] = None) -> Optional[str]:
""" """
Sends a message to the target channel using Stoat's masquerade feature. Sends a message to the target channel using Stoat's masquerade feature.
Raises on permission errors caller must handle. Raises on permission errors caller must handle.
@ -259,7 +260,8 @@ class StoatWriter:
content=final_content, content=final_content,
masquerade=masquerade, masquerade=masquerade,
replies=replies, replies=replies,
attachments=attachments attachments=attachments,
embeds=embeds
) )
return str(msg.id) if msg else None return str(msg.id) if msg else None
except Exception as e: except Exception as e: