From cbf4900c5c3b1de65e55ce480d4b453091528e84 Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Sun, 11 Apr 2021 15:03:35 +0800 Subject: =?UTF-8?q?=F0=9F=9A=80=E2=9C=A8=E2=9A=A1=EF=B8=8F=F0=9F=8E=A8?= =?UTF-8?q?=F0=9F=90=9B=20=E6=AD=A3=E5=BC=8F=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/code-runner.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ATRI/plugins/code-runner.py') diff --git a/ATRI/plugins/code-runner.py b/ATRI/plugins/code-runner.py index 6da97b0..367a144 100644 --- a/ATRI/plugins/code-runner.py +++ b/ATRI/plugins/code-runner.py @@ -4,8 +4,8 @@ Idea from: https://github.com/cczu-osa/aki import json from nonebot.adapters.cqhttp import Bot, MessageEvent +from ATRI.rule import is_in_service from ATRI.service import Service as sv -from ATRI.rule import is_block, is_in_dormant from ATRI.utils.request import post_bytes from ATRI.exceptions import RequestTimeOut @@ -40,10 +40,20 @@ SUPPORTED_LANGUAGES = { } +__doc__ = """ +在线运行代码 +权限组:所有人 +用法: + /code (lang) (code) +示例: + /code python + print('Hello world!') +""" + code_runner = sv.on_command( - cmd="/code", - docs="在线运行代码", - rule=is_block() & is_in_dormant() + cmd="code", + docs=__doc__, + rule=is_in_service('code') ) @code_runner.handle() -- cgit v1.2.3