diff --git a/Cargo.toml b/Cargo.toml index e263e6c..b31c17f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dingtalk" -version = "1.3.0" +version = "1.3.1" authors = ["Hatter Jiang "] edition = "2018" description = "DingTalk Robot Util, Send text/markdown/link messages using DingTalk robot, 钉钉机器人" diff --git a/README.md b/README.md index 67e8c49..cfe2a27 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,8 @@ WeChat Work config: #### Changelog +* v1.3.1 + * Add `DingTalk::new_wechat` * v1.3.0 * Suports WeChat Work now, add type `"type": "wechat"`, supports method `DingTalk::send_text` * v1.2.1 diff --git a/src/lib.rs b/src/lib.rs index 5675542..ae357cf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -267,6 +267,16 @@ impl <'a> DingTalk<'a> { } } + /// Create `DingTalk` for WeChat Work + pub fn new_wechat(key: &'a str) -> Self { + DingTalk { + default_webhook_url: DEFAULT_WECHAT_WORK_ROBOT_URL, + dingtalk_type: DingTalkType::WeChatWork, + access_token: key, + ..Default::default() + } + } + /// Set default webhook url pub fn set_default_webhook_url(&mut self, default_webhook_url: &'a str) { self.default_webhook_url = default_webhook_url;