From a6817a710cb2bf9497b8b6f2cc90557aa3b45af1 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Tue, 1 Jan 2019 10:18:15 -0600 Subject: [PATCH] Added token to SettingsAPI --- api/views.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/api/views.py b/api/views.py index 279a8b4..f323aae 100644 --- a/api/views.py +++ b/api/views.py @@ -38,7 +38,7 @@ class CommandAPI(View): if check_token(get, commands_perm=True): if command.lower() == "commands": - return JsonResponse(command.commands_dict) + return JsonResponse(commands.command_dict) else: return run_command(get, command, "GET") else: @@ -61,12 +61,15 @@ class CommandAPI(View): class SettingsAPI(View): def get(self, request): - response = { - "BOT_PREFIX": getattr(settings, 'BOT_PREFIX', '?'), - "ERROR_USERS": getattr(settings, 'ERROR_USERS', []), - "MOD_RANK": getattr(settings, 'MOD_RANK', []), - "DEFAULT_STATUS": getattr(settings, 'DEFAULT_STATUS', 'sed') - } + if check_token(request, command_perm=True): + response = { + "BOT_PREFIX": getattr(settings, 'GEOFFREY_BOT_PREFIX', '?'), + "ERROR_USERS": getattr(settings, 'GEOFFREY__BOT_ERROR_USERS', []), + "MOD_RANKS": getattr(settings, 'GEOFFREY_BOT_MOD_RANK', []), + "STATUS": getattr(settings, 'GEOFFREY_BOT_STATUS', 'sed') + } + else: + response = {} return JsonResponse(response)