def main():
    """HELLO NOSTRADAMUS"""
    index = prophetic_index.InvertedIndex(prophetic_parser.get_prophecies())

    while True:
        text = raw_input("NOSTRADAMBOT CLI >>> ")
        if text:
            print(index.best_prophecy_for(text))
Example #2
0
"""Reveal Nostradamus' prophecies"""
import random

import hippybot.decorators
import prophetic_parser


PROPHECIES = prophetic_parser.get_prophecies()
PROPHECIES_LENGTH = len(PROPHECIES)


class Plugin(object):
    """Reveal Nostradamus' prophecies"""
    global_commands = ['prophecy']
    command_aliases = {'prophecize': 'prophecy'}

    @hippybot.decorators.botcmd
    def prophecy(self, mess, args):
        """Reveal Nostradamus' prophecies"""
        index = random.randrange(0, PROPHECIES_LENGTH)
        return PROPHECIES[index]

    @hippybot.decorators.directcmd
    def hello(self, mess, args):
        """Reveal Nostradamus' prophecies"""
        index = random.randrange(0, PROPHECIES_LENGTH)
        return PROPHECIES[index]