From 0943055e3499a740b67584f9b95d8b40fbdfacf5 Mon Sep 17 00:00:00 2001 From: Ryuga Date: Fri, 1 May 2026 15:39:36 +0530 Subject: [PATCH 1/2] Add Cpp support --- bot/cogs/hermes.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bot/cogs/hermes.py b/bot/cogs/hermes.py index 1a2fbec..b24a0df 100644 --- a/bot/cogs/hermes.py +++ b/bot/cogs/hermes.py @@ -11,6 +11,8 @@ from bot.constants import tortoise_guild_id EXECUTE_URL = os.getenv("EXECUTION_API_URL") +API_TOKEN = os.getenv("EXECUTION_API_KEY") + LANG_ALIASES = { "py": "python", @@ -18,6 +20,7 @@ "js": "javascript", "javascript": "javascript", "java": "java", + "cpp": "cpp", } view = discord.ui.View() @@ -69,8 +72,10 @@ async def _execute(self, language: str, code: str): "language": language, "code": code, } - - async with self.session.post(EXECUTE_URL, json=payload, timeout=30) as resp: + headers = { + "Authorization": f"Bearer {API_TOKEN}", + } + async with self.session.post(EXECUTE_URL, json=payload, headers=headers, timeout=30) as resp: if resp.status == 429: return { "code": -1, @@ -154,7 +159,7 @@ async def on_message(self, message: discord.Message): if not lang: await message.channel.send( - embed=failure("Unsupported language. Use python, javascript or java in the code block header.") + embed=failure("Unsupported language. Use python, javascript, java or cpp in the code block header.") ) return From 91b668a078834028980749bc49b0c6dc535c00c2 Mon Sep 17 00:00:00 2001 From: Ryuga Date: Fri, 1 May 2026 15:40:24 +0530 Subject: [PATCH 2/2] minor update --- .env.example | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 62b1913..4cc3b7b 100644 --- a/.env.example +++ b/.env.example @@ -19,4 +19,5 @@ PORT=your_health_check_port # Other Environment Variables # Add any additional configuration here # Hermes config -EXECUTION_API_URL=your_code_execution_url \ No newline at end of file +EXECUTION_API_URL=your_code_execution_url +EXECUTION_API_KEY=your_code_execution_token