Code cleanup
This commit is contained in:
parent
2efe7e508c
commit
fef64a854b
2
index.js
2
index.js
|
@ -23,7 +23,7 @@ module.exports = async (robot) => {
|
|||
}
|
||||
|
||||
async function setupSlack (robot) {
|
||||
Slack(robot, slack => {})
|
||||
Slack.setup(robot, slack => {})
|
||||
|
||||
await new Promise(resolve => {
|
||||
robot.on('slack.connected', event => {
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
// Author:
|
||||
// PombeirP
|
||||
|
||||
module.exports.getPullRequestReviewStates = _getPullRequestReviewStates
|
||||
module.exports.getReviewApprovalState = _getReviewApprovalState
|
||||
module.exports.getProjectCardForIssue = _getProjectCardForIssue
|
||||
module.exports.getOrgProjectByName = _getOrgProjectByName
|
||||
module.exports.getRepoProjectByName = _getRepoProjectByName
|
||||
module.exports.getProjectColumnByName = _getProjectColumnByName
|
||||
module.exports = {
|
||||
getPullRequestReviewStates: _getPullRequestReviewStates,
|
||||
getReviewApprovalState: _getReviewApprovalState,
|
||||
getProjectCardForIssue: _getProjectCardForIssue,
|
||||
getOrgProjectByName: _getOrgProjectByName,
|
||||
getRepoProjectByName: _getRepoProjectByName,
|
||||
getProjectColumnByName: _getProjectColumnByName
|
||||
}
|
||||
|
||||
async function _getPullRequestReviewStates (github, prInfo) {
|
||||
let finalReviewsMap = new Map()
|
||||
|
|
10
lib/slack.js
10
lib/slack.js
|
@ -21,9 +21,13 @@ const RTM_EVENTS = require('@slack/client').RTM_EVENTS
|
|||
|
||||
const BOT_TOKEN = process.env.SLACK_BOT_TOKEN || ''
|
||||
|
||||
module.exports.BotUserName = 'probot'
|
||||
module.exports = {
|
||||
BotUserName: 'probot',
|
||||
setup: _setup,
|
||||
sendMessage: _sendMessage
|
||||
}
|
||||
|
||||
module.exports = (robot, connectCallback) => {
|
||||
function _setup (robot, connectCallback) {
|
||||
if (!BOT_TOKEN) {
|
||||
robot.log.error('SLACK_BOT_TOKEN missing, skipping Slack integration')
|
||||
return
|
||||
|
@ -82,7 +86,7 @@ module.exports = (robot, connectCallback) => {
|
|||
SlackAPI.connect('https://slack.com/api/rtm.connect')
|
||||
}
|
||||
|
||||
module.exports.sendMessage = async (robot, room, message) => {
|
||||
async function _sendMessage (robot, room, message) {
|
||||
// Send message to Slack
|
||||
if (robot.slack) {
|
||||
// TODO BOUNTY migrate away from datastore:
|
||||
|
|
Loading…
Reference in New Issue