Beispiel #1
0
import config

def ketchup_listener(arguments):
    return 'mustard' 

def ping_listener(arguments):
    return 'pong'

def jimbob_listener(arguments):
    return 'rocko'

def complex_listener(num_lines):
    messages = []
    if num_lines is not None:
        num_lines_to_print = int(num_lines)
        for j in range(0, num_lines_to_print):
            messages.append('Whoa this is complex!!!')

    return messages

if __name__ == '__main__':
    bot = bot.Bot('test', 'Hello everybody')
    bot.add_simple_listener('ketchup', ketchup_listener)
    bot.add_simple_listener('ping', ping_listener)
    bot.add_simple_listener('jimbob', jimbob_listener)
    bot.add_complex_listener('c', complex_listener)

    # The first argument is the host - a fully qualified domain name.  Second argument is the port.  Third argument is the irc channel
    # example: bot.connect('www.mydomain.com', 6667, 'friends_and_family')
    bot.connect(config.host, config.port, config.channel)
Beispiel #2
0
	def connectall(self):
		for bot in self.bots.values():
			if bot.conn.state == 0:
				bot.connect()
Beispiel #3
0
            elif command == 'help':
                print(
                    'In test mode I support stock, tracked, dow, div, drop, moon, vol, dod, and help'
                )
            elif command == 'dow':
                print(get_dow_stocks(None))
            elif command == 'div':
                print(get_div_stocks(None))
            elif command == 'drop':
                print(get_drop_stocks(None))
            elif command == 'moon':
                print(get_moon_stocks(None))
            elif command == 'vol':
                print(get_vol_stocks(None))
            elif command == 'dod':
                print(get_dod_stocks(None))

    else:
        bot = bot.Bot(mule_name, 'Better than the first')

        bot.add_complex_listener('stock', get_stock_info)
        bot.add_simple_listener('tracked', get_tracked_stocks)
        bot.add_complex_listener('dow', get_dow_stocks)
        bot.add_complex_listener('div', get_div_stocks)
        bot.add_complex_listener('drop', get_drop_stocks)
        bot.add_complex_listener('moon', get_moon_stocks)
        bot.add_complex_listener('vol', get_vol_stocks)
        bot.add_complex_listener('dod', get_dod_stocks)

        bot.connect(mule_network, mule_port, 'pynerds', mule_password)
Beispiel #4
0
            elif command == 'tracked':
                print(get_tracked_stocks(''))
            elif command == 'help':
                print('In test mode I support stock, tracked, dow, div, drop, moon, vol, dod, and help')
            elif command == 'dow':
                print(get_dow_stocks(None))
            elif command == 'div':
                print(get_div_stocks(None))
            elif command == 'drop':
                print(get_drop_stocks(None))
            elif command == 'moon':
                print(get_moon_stocks(None))
            elif command == 'vol':
                print(get_vol_stocks(None))
            elif command == 'dod':
                print(get_dod_stocks(None))

    else:
        bot = bot.Bot(mule_name, 'Better than the first')

        bot.add_complex_listener('stock', get_stock_info)
        bot.add_simple_listener('tracked', get_tracked_stocks)
        bot.add_complex_listener('dow', get_dow_stocks)
        bot.add_complex_listener('div', get_div_stocks)
        bot.add_complex_listener('drop', get_drop_stocks)
        bot.add_complex_listener('moon', get_moon_stocks)
        bot.add_complex_listener('vol', get_vol_stocks)
        bot.add_complex_listener('dod', get_dod_stocks)

        bot.connect(mule_network, mule_port, 'pynerds', mule_password)
Beispiel #5
0
def init(config):
    global dbpool
    dbpool = DatabaseRunner(config["database"])
    connect("groupchat-received", on_groupchat_received)
    connect("user-joined-room", on_user_joined)
Beispiel #6
0
 def connectall(self):
     for bot in self.bots.itervalues():
         if bot.conn.state == 0:
             bot.connect()