UNPKG

pockybot

Version:

Spark bot that handles team recognition

37 lines (35 loc) 1.69 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 Welcome 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().startsWith(command_1.Command.Welcome); } isToTriggerOnPM(message) { return message.text.toLowerCase().trim() === command_1.Command.Welcome; } async createMessage() { let markdown = `## Hello world! I'm ${constants_1.default.botName}. I help you spread the word about the great work that your team mates are doing! I hand out pegs to everyone you tell me about.`; if (this.config.getConfig('requireValues')) { markdown += ` Tell us why you’re giving them a peg and include the relevant company values in your description: ${this.config.getStringConfig('keyword').join(', ')}.`; } else { markdown += ` Make sure to tell us why you’re giving them a peg.`; } markdown += `\n\nBut also... if you spot someone shaming our PC security by leaving their desktop unlocked - you can award them a shame peg! Find out how I work by typing @${constants_1.default.botName} help`; return { markdown: markdown }; } } exports.default = Welcome;