some changes

This commit is contained in:
levina 2022-01-19 21:26:23 +07:00 committed by GitHub
parent 74d27098e3
commit 8b8bb57a05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,13 @@
from cache.admins import admins
from driver.veez import call_py
from driver.veez import call_py, bot
from pyrogram import Client, filters
from driver.chat_author import adminsOnly
from driver.queues import QUEUE, clear_queue
from driver.filters import command, other_filters
from driver.decorators import authorized_users_only
from driver.utils import skip_current_song, skip_item
from program.utils.inline import stream_markup, close_mark, back_mark
from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL
from pyrogram.types import (
CallbackQuery,
InlineKeyboardButton,
@ -16,6 +16,14 @@ from pyrogram.types import (
)
async def member_permissions(chat_id: int, user_id: int):
perms = []
member = await bot.get_chat_member(chat_id, user_id)
if member.can_manage_voice_chats:
perms.append("can_manage_voice_chats")
return perms
@Client.on_message(command(["reload", f"reload@{BOT_USERNAME}"]) & other_filters)
@authorized_users_only
async def update_admin(client, message):
@ -31,9 +39,11 @@ async def update_admin(client, message):
@Client.on_message(command(["skip", f"skip@{BOT_USERNAME}", "vskip"]) & other_filters)
@authorized_users_only
async def skip(client, m: Message):
await m.delete()
permission = "can_manage_voice_chats"
s = await adminsOnly(permission, m)
if s == 1:
return
user_id = m.from_user.id
chat_id = m.chat.id
if len(m.command) < 2:
@ -74,8 +84,11 @@ async def skip(client, m: Message):
command(["stop", f"stop@{BOT_USERNAME}", "end", f"end@{BOT_USERNAME}", "vstop"])
& other_filters
)
@authorized_users_only
async def stop(client, m: Message):
permission = "can_manage_voice_chats"
s = await adminsOnly(permission, m)
if s == 1:
return
chat_id = m.chat.id
if chat_id in QUEUE:
try:
@ -91,8 +104,11 @@ async def stop(client, m: Message):
@Client.on_message(
command(["pause", f"pause@{BOT_USERNAME}", "vpause"]) & other_filters
)
@authorized_users_only
async def pause(client, m: Message):
permission = "can_manage_voice_chats"
s = await adminsOnly(permission, m)
if s == 1:
return
chat_id = m.chat.id
if chat_id in QUEUE:
try:
@ -109,8 +125,11 @@ async def pause(client, m: Message):
@Client.on_message(
command(["resume", f"resume@{BOT_USERNAME}", "vresume"]) & other_filters
)
@authorized_users_only
async def resume(client, m: Message):
permission = "can_manage_voice_chats"
s = await adminsOnly(permission, m)
if s == 1:
return
chat_id = m.chat.id
if chat_id in QUEUE:
try:
@ -127,8 +146,11 @@ async def resume(client, m: Message):
@Client.on_message(
command(["mute", f"mute@{BOT_USERNAME}", "vmute"]) & other_filters
)
@authorized_users_only
async def mute(client, m: Message):
permission = "can_manage_voice_chats"
s = await adminsOnly(permission, m)
if s == 1:
return
chat_id = m.chat.id
if chat_id in QUEUE:
try:
@ -145,8 +167,11 @@ async def mute(client, m: Message):
@Client.on_message(
command(["unmute", f"unmute@{BOT_USERNAME}", "vunmute"]) & other_filters
)
@authorized_users_only
async def unmute(client, m: Message):
permission = "can_manage_voice_chats"
s = await adminsOnly(permission, m)
if s == 1:
return
chat_id = m.chat.id
if chat_id in QUEUE:
try:
@ -252,8 +277,11 @@ async def cbunmute(_, query: CallbackQuery):
@Client.on_message(
command(["volume", f"volume@{BOT_USERNAME}", "vol"]) & other_filters
)
@authorized_users_only
async def change_volume(client, m: Message):
permission = "can_manage_voice_chats"
s = await adminsOnly(permission, m)
if s == 1:
return
range = m.command[1]
chat_id = m.chat.id
if chat_id in QUEUE: