-
Notifications
You must be signed in to change notification settings - Fork 1
/
pause.py
32 lines (29 loc) · 993 Bytes
/
pause.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from pyrogram import filters
from pyrogram.types import Message
from config import BANNED_USERS
from strings import get_command
from AnonX import app
from AnonX.core.call import Anon
from AnonX.utils.database import is_music_playing, music_off
from AnonX.utils.decorators import AdminRightsCheck
from AnonX.utils.inline.play import close_keyboard
from strings.filters import command
# Commands
PAUSE_COMMAND = get_command("PAUSE_COMMAND")
@app.on_message(
command(PAUSE_COMMAND)
& filters.group
& ~BANNED_USERS
)
@AdminRightsCheck
async def pause_admin(cli, message: Message, _, chat_id):
if not len(message.command) == 1:
return await message.reply_text(_["general_2"])
if not await is_music_playing(chat_id):
return await message.reply_text(_["admin_1"])
await music_off(chat_id)
await Anon.pause_stream(chat_id)
await message.reply_text(
_["admin_2"].format(message.from_user.first_name),
reply_markup=close_keyboard
)