Class TwitchClientPoolBuilder
-
Field Summary
Modifier and TypeFieldDescriptionprotected Collection<String>
User IDs of Bot Owners for applyingCommandPermission.OWNER
protected io.github.bucket4j.Bandwidth
Custom RateLimit for AUTHprotected io.github.bucket4j.Bandwidth
Custom RateLimit for Messages per Channelprotected io.github.bucket4j.Bandwidth
Custom RateLimit for JOIN/PARTprotected Integer
Size of the ChatQueueprotected io.github.bucket4j.Bandwidth
Custom RateLimit for ChatMessagesprotected io.github.bucket4j.Bandwidth[]
Deprecated.Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimitIRC Command Handlers -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Initializestatic TwitchClientPoolBuilder
builder()
Initialize the builderUser IDs of Bot Owners for applyingCommandPermission.OWNER
com.github.philippheuer.credentialmanager.domain.OAuth2Credential
Chat Accountio.github.bucket4j.Bandwidth
Custom RateLimit for AUTHio.github.bucket4j.Bandwidth
Custom RateLimit for Messages per Channelio.github.bucket4j.Bandwidth
Custom RateLimit for JOIN/PARTint
The maximum number of retries to make for joining each channel, with exponential backoff.Size of the ChatQueuelong
Wait time for taking items off chat queue in milliseconds.io.github.bucket4j.Bandwidth
Custom RateLimit for ChatMessagesSets the default server used for chatio.github.bucket4j.Bandwidth[]
Deprecated.Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimitClient IdClient SecretIRC Command Handlers@NotNull com.github.philippheuer.credentialmanager.CredentialManager
CredentialManagercom.github.philippheuer.credentialmanager.domain.OAuth2Credential
Default Auth Token for API RequestsClass<? extends com.github.philippheuer.events4j.api.service.IEventHandler>
EventManagercom.github.philippheuer.credentialmanager.domain.OAuth2Credential
Default First-Party OAuth Token for GraphQL callsEnabled: ChatEnabled: EventSub over WebSocketDeprecated.the Extensions API traditionally uses the decommissioned Kraken API.Enabled: GraphQLEnabled: HelixDeprecated.Twitch shutdown the Kraken API in 2022.Enabled: PubSubDeprecated.All of theTwitchMessagingInterfaceBuilder
endpoints have been (or will be) decommissioned by Twitch.com.github.philippheuer.events4j.core.EventManager
EventManagerfeign.Logger.Level
you can overwrite the feign loglevel to print the full requests + responses if neededio.github.bucket4j.Bandwidth
The per-channel rate limit at which chat commands forwarded to helix should be executed.The base URL to use for Helix API calls.long
Millisecond Delay for Client Helper Threadint
int
Proxy ConfigurationRedirect UrlHTTP Request Queue SizeScheduler Thread Pool ExecutorDefault TimeoutUser Agentint
Websocket Close Delay in ms (0 = minimum)int
WebSocket RFC Ping Period in ms (0 = disabled)boolean
Whether chat commands should be executed via the Helix API, if possible.setBotOwnerIds
(Collection<String> botOwnerIds) User IDs of Bot Owners for applyingCommandPermission.OWNER
withBotOwnerId
(String userId) With a Bot Owner's User IDwithChatAccount
(com.github.philippheuer.credentialmanager.domain.OAuth2Credential chatAccount) Chat AccountwithChatAuthLimit
(io.github.bucket4j.Bandwidth chatAuthLimit) Custom RateLimit for AUTHwithChatChannelMessageLimit
(io.github.bucket4j.Bandwidth chatChannelMessageLimit) Custom RateLimit for Messages per ChannelwithChatCommandsViaHelix
(boolean chatCommandsViaHelix) Whether chat commands should be executed via the Helix API, if possible.withChatJoinLimit
(io.github.bucket4j.Bandwidth chatJoinLimit) Custom RateLimit for JOIN/PARTwithChatMaxJoinRetries
(int chatMaxJoinRetries) The maximum number of retries to make for joining each channel, with exponential backoff.withChatQueueSize
(Integer chatQueueSize) Size of the ChatQueuewithChatQueueTimeout
(long chatQueueTimeout) Wait time for taking items off chat queue in milliseconds.withChatRateLimit
(io.github.bucket4j.Bandwidth chatRateLimit) Custom RateLimit for ChatMessageswithChatServer
(String chatServer) Sets the default server used for chatwithChatWhisperLimit
(io.github.bucket4j.Bandwidth[] chatWhisperLimit) Deprecated.Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimitwithClientId
(String clientId) Client IdwithClientSecret
(String clientSecret) Client SecretwithCommandTrigger
(String commandTrigger) With a CommandTriggerwithCredentialManager
(@NotNull com.github.philippheuer.credentialmanager.CredentialManager credentialManager) CredentialManagerwithDefaultAuthToken
(com.github.philippheuer.credentialmanager.domain.OAuth2Credential defaultAuthToken) Default Auth Token for API RequestswithDefaultEventHandler
(Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> defaultEventHandler) EventManagerwithDefaultFirstPartyToken
(com.github.philippheuer.credentialmanager.domain.OAuth2Credential defaultFirstPartyToken) Default First-Party OAuth Token for GraphQL callswithEnableChat
(Boolean enableChat) Enabled: ChatwithEnableChatPool
(Boolean enableChatPool) withEnableEventSocket
(Boolean enableEventSocket) Enabled: EventSub over WebSocketwithEnableExtensions
(Boolean enableExtensions) Deprecated.the Extensions API traditionally uses the decommissioned Kraken API.withEnableGraphQL
(Boolean enableGraphQL) Enabled: GraphQLwithEnableHelix
(Boolean enableHelix) Enabled: HelixwithEnableKraken
(Boolean enableKraken) Deprecated.Twitch shutdown the Kraken API in 2022.withEnablePubSub
(Boolean enablePubSub) Enabled: PubSubwithEnablePubSubPool
(Boolean enablePubSubPool) withEnableTMI
(Boolean enableTMI) Deprecated.All of theTwitchMessagingInterfaceBuilder
endpoints have been (or will be) decommissioned by Twitch.withEventManager
(com.github.philippheuer.events4j.core.EventManager eventManager) EventManagerwithFeignLogLevel
(feign.Logger.Level feignLogLevel) you can overwrite the feign loglevel to print the full requests + responses if neededwithForwardedChatCommandHelixLimitPerChannel
(io.github.bucket4j.Bandwidth forwardedChatCommandHelixLimitPerChannel) Deprecated.withHelixBaseUrl
(String helixBaseUrl) The base URL to use for Helix API calls.withHelperThreadDelay
(long helperThreadDelay) Millisecond Delay for Client Helper ThreadwithHelperThreadRate
(long helperThreadDelay) Deprecated.in favor of withHelperThreadDelaywithMaxChannelsPerChatInstance
(int maxChannelsPerChatInstance) withMaxTopicsPerPubSubInstance
(int maxTopicsPerPubSubInstance) withProxyConfig
(ProxyConfig proxyConfig) Proxy ConfigurationwithRedirectUrl
(String redirectUrl) Redirect UrlwithRequestQueueSize
(Integer requestQueueSize) HTTP Request Queue SizewithScheduledThreadPoolExecutor
(ScheduledThreadPoolExecutor scheduledThreadPoolExecutor) Scheduler Thread Pool ExecutorwithTimeout
(Integer timeout) Default TimeoutwithUserAgent
(String userAgent) User AgentwithWsCloseDelay
(int wsCloseDelay) Websocket Close Delay in ms (0 = minimum)withWsPingPeriod
(int wsPingPeriod) WebSocket RFC Ping Period in ms (0 = disabled)
-
Field Details
-
botOwnerIds
User IDs of Bot Owners for applyingCommandPermission.OWNER
-
commandPrefixes
IRC Command Handlers -
chatQueueSize
Size of the ChatQueue -
chatRateLimit
protected io.github.bucket4j.Bandwidth chatRateLimitCustom RateLimit for ChatMessages -
chatWhisperLimit
Deprecated.Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimitCustom RateLimit for Whispers -
chatJoinLimit
protected io.github.bucket4j.Bandwidth chatJoinLimitCustom RateLimit for JOIN/PART -
chatAuthLimit
protected io.github.bucket4j.Bandwidth chatAuthLimitCustom RateLimit for AUTH -
chatChannelMessageLimit
protected io.github.bucket4j.Bandwidth chatChannelMessageLimitCustom RateLimit for Messages per ChannelFor example, this can restrict messages per channel at 100/30 (for a verified bot that has a global 7500/30 message limit).
-
-
Method Details
-
withBotOwnerId
With a Bot Owner's User ID- Parameters:
userId
- the user id- Returns:
- TwitchClientPoolBuilder
-
withCommandTrigger
With a CommandTrigger- Parameters:
commandTrigger
- Command Trigger (Prefix)- Returns:
- TwitchClientPoolBuilder
-
withHelperThreadRate
Deprecated.in favor of withHelperThreadDelayWith a base thread delay for API calls byTwitchClientHelper
Note: the method name has been a misnomer as it has always set the delay rather than a rate. One can change the rate at any time via
IClientHelper.setThreadRate(long)
.- Parameters:
helperThreadDelay
- TwitchClientHelper Base Thread Delay- Returns:
- TwitchClientPoolBuilder
-
builder
Initialize the builder- Returns:
- Twitch Client Pool Builder
-
build
Initialize- Returns:
TwitchClientPool
initialized class
-
getClientId
Client Id -
getClientSecret
Client Secret -
getUserAgent
User Agent -
getRequestQueueSize
HTTP Request Queue Size -
getRedirectUrl
Redirect Url -
getTimeout
Default Timeout -
getEnableExtensions
Deprecated.the Extensions API traditionally uses the decommissioned Kraken API. While the module now forwards calls to Helix, please migrate to using Helix directly as this module will be removed in the future.Enabled: Extensions- See Also:
-
getEnableHelix
Enabled: Helix -
getEnableKraken
Deprecated.Twitch shutdown the Kraken API in 2022.Enabled: Kraken -
getEnableTMI
Deprecated.All of theTwitchMessagingInterfaceBuilder
endpoints have been (or will be) decommissioned by Twitch.Enabled: TMI -
getEnableChat
Enabled: Chat -
getEnableEventSocket
Enabled: EventSub over WebSocket -
getEnableChatPool
-
getMaxChannelsPerChatInstance
public int getMaxChannelsPerChatInstance() -
getBotOwnerIds
User IDs of Bot Owners for applyingCommandPermission.OWNER
-
getCommandPrefixes
IRC Command Handlers -
getEnablePubSub
Enabled: PubSub -
getEnablePubSubPool
-
getMaxTopicsPerPubSubInstance
public int getMaxTopicsPerPubSubInstance() -
getEnableGraphQL
Enabled: GraphQLThis is an unofficial API that is not intended for third-party use. Use at your own risk. Methods could change or stop working at any time.
-
getChatAccount
public com.github.philippheuer.credentialmanager.domain.OAuth2Credential getChatAccount()Chat Account -
getEventManager
public com.github.philippheuer.events4j.core.EventManager getEventManager()EventManager -
getDefaultEventHandler
public Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> getDefaultEventHandler()EventManager -
getChatQueueSize
Size of the ChatQueue -
getChatRateLimit
public io.github.bucket4j.Bandwidth getChatRateLimit()Custom RateLimit for ChatMessages -
getChatWhisperLimit
Deprecated.Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimitCustom RateLimit for Whispers -
getChatJoinLimit
public io.github.bucket4j.Bandwidth getChatJoinLimit()Custom RateLimit for JOIN/PART -
getChatAuthLimit
public io.github.bucket4j.Bandwidth getChatAuthLimit()Custom RateLimit for AUTH -
getChatChannelMessageLimit
public io.github.bucket4j.Bandwidth getChatChannelMessageLimit()Custom RateLimit for Messages per ChannelFor example, this can restrict messages per channel at 100/30 (for a verified bot that has a global 7500/30 message limit).
-
getChatQueueTimeout
public long getChatQueueTimeout()Wait time for taking items off chat queue in milliseconds. Default recommended -
getChatMaxJoinRetries
public int getChatMaxJoinRetries()The maximum number of retries to make for joining each channel, with exponential backoff. Set to zero or a negative value to disable this feature. -
getChatServer
Sets the default server used for chatDefaults to TwitchChat.TWITCH_WEB_SOCKET_SERVER, you can use TwitchChat.FDGT_TEST_SOCKET_SERVER for testing
-
getHelixBaseUrl
The base URL to use for Helix API calls.Can be adjusted to point to the Twitch CLI Mock API, for example.
-
getCredentialManager
@NotNull public @NotNull com.github.philippheuer.credentialmanager.CredentialManager getCredentialManager()CredentialManager -
getScheduledThreadPoolExecutor
Scheduler Thread Pool Executor -
getHelperThreadDelay
public long getHelperThreadDelay()Millisecond Delay for Client Helper Thread -
getDefaultAuthToken
public com.github.philippheuer.credentialmanager.domain.OAuth2Credential getDefaultAuthToken()Default Auth Token for API Requests -
getDefaultFirstPartyToken
public com.github.philippheuer.credentialmanager.domain.OAuth2Credential getDefaultFirstPartyToken()Default First-Party OAuth Token for GraphQL calls -
getProxyConfig
Proxy Configuration -
getFeignLogLevel
public feign.Logger.Level getFeignLogLevel()you can overwrite the feign loglevel to print the full requests + responses if needed -
getWsPingPeriod
public int getWsPingPeriod()WebSocket RFC Ping Period in ms (0 = disabled) -
getWsCloseDelay
public int getWsCloseDelay()Websocket Close Delay in ms (0 = minimum)- See Also:
-
isChatCommandsViaHelix
public boolean isChatCommandsViaHelix()Whether chat commands should be executed via the Helix API, if possible.Must have
withEnableHelix(Boolean)
set to true. Must havewithEnableChat(Boolean)
orwithEnableChatPool(Boolean)
set to true.Must have
withChatAccount(OAuth2Credential)
orwithDefaultAuthToken(OAuth2Credential)
specified. -
getForwardedChatCommandHelixLimitPerChannel
public io.github.bucket4j.Bandwidth getForwardedChatCommandHelixLimitPerChannel()The per-channel rate limit at which chat commands forwarded to helix should be executed.This prevents commands to a single channel from consuming the entire helix rate limit bucket. As such, this can be restricted further or loosened, depending on how many channels the bot serves.
This has no effect unless
isChatCommandsViaHelix()
is true.Users should migrate to manual helix calls (with whatever throttling they desire) instead.
-
withClientId
Client Id- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withClientSecret
Client Secret- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withUserAgent
User Agent- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withRequestQueueSize
HTTP Request Queue Size- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withRedirectUrl
Redirect Url- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withTimeout
Default Timeout- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEnableExtensions
Deprecated.the Extensions API traditionally uses the decommissioned Kraken API. While the module now forwards calls to Helix, please migrate to using Helix directly as this module will be removed in the future.Enabled: Extensions- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed). - See Also:
-
withEnableHelix
Enabled: Helix- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEnableKraken
Deprecated.Twitch shutdown the Kraken API in 2022.Enabled: Kraken- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEnableTMI
Deprecated.All of theTwitchMessagingInterfaceBuilder
endpoints have been (or will be) decommissioned by Twitch.Enabled: TMI- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEnableChat
Enabled: Chat- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEnableEventSocket
Enabled: EventSub over WebSocket- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEnableChatPool
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withMaxChannelsPerChatInstance
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
setBotOwnerIds
User IDs of Bot Owners for applyingCommandPermission.OWNER
- Returns:
this
.
-
withEnablePubSub
Enabled: PubSub- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEnablePubSubPool
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withMaxTopicsPerPubSubInstance
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEnableGraphQL
Enabled: GraphQLThis is an unofficial API that is not intended for third-party use. Use at your own risk. Methods could change or stop working at any time.
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatAccount
public TwitchClientPoolBuilder withChatAccount(com.github.philippheuer.credentialmanager.domain.OAuth2Credential chatAccount) Chat Account- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withEventManager
public TwitchClientPoolBuilder withEventManager(com.github.philippheuer.events4j.core.EventManager eventManager) EventManager- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withDefaultEventHandler
public TwitchClientPoolBuilder withDefaultEventHandler(Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> defaultEventHandler) EventManager- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatQueueSize
Size of the ChatQueue- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatRateLimit
Custom RateLimit for ChatMessages- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatWhisperLimit
@Deprecated public TwitchClientPoolBuilder withChatWhisperLimit(io.github.bucket4j.Bandwidth[] chatWhisperLimit) Deprecated.Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimitCustom RateLimit for Whispers- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatJoinLimit
Custom RateLimit for JOIN/PART- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatAuthLimit
Custom RateLimit for AUTH- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatChannelMessageLimit
public TwitchClientPoolBuilder withChatChannelMessageLimit(io.github.bucket4j.Bandwidth chatChannelMessageLimit) Custom RateLimit for Messages per ChannelFor example, this can restrict messages per channel at 100/30 (for a verified bot that has a global 7500/30 message limit).
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatQueueTimeout
Wait time for taking items off chat queue in milliseconds. Default recommended- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatMaxJoinRetries
The maximum number of retries to make for joining each channel, with exponential backoff. Set to zero or a negative value to disable this feature.- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withChatServer
Sets the default server used for chatDefaults to TwitchChat.TWITCH_WEB_SOCKET_SERVER, you can use TwitchChat.FDGT_TEST_SOCKET_SERVER for testing
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withHelixBaseUrl
The base URL to use for Helix API calls.Can be adjusted to point to the Twitch CLI Mock API, for example.
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed). - See Also:
-
withCredentialManager
public TwitchClientPoolBuilder withCredentialManager(@NotNull @NotNull com.github.philippheuer.credentialmanager.CredentialManager credentialManager) CredentialManager- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withScheduledThreadPoolExecutor
public TwitchClientPoolBuilder withScheduledThreadPoolExecutor(ScheduledThreadPoolExecutor scheduledThreadPoolExecutor) Scheduler Thread Pool Executor- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withHelperThreadDelay
Millisecond Delay for Client Helper Thread- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withDefaultAuthToken
public TwitchClientPoolBuilder withDefaultAuthToken(com.github.philippheuer.credentialmanager.domain.OAuth2Credential defaultAuthToken) Default Auth Token for API Requests- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withDefaultFirstPartyToken
public TwitchClientPoolBuilder withDefaultFirstPartyToken(com.github.philippheuer.credentialmanager.domain.OAuth2Credential defaultFirstPartyToken) Default First-Party OAuth Token for GraphQL calls- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withProxyConfig
Proxy Configuration- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withFeignLogLevel
you can overwrite the feign loglevel to print the full requests + responses if needed- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withWsPingPeriod
WebSocket RFC Ping Period in ms (0 = disabled)- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withWsCloseDelay
Websocket Close Delay in ms (0 = minimum)- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed). - See Also:
-
withChatCommandsViaHelix
Whether chat commands should be executed via the Helix API, if possible.Must have
withEnableHelix(Boolean)
set to true. Must havewithEnableChat(Boolean)
orwithEnableChatPool(Boolean)
set to true.Must have
withChatAccount(OAuth2Credential)
orwithDefaultAuthToken(OAuth2Credential)
specified.- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withForwardedChatCommandHelixLimitPerChannel
@Deprecated public TwitchClientPoolBuilder withForwardedChatCommandHelixLimitPerChannel(io.github.bucket4j.Bandwidth forwardedChatCommandHelixLimitPerChannel) Deprecated.The per-channel rate limit at which chat commands forwarded to helix should be executed.This prevents commands to a single channel from consuming the entire helix rate limit bucket. As such, this can be restricted further or loosened, depending on how many channels the bot serves.
This has no effect unless
isChatCommandsViaHelix()
is true.Users should migrate to manual helix calls (with whatever throttling they desire) instead.
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-