Skip to content

Commit

Permalink
fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Oct 21, 2022
1 parent ec24d14 commit e2741d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 4 additions & 6 deletions simplebot_tgchan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions simplebot_tgchan/subcommands.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""extra command line subcommands for simplebot's CLI"""

from simplebot import DeltaBot

from .util import get_client, set_config, sync
Expand Down
4 changes: 3 additions & 1 deletion simplebot_tgchan/util.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""Utilities"""

import asyncio
from functools import wraps

from simplebot import DeltaBot
from telethon import TelegramClient
from telethon.sessions import StringSession

_scope = __name__.split(".")[0]
_scope = __name__.split(".", maxsplit=1)[0]


def sync(func):
Expand Down

0 comments on commit e2741d7

Please sign in to comment.