Class AbstractTMIProcessor
java.lang.Object
com.gmt2001.twitch.tmi.processors.AbstractTMIProcessor
- All Implemented Interfaces:
- Flow.Subscriber<TMIMessage>
- Direct Known Subclasses:
- CapabilityTMIProcessor,- ClearChatTMIProcessor,- ClearMsgTMIProcessor,- GlobalUserStateTMIProcessor,- JoinTMIProcessor,- NoticeTMIProcessor,- Numeric001TMIProcessor,- Numeric353TMIProcessor,- PartTMIProcessor,- PingTMIProcessor,- PrivMsgTMIProcessor,- ReconnectTMIProcessor,- RoomStateTMIProcessor,- UserNoticeTMIProcessor,- UserStateTMIProcessor,- WhisperTMIProcessor
An abstract processor of TMI messages
- Author:
- gmt2001
- 
Field SummaryFieldsModifier and TypeFieldDescriptionThe IRC commands this processor listens toprotected Flow.SubscriptionThe flow subscription
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedConstructor.protectedAbstractTMIProcessor(String command) Constructor.protectedAbstractTMIProcessor(String[] commands) Constructor.protectedAbstractTMIProcessor(List<String> commands) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionprotected Stringchannel()Shortcut to get the channel nameprotected voidonClose()Default handler for TMIMessageType.CLOSE, no-opfinal voidSets this.subscription to null, then calls onFlowCompletefinal voidSends the stack trace to the logger, then calls onFlowErrorprotected voidOverride this method to handle Flow.Subscriber.OnComplete, called after this.subscription is set to nullprotected voidonFlowError(Throwable throwable) Override this method to handle Flow.Subscriber.OnError, called after the stack trace is sent to the loggerprotected voidonFlowNext(TMIMessage item) Override this method to handle Flow.Subscriber.OnNext, called after the default handlers for TMIMessageTypeprotected voidOverride this method to handle Flow.Subscriber.OnSubscribe, called after this.subscription is setprotected abstract voidonMessage(TMIMessage item) Called when a TMIMessage of type TMIMessageType.MESSAGE is receivedfinal voidonNext(TMIMessage item) Calls the default handlers by message type, then calls onFlowNextprotected voidonOpen()Default handler for TMIMessageType.OPEN, no-opfinal voidonSubscribe(Flow.Subscription subscription) Saves the subscription to this.subscription, then calls onFlowSubscribeprotected CaselessPropertiesShortcut to get the instance ofCaselessPropertiesprotected StringShortcut toCaselessProperties.getProperty(java.lang.String)protected TwitchSessionsession()Shortcut to get the instance ofTwitchSessionprotected final voidSubscribes to the Flow.Publisher of TwitchMessageInterfaceprotected TwitchMessageInterfacetmi()Shortcut to get the instance ofTwitchMessageInterfaceprotected Stringuser()Shortcut to get the bot username
- 
Field Details- 
subscriptionThe flow subscription
- 
commandsThe IRC commands this processor listens to
 
- 
- 
Constructor Details- 
AbstractTMIProcessorprotected AbstractTMIProcessor()Constructor. Subscribes to the Flow.Publisher and all IRC commands
- 
AbstractTMIProcessorConstructor. Subscribes to the Flow.Publisher and a specified IRC command- Parameters:
- command- The command to subscribe to
 
- 
AbstractTMIProcessorConstructor. Subscribes to the Flow.Publisher and the specified IRC commands- Parameters:
- commands- The commands to subscribe to
 
- 
AbstractTMIProcessorConstructor. Subscribes to the Flow.Publisher and the specified IRC commands- Parameters:
- commands- The commands to subscribe to
 
 
- 
- 
Method Details- 
subscribeprotected final void subscribe()Subscribes to the Flow.Publisher of TwitchMessageInterface
- 
onSubscribeSaves the subscription to this.subscription, then calls onFlowSubscribe- Specified by:
- onSubscribein interface- Flow.Subscriber<TMIMessage>
- Parameters:
- subscription-
 
- 
onNextCalls the default handlers by message type, then calls onFlowNext- Specified by:
- onNextin interface- Flow.Subscriber<TMIMessage>
- Parameters:
- item-
 
- 
onErrorSends the stack trace to the logger, then calls onFlowError- Specified by:
- onErrorin interface- Flow.Subscriber<TMIMessage>
- Parameters:
- throwable-
 
- 
onCompletepublic final void onComplete()Sets this.subscription to null, then calls onFlowComplete- Specified by:
- onCompletein interface- Flow.Subscriber<TMIMessage>
 
- 
onOpenprotected void onOpen()Default handler for TMIMessageType.OPEN, no-op
- 
onCloseprotected void onClose()Default handler for TMIMessageType.CLOSE, no-op
- 
onFlowNextOverride this method to handle Flow.Subscriber.OnNext, called after the default handlers for TMIMessageType- Parameters:
- item- The TMIMessage that was submitted
 
- 
onFlowSubscribeprotected void onFlowSubscribe()Override this method to handle Flow.Subscriber.OnSubscribe, called after this.subscription is set
- 
onFlowErrorOverride this method to handle Flow.Subscriber.OnError, called after the stack trace is sent to the logger- Parameters:
- throwable- The throwable that is causing the subscription to be canceled
 
- 
onFlowCompleteprotected void onFlowComplete()Override this method to handle Flow.Subscriber.OnComplete, called after this.subscription is set to null
- 
onMessageCalled when a TMIMessage of type TMIMessageType.MESSAGE is received- Parameters:
- item- The- TMIMessagethat was received
 
- 
propertiesShortcut to get the instance ofCaselessProperties- Returns:
 
- 
propertyShortcut toCaselessProperties.getProperty(java.lang.String)- Parameters:
- key-
- Returns:
 
- 
tmiShortcut to get the instance ofTwitchMessageInterface- Returns:
 
- 
sessionShortcut to get the instance ofTwitchSession- Returns:
 
- 
userShortcut to get the bot username- Returns:
 
- 
channelShortcut to get the channel name- Returns:
 
 
-