def analyze_data(self, data): """ analyze_data receives 'data' as bytes, converts those bytes to a unicode string, and attempts to route the data to the appropriate Bottly member for processing. """ data = utils.bytes_to_unicode(data) data = data.split() if len(data) > 1: if data[0] in "PING": self.pong(data[1]) else: command = None message = None user = self.get_user(data[0]) msg_type = data[1] destination = data[2] if len(data) >= 4: message = data[3:] message[0] = message[0][1:] if message[0].startswith(self.trigger): command = message[0] message = message[1:] self.check_input(user, msg_type, destination, command, message)
def analyze_data(self, data): data = utils.bytes_to_unicode(data) print(data) data = data.split() if len(data) > 1: if data[0] in "PING": self.pong(data[1]) else: user = self.get_user(data[0]) msg_type = data[1] destination = data[2] if len(data) >= 4: message = data[3:] message[0] = message[0][1:] if message[0].startswith(self.trigger): command = message[0] message = message[1:] else: command = None else: command = None message = None self.check_input(user, msg_type, destination, command, message)