diff --git a/simplebot_tgchan/__init__.py b/simplebot_tgchan/__init__.py index 33bc9f2..ace971f 100644 --- a/simplebot_tgchan/__init__.py +++ b/simplebot_tgchan/__init__.py @@ -9,7 +9,7 @@ from deltachat import Chat, Contact, Message from simplebot import DeltaBot from simplebot.bot import Replies -from telethon import TelegramClient, events +from telethon import TelegramClient from telethon.tl.functions.channels import JoinChannelRequest from telethon.tl.functions.messages import ImportChatInviteRequest from telethon.tl.types import PeerChannel @@ -46,9 +46,7 @@ def deltabot_start(bot: DeltaBot) -> None: @simplebot.hookimpl -def deltabot_member_removed( - bot: DeltaBot, chat: Chat, contact: Contact, replies: Replies -) -> None: +def deltabot_member_removed(bot: DeltaBot, chat: Chat, contact: Contact) -> None: if bot.self_contact != contact and len(chat.get_contacts()) > 1: return @@ -199,14 +197,14 @@ async def check_channel(bot: DeltaBot, client: TelegramClient, dbchan: Channel) bot.logger.debug(f"Channel {channel.title!r} has {len(messages)} new messages") for message in messages: try: - await tg2dc(bot, client, message, dbchan) + await tg2dc(bot, message, dbchan) except Exception as ex: bot.logger.exception(ex) dbchan.last_msg = message.id await client.send_read_acknowledge(channel, messages) -async def tg2dc(bot: DeltaBot, client: TelegramClient, msg, dbchan: Channel) -> None: +async def tg2dc(bot: DeltaBot, msg, dbchan: Channel) -> None: if msg.text is None: return replies = Replies(bot, bot.logger) diff --git a/simplebot_tgchan/subcommands.py b/simplebot_tgchan/subcommands.py index 110598f..7deb82e 100644 --- a/simplebot_tgchan/subcommands.py +++ b/simplebot_tgchan/subcommands.py @@ -1,3 +1,5 @@ +"""extra command line subcommands for simplebot's CLI""" + from simplebot import DeltaBot from .util import get_client, set_config, sync diff --git a/simplebot_tgchan/util.py b/simplebot_tgchan/util.py index 0590d7f..1151e7a 100644 --- a/simplebot_tgchan/util.py +++ b/simplebot_tgchan/util.py @@ -1,3 +1,5 @@ +"""Utilities""" + import asyncio from functools import wraps @@ -5,7 +7,7 @@ from telethon import TelegramClient from telethon.sessions import StringSession -_scope = __name__.split(".")[0] +_scope = __name__.split(".", maxsplit=1)[0] def sync(func):