-
The title might not make sense but I'll just explain here. So I made a loop command for it to constantly loop a song until stopped. I would call it like this: ctx.voice_client.play(player, after=lambda e: print(f'error: {e}') if e else yt.looping(ctx, client, url)) ctx: pass in object from commands -> ( async def play(ctx, *, url) ; ctx in the function behind is what you would pass in) This was a different file where you would pass in the arguments from the main file (e.g client.py where you would run the bot via that file) Line from client.py: ctx.voice_client.play(player, after=lambda e: print(f'error: {e}') if e else asyncio.run_coroutine_threadsafe(ytdl.yt.looping(ctx, client, url), client.loop)) asyncio.run_coroutine_threadsafe required because yt.looping is a async function, cannot be awaited using ytdl is a custom python file for importing (I made it) this would make a loop so that the song would play infinitely (until stopped) after testing a couple times, it would not execute yt.looping(), is this a bug or am I wrong? |
Beta Was this translation helpful? Give feedback.
nvm