async def deeznuts(event): if DEEZER_ARL_TOKEN is None: return await event.edit("**Set** `DEEZER_ARL_TOKEN` **first.**") try: loader = Login(DEEZER_ARL_TOKEN) except Exception as e: return await event.edit(f"**Error:** `{e}`") try: link = get(event.pattern_match.group(1)).url except BaseException: return await event.edit("**Error: Invalid link provided.**") quality = {"flac": "FLAC", "320": "MP3_320", "256": "MP3_256", "128": "MP3_128"} quality = quality[event.pattern_match.group(2)] temp_dl_path = os.path.join(TEMP_DOWNLOAD_DIRECTORY, str(time())) if not os.path.exists(temp_dl_path): os.makedirs(temp_dl_path) await event.edit("`Downloading...`") if "spotify" in link: if "track" in link: try: track = loader.download_trackspo( link, output=temp_dl_path, quality=quality, recursive_quality=True, recursive_download=True, not_interface=True, ) except Exception as e: return await event.edit(f"**Error:** `{e}`") await event.edit("`Uploading...`") await upload_track(track, event) rmtree(temp_dl_path) return await event.delete() if "album" in link: try: album = loader.download_albumspo( link, output=temp_dl_path, quality=quality, recursive_quality=True, recursive_download=True, not_interface=True, zips=False, ) except Exception as e: return await event.edit(f"**Error:** `{e}`") await event.edit("`Uploading...`") for track in album: await upload_track(track, event) rmtree(temp_dl_path) return await event.delete() if "deezer" in link: if "track" in link: try: track = loader.download_trackdee( link, output=temp_dl_path, quality=quality, recursive_quality=True, recursive_download=True, not_interface=True, ) except Exception as e: return await event.edit(f"**Error:** `{e}`") await event.edit("`Uploading...`") await upload_track(track, event) rmtree(temp_dl_path) return await event.delete() if "album" in link: try: album = loader.download_albumdee( link, output=temp_dl_path, quality=quality, recursive_quality=True, recursive_download=True, not_interface=True, zips=False, ) except Exception as e: return await event.edit(f"**Error:** `{e}`") await event.edit("`Uploading...`") for track in album: await upload_track(track, event) rmtree(temp_dl_path) return await event.delete() await event.edit("**Syntax error!\nRead** `.help deezloader`**.**")
async def deeznuts(event): if DEEZER_ARL_TOKEN is None: return await event.edit( "**Configure** `DEEZER_ARL_TOKEN` **primeiro.**") try: loader = Login(DEEZER_ARL_TOKEN) except Exception as e: return await event.edit(f"**Erro:** `{e}`") try: link = get(event.pattern_match.group(1)).url except: return await event.edit("**Erro: Link inválido fornecido.**") quality = { "flac": "FLAC", "320": "MP3_320", "256": "MP3_256", "128": "MP3_128" } quality = quality[event.pattern_match.group(2)] temp_dl_path = os.path.join(TEMP_DOWNLOAD_DIRECTORY, str(time())) if not os.path.exists(temp_dl_path): os.makedirs(temp_dl_path) await event.edit("**Baixando...**") if "spotify" in link: if "track" in link: try: track = loader.download_trackspo( link, output=temp_dl_path, quality=quality, recursive_quality=True, recursive_download=True, not_interface=True, ) except Exception as e: return await event.edit(f"**Erro:** `{e}`") await event.edit("**Enviando...**") await upload_track(track, event) rmtree(temp_dl_path) return await event.delete() if "album" in link: try: album = loader.download_albumspo( link, output=temp_dl_path, quality=quality, recursive_quality=True, recursive_download=True, not_interface=True, zips=False, ) except Exception as e: return await event.edit(f"**Erro:** `{e}`") await event.edit("**Enviando...**") for track in album: await upload_track(track, event) rmtree(temp_dl_path) return await event.delete() if "deezer" in link: if "track" in link: try: track = loader.download_trackdee( link, output=temp_dl_path, quality=quality, recursive_quality=True, recursive_download=True, not_interface=True, ) except Exception as e: return await event.edit(f"**Erro:** `{e}`") await event.edit("**Enviando...**") await upload_track(track, event) rmtree(temp_dl_path) return await event.delete() if "album" in link: try: album = loader.download_albumdee( link, output=temp_dl_path, quality=quality, recursive_quality=True, recursive_download=True, not_interface=True, zips=False, ) except Exception as e: return await event.edit(f"**Erro:** `{e}`") await event.edit("**Enviando...**") for track in album: await upload_track(track, event) rmtree(temp_dl_path) return await event.delete() await event.edit("**Erro de sintaxe!\nVeja** `.help deezloader`**.**")