From 9f3a5c65fbc312f0dbcc01697dbaa3c437482b3f Mon Sep 17 00:00:00 2001 From: rambros Date: Sun, 8 Mar 2026 04:12:33 +0530 Subject: [PATCH] switch to unix timestmp for message references --- src/fluxer/migrate_message.py | 2 +- src/fluxer/writer.py | 6 +++--- src/stoat/migrate_message.py | 2 +- src/stoat/writer.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/fluxer/migrate_message.py b/src/fluxer/migrate_message.py index cda4360..42a5071 100644 --- a/src/fluxer/migrate_message.py +++ b/src/fluxer/migrate_message.py @@ -228,7 +228,7 @@ async def migrate_messages( author_name=msg.author.display_name, author_avatar_url=avatar_url, content=content, - timestamp=msg.created_at.strftime("%Y-%m-%d %H:%M:%S"), + timestamp=int(msg.created_at.timestamp()), files=files if files else None, reply_to_message_id=reply_to_fluxer_id, is_forwarded=is_forwarded, diff --git a/src/fluxer/writer.py b/src/fluxer/writer.py index 532e3a6..e1a9eb0 100644 --- a/src/fluxer/writer.py +++ b/src/fluxer/writer.py @@ -246,7 +246,7 @@ class FluxerWriter: assert self.client is not None 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, embeds: Optional[List[Dict[str, Any]]] = None) -> Optional[str]: + async def send_message(self, channel_id: str, author_name: str, content: str, timestamp: int, 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. Uses a webhook to mimic the original author if possible. @@ -266,7 +266,7 @@ class FluxerWriter: # Prepare content with subtext timestamp # -# is Fluxer/Discord's subtext markdown: small, muted grey text - prefix = f"-# {timestamp}\n" + prefix = f"-# \n" if is_forwarded: prefix += "-# -->*forwarded*\n" @@ -307,7 +307,7 @@ class FluxerWriter: else: # Use bot direct message (supports files and message_reference) # We add the author name to the prefix since bot name won't match - bot_prefix = f"-# {timestamp}\n" + bot_prefix = f"-# \n" if is_forwarded: bot_prefix += "-# -->*forwarded*\n" bot_prefix += f"-# ยท {author_name}\n" diff --git a/src/stoat/migrate_message.py b/src/stoat/migrate_message.py index b8755aa..d730536 100644 --- a/src/stoat/migrate_message.py +++ b/src/stoat/migrate_message.py @@ -231,7 +231,7 @@ async def migrate_messages( author_name=msg.author.display_name, author_avatar_url=avatar_url, content=content, - timestamp=msg.created_at.strftime("%Y-%m-%d %H:%M:%S"), + timestamp=int(msg.created_at.timestamp()), files=files if files else None, reply_to_message_id=reply_to_stoat_id, is_forwarded=is_forwarded, diff --git a/src/stoat/writer.py b/src/stoat/writer.py index 409904f..d6db9bf 100644 --- a/src/stoat/writer.py +++ b/src/stoat/writer.py @@ -271,7 +271,7 @@ class StoatWriter: async def move_channel(self, channel_id: str, parent_id: Optional[str]) -> bool: return True - 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: int, 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]: @@ -289,7 +289,7 @@ class StoatWriter: ) # Build content with timestamp prefix - prefix = f"##### {timestamp}\n" + prefix = f"###### \n" if is_forwarded: prefix += "##### -->*forwarded*\n"