Version 1.3

This commit is contained in:
Taras Terletskyi 2023-03-28 01:19:16 +03:00
parent db2499458c
commit bb23c0aef6
5 changed files with 42 additions and 7 deletions

View file

@ -2,7 +2,7 @@
Simple and reliable YouTube Download Telegram Bot.
Version: 1.2.1. [Release details](RELEASES.md).
Version: 1.3. [Release details](RELEASES.md).
![frames](.assets/download_success.png)

View file

@ -1,3 +1,21 @@
## Release 1.3
Release date: March 28, 2023
## New Features
- Now any user which is in the configured group with the bot can send the link
## Important
N/A
## Misc
N/A
---
## Release 1.2.1
Release date: March 22, 2023

View file

@ -43,9 +43,13 @@ class BotLauncher:
self._bot.add_handler(
MessageHandler(
cb.on_message,
filters=filters.user(list(self._bot.allowed_users.keys()))
& filters.chat(list(self._bot.allowed_users.keys()))
& filters.regex(self.REGEX_NOT_START_WITH_SLASH),
filters=(
filters.regex(self.REGEX_NOT_START_WITH_SLASH)
& (
filters.user(list(self._bot.allowed_users.keys()))
| filters.chat(list(self._bot.allowed_users.keys()))
)
),
),
)

View file

@ -1,6 +1,6 @@
import logging
from pyrogram.enums import ParseMode
from pyrogram.enums import ChatType, ParseMode
from pyrogram.types import Message
from yt_shared.emoji import SUCCESS_EMOJI
from yt_shared.enums import TelegramChatType
@ -48,9 +48,22 @@ class TelegramCallback:
reply_to_message_id=message.id,
)
@staticmethod
def _get_user_id(message: Message) -> int:
"""Make explicit selection to not forget how this works since we just can return
`message.chat.id` for all cases.
"""
match message.chat.type:
case ChatType.PRIVATE:
return message.from_user.id
case ChatType.GROUP:
return message.chat.id
case _:
return message.chat.id
def _parse_urls(self, message: Message) -> list[URL]:
bot: VideoBot = message._client # noqa
user = bot.allowed_users[message.from_user.id]
user = bot.allowed_users[self._get_user_id(message)]
return [
URL(
url=url,

View file

@ -1 +1 @@
__version__ = '1.2.1'
__version__ = '1.3'