|
@@ -12,9 +12,9 @@ module.exports = function(crowi) {
|
|
|
slack = {};
|
|
slack = {};
|
|
|
slack.controller = undefined;
|
|
slack.controller = undefined;
|
|
|
|
|
|
|
|
- slack.createBot = function() {
|
|
|
|
|
|
|
+ slack.createBot = function(isForce, isClearToken) {
|
|
|
// alreay created
|
|
// alreay created
|
|
|
- if (bot) {
|
|
|
|
|
|
|
+ if (!isForce && bot) {
|
|
|
return bot;
|
|
return bot;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -28,7 +28,7 @@ module.exports = function(crowi) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (Config.hasSlackToken(config)) {
|
|
|
|
|
|
|
+ if (!isClearToken && Config.hasSlackToken(config)) {
|
|
|
bot = slack.controller.spawn({token: config.notification['slack:token']});
|
|
bot = slack.controller.spawn({token: config.notification['slack:token']});
|
|
|
} else {
|
|
} else {
|
|
|
bot = slack.controller.spawn();
|
|
bot = slack.controller.spawn();
|
|
@@ -39,8 +39,11 @@ module.exports = function(crowi) {
|
|
|
slack.configureSlackApp = function ()
|
|
slack.configureSlackApp = function ()
|
|
|
{
|
|
{
|
|
|
var config = crowi.getConfig();
|
|
var config = crowi.getConfig();
|
|
|
|
|
+ var isDebugSlackbot = false;
|
|
|
|
|
+ isDebugSlackbot = true;
|
|
|
|
|
+
|
|
|
if (Config.hasSlackConfig(config)) {
|
|
if (Config.hasSlackConfig(config)) {
|
|
|
- slack.controller = Botkit.slackbot();
|
|
|
|
|
|
|
+ slack.controller = Botkit.slackbot({debug: isDebugSlackbot});
|
|
|
slack.controller.configureSlackApp({
|
|
slack.controller.configureSlackApp({
|
|
|
clientId: config.notification['slack:clientId'],
|
|
clientId: config.notification['slack:clientId'],
|
|
|
clientSecret: config.notification['slack:clientSecret'],
|
|
clientSecret: config.notification['slack:clientSecret'],
|