我正在尝试向.reddit我的机器人添加命令。这是我的代码:
@client.command(name="random", aliases=["reddit"])
async def _random(ctx, subreddit: str = ""):
reddit = None
if reddit_app_id and reddit_app_secret:
reddit = praw.Reddit(client_id=reddit_app_id,client_secret=reddit_app_secret,user_agent="MASTERBOT:%s1.0" % reddit_app_id)
if reddit:
submissions = reddit.subreddit(subreddit).hot()
submission = next(x for x in submissions if not x.stickied)
await ctx.send(submissions.url)
我已经导入了所有内容,一切似乎都很好,直到出现此错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'randint'
据我了解,该程序不知道什么是 randint。我检查了我是否打错了字,但没有。一切似乎都很好。我在同一命令上遇到了错误,但我设法修复了它。但这一个抓住了我,我需要你的帮助。
这些是新错误:
AttributeError: 'coroutine' object has no attribute 'url'
.
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
噜噜哒
相关分类