diff options
author | 2025-01-02 19:15:11 +0000 | |
---|---|---|
committer | 2025-01-02 19:15:11 +0000 | |
commit | 6b12cbd18e6351b45dd75ec68807b546db88da70 (patch) | |
tree | 33050e9da4a76d8449af77238303caa2dd7b02f4 | |
parent | Add warning log if bot hits reddit ratelimit (diff) |
Add env var setting to determine whether to post daily top reddit posts
-rw-r--r-- | bot/constants.py | 1 | ||||
-rw-r--r-- | bot/exts/utilities/reddit.py | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/bot/constants.py b/bot/constants.py index 6b6d1a1d..bf53c4b4 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -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() diff --git a/bot/exts/utilities/reddit.py b/bot/exts/utilities/reddit.py index 74927c92..bfb7337a 100644 --- a/bot/exts/utilities/reddit.py +++ b/bot/exts/utilities/reddit.py @@ -36,7 +36,8 @@ class Reddit(Cog): 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.""" |