Issue
I want to use Python Twitch API module completely async in discord.py and if it is not possible or it will take a long time, please introduce the complete alternative async modules.
Solution
asyncio
does not forbid the use of sync
functions in the async
function, so you can use your library inside discord.py events
import asyncio
# Synchronous function
def say_sync(string):
print(string)
# Asynchronous function
async def async_function():
say_sync("Hello")
await asyncio.sleep(1) # Sleep for 1 second
say_sync("world!")
asyncio.run(async_function()) # Run async function
Answered By - mrzen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.