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