detect chat

This commit is contained in:
levina 2022-02-07 23:38:49 +07:00 committed by GitHub
parent efc0b92770
commit b8efcb1ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,8 +11,9 @@ 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.database.dbpunish import is_gbanned_user
from driver.database.dblockchat import blacklisted_chats
# pyrogram stuff
from pyrogram import Client
from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
@ -69,6 +70,11 @@ async def vplay(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
@ -342,6 +348,11 @@ async def vstream(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