Ejemplo n.º 1
0
    def process_message(self, message):
        if not type(message) in [SlackMessage, SlackPong]:
            return

        if type(message) is SlackMessage:
            if does_msg_contain_prefix("!version", message.text):
                yield from self.send_version_message(message.channel)

        if type(message) is SlackPong:
            self.log.debug(str(message))
Ejemplo n.º 2
0
    def process_message(self, message):
        if not type(message) in [SlackMessage, SlackPong]:
            return

        if type(message) is SlackMessage:
            if does_msg_contain_prefix("!version", message.text):
                yield from self.send_version_message(message.channel)

        if type(message) is SlackPong:
            self.log.debug(str(message))
Ejemplo n.º 3
0
    def process_message(self, message):
        """
        Main method that handles all messages sent to this plugin
        """
        if not type(message) is SlackMessage:
            return

        parsed_message = parse_msg_with_prefix("!lock", message.text)
        if not parsed_message:
            return

        if does_msg_contain_prefix("acquire", parsed_message):
            yield from self.rundeck_lock.toggle_rundeck_lock(message,
                                                             lock_job=True)
        elif does_msg_contain_prefix("release", parsed_message):
            yield from self.rundeck_lock.toggle_rundeck_lock(message,
                                                             lock_job=False)
        elif does_msg_contain_prefix("status", parsed_message):
            yield from self.rundeck_lock.print_lock_status(message)
    def process_message(self, message):
        """
        Main method that handles all messages sent to this plugin
        """
        if not type(message) is SlackMessage:
            return
        parsed_message = parse_msg_with_prefix("!lassie", message.text)
        if not parsed_message:  # pragma: no cover
            return

        if does_msg_contain_prefix("services", parsed_message):
            yield from self.print_service_list(message)
        else:
            yield from self.trigger_escalation_incident(parsed_message,
                                                        message)
    def process_message(self, message):
        """
        Main method that handles all messages sent to this plugin
        """
        if not type(message) is SlackMessage:
            return
        parsed_message = parse_msg_with_prefix("!lassie", message.text)
        if not parsed_message:  # pragma: no cover
            return

        if does_msg_contain_prefix("services", parsed_message):
            yield from self.print_service_list(message)
        else:
            yield from self.trigger_escalation_incident(
                parsed_message, message)
    def process_message(self, message):
        self.log.info("Processing message %s" % message)

        if not type(message) is SlackMessage:
            return

        if not does_msg_contain_prefix("!hn", message.text):
            return

        raw_story_ids = yield from self.get_all_hn_top_stories()
        return_attachment = yield from self.print_top_n_hn_stories(self.num_articles, raw_story_ids)
        yield from self.slack.api_call(
            'chat.postMessage',
            channel=message.channel,
            attachments=return_attachment,
            as_user=False,
            username="******",
            icon_url="https://s3-us-west-2.amazonaws.com/slack-files2/bot_icons/2016-03-18/27749445461_48.png"
        )
    def process_message(self, message):
        self.log.info("Processing message %s" % message)

        if not type(message) is SlackMessage:
            return

        if not does_msg_contain_prefix("!hn", message.text):
            return

        raw_story_ids = yield from self.get_all_hn_top_stories()
        return_attachment = yield from self.print_top_n_hn_stories(
            self.num_articles, raw_story_ids)
        yield from self.slack.api_call(
            'chat.postMessage',
            channel=message.channel,
            attachments=return_attachment,
            as_user=False,
            username="******",
            icon_url=
            "https://s3-us-west-2.amazonaws.com/slack-files2/bot_icons/2016-03-18/27749445461_48.png"
        )
 def test_prefix_twelve(self):
     msg = "!helpsasdfsdf"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertFalse(retval)
Ejemplo n.º 9
0
 def process_message(self, message):
     if not type(message) is SlackMessage:
         return
     if does_msg_contain_prefix("!help", message.text):
         yield from self.send_help_message(message.channel)
 def test_prefix_eight(self):
     msg = "!help  asdfsadfa"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertTrue(retval)
Ejemplo n.º 11
0
 def process_message(self, message):
     if not type(message) is SlackMessage:
         return
     if does_msg_contain_prefix("!help", message.text):
         yield from self.send_help_message(message.channel)
 def test_prefix_one(self):
     msg = "!HELP"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertTrue(retval)
 def test_prefix_thirteen(self):
     msg = "  !help lllllllllllllllll  asdfsadf"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertTrue(retval)
 def test_prefix_twelve(self):
     msg = "!helpsasdfsdf"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertFalse(retval)
 def test_prefix_fourteen(self):
     msg = "  !help                                    "
     retval = does_msg_contain_prefix("!help", msg)
     self.assertTrue(retval)
 def test_prefix_fourteen(self):
     msg = "  !help                                    "
     retval = does_msg_contain_prefix("!help", msg)
     self.assertTrue(retval)
 def test_prefix_thirteen(self):
     msg = "  !help lllllllllllllllll  asdfsadf"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertTrue(retval)
 def test_prefix_four(self):
     msg = "!helps"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertFalse(retval)
 def test_prefix_one(self):
     msg = "!HELP"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertTrue(retval)
 def test_prefix_eight(self):
     msg = "!help  asdfsadfa"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertTrue(retval)
 def test_prefix_four(self):
     msg = "!helps"
     retval = does_msg_contain_prefix("!help", msg)
     self.assertFalse(retval)