Beispiel #1
0
    for plugin in os.listdir('plugins'):
        # Ignore blacklisted files, or files not ending with .py
        if plugin in blacklist or not plugin.endswith('.py'):
            continue

        # __import__ uses pythons dot syntax to import, so remove the .py ext.
        name = plugin[:-3]
        plugins[name] = __import__('plugins.' + name, globals(), locals(), -1)

    #---------------------------------------------------------------------------
    # Connect to servers and start working.
    #---------------------------------------------------------------------------

    # Test server connection, need some proper dynamic configuration, but that
    # can come later.
    servers += [connectIRC('irc.rizon.net', 6667, 'bruv')]
    servers[0].raw('JOIN #bruh\r\n')

    # Plugins work by hooking IRC events. Bruh provides one non-IRC related
    # event, 'BRUH'. Plugins that hook this event are called with the server
    # object immediately -- this allows them to do things such as modify the
    # server object before other plugins can access them. Here is where we call
    # those plugins.
    for server in servers:
        # Attach the plugins dictionary here, so that plugins have access to
        # it.  It happens before 'BRUH' hooks so those hooks can process
        # plugins in some way if required.
        server.plugins = plugins

        for hook in bruh.hooks['BRUH']:
            hook(server)
Beispiel #2
0
    for plugin in os.listdir('plugins'):
        # Ignore blacklisted files, or files not ending with .py
        if plugin in blacklist or not plugin.endswith('.py'):
            continue

        # __import__ uses pythons dot syntax to import, so remove the .py ext.
        name = plugin[:-3]
        plugins[name] = __import__('plugins.' + name, globals(), locals(), -1)

    #---------------------------------------------------------------------------
    # Connect to servers and start working.
    #---------------------------------------------------------------------------

    # Test server connection, need some proper dynamic configuration, but that
    # can come later.
    servers += [connectIRC(args.server, args.port, args.nick, args.password)]

    for channel in args.channels:
        servers[0].raw('JOIN %s\r\n' % channel)

    # Plugins work by hooking IRC events. Bruh provides one non-IRC related
    # event, 'BRUH'. Plugins that hook this event are called with the server
    # object immediately -- this allows them to do things such as modify the
    # server object before other plugins can access them. Here is where we call
    # those plugins.
    for server in servers:
        # Attach the plugins dictionary here, so that plugins have access to
        # it.  It happens before 'BRUH' hooks so those hooks can process
        # plugins in some way if required.
        server.plugins = plugins