Discord.py Reddit Meme 命令

时间:2021-02-14 16:51:48

标签: python discord discord.py bots

我正在尝试创建一个从 reddit 发布随机模因的命令,但我不断收到 401 HTTP 响应错误,这是我的代码:

@commands.command()
async def meme(self, ctx):
reddit = praw.Reddit(client_id='id here',
  client_secret='secret here',
  user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) FxiOS/7.5b3349 Mobile/14F89 Safari/603.2.4')

memes_submissions = reddit.subreddit('memes').hot()

post = random.randint(1, 10)

for i in range(0, post):
    submission = next(x for x in memes_submissions if not x.stickied)

await self.client.say(submission.url)

0 个答案:

没有答案