|
|
@ -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)); |
|
|
|