From 15410416e8753a885a9e28107ebae3954ca6f098 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Mon, 25 Dec 2023 19:46:49 +0800 Subject: [PATCH] Update helloworld.py --- helloworld.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/helloworld.py b/helloworld.py index 06ec7e4..580b634 100644 --- a/helloworld.py +++ b/helloworld.py @@ -5,8 +5,10 @@ from nakuru import ( ) from botpy.message import Message, DirectMessage from model.platform.qq import QQ -import time -from cores.qqbot.global_object import AstrMessageEvent +from cores.qqbot.global_object import ( + AstrMessageEvent, + CommandResult +) ''' 注意改插件名噢!格式:XXXPlugin 或 Main @@ -27,10 +29,19 @@ class HelloWorldPlugin: """ def run(self, ame: AstrMessageEvent): if ame.message_str == "helloworld": - return True, tuple([True, "Hello World!!", "helloworld"]) + # return True, tuple([True, "Hello World!!", "helloworld"]) + return CommandResult( + hit=True, + success=True, + message_chain=[Plain("Hello World!!")], + command_name="helloworld" + ) else: - return False, None - + return CommandResult( + hit=False, + success=False, + message_chain=None, + ) """ 插件元信息。 当用户输入 plugin v 插件名称 时,会调用此函数,返回帮助信息。