Skip to content

Commit

Permalink
yes
Browse files Browse the repository at this point in the history
  • Loading branch information
KSKOP69 committed Nov 8, 2024
1 parent 654f5ef commit 5162f15
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 45 deletions.
2 changes: 1 addition & 1 deletion AlexaMusic/utils/decorators/admins.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ async def wrapper(client, CallbackQuery):
return await CallbackQuery.answer(f"Error: {str(e)}")
return await mystic(client, CallbackQuery, _)

return wrapper
return wrapper
21 changes: 9 additions & 12 deletions AlexaMusic/utils/decorators/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,22 @@


from strings import get_string
from AlexaMusic import app
from AlexaMusic.misc import SUDOERS
from config import SUPPORT_GROUP
from AlexaMusic.utils.database import get_lang, is_maintenance
from AlexaMusic.utils.database import get_lang, is_commanddelete_on, is_maintenance


def language(mystic):
async def wrapper(_, message, **kwargs):
if await is_maintenance() is False:
if message.from_user.id not in SUDOERS:
return await message.reply_text(
text=f"{app.mention} ɪs ᴜɴᴅᴇʀ ᴍᴀɪɴᴛᴇɴᴀɴᴄᴇ, ᴠɪsɪᴛ <a href={SUPPORT_GROUP}>sᴜᴘᴘᴏʀᴛ ᴄʜᴀᴛ</a> ғᴏʀ ᴋɴᴏᴡɪɴɢ ᴛʜᴇ ʀᴇᴀsᴏɴ.",
disable_web_page_preview=True,
"» ʙᴏᴛ ɪs ᴜɴᴅᴇʀ ᴍᴀɪɴᴛᴇɴᴀɴᴄᴇ ғᴏʀ sᴏᴍᴇ ᴛɪᴍᴇ, ᴩʟᴇᴀsᴇ ᴠɪsɪᴛ sᴜᴩᴩᴏʀᴛ ᴄʜᴀᴛ ᴛᴏ ᴋɴᴏᴡ ᴛʜᴇ ʀᴇᴀsᴏɴ."
)
try:
await message.delete()
except:
pass

if await is_commanddelete_on(message.chat.id):
try:
await message.delete()
except:
pass
try:
language = await get_lang(message.chat.id)
language = get_string(language)
Expand All @@ -45,7 +42,7 @@ async def wrapper(_, CallbackQuery, **kwargs):
if await is_maintenance() is False:
if CallbackQuery.from_user.id not in SUDOERS:
return await CallbackQuery.answer(
f"{app.mention} ɪs ᴜɴᴅᴇʀ ᴍᴀɪɴᴛᴇɴᴀɴᴄᴇ, ᴠɪsɪᴛ sᴜᴘᴘᴏʀᴛ ᴄʜᴀᴛ ғᴏʀ ᴋɴᴏᴡɪɴɢ ᴛʜᴇ ʀᴇᴀsᴏɴ.",
"» ʙᴏᴛ ɪs ᴜɴᴅᴇʀ ᴍᴀɪɴᴛᴇɴᴀɴᴄᴇ ғᴏʀ sᴏᴍᴇ ᴛɪᴍᴇ, ᴩʟᴇᴀsᴇ ᴠɪsɪᴛ sᴜᴩᴩᴏʀᴛ ᴄʜᴀᴛ ᴛᴏ ᴋɴᴏᴡ ᴛʜᴇ ʀᴇᴀsᴏɴ.",
show_alert=True,
)
try:
Expand All @@ -67,4 +64,4 @@ async def wrapper(_, message, **kwargs):
language = get_string("en")
return await mystic(_, message, language)

return wrapper
return wrapper
70 changes: 38 additions & 32 deletions AlexaMusic/utils/decorators/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
)
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup

