我如何从tweepy同步on_status?

问题描述 投票:0回答:1

我得到的错误是:

RuntimeWarning: coroutine 'StdOutListener.on_status' was never awaited
if self.on_status(status) is False:
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

我的stdOutListener看起来像这样:

class StdOutListener(StreamListener):

async def on_status(self, status):
    channel = await bot.get_channel(64970710814)
    await channel.send(status.text)

我了解我需要获取名为async'd的on_status,但是我该怎么做?我已尝试等待on_status中的大多数内容

python tweepy discord.py
1个回答
0
投票
Tweepy尚不支持异步。为此,请参见https://github.com/tweepy/tweepy/issues/732

相反,您可以使用is_async参数在单独的线程中运行流。参见https://tweepy.readthedocs.io/en/latest/streaming_how_to.html#async-streaming

© www.soinside.com 2019 - 2024. All rights reserved.