UNPKG

pockybot

Version:

Spark bot that handles team recognition

32 lines (31 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const trigger_1 = require("../../models/trigger"); const constants_1 = require("../../constants"); const command_1 = require("../../models/command"); const xmlMessageParser_1 = require("../parsers/xmlMessageParser"); class Rotation extends trigger_1.default { constructor(config) { super(); this.config = config; } isToTriggerOn(message) { let parsedMessage = xmlMessageParser_1.default.parseNonPegMessage(message); return parsedMessage.botId === constants_1.default.botId && parsedMessage.command.toLowerCase() === command_1.Command.Rotation; } isToTriggerOnPM(message) { return message.text.toLowerCase().trim() === command_1.Command.Rotation; } async createMessage() { const data = this.config.getStringConfig('rotation')[0]; let newMessage = `## Here's the snack buying rotation:\n\n`; data.split(',').forEach(item => { newMessage += `* ${item}\n`; }); return { markdown: newMessage }; } } exports.default = Rotation; ;