# File lib/server.rb, line 160 def execute(command, params = {}) allow_to_fail = params[:allow_to_fail] params.delete(:allow_to_fail) prepared_command = prepare_command(command, params) @socket.puts(prepared_command) # every response contains an error information. so we wait until we receive a response response = @socket.waitfor(/error id=.*/) response = TeamSpeak3::ServerResponse.parse(response) if response[:errors][:msg] != 'ok' && !allow_to_fail raise TeamSpeak3::Exceptions::CommandExecutionFailed.new( response[:errors][:id], response[:errors][:msg], prepared_command, ) end response end