def get(self, ctx: commands.Context, subreddit, num_posts=5, category='hot'):
"""Base command for returning data from a subreddit.
Keyword arguments:
posts -- Number of posts to return (default 5)
category -- Category to look at [hot, new, rising, controversial, top] (default hot)
"""
if num_posts > 25:
await self.bot.say('Number of posts must be no greater than 25.')
return
if subreddit.strip():
if category in self.categories:
result = await self.get_subreddit_top(
session=self.session, subreddit=subreddit, num_posts=num_posts, category=category)
await self.bot.say('\n\n'.join(result))
else:
await self.bot.say('Valid categories are {}: '.format(', '.join(self.categories)))
else:
await self.bot.pm_help(ctx)
评论列表
文章目录