feat: 初步实现代码执行器 #210

This commit is contained in:
Soulter
2025-01-08 02:10:27 +08:00
parent 419f77e245
commit b8fb0bee24
6 changed files with 235 additions and 3 deletions
+13
View File
@@ -0,0 +1,13 @@
import os
def _get_magic_code():
'''防止注入攻击'''
return os.getenv("MAGIC_CODE")
def send_text(text: str):
print(f"[ASTRBOT_TEXT_OUTPUT#{_get_magic_code()}]: {text}")
def send_image(image_path: str):
if not os.path.exists(image_path):
raise Exception(f"Image file not found: {image_path}")
print(f"[ASTRBOT_IMAGE_OUTPUT#{_get_magic_code()}]: {image_path}")