1
0
Fork 0

Imports cleanup, also fixed #4

This commit is contained in:
Casey 2022-08-26 14:32:55 +03:00
parent 2f03b47b66
commit 239957bb81
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
4 changed files with 9 additions and 11 deletions

View File

@ -1,11 +1,9 @@
#!/usr/bin/env python3
from asyncio import run
from configparser import ConfigParser
from mastoposter.integrations.discord import DiscordIntegration
from mastoposter.integrations.telegram import TelegramIntegration
from mastoposter.integrations import DiscordIntegration, TelegramIntegration
from mastoposter.sources import websocket_source
from typing import Any, AsyncGenerator, Callable, Dict, List
from typing import AsyncGenerator, Callable, List
from mastoposter.integrations.base import BaseIntegration
from mastoposter.types import Status

View File

@ -1 +1,2 @@
from .telegram import TelegramIntegration
from .discord import DiscordIntegration

View File

@ -1,5 +1,4 @@
from json import dumps
from typing import Dict, List, Optional
from typing import List, Optional
from bs4 import BeautifulSoup, PageElement, Tag
from httpx import AsyncClient
from zlib import crc32
@ -7,7 +6,6 @@ from mastoposter.integrations.base import BaseIntegration
from mastoposter.integrations.discord.types import (
DiscordEmbed,
DiscordEmbedAuthor,
DiscordEmbedField,
DiscordEmbedImage,
)
from mastoposter.types import Status
@ -74,12 +72,12 @@ class DiscordIntegration(BaseIntegration):
text = self.node_to_text(BeautifulSoup(source.content, features="lxml"))
if source.spoiler_text:
text = f"CW: {source.spoiler_text}\n||{text}||"
text = f"{source.spoiler_text}\n||{text}||"
if status.reblog is not None:
title = f"{status.account.acct} boosted from {source.account.acct}"
title = f"@{status.account.acct} boosted from @{source.account.acct}"
else:
title = f"{status.account.acct} posted"
title = f"@{status.account.acct} posted"
embeds.append(
DiscordEmbed(

View File

@ -142,7 +142,8 @@ class TelegramIntegration(BaseIntegration):
if status.reblog and self.show_boost_from:
text = (
'Boosted post from <a href="{}">{}</a>\n'.format(
source.account.url, source.account.display_name
source.account.url,
source.account.display_name or source.account.username,
)
+ text
)