From 89009a147a985f551c0b37cd4aa34c271042cb7f Mon Sep 17 00:00:00 2001 From: "Mr.Miss" Date: Mon, 7 Jun 2021 18:48:48 +0700 Subject: [PATCH] welcome: fix bug when chat have no welcome data --- anjani_bot/plugins/welcome.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/anjani_bot/plugins/welcome.py b/anjani_bot/plugins/welcome.py index 85f3a6dfd..217f5e33c 100644 --- a/anjani_bot/plugins/welcome.py +++ b/anjani_bot/plugins/welcome.py @@ -26,7 +26,7 @@ from anjani_bot.utils import MessageParser, ParsedChatMember -class RawGreeting(MessageParser): +class RawGreeting(plugin.Plugin, MessageParser): welcome_db: AsyncIOMotorCollection lock: asyncio.locks.Lock @@ -77,8 +77,8 @@ async def welc_pref(self, chat_id) -> bool: async def welc_msg(self, chat_id) -> str: """Get chat welcome string""" data = await self.welcome_db.find_one({"chat_id": chat_id}) - if message := data.get("custom_welcome"): - return message, data.get("button") + if data: + return data.get("custom_welcome"), data.get("button") return await self.default_welc(chat_id), None async def clean_service(self, chat_id) -> bool: @@ -130,7 +130,7 @@ async def prev_welcome(self, chat_id, msg_id: int) -> Union[int, bool]: return False -class Greeting(plugin.Plugin, RawGreeting): +class Greeting(RawGreeting): name: ClassVar[str] = "Greetings" helpable: ClassVar[bool] = True