From efc0b927704acbbcda42a9ece02a6ba38c66eb4e Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 7 Feb 2022 23:36:42 +0700 Subject: [PATCH] detect chat --- program/music.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/program/music.py b/program/music.py index 7e30845..3a0a1f4 100644 --- a/program/music.py +++ b/program/music.py @@ -17,9 +17,10 @@ from driver.design.thumbnail import thumb from driver.design.chatname import CHAT_TITLE from driver.filters import command, other_filters from driver.queues import QUEUE, add_to_queue -from driver.core import calls, user +from driver.core import calls, user, bot from driver.utils import bash from driver.database.dbpunish import is_gbanned_user +from driver.database.dblockchat import blacklisted_chats from config import BOT_USERNAME, IMG_5 # youtube-dl stuff from youtubesearchpython import VideosSearch @@ -55,6 +56,11 @@ async def play(c: Client, m: Message): chat_id = m.chat.id user_id = m.from_user.id user_xd = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" + if chat_id in blacklisted_chats(): + await m.reply( + "❗️ This chat has blacklisted by sudo user and You're not allowed to use me in this chat." + ) + return await bot.leave_chat(chat_id) if await is_gbanned_user(user_id): await message.reply_text(f"❗️ {user_xd} **You've blocked from using this bot!**") return