Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wx-work bot template #84

Merged
merged 7 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"homepage": "https://github.com/kaiyuanshe/OSSChat#readme",
"dependencies": {
"@types/request": "^2.48.4",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move @types to dev dependencies.

Thanks!

"@reduxjs/toolkit": "^1.3.2",
"array-flatten": "^3.0.0",
"brolog": "^1.6.5",
Expand All @@ -39,6 +40,7 @@
"node-cache": "^5.1.0",
"probot": "^9.8.1",
"qrcode-terminal": "^0.12.0",
"request": "^2.88.2",
"redux": "^4.0.5",
"smee-client": "^1.1.0",
"wechaty": "^0.37.8",
Expand Down
26 changes: 26 additions & 0 deletions src/issue-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { getHAWechaty } from './get-wechaty'

import { Chatops } from './chatops'

import request from 'request'

import {
managedRepoConfig,
log,
Expand Down Expand Up @@ -185,6 +187,30 @@ async function manageIssue (
'issue card for chatops',
)

if (owner === 'juzibot' && repository === 'Juzi-WeChat-Work-Tasks') {
const wxBotUrl = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send'
const key = '974db6af-6b24-41aa-8da6-5ed634d24fcf'

const options = {
body: {
markdown: {
content: `[${urlLinkPayload.title}](${urlLinkPayload.url}) \n ${urlLinkPayload.description}`,
},
msgtype: 'markdown',
},
headers: { 'content-type': 'application/json' },
json: true,
method: 'POST',
qs: { key: key },
url: wxBotUrl,
}

request(options, function (error) {
if (error) throw new Error(error)
})

}

const roomList = await getRoomList(owner, repository)
if (roomList.length <= 0) {
return
Expand Down