Package com.github.twitch4j.chat
Class TwitchChatBuilder
java.lang.Object
com.github.twitch4j.chat.TwitchChatBuilder
public class TwitchChatBuilder
extends java.lang.Object
Twitch Chat
Documentation: https://dev.twitch.tv/docs/irc
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Collection<java.lang.String>botOwnerIdsUser IDs of Bot Owners for applyingCommandPermission.OWNERprotected java.lang.IntegerchatQueueSizeSize of the ChatQueueprotected io.github.bucket4j.BandwidthchatRateLimitCustom RateLimit for ChatMessagesprotected java.util.List<java.lang.String>commandPrefixesIRC Command Handlersprotected io.github.bucket4j.BucketircJoinBucketShared bucket for joinsprotected io.github.bucket4j.BucketircMessageBucketShared bucket for messagesprotected io.github.bucket4j.BucketircWhisperBucketShared bucket for whispersprotected io.github.bucket4j.BandwidthjoinRateLimitCustom RateLimit for JOIN/PARTprotected io.github.bucket4j.Bandwidth[]whisperRateLimitCustom RateLimit for Whispers -
Method Summary
Modifier and Type Method Description TwitchChatbuild()Twitch API Client (Helix)static TwitchChatBuilderbuilder()Initialize the builderjava.lang.StringgetBaseUrl()A custom websocket url forTwitchChatto connect to.java.util.Collection<java.lang.String>getBotOwnerIds()User IDs of Bot Owners for applyingCommandPermission.OWNERcom.github.philippheuer.credentialmanager.domain.OAuth2CredentialgetChatAccount()IRC User Idjava.lang.IntegergetChatQueueSize()Size of the ChatQueuelonggetChatQueueTimeout()Millisecond wait time for taking items off chat queue.io.github.bucket4j.BandwidthgetChatRateLimit()Custom RateLimit for ChatMessagesjava.lang.StringgetClientId()Client Idjava.lang.StringgetClientSecret()Client Secretjava.util.List<java.lang.String>getCommandPrefixes()IRC Command Handlerscom.github.philippheuer.credentialmanager.CredentialManagergetCredentialManager()Credential Managerjava.lang.Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler>getDefaultEventHandler()EventManagercom.github.philippheuer.events4j.core.EventManagergetEventManager()Event Managerio.github.bucket4j.BucketgetIrcJoinBucket()Shared bucket for joinsio.github.bucket4j.BucketgetIrcMessageBucket()Shared bucket for messagesio.github.bucket4j.BucketgetIrcWhisperBucket()Shared bucket for whispersio.github.bucket4j.BandwidthgetJoinRateLimit()Custom RateLimit for JOIN/PARTcom.github.twitch4j.common.config.ProxyConfiggetProxyConfig()Proxy Configurationjava.lang.IntegergetRequestQueueSize()HTTP Request Queue Sizejava.util.concurrent.ScheduledThreadPoolExecutorgetScheduledThreadPoolExecutor()Scheduler Thread Pool Executorio.github.bucket4j.Bandwidth[]getWhisperRateLimit()Custom RateLimit for WhispersbooleanisAutoJoinOwnChannel()Whether one's own channel should automatically be joinedbooleanisEnableMembershipEvents()Whether JOIN/PART events should be enabled for theTwitchChatinstance.booleanisSendCredentialToThirdPartyHost()Whether theOAuth2Credentialpassword should be sent when the baseUrl does not match the official twitch websocket server, thus bypassing a security check in the library.TwitchChatBuildersetBotOwnerIds(java.util.Collection<java.lang.String> botOwnerIds)User IDs of Bot Owners for applyingCommandPermission.OWNERTwitchChatBuilderwithAutoJoinOwnChannel(boolean autoJoinOwnChannel)Whether one's own channel should automatically be joinedTwitchChatBuilderwithBaseUrl(java.lang.String baseUrl)A custom websocket url forTwitchChatto connect to.TwitchChatBuilderwithBotOwnerId(java.lang.String userId)With a Bot Owner's User IDTwitchChatBuilderwithBotOwnerIds(java.util.Collection<java.lang.String> botOwnerIds)With multiple Bot Owner User IDsTwitchChatBuilderwithChatAccount(com.github.philippheuer.credentialmanager.domain.OAuth2Credential chatAccount)IRC User IdTwitchChatBuilderwithChatQueueSize(java.lang.Integer chatQueueSize)Size of the ChatQueueTwitchChatBuilderwithChatQueueTimeout(long chatQueueTimeout)Millisecond wait time for taking items off chat queue.TwitchChatBuilderwithChatRateLimit(io.github.bucket4j.Bandwidth chatRateLimit)Custom RateLimit for ChatMessagesTwitchChatBuilderwithClientId(java.lang.String clientId)Client IdTwitchChatBuilderwithClientSecret(java.lang.String clientSecret)Client SecretTwitchChatBuilderwithCommandTrigger(java.lang.String commandTrigger)With a CommandTriggerTwitchChatBuilderwithCommandTriggers(java.util.Collection<java.lang.String> commandTrigger)With multiple CommandTriggersTwitchChatBuilderwithCredentialManager(com.github.philippheuer.credentialmanager.CredentialManager credentialManager)Credential ManagerTwitchChatBuilderwithDefaultEventHandler(java.lang.Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> defaultEventHandler)EventManagerTwitchChatBuilderwithEnableMembershipEvents(boolean enableMembershipEvents)Whether JOIN/PART events should be enabled for theTwitchChatinstance.TwitchChatBuilderwithEventManager(com.github.philippheuer.events4j.core.EventManager eventManager)Event ManagerTwitchChatBuilderwithIrcJoinBucket(io.github.bucket4j.Bucket ircJoinBucket)Shared bucket for joinsTwitchChatBuilderwithIrcMessageBucket(io.github.bucket4j.Bucket ircMessageBucket)Shared bucket for messagesTwitchChatBuilderwithIrcWhisperBucket(io.github.bucket4j.Bucket ircWhisperBucket)Shared bucket for whispersTwitchChatBuilderwithJoinRateLimit(io.github.bucket4j.Bandwidth joinRateLimit)Custom RateLimit for JOIN/PARTTwitchChatBuilderwithProxyConfig(com.github.twitch4j.common.config.ProxyConfig proxyConfig)Proxy ConfigurationTwitchChatBuilderwithRequestQueueSize(java.lang.Integer requestQueueSize)HTTP Request Queue SizeTwitchChatBuilderwithScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor scheduledThreadPoolExecutor)Scheduler Thread Pool ExecutorTwitchChatBuilderwithSendCredentialToThirdPartyHost(boolean sendCredentialToThirdPartyHost)Whether theOAuth2Credentialpassword should be sent when the baseUrl does not match the official twitch websocket server, thus bypassing a security check in the library.TwitchChatBuilderwithWhisperRateLimit(io.github.bucket4j.Bandwidth[] whisperRateLimit)Custom RateLimit for WhispersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
botOwnerIds
protected java.util.Collection<java.lang.String> botOwnerIdsUser IDs of Bot Owners for applyingCommandPermission.OWNER -
commandPrefixes
protected final java.util.List<java.lang.String> commandPrefixesIRC Command Handlers -
chatQueueSize
protected java.lang.Integer chatQueueSizeSize of the ChatQueue -
chatRateLimit
protected io.github.bucket4j.Bandwidth chatRateLimitCustom RateLimit for ChatMessages -
whisperRateLimit
protected io.github.bucket4j.Bandwidth[] whisperRateLimitCustom RateLimit for Whispers -
joinRateLimit
protected io.github.bucket4j.Bandwidth joinRateLimitCustom RateLimit for JOIN/PART -
ircMessageBucket
protected io.github.bucket4j.Bucket ircMessageBucketShared bucket for messages -
ircWhisperBucket
protected io.github.bucket4j.Bucket ircWhisperBucketShared bucket for whispers -
ircJoinBucket
protected io.github.bucket4j.Bucket ircJoinBucketShared bucket for joins
-
-
Method Details
-
builder
Initialize the builder- Returns:
- Twitch Chat Builder
-
build
Twitch API Client (Helix)- Returns:
- TwitchHelix
-
withCommandTrigger
With a CommandTrigger- Parameters:
commandTrigger- Command Trigger (Prefix)- Returns:
- TwitchChatBuilder
-
withCommandTriggers
public TwitchChatBuilder withCommandTriggers(java.util.Collection<java.lang.String> commandTrigger)With multiple CommandTriggers- Parameters:
commandTrigger- Command Trigger (Prefix)- Returns:
- TwitchChatBuilder
-
withBotOwnerId
With a Bot Owner's User ID- Parameters:
userId- the user id- Returns:
- TwitchChatBuilder
-
withBotOwnerIds
With multiple Bot Owner User IDs- Parameters:
botOwnerIds- the user ids- Returns:
- TwitchChatBuilder
-
getClientId
public java.lang.String getClientId()Client Id -
getClientSecret
public java.lang.String getClientSecret()Client Secret -
getRequestQueueSize
public java.lang.Integer getRequestQueueSize()HTTP Request Queue Size -
getEventManager
public com.github.philippheuer.events4j.core.EventManager getEventManager()Event Manager -
getDefaultEventHandler
public java.lang.Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> getDefaultEventHandler()EventManager -
getCredentialManager
public com.github.philippheuer.credentialmanager.CredentialManager getCredentialManager()Credential Manager -
getChatAccount
public com.github.philippheuer.credentialmanager.domain.OAuth2Credential getChatAccount()IRC User Id -
getBaseUrl
public java.lang.String getBaseUrl()A custom websocket url forTwitchChatto connect to. Must include the scheme (e.g. ws:// or wss://). -
isSendCredentialToThirdPartyHost
public boolean isSendCredentialToThirdPartyHost()Whether theOAuth2Credentialpassword should be sent when the baseUrl does not match the official twitch websocket server, thus bypassing a security check in the library.Do not depart from the default false value unless you understand the consequences.
-
getBotOwnerIds
public java.util.Collection<java.lang.String> getBotOwnerIds()User IDs of Bot Owners for applyingCommandPermission.OWNER -
getCommandPrefixes
public java.util.List<java.lang.String> getCommandPrefixes()IRC Command Handlers -
getChatQueueSize
public java.lang.Integer getChatQueueSize()Size of the ChatQueue -
getChatRateLimit
public io.github.bucket4j.Bandwidth getChatRateLimit()Custom RateLimit for ChatMessages -
getWhisperRateLimit
public io.github.bucket4j.Bandwidth[] getWhisperRateLimit()Custom RateLimit for Whispers -
getJoinRateLimit
public io.github.bucket4j.Bandwidth getJoinRateLimit()Custom RateLimit for JOIN/PART -
getIrcMessageBucket
public io.github.bucket4j.Bucket getIrcMessageBucket()Shared bucket for messages -
getIrcWhisperBucket
public io.github.bucket4j.Bucket getIrcWhisperBucket()Shared bucket for whispers -
getIrcJoinBucket
public io.github.bucket4j.Bucket getIrcJoinBucket()Shared bucket for joins -
getScheduledThreadPoolExecutor
public java.util.concurrent.ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()Scheduler Thread Pool Executor -
getChatQueueTimeout
public long getChatQueueTimeout()Millisecond wait time for taking items off chat queue. Default recommended -
getProxyConfig
public com.github.twitch4j.common.config.ProxyConfig getProxyConfig()Proxy Configuration -
isAutoJoinOwnChannel
public boolean isAutoJoinOwnChannel()Whether one's own channel should automatically be joined -
isEnableMembershipEvents
public boolean isEnableMembershipEvents()Whether JOIN/PART events should be enabled for theTwitchChatinstance. -
withClientId
Client Id- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withClientSecret
Client Secret- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withRequestQueueSize
HTTP Request Queue Size- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withEventManager
public TwitchChatBuilder withEventManager(com.github.philippheuer.events4j.core.EventManager eventManager)Event Manager- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withDefaultEventHandler
public TwitchChatBuilder withDefaultEventHandler(java.lang.Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> defaultEventHandler)EventManager- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withCredentialManager
public TwitchChatBuilder withCredentialManager(com.github.philippheuer.credentialmanager.CredentialManager credentialManager)Credential Manager- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withChatAccount
public TwitchChatBuilder withChatAccount(com.github.philippheuer.credentialmanager.domain.OAuth2Credential chatAccount)IRC User Id- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withBaseUrl
A custom websocket url forTwitchChatto connect to. Must include the scheme (e.g. ws:// or wss://).- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withSendCredentialToThirdPartyHost
public TwitchChatBuilder withSendCredentialToThirdPartyHost(boolean sendCredentialToThirdPartyHost)Whether theOAuth2Credentialpassword should be sent when the baseUrl does not match the official twitch websocket server, thus bypassing a security check in the library.Do not depart from the default false value unless you understand the consequences.
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
setBotOwnerIds
User IDs of Bot Owners for applyingCommandPermission.OWNER- Returns:
this.
-
withChatQueueSize
Size of the ChatQueue- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withChatRateLimit
Custom RateLimit for ChatMessages- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withWhisperRateLimit
Custom RateLimit for Whispers- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withJoinRateLimit
Custom RateLimit for JOIN/PART- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withIrcMessageBucket
Shared bucket for messages- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withIrcWhisperBucket
Shared bucket for whispers- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withIrcJoinBucket
Shared bucket for joins- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withScheduledThreadPoolExecutor
public TwitchChatBuilder withScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor scheduledThreadPoolExecutor)Scheduler Thread Pool Executor- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withChatQueueTimeout
Millisecond wait time for taking items off chat queue. Default recommended- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withProxyConfig
public TwitchChatBuilder withProxyConfig(com.github.twitch4j.common.config.ProxyConfig proxyConfig)Proxy Configuration- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withAutoJoinOwnChannel
Whether one's own channel should automatically be joined- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withEnableMembershipEvents
Whether JOIN/PART events should be enabled for theTwitchChatinstance.- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-