问题
The error I'm getting is:
RuntimeWarning: coroutine 'StdOutListener.on_status' was never awaited
if self.on_status(status) is False:
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
My stdOutListener looks like this:
class StdOutListener(StreamListener):
async def on_status(self, status):
channel = await bot.get_channel(64970710814)
await channel.send(status.text)
I understand that I need to get on_status called async'd, but how do I do this? I've tried awaiting most of the things inside on_status
回答1:
Tweepy doesn't yet have asyncio support. For that, see https://github.com/tweepy/tweepy/issues/732.
Instead, you can use the is_async
parameter to run the stream in a separate thread.
See https://tweepy.readthedocs.io/en/latest/streaming_how_to.html#async-streaming.
来源:https://stackoverflow.com/questions/59125640/how-do-i-async-on-status-from-tweepy