def send_command_response(self,
                              source: list,
                              command: str,
                              *args,
                              **kwargs):
        """
        Used in bot observer `on_next` method
        """
        args = _json.dumps(args).encode('utf8')
        kwargs = _json.dumps(kwargs).encode('utf8')
        if isinstance(source, list):
            frame = (*source, b'', command.encode('utf8'), args, kwargs)
        else:
            frame = (b'', command.encode('utf8'), args, kwargs)
        if self._run_control_loop:
            self.add_callback(self.command_socket.send_multipart, frame)
        else:
            self.command_socket.send_multipart(frame)
def send_command_response ( self , source : list , command : str , * args , ** kwargs ) : args = _json . dumps ( args ) . encode ( 'utf8' ) kwargs = _json . dumps ( kwargs ) . encode ( 'utf8' ) if isinstance ( source , list ) : frame = ( * source , b'' , command . encode ( 'utf8' ) , args , kwargs ) else : frame = ( b'' , command . encode ( 'utf8' ) , args , kwargs ) if self . _run_control_loop : self . add_callback ( self . command_socket . send_multipart , frame ) else : self . command_socket . send_multipart ( frame )
Used in bot observer `on_next` method