From 7c94d4c72bfdb9658c55a29cd9c715feca802a20 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 3 Feb 2023 23:17:26 +0300 Subject: [PATCH] a --- v_repl_bot/cogs/playground.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/v_repl_bot/cogs/playground.py b/v_repl_bot/cogs/playground.py index baa0fde..312b203 100644 --- a/v_repl_bot/cogs/playground.py +++ b/v_repl_bot/cogs/playground.py @@ -1,6 +1,6 @@ from __future__ import annotations -import json +import ast from io import BytesIO from typing import Literal, TYPE_CHECKING @@ -50,8 +50,8 @@ class Playground( f"https://play.vlang.io/run", data = { "code": code }, ) as response: - body = json.loads(await response.text()) - print(body, type(body)) + body = ast.literal_eval(await response.text()) + return body["ok"], body["output"] async def test_code(self, code: str) -> tuple[bool, str]: @@ -59,7 +59,7 @@ class Playground( f"https://play.vlang.io/run_test", data = { "code": code }, ) as response: - body = json.loads(await response.text()) + body = ast.literal_eval(await response.text()) return body["ok"], body["output"]