|
7 | 7 | use wechat_oa_sdk::Config; |
8 | 8 | use wechat_oa_sdk::WeChatClient; |
9 | 9 | use wechat_oa_sdk::api::message::IncomingMessage; |
10 | | -use wechat_oa_sdk::models::reply::{TextReply, NewsReply, NewsArticle, empty_reply}; |
| 10 | +use wechat_oa_sdk::models::reply::{NewsArticle, NewsReply, TextReply, empty_reply}; |
11 | 11 |
|
12 | 12 | fn main() { |
13 | 13 | // Create client with token for signature verification |
@@ -76,14 +76,12 @@ fn handle_message(msg: IncomingMessage) -> String { |
76 | 76 | } |
77 | 77 | IncomingMessage::Image(img) => { |
78 | 78 | // Reply with news article |
79 | | - let articles = vec![ |
80 | | - NewsArticle { |
81 | | - title: "Thanks for the image!".to_string(), |
82 | | - description: "We received your image.".to_string(), |
83 | | - pic_url: img.pic_url.clone(), |
84 | | - url: "https://example.com".to_string(), |
85 | | - } |
86 | | - ]; |
| 79 | + let articles = vec![NewsArticle { |
| 80 | + title: "Thanks for the image!".to_string(), |
| 81 | + description: "We received your image.".to_string(), |
| 82 | + pic_url: img.pic_url.clone(), |
| 83 | + url: "https://example.com".to_string(), |
| 84 | + }]; |
87 | 85 | let reply = NewsReply::new(&img.from_user_name, &img.to_user_name, articles); |
88 | 86 | reply.to_xml() |
89 | 87 | } |
|
0 commit comments