From 51547f974511dc909bc2697c36c7b3b2681335c8 Mon Sep 17 00:00:00 2001 From: lyteloli Date: Sun, 13 Sep 2020 22:08:55 +0300 Subject: [PATCH] Fixed usage of deprecated is_private function (#421) Co-authored-by: Alex Root Junior --- aiogram/dispatcher/filters/builtin.py | 2 +- aiogram/types/message.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/aiogram/dispatcher/filters/builtin.py b/aiogram/dispatcher/filters/builtin.py index fcaaf786..20317f57 100644 --- a/aiogram/dispatcher/filters/builtin.py +++ b/aiogram/dispatcher/filters/builtin.py @@ -673,7 +673,7 @@ class AdminFilter(Filter): message = obj.message else: return False - if ChatType.is_private(message): # there is no admin in private chats + if message.chat.type == ChatType.PRIVATE: # there is no admin in private chats return False chat_ids = [message.chat.id] else: diff --git a/aiogram/types/message.py b/aiogram/types/message.py index fedd656e..52c2b3a8 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -236,9 +236,8 @@ class Message(base.TelegramObject): :return: str """ - if ChatType.is_private(self.chat): - raise TypeError("Invalid chat type!") - + if self.chat.type == ChatType.PRIVATE: + raise TypeError('Invalid chat type url = "https://t.me/" if self.chat.username: # Generates public link