예제 #1
0
    def cmd_get(self):
        output_channel = self.input_channel
        output_broadcast = False

        # print merbs in target
        if "target" in self.lp.key_words:
            output_content = "NEXT TARGETS\n"
            output_content += "=" * (len(output_content) - 1) + "\n\n"
            output_content += messagecomposer.output_list(
                self.merbs.get_all_targets())
        # print merbs by tag
        elif self.lp.tag:
            output_content = "#%s\n" % self.lp.tag.upper()
            output_content += "=" * len(self.lp.tag) + "\n\n"
            output_content += messagecomposer.output_list(
                self.merbs.get_all_by_tag(self.lp.tag))

        # print only merbs in windows
        elif "window" in self.lp.key_words:
            output_content = "MERBS IN WINDOW\n"
            output_content += "=" * len(output_content) + "\n\n"
            output_content += messagecomposer.output_list(
                self.merbs.get_all_window())

        # print a list of all merbs
        elif "all" in self.lp.key_words:
            output_content = messagecomposer.output_list(
                self.merbs.get_all(self.lp.timezone, 'countdown'))

        # print single merb
        elif self.lp.merb_found:
            if "info" in self.lp.key_words:
                output_content = self.lp.merb_found.print_long_info(
                    self.lp.timezone)
            else:
                output_content = self.lp.merb_found.print_short_info()

        # no parameter recognized but a guessed merb
        elif self.lp.merb_guessed:
            output_content = "Merb not found. Did you mean %s?" % self.lp.merb_guessed.name
            output_channel = self.input_author

        # no parameter recognized
        else:
            output_content = errors.error_param(self.lp.cmd,
                                                "Missing Parameter. ")
            output_channel = self.input_author

        return {
            "destination": output_channel,
            "content": messagecomposer.prettify(output_content, "CSS"),
            'broadcast': output_broadcast
        }
예제 #2
0
    def cmd_merbs(self):
        output_content = messagecomposer.output_list(self.merbs.get_all_meta())

        return {
            "destination": self.input_author,
            "content": messagecomposer.prettify(output_content, "CSS"),
            'broadcast': False
        }
예제 #3
0
    def cmd_merbs(self):
        output_content = messagecomposer.output_list(
            self.merbs.print_all_meta())

        return [{
            'destination': self.input_author,
            'content': output_content,
            'decoration': 'CSS'
        }]
예제 #4
0
    def cmd_missing(self):
        output_channel = self.input_channel
        output_content = "MISSING ETA"

        if self.lp.tag:
            output_content += " - #%s" % self.lp.tag.upper()
        output_content += " - Timezone: %s" % self.lp.timezone

        output_content += "\n"
        output_content += "=" * len(output_content) + "\n\n"
        output_content += messagecomposer.output_list(
            self.merbs.get_all_missing(self.lp.timezone, self.lp.tag))

        return [{
            'destination': output_channel,
            'content': output_content,
            'decoration': "CSS"
        }]
예제 #5
0
    def cmd_get(self):
        output_channel = self.input_channel

        # print merbs in target
        if "target" in self.lp.key_words:
            output_content = "NEXT TARGETS\n"
            output_content += "=" * (len(output_content) - 1) + "\n\n"
            output_content += messagecomposer.output_list(
                self.merbs.print_all_targets())
        # print merbs by tag
        elif self.lp.tag:
            output_content = "#%s\n" % self.lp.tag.upper()
            output_content += "=" * len(self.lp.tag) + "\n\n"
            output_content += messagecomposer.output_list(
                self.merbs.print_all_by_tag(self.lp.tag))

        # print only merbs in windows
        elif "window" in self.lp.key_words:
            output_content = "MERBS IN WINDOW\n"
            output_content += "=" * len(output_content) + "\n\n"
            output_content += messagecomposer.output_list(
                self.merbs.print_all_in_window())

        # print a list of all merbs
        elif "all" in self.lp.key_words:
            output_content = messagecomposer.output_list(
                self.merbs.print_all())

        elif "today" in self.lp.key_words:
            output_content = messagecomposer.output_list(
                self.merbs.print_all(limit_hours=24))

        # print single merb
        elif self.lp.merb_found:
            if "info" in self.lp.key_words:
                output_content = self.lp.merb_found.print_long_info(
                    self.lp.timezone, v_single=True)

            else:
                output_content = self.lp.merb_found.print_short_info(
                    self.lp.timezone,
                    v_trackers=True,
                    v_only_active_trackers=True,
                    v_single=True)

        # no parameter recognized but a guessed merb
        elif self.lp.merb_guessed:
            output_content = "Merb not found. Did you mean %s?" % self.lp.merb_guessed.name
            output_channel = self.input_author

        # no parameter recognized
        else:
            output_content = errors.error_param(self.lp.cmd,
                                                "Missing Parameter. ")
            output_channel = self.input_author

        return [{
            'destination': output_channel,
            'content': output_content,
            'decoration': "CSS"
        }]