Async API calls

This commit is contained in:
Zeva Rose 2022-02-03 20:21:48 -07:00
parent dd8b3be19a
commit 2a7259d1b8

View file

@ -114,7 +114,7 @@ class TwitterCog(Scale):
return return
try: try:
latest_tweet = self.api.user_timeline(screen_name=handle, count=1)[0] latest_tweet = await asyncio.to_thread(self.api.user_timeline, screen_name=handle)[0]
except Exception: except Exception:
await ctx.send( await ctx.send(
"Unable to get user timeline. Are you sure the handle is correct?", hidden=True "Unable to get user timeline. Are you sure the handle is correct?", hidden=True