Imports cleanup, also fixed #4
This commit is contained in:
parent
2f03b47b66
commit
239957bb81
|
@ -1,11 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from asyncio import run
|
from asyncio import run
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from mastoposter.integrations.discord import DiscordIntegration
|
from mastoposter.integrations import DiscordIntegration, TelegramIntegration
|
||||||
|
|
||||||
from mastoposter.integrations.telegram import TelegramIntegration
|
|
||||||
from mastoposter.sources import websocket_source
|
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.integrations.base import BaseIntegration
|
||||||
from mastoposter.types import Status
|
from mastoposter.types import Status
|
||||||
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
from .telegram import TelegramIntegration
|
from .telegram import TelegramIntegration
|
||||||
|
from .discord import DiscordIntegration
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from json import dumps
|
from typing import List, Optional
|
||||||
from typing import Dict, List, Optional
|
|
||||||
from bs4 import BeautifulSoup, PageElement, Tag
|
from bs4 import BeautifulSoup, PageElement, Tag
|
||||||
from httpx import AsyncClient
|
from httpx import AsyncClient
|
||||||
from zlib import crc32
|
from zlib import crc32
|
||||||
|
@ -7,7 +6,6 @@ from mastoposter.integrations.base import BaseIntegration
|
||||||
from mastoposter.integrations.discord.types import (
|
from mastoposter.integrations.discord.types import (
|
||||||
DiscordEmbed,
|
DiscordEmbed,
|
||||||
DiscordEmbedAuthor,
|
DiscordEmbedAuthor,
|
||||||
DiscordEmbedField,
|
|
||||||
DiscordEmbedImage,
|
DiscordEmbedImage,
|
||||||
)
|
)
|
||||||
from mastoposter.types import Status
|
from mastoposter.types import Status
|
||||||
|
@ -74,12 +72,12 @@ class DiscordIntegration(BaseIntegration):
|
||||||
|
|
||||||
text = self.node_to_text(BeautifulSoup(source.content, features="lxml"))
|
text = self.node_to_text(BeautifulSoup(source.content, features="lxml"))
|
||||||
if source.spoiler_text:
|
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:
|
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:
|
else:
|
||||||
title = f"{status.account.acct} posted"
|
title = f"@{status.account.acct} posted"
|
||||||
|
|
||||||
embeds.append(
|
embeds.append(
|
||||||
DiscordEmbed(
|
DiscordEmbed(
|
||||||
|
|
|
@ -142,7 +142,8 @@ class TelegramIntegration(BaseIntegration):
|
||||||
if status.reblog and self.show_boost_from:
|
if status.reblog and self.show_boost_from:
|
||||||
text = (
|
text = (
|
||||||
'Boosted post from <a href="{}">{}</a>\n'.format(
|
'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
|
+ text
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue