summaryrefslogtreecommitdiff
path: root/ATRI/plugins/code_runner/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/plugins/code_runner/__init__.py')
-rw-r--r--ATRI/plugins/code_runner/__init__.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/ATRI/plugins/code_runner/__init__.py b/ATRI/plugins/code_runner/__init__.py
index 3f5697b..dfe6162 100644
--- a/ATRI/plugins/code_runner/__init__.py
+++ b/ATRI/plugins/code_runner/__init__.py
@@ -13,16 +13,15 @@ _flmt_notice = choice(["慢...慢一..点❤", "冷静1下", "歇会歇会~~"])
code_runner = CodeRunner().on_command("/code", "在线运行一段代码,帮助:/code help")
-
@code_runner.handle()
async def _code_runner(bot: Bot, event: MessageEvent):
user_id = event.get_user_id()
if not _flmt.check(user_id):
await code_runner.finish(_flmt_notice)
-
+
msg = str(event.get_message())
args = msg.split("\n")
-
+
if not args:
content = f"> {MessageSegment.at(user_id)}\n" + "请键入 /code help 以获取帮助~!"
elif args[0] == "help":
@@ -31,6 +30,6 @@ async def _code_runner(bot: Bot, event: MessageEvent):
content = f"> {MessageSegment.at(user_id)}\n" + CodeRunner().list_supp_lang()
else:
content = MessageSegment.at(user_id) + await CodeRunner().runner(msg)
-
+
_flmt.start_cd(user_id)
await code_runner.finish(Message(content))