Browse Source

Code formatting cleanup

develop
Drew Short 5 years ago
parent
commit
c28fb72fc3
  1. 2
      bot/bot.js
  2. 4
      bot/config.js
  3. 4
      bot/engine.js
  4. 2
      bot/message.js
  5. 4
      bot/module/index.js

2
bot/bot.js

@ -96,7 +96,7 @@ class Bot {
botClient.loginWithToken(this.config.accessToken, connectWithToken);
}
updateAvatar(avatarFile, overwrite=false) {
updateAvatar(avatarFile, overwrite = false) {
let matrixClient = this.client;
let botConfig = this.config;
let promises = [Promise.resolve(true)];

4
bot/config.js

@ -3,7 +3,7 @@ let { logger } = require('./logging');
let loadedConfigs = new Map();
function sanitizeConfig(config, fields=[]) {
function sanitizeConfig(config, fields = []) {
let clonedConfig = { ...config };
fields.forEach((field) => {
clonedConfig[field] = '******'
@ -11,7 +11,7 @@ function sanitizeConfig(config, fields=[]) {
return clonedConfig;
}
function getConfig(configFile, sanitizedFields=[], reload=false) {
function getConfig(configFile, sanitizedFields = [], reload = false) {
if (loadedConfigs.has(configFile) && !reload) {
return loadedConfigs.get(configFile);
} else {

4
bot/engine.js

@ -7,7 +7,7 @@ let message = require('./message');
let utility = require('./utility');
let { initModule } = require('./module/abstract');
let sentinelValue = '!';
let commandPrefix = '!';
class Engine {
constructor(config, bot, modules) {
@ -65,7 +65,7 @@ class Engine {
} else {
let messageBody = event.event.content.body;
logger.debug("[%s] %s", room.name, messageBody);
if (messageBody.indexOf(sentinelValue) === 0) {
if (messageBody.indexOf(commandPrefix) === 0) {
let command = messageBody.split(' ')[0].substring(1);
if (engine.commandMap.has(command)) {
engine.commandMap.get(command).handleMessage(event, room, sendResponseMessageCallback(engine.bot));

2
bot/message.js

@ -3,7 +3,7 @@ let messageTypes = {
NOTICE: 'm.notice'
}
function createBasicMessage(body, msgtype=messageTypes.TEXT) {
function createBasicMessage(body, msgtype = messageTypes.TEXT) {
return {
"body": body,
"msgtype": msgtype

4
bot/module/index.js

@ -2,8 +2,8 @@
* Manage the registered modules
*/
let admin = require('./admin');
let giphy = require('./giphy')
let admin = require('./admin');
let giphy = require('./giphy')
function getModules() {
return [

Loading…
Cancel
Save