приватные каналы

This commit is contained in:
Artem Tsyrulnikov
2026-01-21 12:16:02 +03:00
parent b5695360c2
commit 2c0dcbef97
7 changed files with 59 additions and 89 deletions

View File

@@ -27,6 +27,15 @@ class Post(TimestampedModel):
@property
def url(self) -> str | None:
if not self.channel.username:
if self.channel.username:
return f'https://t.me/{self.channel.username}/{self.message_id}'
telegram_id = self.channel.telegram_id
if telegram_id is None:
return None
return f'https://t.me/{self.channel.username}/{self.message_id}'
channel_id = telegram_id
if telegram_id < 0:
channel_id = -telegram_id - 1000000000000
return f'https://t.me/c/{channel_id}/{self.message_id}'