from config import PLAYLIST_IMG_URL, SUPPORT_GROUP, adminlist
from config import PLAYLIST_IMG_URL, PRIVATE_BOT_MODE, adminlist
from AlexaMusic.misc import db
from strings import get_string
from AlexaMusic import YouTube, app
from AlexaMusic.misc import SUDOERS
Expand All @@ -30,6 +31,8 @@
get_assistant,
get_playtype,
is_active_chat,
is_commanddelete_on,
is_served_private_chat,
)
from AlexaMusic.utils.database.memorydatabase import is_maintenance
from AlexaMusic.utils.inline.playlist import botplaylist_markup
Expand All @@ -39,32 +42,24 @@

def PlayWrapper(command):
async def wrapper(client, message):
language = await get_lang(message.chat.id)
_ = get_string(language)
if message.sender_chat:
upl = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="ʜᴏᴡ ᴛᴏ ғɪx ?",
callback_data="AnonymousAdmin",
),
]
]
)
return await message.reply_text(_["general_3"], reply_markup=upl)

if await is_maintenance() is False:
if message.from_user.id not in SUDOERS:
return await message.reply_text(
text=f"{app.mention} ɪs ᴜɴᴅᴇʀ ᴍᴀɪɴᴛᴇɴᴀɴᴄᴇ, ᴠɪsɪᴛ <a href={SUPPORT_GROUP}>sᴜᴘᴘᴏʀᴛ ᴄʜᴀᴛ</a> ғᴏʀ ᴋɴᴏᴡɪɴɢ ᴛʜᴇ ʀᴇᴀsᴏɴ.",
disable_web_page_preview=True,
"Bot is under maintenance. Please wait for some time..."
)
try:
await message.delete()
except:
pass

if PRIVATE_BOT_MODE == str(True):
if not await is_served_private_chat(message.chat.id):
await message.reply_text(
"**Private Music Bot**\n\nOnly for authorized chats from the owner. Ask my owner to allow your chat first."
)
return await app.leave_chat(message.chat.id)
if await is_commanddelete_on(message.chat.id):
try:
await message.delete()
except:
pass
language = await get_lang(message.chat.id)
_ = get_string(language)
audio_telegram = (
(message.reply_to_message.audio or message.reply_to_message.voice)
if message.reply_to_message
Expand All @@ -86,6 +81,18 @@ async def wrapper(client, message):
caption=_["playlist_1"],
reply_markup=InlineKeyboardMarkup(buttons),
)
if message.sender_chat:
upl = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="How to Fix this? ",
callback_data="AnonymousAdmin",
),
]
]
)
return await message.reply_text(_["general_4"], reply_markup=upl)
if message.command[0][0] == "c":
chat_id = await get_cmode(message.chat.id)
if chat_id is None:
Expand All @@ -105,13 +112,12 @@ async def wrapper(client, message):
admins = adminlist.get(message.chat.id)
if not admins:
return await message.reply_text(_["admin_18"])
else:
if message.from_user.id not in admins:
return await message.reply_text(_["play_4"])
if message.from_user.id not in admins:
return await message.reply_text(_["play_4"])
if message.command[0][0] == "v":
video = True
else:
if "-v" in message.text:
if message.text and "-v" in message.text:
video = True
else:
video = True if message.command[0][1] == "v" else None
Expand All @@ -129,10 +135,10 @@ async def wrapper(client, message):
get = await app.get_chat_member(chat_id, userbot.id)
except ChatAdminRequired:
return await message.reply_text(_["call_12"])
if (
get.status == ChatMemberStatus.BANNED
or get.status == ChatMemberStatus.RESTRICTED
):
if get.status in [
ChatMemberStatus.BANNED,
ChatMemberStatus.RESTRICTED,
]:
return await message.reply_text(
_["call_13"].format(
app.mention, userbot.id, userbot.name, userbot.username
Expand Down Expand Up @@ -201,4 +207,4 @@ async def wrapper(client, message):
fplay,
)

return wrapper
return wrapper

0 comments on commit 5162f15

Please sign in to comment.