コード例 #1
0
ファイル: bot.py プロジェクト: RPGCodeBase/Lifecost-Hackbot
def main(name):
    if len(sys.argv) < 3:
        print u"Usage: bot.py [email protected] password [logfile]"
    else:
        background.start()

        jid = xmpp.JID(node=sys.argv[1], domain=config.server, resource="LC")
        user, server, password = jid.getNode(), jid.getDomain(), sys.argv[2]

        conn = xmpp.Client(server)
        conres = conn.connect()
        if not conres:
            logging.error(u"Unable to connect to server %s!", server)
            return 1
        if conres <> 'tls':
            logging.warning(
                u"Warning: unable to estabilish secure connection - TLS failed!"
            )

        authres = conn.auth(user, password)
        if not authres:
            logging.error(u"Unable to authorize on %s - check login/password.",
                          server)
            return 1
        if authres != 'sasl':
            logging.error(
                u"Warning: unable to perform SASL auth os %s. Old authentication method used!",
                server)

        conn.RegisterHandler('message', onMessage)
        conn.RegisterHandler('presence', onPresence)
        conn.sendInitPresence()
        joinConference(conn,
                       config.conference,
                       room=config.mainChannel,
                       nickname=name,
                       password="",
                       public=True)
        logging.info("Bot started.")

        counter = 1
        while True:
            #         counter = 20
            if not conn.isConnected(): conn.reconnectAndReauth()
            result = doStep(conn)
            if result == 0:
                break
            if result == '0':
                if doIdle(conn) == 0:
                    break
コード例 #2
0
ファイル: bot.py プロジェクト: themoriarty/lifecostHackbot
def main(name):
    if len(sys.argv)<3:
        print "Usage: bot.py [email protected] password"
    else:
        background.start()

        jid = xmpp.JID(node = sys.argv[1], domain = config.server, resource = "LC")
        user, server, password = jid.getNode(), jid.getDomain(),sys.argv[2]

        conn = xmpp.Client(server, debug=[])
        conres = conn.connect()
        if not conres:
            print "Unable to connect to server %s!"%server
            return 1
        if conres<>'tls':
            print "Warning: unable to estabilish secure connection - TLS failed!"
        
        authres = conn.auth(user,password)
        if not authres:
            print "Unable to authorize on %s - check login/password."%server
            return 1
        if authres != 'sasl':
            print "Warning: unable to perform SASL auth os %s. Old authentication method used!"%server

        conn.RegisterHandler('message', onMessage)
        conn.RegisterHandler('presence', onPresence)
        conn.sendInitPresence()
        joinConference(conn, config.conference, room = config.mainChannel, nickname = name, password = "")
        print "Bot started."

        counter = 10
        while True:
            result = doStep(conn)
            if result == 0:
                break
            if result == '0' or counter == 0:
                doIdle(conn)
                counter = 10
            else:
                counter -= 1
コード例 #3
0
ファイル: bot.py プロジェクト: dralex/Lifecost-Hackbot
def main(name):
    if len(sys.argv)<3:
        print u"Usage: bot.py [email protected] password [logfile]"
    else:
        background.start()

        jid = xmpp.JID(node = sys.argv[1], domain = config.server, resource = "LC")
        user, server, password = jid.getNode(), jid.getDomain(),sys.argv[2]

        conn = xmpp.Client(server)
        conres = conn.connect()
        if not conres:
            logging.error(u"Unable to connect to server %s!",server)
            return 1
        if conres<>'tls':
            logging.warning(u"Warning: unable to estabilish secure connection - TLS failed!")
        
        authres = conn.auth(user,password)
        if not authres:
            logging.error(u"Unable to authorize on %s - check login/password.",server)
            return 1
        if authres != 'sasl':
            logging.error(u"Warning: unable to perform SASL auth os %s. Old authentication method used!",server)

        conn.RegisterHandler('message', onMessage)
        conn.RegisterHandler('presence', onPresence)
        conn.sendInitPresence()
        joinConference(conn, config.conference, room = config.mainChannel, nickname = name, password = "", public = True)
        logging.info("Bot started.")

        counter = 1
        while True:
   #         counter = 20                        
            if not conn.isConnected(): conn.reconnectAndReauth()
            result = doStep(conn)
            if result == 0:
                break;
            if result == '0':
                if doIdle(conn) == 0:
                    break;
コード例 #4
0
ファイル: Main.py プロジェクト: SeanKuehl/Adventure-game
#pictures will be 800 wide by 400 tall
pygame.event.wait()
open = True
pygame.event.get()


def eventHandler():
    pygame.event.get()
    for event in pygame.event.get():
        if event.type == QUIT or (event.type == KEYDOWN
                                  and event.key == K_ESCAPE):
            pygame.quit()
            sys.exit()


#Django is installed, how to use it I will need tutorials for
pygame.event.get()

while open == True:
    pygame.event.get()
    eventHandler()
    pygame.event.get()
    #displaySurface.blit(myImage, (picPosW - myImageRect.center[0], picPosH - myImageRect.center[1]))
    #pygame.display.update()
    pygame.event.get()
    #displaySurface.fill((0, 0, 0))
    if startUp == True:
        pygame.event.wait()
        start(caveSelection, startUp, 0, currentCaveSpot)