From 35bce0e63b686280b241d37ceff55acd7ac1cf36 Mon Sep 17 00:00:00 2001 From: vckyou <79180058+vckyou@users.noreply.github.com> Date: Fri, 15 Apr 2022 14:31:11 +0700 Subject: [PATCH] . --- userbot/modules/getmusic.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/userbot/modules/getmusic.py b/userbot/modules/getmusic.py index 85941739..1f3a6e73 100644 --- a/userbot/modules/getmusic.py +++ b/userbot/modules/getmusic.py @@ -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 @@ -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: @@ -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] ) @@ -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] )