private void handleServerTextChannel ( JsonNode jsonChannel ) { long channelId = jsonChannel . get ( "id" ) . asLong ( ) ; api . getTextChannelById ( channelId ) . map ( c -> ( ( ServerTextChannelImpl ) c ) ) . ifPresent ( channel -> { String oldTopic = channel . getTopic ( ) ; String newTopic = jsonChannel . has ( "topic" ) && ! jsonChannel . get ( "topic" ) . isNull ( ) ? jsonChannel . get ( "topic" ) . asText ( ) : "" ; if ( ! oldTopic . equals ( newTopic ) ) { channel . setTopic ( newTopic ) ; ServerTextChannelChangeTopicEvent event = new ServerTextChannelChangeTopicEventImpl ( channel , newTopic , oldTopic ) ; api . getEventDispatcher ( ) . dispatchServerTextChannelChangeTopicEvent ( ( DispatchQueueSelector ) channel . getServer ( ) , channel . getServer ( ) , channel , event ) ; } boolean oldNsfwFlag = channel . isNsfw ( ) ; boolean newNsfwFlag = jsonChannel . get ( "nsfw" ) . asBoolean ( ) ; if ( oldNsfwFlag != newNsfwFlag ) { channel . setNsfwFlag ( newNsfwFlag ) ; ServerChannelChangeNsfwFlagEvent event = new ServerChannelChangeNsfwFlagEventImpl ( channel , newNsfwFlag , oldNsfwFlag ) ; api . getEventDispatcher ( ) . dispatchServerChannelChangeNsfwFlagEvent ( ( DispatchQueueSelector ) channel . getServer ( ) , null , channel . getServer ( ) , channel , event ) ; } int oldSlowmodeDelay = channel . getSlowmodeDelayInSeconds ( ) ; int newSlowmodeDelay = jsonChannel . get ( "rate_limit_per_user" ) . asInt ( 0 ) ; if ( oldSlowmodeDelay != newSlowmodeDelay ) { channel . setSlowmodeDelayInSeconds ( newSlowmodeDelay ) ; ServerTextChannelChangeSlowmodeEvent event = new ServerTextChannelChangeSlowmodeEventImpl ( channel , oldSlowmodeDelay , newSlowmodeDelay ) ; api . getEventDispatcher ( ) . dispatchServerTextChannelChangeSlowmodeEvent ( ( DispatchQueueSelector ) channel . getServer ( ) , channel . getServer ( ) , channel , event ) ; } } ) ; }
Handles a server text channel update .