用Python编程一个与Aync Praw有问题的Discord机器人

2024-09-28 22:25:16 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我用普通的婴儿车作为我的Discord机器人,当我最终开始得到这个信息:

It appears that you are using PRAW in an asynchronous environment.
It is strongly recommended to use Async PRAW: https://asyncpraw.readthedocs.io.
See https://praw.readthedocs.io/en/latest/getting_started/multiple_instances.html#discord-bots-and-asynchronous-environments for more info.

它没有给我任何错误,但似乎很重要,所以我尝试切换到异步Praw。我把import praw改为import asyncpraw,把reddit = praw.Reddit()改为reddit = asyncpraw.Reddit()

现在在我的代码中,它说memes_hot = memes.hot(limit = 100),我得到了这个错误:

AttributeError: 'coroutine' object has no attribute 'hot'

Tags: httpsioimport错误readthedocsitasynchronousreddit