Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code. #40

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 27 additions & 45 deletions AlexaMusic/core/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ async def force_stop_stream(self, chat_id: int):
pass

async def skip_stream(
self, chat_id: int, link: str, video: Union[bool, str] = None, image: Union[bool, str] = None
self,
chat_id: int,
link: str,
video: Union[bool, str] = None,
image: Union[bool, str] = None,
):
assistant = await group_assistant(self, chat_id)
audio_stream_quality = await get_audio_bitrate(chat_id)
Expand All @@ -168,10 +172,7 @@ async def skip_stream(
stream,
)


async def seek_stream(
self, chat_id, file_path, to_seek, duration, mode
):
async def seek_stream(self, chat_id, file_path, to_seek, duration, mode):
assistant = await group_assistant(self, chat_id)
audio_stream_quality = await get_audio_bitrate(chat_id)
video_stream_quality = await get_video_bitrate(chat_id)
Expand Down Expand Up @@ -205,7 +206,12 @@ async def join_assistant(self, original_chat_id, chat_id):
await app.unban_chat_member(chat_id, userbot.id)
except:
raise AssistantErr(
_["call_2"].format(config.BOT_NAME, userbot.id, userbot.mention, userbot.username),
_["call_2"].format(
config.BOT_NAME,
userbot.id,
userbot.mention,
userbot.username,
),
)
except UserNotParticipant:
chat = await app.get_chat(chat_id)
Expand All @@ -222,17 +228,9 @@ async def join_assistant(self, original_chat_id, chat_id):
try:
invitelink = chat.invite_link
if invitelink is None:
invitelink = (
await app.export_chat_invite_link(
chat_id
)
)
invitelink = await app.export_chat_invite_link(chat_id)
except:
invitelink = (
await app.export_chat_invite_link(
chat_id
)
)
invitelink = await app.export_chat_invite_link(chat_id)
except ChatAdminRequired:
raise AssistantErr(_["call_4"])
except Exception as e:
Expand Down Expand Up @@ -325,9 +323,7 @@ async def join_call(
counter[chat_id] = {}
users = len(await assistant.get_participants(chat_id))
if users == 1:
autoend[chat_id] = datetime.now() + timedelta(
minutes=AUTO_END_TIME
)
autoend[chat_id] = datetime.now() + timedelta(minutes=AUTO_END_TIME)

async def change_stream(self, client, chat_id):
check = db.get(chat_id)
Expand Down Expand Up @@ -419,17 +415,13 @@ async def change_stream(self, client, chat_id):
db[chat_id][0]["mystic"] = run
db[chat_id][0]["markup"] = "tg"
elif "vid_" in queued:
mystic = await app.send_message(
original_chat_id, _["call_10"]
)
mystic = await app.send_message(original_chat_id, _["call_10"])
try:
file_path, direct = await YouTube.download(
videoid,
mystic,
videoid=True,
video=True
if str(streamtype) == "video"
else False,
video=True if str(streamtype) == "video" else False,
)
except:
return await mystic.edit_text(
Expand Down Expand Up @@ -465,7 +457,7 @@ async def change_stream(self, client, chat_id):
original_chat_id,
text=_["call_9"],
)
theme = await check_theme(chat_id)
theme = await check_theme(chat_id)
img = await gen_thumb(videoid, user_id, theme)
button = stream_markup(_, videoid, chat_id)
await mystic.delete()
Expand All @@ -490,9 +482,7 @@ async def change_stream(self, client, chat_id):
video_parameters=video_stream_quality,
)
if str(streamtype) == "video"
else AudioPiped(
videoid, audio_parameters=audio_stream_quality
)
else AudioPiped(videoid, audio_parameters=audio_stream_quality)
)
try:
await client.change_stream(chat_id, stream)
Expand Down Expand Up @@ -553,9 +543,7 @@ async def change_stream(self, client, chat_id):
photo=config.TELEGRAM_AUDIO_URL
if str(streamtype) == "audio"
else config.TELEGRAM_VIDEO_URL,
caption=_["stream_3"].format(
title, check[0]["dur"], user
),
caption=_["stream_3"].format(title, check[0]["dur"], user),
reply_markup=InlineKeyboardMarkup(button),
)
db[chat_id][0]["mystic"] = run
Expand All @@ -565,9 +553,7 @@ async def change_stream(self, client, chat_id):
run = await app.send_photo(
original_chat_id,
photo=config.SOUNCLOUD_IMG_URL,
caption=_["stream_3"].format(
title, check[0]["dur"], user
),
caption=_["stream_3"].format(title, check[0]["dur"], user),
reply_markup=InlineKeyboardMarkup(button),
)
db[chat_id][0]["mystic"] = run
Expand Down Expand Up @@ -652,9 +638,9 @@ async def stream_end_handler1(client, update: Update):
@self.four.on_participants_change()
@self.five.on_participants_change()
async def participants_change_handler(client, update: Update):
if not isinstance(
update, JoinedGroupCallParticipant
) and not isinstance(update, LeftGroupCallParticipant):
if not isinstance(update, JoinedGroupCallParticipant) and not isinstance(
update, LeftGroupCallParticipant
):
return
chat_id = update.chat_id
users = counter.get(chat_id)
Expand All @@ -665,9 +651,7 @@ async def participants_change_handler(client, update: Update):
return
counter[chat_id] = got
if got == 1:
autoend[chat_id] = datetime.now() + timedelta(
minutes=AUTO_END_TIME
)
autoend[chat_id] = datetime.now() + timedelta(minutes=AUTO_END_TIME)
return
autoend[chat_id] = {}
else:
Expand All @@ -678,11 +662,9 @@ async def participants_change_handler(client, update: Update):
)
counter[chat_id] = final
if final == 1:
autoend[chat_id] = datetime.now() + timedelta(
minutes=AUTO_END_TIME
)
autoend[chat_id] = datetime.now() + timedelta(minutes=AUTO_END_TIME)
return
autoend[chat_id] = {}


Alexa = Call()
Alexa = Call()
1 change: 0 additions & 1 deletion AlexaMusic/plugins/admins/skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# All rights reserved. © Alisha © Alexa © Yukki



from pyrogram import filters
from pyrogram.types import InlineKeyboardMarkup, Message

Expand Down
2 changes: 1 addition & 1 deletion AlexaMusic/utils/theme.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## this code is added by the (C) TheTeamAlexa on 7th March
## this code is added by the (C) TheTeamAlexa on 7th March
# Copyright (C) 2021-2022 by Alexa_Help @ Github, < https://github.com/TheTeamAlexa >.
# A Powerful Music Bot Property Of Rocks Indian Largest Chatting Group
# All rights reserved. © Alisha © Alexa © Yukki
Expand Down