shorting
This commit is contained in:
parent
7f5c7a7068
commit
7d2829777b
@ -9,6 +9,7 @@ from driver.filters import command, other_filters
|
|||||||
from driver.decorators import authorized_users_only
|
from driver.decorators import authorized_users_only
|
||||||
from driver.utils import skip_current_song, skip_item
|
from driver.utils import skip_current_song, skip_item
|
||||||
from driver.database.dbpunish import is_gbanned_user
|
from driver.database.dbpunish import is_gbanned_user
|
||||||
|
|
||||||
from driver.database.dbqueue import (
|
from driver.database.dbqueue import (
|
||||||
is_music_playing,
|
is_music_playing,
|
||||||
remove_active_chat,
|
remove_active_chat,
|
||||||
@ -231,16 +232,23 @@ async def unmute(client, m: Message):
|
|||||||
await m.reply("❌ **nothing is streaming**")
|
await m.reply("❌ **nothing is streaming**")
|
||||||
|
|
||||||
|
|
||||||
@Client.on_callback_query(filters.regex("set_pause"))
|
@Client.on_callback_query(
|
||||||
async def cbpause(_, query: CallbackQuery):
|
filters.regex(
|
||||||
|
pattern=r"^(set_pause|set_resume|set_stop|set_mute|set_unmute)$"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
async def data_stream_markup(_, query: CallbackQuery):
|
||||||
user_id = query.from_user.id
|
user_id = query.from_user.id
|
||||||
|
chat_id = query.message.chat.id
|
||||||
|
data = query.matches[0].group(1)
|
||||||
|
if data == "set_pause":
|
||||||
if await is_gbanned_user(user_id):
|
if await is_gbanned_user(user_id):
|
||||||
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
||||||
return
|
return
|
||||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||||
if not a.can_manage_voice_chats:
|
if not a.can_manage_voice_chats:
|
||||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||||
chat_id = query.message.chat.id
|
return
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
try:
|
try:
|
||||||
if not await is_music_playing(chat_id):
|
if not await is_music_playing(chat_id):
|
||||||
@ -253,18 +261,14 @@ async def cbpause(_, query: CallbackQuery):
|
|||||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||||
else:
|
else:
|
||||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||||
|
if data == "set_resume":
|
||||||
|
|
||||||
@Client.on_callback_query(filters.regex("set_resume"))
|
|
||||||
async def cbresume(_, query: CallbackQuery):
|
|
||||||
user_id = query.from_user.id
|
|
||||||
if await is_gbanned_user(user_id):
|
if await is_gbanned_user(user_id):
|
||||||
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
||||||
return
|
return
|
||||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||||
if not a.can_manage_voice_chats:
|
if not a.can_manage_voice_chats:
|
||||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||||
chat_id = query.message.chat.id
|
return
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
try:
|
try:
|
||||||
if await is_music_playing(chat_id):
|
if await is_music_playing(chat_id):
|
||||||
@ -277,18 +281,14 @@ async def cbresume(_, query: CallbackQuery):
|
|||||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||||
else:
|
else:
|
||||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||||
|
if data == "set_stop":
|
||||||
|
|
||||||
@Client.on_callback_query(filters.regex("set_stop"))
|
|
||||||
async def cbstop(_, query: CallbackQuery):
|
|
||||||
user_id = query.from_user.id
|
|
||||||
if await is_gbanned_user(user_id):
|
if await is_gbanned_user(user_id):
|
||||||
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
||||||
return
|
return
|
||||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||||
if not a.can_manage_voice_chats:
|
if not a.can_manage_voice_chats:
|
||||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||||
chat_id = query.message.chat.id
|
return
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
try:
|
try:
|
||||||
await calls.leave_group_call(chat_id)
|
await calls.leave_group_call(chat_id)
|
||||||
@ -299,18 +299,14 @@ async def cbstop(_, query: CallbackQuery):
|
|||||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||||
else:
|
else:
|
||||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||||
|
if data == "set_mute":
|
||||||
|
|
||||||
@Client.on_callback_query(filters.regex("set_mute"))
|
|
||||||
async def cbmute(_, query: CallbackQuery):
|
|
||||||
user_id = query.from_user.id
|
|
||||||
if await is_gbanned_user(user_id):
|
if await is_gbanned_user(user_id):
|
||||||
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
||||||
return
|
return
|
||||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||||
if not a.can_manage_voice_chats:
|
if not a.can_manage_voice_chats:
|
||||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||||
chat_id = query.message.chat.id
|
return
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
try:
|
try:
|
||||||
if not await is_music_playing(chat_id):
|
if not await is_music_playing(chat_id):
|
||||||
@ -323,18 +319,14 @@ async def cbmute(_, query: CallbackQuery):
|
|||||||
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
|
||||||
else:
|
else:
|
||||||
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
await query.answer("❌ nothing is currently streaming", show_alert=True)
|
||||||
|
if data = "set_unmute":
|
||||||
|
|
||||||
@Client.on_callback_query(filters.regex("set_unmute"))
|
|
||||||
async def cbunmute(_, query: CallbackQuery):
|
|
||||||
user_id = query.from_user.id
|
|
||||||
if await is_gbanned_user(user_id):
|
if await is_gbanned_user(user_id):
|
||||||
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
await query.answer("❗️ You've blocked from using this bot!", show_alert=True)
|
||||||
return
|
return
|
||||||
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
|
||||||
if not a.can_manage_voice_chats:
|
if not a.can_manage_voice_chats:
|
||||||
return await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
await query.answer("💡 Only admin with manage video chat permission that can tap this button !", show_alert=True)
|
||||||
chat_id = query.message.chat.id
|
return
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
try:
|
try:
|
||||||
if await is_music_playing(chat_id):
|
if await is_music_playing(chat_id):
|
||||||
|
Loading…
Reference in New Issue
Block a user