Skip to content

Commit

Permalink
Merge pull request #57 from TheTeamAlexa/autofix
Browse files Browse the repository at this point in the history
Format code.
  • Loading branch information
TheTeamAlexa committed Mar 7, 2023
2 parents 9bbfc23 + 623cbdb commit f75be43
Showing 1 changed file with 27 additions and 45 deletions.
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 @@ -421,17 +417,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 @@ -467,7 +459,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 @@ -492,9 +484,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 @@ -555,9 +545,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 @@ -567,9 +555,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 @@ -654,9 +640,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 @@ -667,9 +653,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 @@ -680,11 +664,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()

0 comments on commit f75be43

Please sign in to comment.