Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.9k stars 3.77k forks source link

Using couroutine in "after" function #905

Closed WDN2010 closed 7 years ago

WDN2010 commented 7 years ago

Hello! I have a trouble with my music bot. I'm trying to play next track using _after = checkqueue. But i can use await only inside async def functions, so i cant use await. Without await i'm getting generator instead of thread (that seems quite logical). And when i'm trying to use yield or yield from, function check_queue just doesnt calling. Can you help me to reslove this problem?

scarletcafe commented 7 years ago

Look at How do I pass a coroutine to the player’s “after” function?

WDN2010 commented 7 years ago

omg i watched this answer for 3 days and tried to use for full function, but only now understood that i should use this for coroutine. Many thanks @Gorialis