switch to unix timestmp for message references
This commit is contained in:
parent
542411cc0b
commit
9f3a5c65fb
4 changed files with 7 additions and 7 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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"-# <t:{timestamp}:D>\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"-# <t:{timestamp}:D>\n"
|
||||
if is_forwarded:
|
||||
bot_prefix += "-# -->*forwarded*\n"
|
||||
bot_prefix += f"-# · {author_name}\n"
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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"###### <t:{timestamp}:D>\n"
|
||||
if is_forwarded:
|
||||
prefix += "##### -->*forwarded*\n"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue