forked from osdc/osdc-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
32 lines (29 loc) · 767 Bytes
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
const constants = require('./constants');
const getStartsWith = (parsedMessage) => {
let result = null;
if (!parsedMessage) {
return result;
}
for (let botAction in constants.BOT_ACTIONS) {
if (parsedMessage.startsWith(constants.BOT_ACTIONS[botAction])) {
result = constants.BOT_ACTIONS[botAction];
/* eslint-disable no-console */
console.log(`[INFO] In loop ${result}`);
/* eslint-enable no-console */
break;
}
}
return result;
};
const generateBotHelp = () => {
let resultString = 'You can:';
for (let botAction in constants.BOT_ACTIONS) {
resultString += `\n- ${constants.BOT_ACTIONS[botAction]}`;
}
return resultString;
};
module.exports = {
getStartsWith,
generateBotHelp
};