From 8aaf32b934f77f89f63ed35218500f3fc08484fc Mon Sep 17 00:00:00 2001 From: sundeep8967 Date: Sat, 7 Nov 2026 20:38:42 +0530 Subject: [PATCH] fix(discord-command-bot): fix setup.py script import and send json payload When running setup.py as a script via build command `python src/setup.py`, the relative import `from .utils import throw_if_missing` raised ImportError (attempted relative import with no known parent package). Fallback to absolute import `from utils import throw_if_missing` when executed directly as a script. Additionally, send the command registration payload using `json=` instead of `data=` to ensure Discord's API receives a valid JSON body. Fixes #491 Signed-off-by: sundeep8967 --- python/discord_command_bot/src/setup.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/discord_command_bot/src/setup.py b/python/discord_command_bot/src/setup.py index f8bc2cb5..cb26ad61 100644 --- a/python/discord_command_bot/src/setup.py +++ b/python/discord_command_bot/src/setup.py @@ -1,5 +1,8 @@ import requests, os -from .utils import throw_if_missing +try: + from .utils import throw_if_missing +except (ImportError, ValueError): + from utils import throw_if_missing def setup(): @@ -16,7 +19,7 @@ def setup(): response = requests.post( REGISTER_API, - data={ + json={ "name": "hello", "description": "Hello World Command", },