-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
240 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2020 | ||
|
||
Copyright (C) 2020 ysicing <[email protected]> | ||
|
||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
|
||
0. You just DO WHAT THE FUCK YOU WANT TO. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package wxapp | ||
|
||
import ( | ||
"github.com/ysicing/workwxbot" | ||
) | ||
|
||
func main() { | ||
corpid := "xxxx" | ||
agentid := int64(1000000) | ||
secretkey := "xxxx" | ||
client := workwxbot.Client{CropID: corpid, AgentID: agentid, AgentSecret: secretkey} | ||
md := workwxbot.Message{ | ||
ToUser: "xxxx", | ||
MsgType: "markdown", | ||
Markdown: workwxbot.Content{Content: "### 测试"}, | ||
} | ||
client.Send(md) | ||
text := workwxbot.Message{ | ||
ToUser: "xxxx", | ||
MsgType: "text", | ||
Text: workwxbot.Content{Content: "文本测试"}, | ||
} | ||
client.Send(text) | ||
textcard := workwxbot.Message{ | ||
ToUser: "xxx", | ||
MsgType: "textcard", | ||
Textcard: workwxbot.TextCard{ | ||
Title: "hahha", | ||
Description: "xxxx", | ||
Url: "https://jira.baidu.com", | ||
Btntxt: "更多", | ||
}, | ||
} | ||
client.Send(textcard) | ||
news := workwxbot.Message{ | ||
ToUser: "xxxx", | ||
MsgType: "news", | ||
News: workwxbot.News{ | ||
Articles: []workwxbot.Article{ | ||
{ | ||
Title: "中秋节礼品领取", | ||
Description: "今年中秋节公司有豪礼相送", | ||
Url: "https://jira.baidu.com", | ||
Picurl: "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png", | ||
}, | ||
{ | ||
Title: "国庆节礼品领取", | ||
Description: "今年国庆节公司有豪礼相送", | ||
Url: "https://wiki.baidu.com", | ||
Picurl: "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png", | ||
}, | ||
}, | ||
}, | ||
} | ||
client.Send(news) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package wxbot | ||
|
||
import ( | ||
"github.com/ysicing/workwxbot" | ||
) | ||
|
||
//func SendBot() { | ||
// webhook := "http://wr.oa.baidu.com/api/Robot?token=12345678" | ||
// wxbot := workwxbot.NewRobot(webhook) | ||
// configid := "12b9a5fa-xxxx-xxxx-8d7f-a6b4f8c7184f" | ||
// content := "测试 测试哈哈哈哈" | ||
// msg := workwxbot.BotMessage{ | ||
// MsgType: "markdown", | ||
// ProgramType: "OA", | ||
// IsSendNow: true, | ||
// ConfigID: configid, | ||
// Content: content, | ||
// MentionedList: "@all", | ||
// } | ||
// wxbot.Send(msg) | ||
//} | ||
|
||
func main() { | ||
webhook := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=12b9a5fa-xxxx-xxxx-8d7f-a6b4f8c7184f" | ||
wxbot := workwxbot.NewRobot(webhook) | ||
text := workwxbot.WxBotMessage{ | ||
MsgType: "text", | ||
BotText: workwxbot.BotText{ | ||
Content: "测试", | ||
MentionedList: []string{"@all"}, | ||
}, | ||
} | ||
wxbot.Send(text) | ||
markdown := workwxbot.WxBotMessage{ | ||
MsgType: "markdown", | ||
MarkDown: workwxbot.BotMarkDown{Content: "### 哈哈哈"}} | ||
wxbot.Send(markdown) | ||
news := workwxbot.WxBotMessage{ | ||
MsgType: "news", | ||
News: workwxbot.News{ | ||
Articles: []workwxbot.Article{ | ||
{ | ||
Title: "中秋节礼品领取", | ||
Description: "今年中秋节公司有豪礼相送", | ||
Url: "https://jira.baidu.com", | ||
Picurl: "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png", | ||
}, | ||
{ | ||
Title: "国庆节礼品领取", | ||
Description: "今年国庆节公司有豪礼相送", | ||
Url: "https://wiki.baidu.com", | ||
Picurl: "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png", | ||
}, | ||
}, | ||
}, | ||
} | ||
wxbot.Send(news) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.