aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-08-19 12:04:26 +0100
committerGravatar Chris Lovering <[email protected]>2024-08-19 12:04:26 +0100
commitb377abd12875aeb1af82600695792f26c1f08c7c (patch)
tree05666f3030f8c70672b30ff55994cb925fa1a8e3
parentUpdate URL for rules page (diff)
Allow loading the bot without a cloudflare_token set
-rw-r--r--arthur/config.py2
-rw-r--r--arthur/exts/cloudflare/zones.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/arthur/config.py b/arthur/config.py
index 80e4825..db92ad7 100644
--- a/arthur/config.py
+++ b/arthur/config.py
@@ -17,7 +17,7 @@ class Config(
token: pydantic.SecretStr
prefixes: tuple[str, ...] = ("arthur ", "M-x ")
- cloudflare_token: pydantic.SecretStr
+ cloudflare_token: pydantic.SecretStr | None = None
youtube_api_key: pydantic.SecretStr | None = None
grafana_url: str = "https://grafana.pydis.wtf"
grafana_token: pydantic.SecretStr
diff --git a/arthur/exts/cloudflare/zones.py b/arthur/exts/cloudflare/zones.py
index 8a21ad1..6735f50 100644
--- a/arthur/exts/cloudflare/zones.py
+++ b/arthur/exts/cloudflare/zones.py
@@ -7,6 +7,7 @@ from discord.ext import commands
from arthur.apis.cloudflare import zones
from arthur.bot import KingArthur
from arthur.config import CONFIG
+from arthur.log import logger
from arthur.utils import generate_error_message
@@ -80,4 +81,7 @@ class Zones(commands.Cog):
async def setup(bot: KingArthur) -> None:
"""Add the extension to the bot."""
+ if not CONFIG.cloudflare_token:
+ logger.warning("Not loading Cloudflare Zone cog as cloudflare_token env var is not set.")
+ return
await bot.add_cog(Zones(bot))