Code cleanup

This commit is contained in:
Pedro Pombeiro 2018-02-22 21:58:54 +01:00
parent 2efe7e508c
commit fef64a854b
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
3 changed files with 16 additions and 10 deletions

View File

@ -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 => {

View File

@ -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()

View File

@ -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: