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) {
|
async function setupSlack (robot) {
|
||||||
Slack(robot, slack => {})
|
Slack.setup(robot, slack => {})
|
||||||
|
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
robot.on('slack.connected', event => {
|
robot.on('slack.connected', event => {
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
// Author:
|
// Author:
|
||||||
// PombeirP
|
// PombeirP
|
||||||
|
|
||||||
module.exports.getPullRequestReviewStates = _getPullRequestReviewStates
|
module.exports = {
|
||||||
module.exports.getReviewApprovalState = _getReviewApprovalState
|
getPullRequestReviewStates: _getPullRequestReviewStates,
|
||||||
module.exports.getProjectCardForIssue = _getProjectCardForIssue
|
getReviewApprovalState: _getReviewApprovalState,
|
||||||
module.exports.getOrgProjectByName = _getOrgProjectByName
|
getProjectCardForIssue: _getProjectCardForIssue,
|
||||||
module.exports.getRepoProjectByName = _getRepoProjectByName
|
getOrgProjectByName: _getOrgProjectByName,
|
||||||
module.exports.getProjectColumnByName = _getProjectColumnByName
|
getRepoProjectByName: _getRepoProjectByName,
|
||||||
|
getProjectColumnByName: _getProjectColumnByName
|
||||||
|
}
|
||||||
|
|
||||||
async function _getPullRequestReviewStates (github, prInfo) {
|
async function _getPullRequestReviewStates (github, prInfo) {
|
||||||
let finalReviewsMap = new Map()
|
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 || ''
|
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) {
|
if (!BOT_TOKEN) {
|
||||||
robot.log.error('SLACK_BOT_TOKEN missing, skipping Slack integration')
|
robot.log.error('SLACK_BOT_TOKEN missing, skipping Slack integration')
|
||||||
return
|
return
|
||||||
|
@ -82,7 +86,7 @@ module.exports = (robot, connectCallback) => {
|
||||||
SlackAPI.connect('https://slack.com/api/rtm.connect')
|
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
|
// Send message to Slack
|
||||||
if (robot.slack) {
|
if (robot.slack) {
|
||||||
// TODO BOUNTY migrate away from datastore:
|
// TODO BOUNTY migrate away from datastore:
|
||||||
|
|
Loading…
Reference in New Issue