コード例 #1
0
ファイル: BotProtocol.py プロジェクト: yigitbey/esbot
 def connectionMade(self):
     MCBaseClientProtocol.connectionMade(self)
     logging.info("connectionmade")
     self.client = BotClient(self, self.factory.botname)
     
     if self.factory.interfaceNamespace is not None:
         self.factory.interfaceNamespace[self.factory.botname] = self.client
コード例 #2
0
ファイル: BotProtocol.py プロジェクト: yigitbey/esbot
class BotProtocol(MCBaseClientProtocol):
    def connectionMade(self):
        MCBaseClientProtocol.connectionMade(self)
        logging.info("connectionmade")
        self.client = BotClient(self, self.factory.botname)
        
        if self.factory.interfaceNamespace is not None:
            self.factory.interfaceNamespace[self.factory.botname] = self.client
    
    def _handleLogin(self, parts):
        MCBaseClientProtocol._handleLogin(self, parts)
        
        self.client.start()
コード例 #3
0
    for id in busid:
        if busses[id].config['hidden']:
            continue
        eta = busses[id].eta
        response = response + busses[id].config['color'] + '\n'
        for i in xrange(len(eta)):
            stopInfo = eta[i]
            response = response + '%s\t| %s\n' % (stopInfo[0],
                                                  formatTimeStamp(stopInfo[1]))
        response = response + '\n'

    return response


BC = BotClient.BotClient('busbot', 'SLACK_BOT_TOKEN', getETAString)
BC.connect()

if RUN_LIVE:
    while True:
        line = getData(URL)
        data = parseJSON(line)
        busid = data['Positions'].keys()
        for id in busid:
            if busses.has_key(id):
                busses[id].parse(data)
            else:
                busses[id] = Bus(id, data)

        BC.read()
        #print getETAString()
コード例 #4
0
ファイル: crypto.py プロジェクト: KeralaPyApi/KeralaAdmin
import BotClient

from datetime import datetime

cf = datetime.now()
BotClient.new("Token", "send_message")
cs = datetime.now()
print(f"{(cs - cf).microseconds / 1000} ms")

pf = datetime.now()
print("successful login Token\nMethod send")
ps = datetime.now()
print(f"{(ps - pf).microseconds / 1000} ms")