From 7ae689117cb86c6fbc3bc0fa0ea8c60c182b241f Mon Sep 17 00:00:00 2001 From: ZhehaoMi <1125263974@qq.com> Date: Sat, 7 Sep 2019 16:50:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E7=94=A8=E6=88=B7=E6=98=B5=E7=A7=B0?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E8=BD=AC=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/python_runner/python_runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/python_runner/python_runner.py b/plugins/python_runner/python_runner.py index 677e8cf..452cb7e 100644 --- a/plugins/python_runner/python_runner.py +++ b/plugins/python_runner/python_runner.py @@ -32,7 +32,11 @@ def exec_python_code(bot: CQHttp, context=None, args=None): for item in pattern.findall(code): code = code.replace("&#{};".format( item), bytes([int(item)]).decode("utf-8")) - code = f"""CALLER_UID={context['user_id']}\nCALLER_NICKNAME='{context['sender']['nickname']}'\nCALLER_CARD='{context['sender']['card']}'\n"""+code + code = f""" + CALLER_UID={context['user_id']}\n + CALLER_NICKNAME={str(context['sender']['nickname']).encode()}.decode()\n + CALLER_CARD={str(context['sender']['card']).encode()}.decode()\n + """+code run_python_in_docker(callback, code) -- Gitee