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

. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

. #4

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
21 changes: 10 additions & 11 deletions userbot/modules/getmusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
DEEZER_ARL_TOKEN,
LASTFM_USERNAME,
TEMP_DOWNLOAD_DIRECTORY,
bot,
lastfm,
)
from userbot.utils import bash, chrome, edit_or_reply, geez_cmd, progress
Expand Down Expand Up @@ -179,26 +178,26 @@ async def _(event):
chat = "@SpotifyMusicDownloaderBot"
try:
await event.edit("`Getting Your Music...`")
async with bot.conversation(chat) as conv:
async with event.client.conversation(chat) as conv:
await asyncio.sleep(2)
await event.edit("`Downloading...`")
try:
response = conv.wait_event(
events.NewMessage(incoming=True, from_users=752979930)
)
msg = await bot.send_message(chat, track)
msg = await event.client.send_message(chat, track)
respond = await response
res = conv.wait_event(
events.NewMessage(incoming=True, from_users=752979930)
)
r = await res
await bot.send_read_acknowledge(conv.chat_id)
await event.client.send_read_acknowledge(conv.chat_id)
except YouBlockedUserError:
await event.reply(
"`Unblock `@SpotifyMusicDownloaderBot` dan coba lagi`"
)
return
await bot.forward_messages(event.chat_id, respond.message)
await event.client.forward_messages(event.chat_id, respond.message)
await event.client.delete_messages(conv.chat_id, [msg.id, r.id, respond.id])
await event.delete()
except TimeoutError:
Expand Down Expand Up @@ -227,20 +226,20 @@ async def _(event):
link = f"/netease {track}"
await event.edit("`Searching...`")
try:
async with bot.conversation(chat) as conv:
async with event.client.conversation(chat) as conv:
await asyncio.sleep(2)
await event.edit("`Processing...`")
try:
msg = await conv.send_message(link)
response = await conv.get_response()
respond = await conv.get_response()
await bot.send_read_acknowledge(conv.chat_id)
await event.client.send_read_acknowledge(conv.chat_id)
except YouBlockedUserError:
await event.reply("`Please unblock @WooMaiBot and try again`")
return
await event.edit("`Sending Your Music...`")
await asyncio.sleep(3)
await bot.send_file(event.chat_id, respond)
await event.client.send_file(event.chat_id, respond)
await event.client.delete_messages(
conv.chat_id, [msg.id, response.id, respond.id]
)
Expand All @@ -262,18 +261,18 @@ async def _(event):
await event.edit("`Processing...`")
chat = "@MusicsHunterBot"
try:
async with bot.conversation(chat) as conv:
async with event.client.conversation(chat) as conv:
try:
msg_start = await conv.send_message("/start")
response = await conv.get_response()
msg = await conv.send_message(d_link)
details = await conv.get_response()
song = await conv.get_response()
await bot.send_read_acknowledge(conv.chat_id)
await event.client.send_read_acknowledge(conv.chat_id)
except YouBlockedUserError:
await event.edit("`Unblock `@MusicsHunterBot` and retry`")
return
await bot.send_file(event.chat_id, song, caption=details.text)
await event.client.send_file(event.chat_id, song, caption=details.text)
await event.client.delete_messages(
conv.chat_id, [msg_start.id, response.id, msg.id, details.id, song.id]
)
Expand Down