aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Zenith <[email protected]>2025-11-01 23:06:37 -0400
committerGravatar Joe Banks <[email protected]>2025-11-02 03:07:07 +0000
commitd992b5e62ff8c77f297b95cec851bf9e6d87d9cc (patch)
treef53af6ad6e6bf5c35d0354b07e68a3f2d8ffb4b2
parentUpgrade deepdiff to 8.6.1 (diff)
feat: include GitHub token in headers if available
Add GitHub authorization header using token from Keys.
-rw-r--r--bot/exts/info/code_snippets.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/exts/info/code_snippets.py b/bot/exts/info/code_snippets.py
index 1ba4151c7..f127d1650 100644
--- a/bot/exts/info/code_snippets.py
+++ b/bot/exts/info/code_snippets.py
@@ -10,7 +10,7 @@ from aiohttp import ClientResponseError
from discord.ext.commands import Cog
from bot.bot import Bot
-from bot.constants import Channels
+from bot.constants import Channels, Keys
from bot.log import get_logger
from bot.utils.messages import wait_for_deletion
@@ -28,6 +28,8 @@ GITHUB_GIST_RE = re.compile(
)
GITHUB_HEADERS = {"Accept": "application/vnd.github.v3.raw"}
+if Keys.github:
+ GITHUB_HEADERS["Authorization"] = f"token {Keys.github}"
GITLAB_RE = re.compile(
r"https://gitlab\.com/(?P<repo>[\w.-]+/[\w.-]+)/\-/blob/(?P<path>[^#>]+)"