Skip to content

Commit

Permalink
Add env var setting to determine whether to post daily top reddit posts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed Jan 2, 2025
1 parent 1ea28a1 commit 6b12cbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions bot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ class _Reddit(EnvConfig, env_prefix="reddit_"):
client_id: SecretStr = ""
secret: SecretStr = ""
webhook: int = 635408384794951680
send_top_daily_posts: bool = True


Reddit = _Reddit()
Expand Down
3 changes: 2 additions & 1 deletion bot/exts/utilities/reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def __init__(self, bot: Bot):
self.access_token = None
self.client_auth = BasicAuth(RedditConfig.client_id.get_secret_value(), RedditConfig.secret.get_secret_value())

self.auto_poster_loop.start()
if RedditConfig.send_top_daily_posts:
self.auto_poster_loop.start()

async def cog_unload(self) -> None:
"""Stop the loop task and revoke the access token when the cog is unloaded."""
Expand Down

0 comments on commit 6b12cbd

Please sign in to comment.