From cfac27c564c4089e60366b6195b28b238ea3bdb1 Mon Sep 17 00:00:00 2001 From: Threkork Date: Tue, 6 Aug 2024 18:57:29 +0800 Subject: [PATCH] modified: Cargo.toml modified: src/bot/plugin_builder/event.rs --- Cargo.toml | 2 +- src/bot/plugin_builder/event.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e2471ef..caf80e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kovi" -version = "0.2.0-rc1" +version = "0.2.0-rc2" edition = "2021" description = "A fast and lightweight OneBot V11 bot plugin framework" license = "MPL-2.0" diff --git a/src/bot/plugin_builder/event.rs b/src/bot/plugin_builder/event.rs index 017df7c..2832bc2 100644 --- a/src/bot/plugin_builder/event.rs +++ b/src/bot/plugin_builder/event.rs @@ -144,6 +144,14 @@ impl OnMsgEvent { self.api_tx.send((send_msg, None)).unwrap(); } + + /// 获取文本,如果没有文本则会返回空字符串 + pub fn get_text(&self) -> String { + match self.text.clone() { + Some(v) => v, + None => "".to_string(), + } + } } #[derive(Clone)]