Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
patrinhani-ciandt committed Nov 27, 2017
1 parent 789676a commit 0a6ace6
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions lib/botkit/CoreBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ function Botkit(configuration) {
} else {
// handle might be a mapping of keyword to callback.
// lets see if the message matches any of the keywords
var match, patterns = that.handler;
for (var p = 0; p < patterns.length; p++) {
let match, patterns = that.handler;
for (let p = 0; p < patterns.length; p++) {
if (patterns[p].pattern && botkit.hears_test([patterns[p].pattern], message)) {
botkit.middleware.heard.run(that.task.bot, message, function (err, bot, message) {
patterns[p].callback(message, that);
Expand All @@ -233,7 +233,7 @@ function Botkit(configuration) {

// none of the messages matched! What do we do?
// if a default exists, fire it!
for (var p = 0; p < patterns.length; p++) {
for (let p = 0; p < patterns.length; p++) {
if (patterns[p].default) {
botkit.middleware.heard.run(that.task.bot, message, function (err, bot, message) {
patterns[p].callback(message, that);
Expand Down Expand Up @@ -489,13 +489,13 @@ function Botkit(configuration) {
var last_user = null;
var multi_users = false;
last_user = messages[0].user;
for (var x = 0; x < messages.length; x++) {
for (let x = 0; x < messages.length; x++) {
if (messages[x].user != last_user) {
multi_users = true;
}
}
last_user = '';
for (var x = 0; x < messages.length; x++) {
for (let x = 0; x < messages.length; x++) {
if (multi_users && messages[x].user != last_user) {
last_user = messages[x].user;
if (txt.length) {
Expand Down Expand Up @@ -562,8 +562,8 @@ function Botkit(configuration) {
this.replaceAttachmentTokens = function (attachments) {

if (attachments && attachments.length) {
for (var a = 0; a < attachments.length; a++) {
for (var key in attachments[a]) {
for (let a = 0; a < attachments.length; a++) {
for (let key in attachments[a]) {
if (typeof (attachments[a][key]) == 'string') {
attachments[a][key] = this.replaceTokens(attachments[a][key]);
} else {
Expand All @@ -572,7 +572,7 @@ function Botkit(configuration) {
}
}
} else {
for (var a in attachments) {
for (let a in attachments) {
if (typeof (attachments[a]) == 'string') {
attachments[a] = this.replaceTokens(attachments[a]);
} else {
Expand Down Expand Up @@ -601,7 +601,7 @@ function Botkit(configuration) {
} catch (err) {
botkit.logger.error('Error in message template. Mustache failed with error: ', err);
rendered = text;
};
}

return rendered;
};
Expand Down Expand Up @@ -823,7 +823,7 @@ function Botkit(configuration) {

botkit.debug('CREATED A CONVO FOR', this.source_message.user, this.source_message.channel);
this.gotoThread('default');
};
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

Expand Down Expand Up @@ -964,7 +964,7 @@ function Botkit(configuration) {
}
}
};
};
}

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

Expand Down Expand Up @@ -1053,7 +1053,8 @@ function Botkit(configuration) {
test = tests[t];
}

if (match = message.text.match(test)) {
let match = message.text.match(test);
if (match) {
message.match = match;
return true;
}
Expand Down Expand Up @@ -1277,10 +1278,10 @@ function Botkit(configuration) {
};

botkit.tick = function () {
for (var t = 0; t < botkit.tasks.length; t++) {
for (let t = 0; t < botkit.tasks.length; t++) {
botkit.tasks[t].tick();
}
for (var t = botkit.tasks.length - 1; t >= 0; t--) {
for (let t = botkit.tasks.length - 1; t >= 0; t--) {
if (!botkit.tasks[t].isActive()) {
botkit.tasks.splice(t, 1);
}
Expand Down Expand Up @@ -1401,7 +1402,7 @@ function Botkit(configuration) {
**/
if (!botkit.config.hostname) {
botkit.config.hostname = '0.0.0.0';
};
}


if (!configuration.logLevel) {
Expand Down

0 comments on commit 0a6ace6

Please sign in to comment.