Пример #1
0
                    req["words"] = ["!boobies", url]
                    self.subhandle_ADD_BOOBIES(req, url)

    #}}}
    def joined(self, channel):  #{{{
        pass

    #}}}


class BoobiesBotFactory(GenericIRCBotFactory):
    def __init__(self, proto, db, channel, nick):  #{{{
        GenericIRCBotFactory.__init__(self, proto, channel, nick)
        self.db = db


# }}}

if __name__ == '__main__':
    # create factory protocol and application
    db = BoobiesDatabaseMongoDB(
        host=sys.argv[2] if len(sys.argv) > 2 else "localhost")
    f = BoobiesBotFactory(BoobiesBot, db, ["#social"], "BoobiesBot")

    # connect factory to this host and port
    reactor.connectTCP(
        sys.argv[1] if len(sys.argv) > 1 else "irc.overthewire.org", 6667, f)

    # run bot
    reactor.run()
#!/usr/bin/python

import sys
from boobies.BoobiesDatabaseMongoDB import *

if __name__ == '__main__':
    x = BoobiesDatabaseMongoDB()
    for l in [s.strip() for s in sys.stdin.readlines()]:
	x.addBoobies(l)
Пример #3
0
#!/usr/bin/env python

from boobies.BoobiesDatabaseMongoDB import *

db = BoobiesDatabaseMongoDB()

ids = db.getAllIds()
c = 0
for i in ids:
    c += 1
    print "Updating %s (%d/%d)" % (i, c, len(ids))
    db.validateAndCacheURL(i, autodelete=True)
print "Done"

ids2 = db.getAllIds()
print "Went from %d to %d URLs" % (len(ids), len(ids2))
Пример #4
0
#!/usr/bin/python

import sys
from boobies.BoobiesDatabaseMongoDB import *

if __name__ == '__main__':
    x = BoobiesDatabaseMongoDB()
    for l in [s.strip() for s in sys.stdin.readlines()]:
        x.addBoobies(l)