public void updateStatus ( ) { Optional < Activity > activity = api . getActivity ( ) ; ObjectNode updateStatus = JsonNodeFactory . instance . objectNode ( ) . put ( "op" , GatewayOpcode . STATUS_UPDATE . getCode ( ) ) ; ObjectNode data = updateStatus . putObject ( "d" ) . put ( "status" , api . getStatus ( ) . getStatusString ( ) ) . put ( "afk" , false ) . putNull ( "since" ) ; ObjectNode activityJson = data . putObject ( "game" ) ; activityJson . put ( "name" , activity . isPresent ( ) ? activity . get ( ) . getName ( ) : null ) ; activityJson . put ( "type" , activity . map ( g -> g . getType ( ) . getId ( ) ) . orElse ( 0 ) ) ; activity . ifPresent ( g -> g . getStreamingUrl ( ) . ifPresent ( url -> activityJson . put ( "url" , url ) ) ) ; logger . debug ( "Updating status (content: {})" , updateStatus ) ; websocket . get ( ) . sendText ( updateStatus . toString ( ) ) ; }
Sends the update status packet .