diff options
| author | 2020-05-18 18:19:26 -0400 | |
|---|---|---|
| committer | 2020-05-18 18:19:26 -0400 | |
| commit | dd22088a0e709d4f1f612591e7c3c93364c84441 (patch) | |
| tree | 193873c8d706f99a266f9bdacc6121b6f7e06bac | |
| parent | Merge pull request #858 from python-discord/decorator-factory-mutability-tag (diff) | |
| parent | Merge branch 'master' into reddit-publish (diff) | |
Merge pull request #941 from ks129/reddit-publish
Add message publishing to Reddit cog
| -rw-r--r-- | bot/cogs/reddit.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py index 5f2aec7a5..a300cfe0f 100644 --- a/bot/cogs/reddit.py +++ b/bot/cogs/reddit.py @@ -218,7 +218,10 @@ class Reddit(Cog): for subreddit in RedditConfig.subreddits: top_posts = await self.get_top_posts(subreddit=subreddit, time="day") - await self.webhook.send(username=f"{subreddit} Top Daily Posts", embed=top_posts) + message = await self.webhook.send(username=f"{subreddit} Top Daily Posts", embed=top_posts) + + if message.channel.is_news(): + await message.publish() async def top_weekly_posts(self) -> None: """Post a summary of the top posts.""" @@ -242,6 +245,9 @@ class Reddit(Cog): await message.pin() + if message.channel.is_news(): + await message.publish() + @group(name="reddit", invoke_without_command=True) async def reddit_group(self, ctx: Context) -> None: """View the top posts from various subreddits.""" |