merge pull request #26 from levina-lab/issue-13-issues_report

push commit from beta branch
This commit is contained in:
levina 2021-11-01 20:32:18 +07:00 committed by GitHub
commit b962c478ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 140 additions and 11 deletions

View File

@ -6,7 +6,22 @@ from driver.filters import command, other_filters
from driver.queues import QUEUE, clear_queue
from driver.utils import skip_current_song, skip_item
from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from pyrogram.types import (
CallbackQuery,
InlineKeyboardButton,
InlineKeyboardMarkup,
Message,
)
bttn = InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbmenu")]]
)
bcl = InlineKeyboardMarkup(
[[InlineKeyboardButton("🗑 Close", callback_data="cls")]]
)
@Client.on_message(command(["reload", f"reload@{BOT_USERNAME}"]) & other_filters)
@ -31,10 +46,10 @@ async def skip(client, m: Message):
[
[
InlineKeyboardButton(
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
text="• Mᴇɴ", callback_data="cbmenu"
),
InlineKeyboardButton(
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
text="• Cʟsᴇ", callback_data="cls"
),
]
]
@ -161,6 +176,95 @@ async def unmute(client, m: Message):
await m.reply("❌ **nothing in streaming**")
@Client.on_callback_query(filters.regex("cbpause"))
async def cbpause(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
chat_id = query.message.chat.id
if chat_id in QUEUE:
try:
await call_py.pause_stream(chat_id)
await query.edit_message_text(
"⏸ streaming has paused", reply_markup=bttn
)
except Exception as e:
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl)
else:
await query.edit_message_text("❌ **nothing in streaming**", reply_markup=bcl)
@Client.on_callback_query(filters.regex("cbresume"))
async def cbresume(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
chat_id = query.message.chat.id
if chat_id in QUEUE:
try:
await call_py.resume_stream(chat_id)
await query.edit_message_text(
"▶️ streaming has resumed", reply_markup=bttn
)
except Exception as e:
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl)
else:
await query.edit_message_text("❌ **nothing in streaming**", reply_markup=bcl)
@Client.on_callback_query(filters.regex("cbstop"))
async def cbstop(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
chat_id = query.message.chat.id
if chat_id in QUEUE:
try:
await call_py.leave_group_call(chat_id)
clear_queue(chat_id)
await query.edit_message_text("✅ **streaming has ended**", reply_markup=bcl)
except Exception as e:
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl)
else:
await query.edit_message_text("❌ **nothing in streaming**", reply_markup=bcl)
@Client.on_callback_query(filters.regex("cbmute"))
async def cbmute(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
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:
await query.edit_message_text("❌ **nothing in streaming**", reply_markup=bcl)
@Client.on_callback_query(filters.regex("cbunmute"))
async def cbunmute(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
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:
await query.edit_message_text("❌ **nothing in streaming**", reply_markup=bcl)
@Client.on_message(
command(["volume", f"volume@{BOT_USERNAME}", "vol"]) & other_filters
)

View File

@ -162,6 +162,31 @@ async def cbsudo(_, query: CallbackQuery):
)
@Client.on_callback_query(filters.regex("cbmenu"))
async def cbmenu(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
await query.edit_message_text(
f"⚙️ **settings of** {query.message.chat.title}\n\n⏸ : pause stream\n▶️ : resume stream\n🔇 : mute userbot\n🔊 : unmute userbot\n⏹ : stop stream",
reply_markup=InlineKeyboardMarkup(
[[
InlineKeyboardButton("", callback_data="cbstop"),
InlineKeyboardButton("", callback_data="cbpause"),
InlineKeyboardButton("▶️", callback_data="cbresume"),
],[
InlineKeyboardButton("🔇", callback_data="cbmute"),
InlineKeyboardButton("🔊", callback_data="cbunmute"),
],[
InlineKeyboardButton("🗑 Close", callback_data="cls")],
]
),
)
@Client.on_callback_query(filters.regex("cls"))
async def close(_, query: CallbackQuery):
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
await query.message.delete()

View File

@ -56,10 +56,10 @@ async def play(_, m: Message):
[
[
InlineKeyboardButton(
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
text="• Mᴇɴ", callback_data="cbmenu"
),
InlineKeyboardButton(
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
text="• Cʟsᴇ", callback_data="cls"
),
]
]
@ -207,10 +207,10 @@ async def stream(_, m: Message):
[
[
InlineKeyboardButton(
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
text="• Mᴇɴ", callback_data="cbmenu"
),
InlineKeyboardButton(
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
text="• Cʟsᴇ", callback_data="cls"
),
]
]

View File

@ -62,10 +62,10 @@ async def vplay(client, m: Message):
[
[
InlineKeyboardButton(
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
text="• Mᴇɴ", callback_data="cbmenu"
),
InlineKeyboardButton(
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
text="• Cʟsᴇ", callback_data="cls"
),
]
]
@ -224,10 +224,10 @@ async def vstream(client, m: Message):
[
[
InlineKeyboardButton(
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
text="• Mᴇɴ", callback_data="cbmenu"
),
InlineKeyboardButton(
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
text="• Cʟsᴇ", callback_data="cls"
),
]
]