pub struct ChatbotReplier { /* private fields */ }Expand description
聊天机器人回复工具
Implementations§
Source§impl ChatbotReplier
impl ChatbotReplier
Sourcepub fn new(
http_client: HttpClient,
token_manager: Arc<TokenManager>,
client_id: String,
) -> Self
pub fn new( http_client: HttpClient, token_manager: Arc<TokenManager>, client_id: String, ) -> Self
创建新的 ChatbotReplier
Sourcepub async fn reply_text(
&self,
text: &str,
incoming_message: &ChatbotMessage,
) -> Result<Value>
pub async fn reply_text( &self, text: &str, incoming_message: &ChatbotMessage, ) -> Result<Value>
通过 session webhook 回复文本消息
Sourcepub async fn reply_markdown(
&self,
title: &str,
text: &str,
incoming_message: &ChatbotMessage,
) -> Result<Value>
pub async fn reply_markdown( &self, title: &str, text: &str, incoming_message: &ChatbotMessage, ) -> Result<Value>
通过 session webhook 回复 markdown 消息
Sourcepub async fn reply_card(
&self,
card_data: &Value,
incoming_message: &ChatbotMessage,
at_sender: bool,
at_all: bool,
) -> Result<String>
pub async fn reply_card( &self, card_data: &Value, incoming_message: &ChatbotMessage, at_sender: bool, at_all: bool, ) -> Result<String>
发送互动卡片 (OpenAPI)
Sourcepub async fn update_card(
&self,
card_biz_id: &str,
card_data: &Value,
) -> Result<Value>
pub async fn update_card( &self, card_biz_id: &str, card_data: &Value, ) -> Result<Value>
更新互动卡片
Sourcepub fn create_ai_card_replier(
&self,
incoming_message: &ChatbotMessage,
) -> AICardReplier
pub fn create_ai_card_replier( &self, incoming_message: &ChatbotMessage, ) -> AICardReplier
创建 AI 卡片回复器,用于自定义模板场景
Sourcepub async fn reply_markdown_card(
&self,
markdown: &str,
incoming_message: &ChatbotMessage,
title: &str,
logo: &str,
at_sender: bool,
at_all: bool,
) -> Result<MarkdownCardInstance>
pub async fn reply_markdown_card( &self, markdown: &str, incoming_message: &ChatbotMessage, title: &str, logo: &str, at_sender: bool, at_all: bool, ) -> Result<MarkdownCardInstance>
回复 Markdown 卡片
Sourcepub async fn reply_rpa_plugin_card(
&self,
incoming_message: &ChatbotMessage,
plugin_id: &str,
plugin_version: &str,
plugin_name: &str,
ability_name: &str,
plugin_args: &Value,
goal: &str,
corp_id: &str,
recipients: Option<&[String]>,
) -> Result<RPAPluginCardInstance>
pub async fn reply_rpa_plugin_card( &self, incoming_message: &ChatbotMessage, plugin_id: &str, plugin_version: &str, plugin_name: &str, ability_name: &str, plugin_args: &Value, goal: &str, corp_id: &str, recipients: Option<&[String]>, ) -> Result<RPAPluginCardInstance>
回复 RPA 插件卡片
回复带按钮的 Markdown 卡片
回复带按钮的 AI Markdown 卡片
Sourcepub async fn reply_carousel_card(
&self,
incoming_message: &ChatbotMessage,
markdown: &str,
image_slider: &[(String, String)],
button_text: &str,
title: &str,
logo: &str,
) -> Result<CarouselCardInstance>
pub async fn reply_carousel_card( &self, incoming_message: &ChatbotMessage, markdown: &str, image_slider: &[(String, String)], button_text: &str, title: &str, logo: &str, ) -> Result<CarouselCardInstance>
回复轮播图卡片
Sourcepub async fn ai_markdown_card_start(
&self,
incoming_message: &ChatbotMessage,
title: &str,
logo: &str,
recipients: Option<&[String]>,
) -> Result<AIMarkdownCardInstance>
pub async fn ai_markdown_card_start( &self, incoming_message: &ChatbotMessage, title: &str, logo: &str, recipients: Option<&[String]>, ) -> Result<AIMarkdownCardInstance>
发起 AI 卡片
Sourcepub fn extract_text(incoming_message: &ChatbotMessage) -> Option<Vec<String>>
pub fn extract_text(incoming_message: &ChatbotMessage) -> Option<Vec<String>>
从消息中提取文本列表
Sourcepub async fn extract_and_reupload_images(
&self,
incoming_message: &ChatbotMessage,
) -> Result<Vec<String>>
pub async fn extract_and_reupload_images( &self, incoming_message: &ChatbotMessage, ) -> Result<Vec<String>>
从消息中提取图片,下载后重新上传到钉钉
Sourcepub async fn get_image_download_url(
&self,
download_code: &str,
) -> Result<String>
pub async fn get_image_download_url( &self, download_code: &str, ) -> Result<String>
根据 download_code 获取图片下载 URL
Auto Trait Implementations§
impl Freeze for ChatbotReplier
impl !RefUnwindSafe for ChatbotReplier
impl Send for ChatbotReplier
impl Sync for ChatbotReplier
impl Unpin for ChatbotReplier
impl UnsafeUnpin for ChatbotReplier
impl !UnwindSafe for ChatbotReplier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more