示例#1
0
文件: main.py 项目: orestotel/chatbot
    def actuators(self, message, nick, pm):
        """ Actuators for modules and functions. Only activates on user messages.
        :param message: The user message recieved.
        :param nick: Nick of the user that sent the message.
        :param pm: Whether or not its a private message. """
        message = str(message)
        print(message)
        if "!" in message[0]:
            if "!hello" in message.lower():
                msg = "Hello there, {}!".format(nick)
                self.send_msg(msg, nick, pm)

            elif "!urban" in message.lower():
                result = urban_dictionary.urban_term(message)
                self.send_msg(result, nick, pm)

            elif "!check" in message.lower():
                result = spelling.check_spelling(message)
                self.send_msg(result, nick, pm)
            elif "!joke" in message.lower():
                result = jokes.random_joke()
                self.send_msg(result, nick, pm)
            elif "!quote" in message.lower():
                result = quote_day.quote_of_the_day()
                self.send_msg(result, nick, pm)
            elif "!sympathy" in message.lower():
                result = sympathy_answer.aww()
                self.send_msg(result, nick, pm)
示例#2
0
文件: main.py 项目: pennev/chatbot
    def actuators(self, message, nick, pm):
        """ Actuators for modules and functions. Only activates on user messages.
        :param message: The user message recieved.
        :param nick: Nick of the user that sent the message.
        :param pm: Whether or not its a private message. """
        message = str(message)
        print(message)
        if "!" in message[0]:
            message_lower = message.lower()

            if "!hello" in message_lower:
                msg = "Hello there, {}!".format(nick)
                self.send_msg(msg, nick, pm)

            elif "!urban" in message_lower:
                result = urban_dictionary.urban_term(message)
                self.send_msg(result, nick, pm)

            elif "!check" in message_lower:
                result = spelling.check_spelling(message)
                self.send_msg(result, nick, pm)

            elif "!roll" in message_lower:
                result = roll.roll(message)
                self.send_msg(result, nick, pm)

            elif "!flip" in message_lower:
                result = roll.coin_flip()
                self.send_msg(result, nick, pm)

            elif "!joke" in message_lower:
                result = jokes.random_joke()
                self.send_msg(result, nick, pm)

            elif "!quote" in message_lower:
                result = quote_day.quote_of_the_day()
                self.send_msg(result, nick, pm)

            elif "!nameday" in message_lower:
                result = name_day.todays_names()
                self.send_msg(result, nick, pm)

            elif "!chucknorris" in message_lower:
                result = jokes.random_chuck_joke()
                self.send_msg(result, nick, pm)

            elif "!meow" in message_lower:
                result = random_cat.random_cat_pic()
                self.send_msg(result, nick, pm)

            elif "!horoscope" in message_lower:
                try:
                    zodiac = message.split(' ', 1)[1].split('\r\n')[0]
                    result = horoscope.get_horoscope(zodiac)
                    self.send_msg(result, nick, pm)
                except IndexError:
                    self.send_msg('Did you forget the zodiac sign?', nick, pm)
示例#3
0
 def urban(self, argument):
     if (argument): return urban_dictionary.urban_term(argument)
     return self.missing_argument()