2021-10-26 14:57:44 +00:00
from cache . admins import admins
2021-10-31 12:53:10 +00:00
from driver . veez import call_py
from pyrogram import Client , filters
2021-10-29 18:55:54 +00:00
from driver . decorators import authorized_users_only
2021-10-28 05:27:59 +00:00
from driver . filters import command , other_filters
2021-10-26 14:57:44 +00:00
from driver . queues import QUEUE , clear_queue
from driver . utils import skip_current_song , skip_item
2021-10-31 12:53:10 +00:00
from config import BOT_USERNAME , GROUP_SUPPORT , IMG_3 , UPDATES_CHANNEL
2021-11-01 07:56:12 +00:00
from pyrogram . types import (
CallbackQuery ,
InlineKeyboardButton ,
InlineKeyboardMarkup ,
Message ,
)
bttn = InlineKeyboardMarkup (
2021-11-01 08:13:31 +00:00
[ [ InlineKeyboardButton ( " 🔙 Go Back " , callback_data = " cbmenu " ) ] ]
2021-11-01 07:56:12 +00:00
)
bcl = InlineKeyboardMarkup (
[ [ InlineKeyboardButton ( " 🗑 Close " , callback_data = " cls " ) ] ]
)
2021-10-26 14:57:44 +00:00
@Client.on_message ( command ( [ " reload " , f " reload@ { BOT_USERNAME } " ] ) & other_filters )
@authorized_users_only
async def update_admin ( client , message ) :
global admins
new_admins = [ ]
new_ads = await client . get_chat_members ( message . chat . id , filter = " administrators " )
for u in new_ads :
new_admins . append ( u . user . id )
admins [ message . chat . id ] = new_admins
await message . reply_text (
" ✅ Bot **reloaded correctly !** \n ✅ **Admin list** has been **updated !** "
)
2021-10-28 12:06:13 +00:00
@Client.on_message ( command ( [ " skip " , f " skip@ { BOT_USERNAME } " , " vskip " ] ) & other_filters )
2021-10-26 14:57:44 +00:00
@authorized_users_only
async def skip ( client , m : Message ) :
2021-10-29 18:55:54 +00:00
keyboard = InlineKeyboardMarkup (
[
2021-10-28 18:16:27 +00:00
[
2021-10-29 18:55:54 +00:00
InlineKeyboardButton (
2021-11-01 08:13:31 +00:00
text = " • Mᴇɴᴜ " , callback_data = " cbmenu "
2021-10-29 18:55:54 +00:00
) ,
InlineKeyboardButton (
2021-11-01 08:13:31 +00:00
text = " • Cʟᴏ sᴇ " , callback_data = " cls "
2021-10-29 18:55:54 +00:00
) ,
2021-10-28 18:16:27 +00:00
]
2021-10-29 18:55:54 +00:00
]
)
chat_id = m . chat . id
if len ( m . command ) < 2 :
op = await skip_current_song ( chat_id )
if op == 0 :
await m . reply ( " ❌ nothing is currently playing " )
elif op == 1 :
2021-11-10 13:11:39 +00:00
await m . reply ( " ✅ __Queues__ **is empty.** \n \n **• userbot leaving voice chat** " )
2021-11-10 13:20:53 +00:00
elif op == 2 :
2021-11-10 13:11:39 +00:00
await m . reply ( " 🗑️ **Clearing the Queues** \n \n **• userbot leaving voice chat** " )
2021-10-29 18:55:54 +00:00
else :
await m . reply_photo (
photo = f " { IMG_3 } " ,
2021-10-30 10:39:17 +00:00
caption = f " ⏭ **Skipped to the next track.** \n \n 🏷 **Name:** [ { op [ 0 ] } ]( { op [ 1 ] } ) \n 💭 **Chat:** ` { chat_id } ` \n 💡 **Status:** `Playing` \n 🎧 **Request by:** { m . from_user . mention ( ) } " ,
2021-10-29 18:55:54 +00:00
reply_markup = keyboard ,
)
else :
skip = m . text . split ( None , 1 ) [ 1 ]
OP = " 🗑 **removed song from queue:** "
if chat_id in QUEUE :
items = [ int ( x ) for x in skip . split ( " " ) if x . isdigit ( ) ]
items . sort ( reverse = True )
for x in items :
if x == 0 :
pass
else :
hm = await skip_item ( chat_id , x )
if hm == 0 :
pass
else :
OP = OP + " \n " + f " **# { x } ** - { hm } "
await m . reply ( OP )
2021-10-26 14:57:44 +00:00
2021-10-29 18:55:54 +00:00
@Client.on_message (
command ( [ " stop " , f " stop@ { BOT_USERNAME } " , " end " , f " end@ { BOT_USERNAME } " , " vstop " ] )
& other_filters
)
2021-10-26 14:57:44 +00:00
@authorized_users_only
async def stop ( client , m : Message ) :
2021-10-29 18:55:54 +00:00
chat_id = m . chat . id
if chat_id in QUEUE :
try :
await call_py . leave_group_call ( chat_id )
clear_queue ( chat_id )
await m . reply ( " ✅ **streaming has ended.** " )
except Exception as e :
await m . reply ( f " 🚫 **error:** \n \n ` { e } ` " )
else :
await m . reply ( " ❌ **nothing in streaming** " )
2021-10-26 14:57:44 +00:00
2021-10-29 18:55:54 +00:00
@Client.on_message (
command ( [ " pause " , f " pause@ { BOT_USERNAME } " , " vpause " ] ) & other_filters
)
2021-10-26 14:57:44 +00:00
@authorized_users_only
async def pause ( client , m : Message ) :
2021-10-29 18:55:54 +00:00
chat_id = m . chat . id
if chat_id in QUEUE :
try :
await call_py . pause_stream ( chat_id )
await m . reply (
" ⏸ **Track paused.** \n \n • **To resume the stream, use the** \n » /resume command. "
)
except Exception as e :
await m . reply ( f " 🚫 **error:** \n \n ` { e } ` " )
else :
await m . reply ( " ❌ **nothing in streaming** " )
2021-10-26 14:57:44 +00:00
2021-10-29 18:55:54 +00:00
@Client.on_message (
command ( [ " resume " , f " resume@ { BOT_USERNAME } " , " vresume " ] ) & other_filters
)
2021-10-26 14:57:44 +00:00
@authorized_users_only
async def resume ( client , m : Message ) :
2021-10-29 18:55:54 +00:00
chat_id = m . chat . id
if chat_id in QUEUE :
try :
await call_py . resume_stream ( chat_id )
await m . reply (
" ▶️ **Track resumed.** \n \n • **To pause the stream, use the** \n » /pause command. "
)
except Exception as e :
await m . reply ( f " 🚫 **error:** \n \n ` { e } ` " )
else :
await m . reply ( " ❌ **nothing in streaming** " )
2021-10-30 11:30:01 +00:00
2021-10-31 12:53:10 +00:00
@Client.on_message (
command ( [ " mute " , f " mute@ { BOT_USERNAME } " , " vmute " ] ) & other_filters
)
@authorized_users_only
async def mute ( client , m : Message ) :
chat_id = m . chat . id
if chat_id in QUEUE :
try :
await call_py . mute_stream ( chat_id )
await m . reply (
" 🔇 **Userbot muted.** \n \n • **To unmute the userbot, use the** \n » /unmute command. "
)
except Exception as e :
await m . reply ( f " 🚫 **error:** \n \n ` { e } ` " )
else :
await m . reply ( " ❌ **nothing in streaming** " )
@Client.on_message (
command ( [ " unmute " , f " unmute@ { BOT_USERNAME } " , " vunmute " ] ) & other_filters
)
@authorized_users_only
async def unmute ( client , m : Message ) :
chat_id = m . chat . id
if chat_id in QUEUE :
try :
await call_py . unmute_stream ( chat_id )
await m . reply (
" 🔊 **Userbot unmuted.** \n \n • **To mute the userbot, use the** \n » /mute command. "
)
except Exception as e :
await m . reply ( f " 🚫 **error:** \n \n ` { e } ` " )
else :
await m . reply ( " ❌ **nothing in streaming** " )
2021-11-01 07:56:12 +00:00
@Client.on_callback_query ( filters . regex ( " cbpause " ) )
async def cbpause ( _ , query : CallbackQuery ) :
2021-11-05 10:24:01 +00:00
if query . message . sender_chat :
2021-11-05 10:28:00 +00:00
return await query . answer ( " you ' re an Anonymous Admin ! \n \n » revert back to user account from admin rights. " )
2021-11-01 08:57:52 +00:00
a = await _ . get_chat_member ( query . message . chat . id , query . from_user . id )
if not a . can_manage_voice_chats :
2021-11-01 10:36:32 +00:00
return await query . answer ( " 💡 only admin with manage voice chats permission that can tap this button ! " , show_alert = True )
2021-11-01 07:56:12 +00:00
chat_id = query . message . chat . id
if chat_id in QUEUE :
try :
await call_py . pause_stream ( chat_id )
await query . edit_message_text (
2021-11-07 11:52:30 +00:00
" ⏸ the streaming has paused " , reply_markup = bttn
2021-11-01 07:56:12 +00:00
)
except Exception as e :
await query . edit_message_text ( f " 🚫 **error:** \n \n ` { e } ` " , reply_markup = bcl )
else :
2021-11-07 11:52:30 +00:00
await query . answer ( " ❌ nothing is currently streaming " , show_alert = True )
2021-11-01 07:56:12 +00:00
@Client.on_callback_query ( filters . regex ( " cbresume " ) )
async def cbresume ( _ , query : CallbackQuery ) :
2021-11-05 10:24:01 +00:00
if query . message . sender_chat :
2021-11-05 10:28:00 +00:00
return await query . answer ( " you ' re an Anonymous Admin ! \n \n » revert back to user account from admin rights. " )
2021-11-01 08:57:52 +00:00
a = await _ . get_chat_member ( query . message . chat . id , query . from_user . id )
if not a . can_manage_voice_chats :
2021-11-01 10:36:32 +00:00
return await query . answer ( " 💡 only admin with manage voice chats permission that can tap this button ! " , show_alert = True )
2021-11-01 07:56:12 +00:00
chat_id = query . message . chat . id
if chat_id in QUEUE :
try :
await call_py . resume_stream ( chat_id )
await query . edit_message_text (
2021-11-07 11:52:30 +00:00
" ▶️ the streaming has resumed " , reply_markup = bttn
2021-11-01 07:56:12 +00:00
)
except Exception as e :
await query . edit_message_text ( f " 🚫 **error:** \n \n ` { e } ` " , reply_markup = bcl )
else :
2021-11-07 11:52:30 +00:00
await query . answer ( " ❌ nothing is currently streaming " , show_alert = True )
2021-11-01 07:56:12 +00:00
@Client.on_callback_query ( filters . regex ( " cbstop " ) )
async def cbstop ( _ , query : CallbackQuery ) :
2021-11-05 10:24:01 +00:00
if query . message . sender_chat :
2021-11-05 10:28:00 +00:00
return await query . answer ( " you ' re an Anonymous Admin ! \n \n » revert back to user account from admin rights. " )
2021-11-01 08:57:52 +00:00
a = await _ . get_chat_member ( query . message . chat . id , query . from_user . id )
if not a . can_manage_voice_chats :
2021-11-01 10:36:32 +00:00
return await query . answer ( " 💡 only admin with manage voice chats permission that can tap this button ! " , show_alert = True )
2021-11-01 07:56:12 +00:00
chat_id = query . message . chat . id
if chat_id in QUEUE :
try :
await call_py . leave_group_call ( chat_id )
clear_queue ( chat_id )
2021-11-07 11:52:30 +00:00
await query . edit_message_text ( " ✅ **the streaming has ended** " , reply_markup = bcl )
2021-11-01 07:56:12 +00:00
except Exception as e :
await query . edit_message_text ( f " 🚫 **error:** \n \n ` { e } ` " , reply_markup = bcl )
else :
2021-11-07 11:52:30 +00:00
await query . answer ( " ❌ nothing is currently streaming " , show_alert = True )
2021-11-01 07:56:12 +00:00
@Client.on_callback_query ( filters . regex ( " cbmute " ) )
async def cbmute ( _ , query : CallbackQuery ) :
2021-11-05 10:24:01 +00:00
if query . message . sender_chat :
2021-11-05 10:28:00 +00:00
return await query . answer ( " you ' re an Anonymous Admin ! \n \n » revert back to user account from admin rights. " )
2021-11-01 08:57:52 +00:00
a = await _ . get_chat_member ( query . message . chat . id , query . from_user . id )
if not a . can_manage_voice_chats :
2021-11-01 10:36:32 +00:00
return await query . answer ( " 💡 only admin with manage voice chats permission that can tap this button ! " , show_alert = True )
2021-11-01 07:56:12 +00:00
chat_id = query . message . chat . id
if chat_id in QUEUE :
try :
await call_py . mute_stream ( chat_id )
await query . edit_message_text (
" 🔇 userbot succesfully muted " , reply_markup = bttn
)
except Exception as e :
await query . edit_message_text ( f " 🚫 **error:** \n \n ` { e } ` " , reply_markup = bcl )
else :
2021-11-07 11:52:30 +00:00
await query . answer ( " ❌ nothing is currently streaming " , show_alert = True )
2021-11-01 07:56:12 +00:00
@Client.on_callback_query ( filters . regex ( " cbunmute " ) )
async def cbunmute ( _ , query : CallbackQuery ) :
2021-11-05 10:24:01 +00:00
if query . message . sender_chat :
2021-11-05 10:28:00 +00:00
return await query . answer ( " you ' re an Anonymous Admin ! \n \n » revert back to user account from admin rights. " )
2021-11-01 08:57:52 +00:00
a = await _ . get_chat_member ( query . message . chat . id , query . from_user . id )
if not a . can_manage_voice_chats :
2021-11-01 10:36:32 +00:00
return await query . answer ( " 💡 only admin with manage voice chats permission that can tap this button ! " , show_alert = True )
2021-11-01 07:56:12 +00:00
chat_id = query . message . chat . id
if chat_id in QUEUE :
try :
await call_py . unmute_stream ( chat_id )
await query . edit_message_text (
" 🔊 userbot succesfully unmuted " , reply_markup = bttn
)
except Exception as e :
await query . edit_message_text ( f " 🚫 **error:** \n \n ` { e } ` " , reply_markup = bcl )
else :
2021-11-07 11:52:30 +00:00
await query . answer ( " ❌ nothing is currently streaming " , show_alert = True )
2021-11-01 07:56:12 +00:00
2021-10-30 11:30:01 +00:00
@Client.on_message (
2021-10-30 12:56:46 +00:00
command ( [ " volume " , f " volume@ { BOT_USERNAME } " , " vol " ] ) & other_filters
2021-10-30 11:30:01 +00:00
)
@authorized_users_only
2021-11-01 00:51:31 +00:00
async def change_volume ( client , m : Message ) :
2021-10-30 11:30:01 +00:00
range = m . command [ 1 ]
chat_id = m . chat . id
2021-11-01 00:49:12 +00:00
if chat_id in QUEUE :
try :
2021-11-01 00:51:31 +00:00
await call_py . change_volume_call ( chat_id , volume = int ( range ) )
2021-11-01 00:49:12 +00:00
await m . reply (
f " ✅ **volume set to** ` { range } `% "
)
except Exception as e :
await m . reply ( f " 🚫 **error:** \n \n ` { e } ` " )
else :
await m . reply ( " ❌ **nothing in streaming** " )