Klasse TwitchChatBuilder

java.lang.Object
com.github.twitch4j.chat.TwitchChatBuilder

public class TwitchChatBuilder extends Object
Twitch Chat

Documentation: https://dev.twitch.tv/docs/irc

  • Felddetails

    • botOwnerIds

      protected Collection<String> botOwnerIds
      User IDs of Bot Owners for applying CommandPermission.OWNER
    • commandPrefixes

      protected Set<String> commandPrefixes
      IRC Command Handlers
    • chatQueueSize

      protected Integer chatQueueSize
      Size of the ChatQueue
    • chatRateLimit

      protected Bandwidth chatRateLimit
      Custom RateLimit for ChatMessages
    • whisperRateLimit

      @Deprecated protected Bandwidth[] whisperRateLimit
      Veraltet.
      Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimit
      Custom RateLimit for Whispers
    • joinRateLimit

      protected Bandwidth joinRateLimit
      Custom RateLimit for JOIN/PART
    • authRateLimit

      protected Bandwidth authRateLimit
      Custom RateLimit for AUTH
    • perChannelRateLimit

      protected Bandwidth perChannelRateLimit
      Custom RateLimit for Messages per Channel

      For example, this can restrict messages per channel at 100/30 (for a verified bot that has a global 7500/30 message limit).

    • ircMessageBucket

      protected Bucket ircMessageBucket
      Shared bucket for messages
    • ircWhisperBucket

      @Deprecated protected Bucket ircWhisperBucket
      Veraltet.
      Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimit
      Shared bucket for whispers
    • ircJoinBucket

      protected Bucket ircJoinBucket
      Shared bucket for joins
    • ircAuthBucket

      protected Bucket ircAuthBucket
      Shared bucket for auths
  • Methodendetails

    • builder

      public static TwitchChatBuilder builder()
      Initialize the builder
      Gibt zurück:
      Twitch Chat Builder
    • build

      public TwitchChat build()
      Twitch API Client (Helix)
      Gibt zurück:
      TwitchHelix
    • withCommandTrigger

      public TwitchChatBuilder withCommandTrigger(String commandTrigger)
      With a CommandTrigger
      Parameter:
      commandTrigger - Command Trigger (Prefix)
      Gibt zurück:
      TwitchChatBuilder
    • withCommandTriggers

      public TwitchChatBuilder withCommandTriggers(Collection<String> commandTrigger)
      With multiple CommandTriggers
      Parameter:
      commandTrigger - Command Trigger (Prefix)
      Gibt zurück:
      TwitchChatBuilder
    • withBotOwnerId

      public TwitchChatBuilder withBotOwnerId(String userId)
      With a Bot Owner's User ID
      Parameter:
      userId - the user id
      Gibt zurück:
      TwitchChatBuilder
    • withBotOwnerIds

      public TwitchChatBuilder withBotOwnerIds(Collection<String> botOwnerIds)
      With multiple Bot Owner User IDs
      Parameter:
      botOwnerIds - the user ids
      Gibt zurück:
      TwitchChatBuilder
    • getWebsocketConnection

      public WebsocketConnection getWebsocketConnection()
      WebsocketConnection

      can be used to inject a mocked connection into the TwitchChat instance

    • getClientId

      public String getClientId()
      Client Id
    • getClientSecret

      public String getClientSecret()
      Client Secret
    • getRequestQueueSize

      public Integer getRequestQueueSize()
      HTTP Request Queue Size
    • getEventManager

      public EventManager getEventManager()
      Event Manager
    • getDefaultEventHandler

      public Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> getDefaultEventHandler()
      EventManager
    • getCredentialManager

      public CredentialManager getCredentialManager()
      Credential Manager
    • getChatAccount

      public OAuth2Credential getChatAccount()
      IRC User Id
    • getBaseUrl

      public String getBaseUrl()
      A custom websocket url for TwitchChat to connect to. Must include the scheme (e.g. ws:// or wss://).
    • isSendCredentialToThirdPartyHost

      public boolean isSendCredentialToThirdPartyHost()
      Whether the OAuth2Credential password 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 Collection<String> getBotOwnerIds()
      User IDs of Bot Owners for applying CommandPermission.OWNER
    • getCommandPrefixes

      public Set<String> getCommandPrefixes()
      IRC Command Handlers
    • getChatQueueSize

      public Integer getChatQueueSize()
      Size of the ChatQueue
    • getChatRateLimit

      public Bandwidth getChatRateLimit()
      Custom RateLimit for ChatMessages
    • getWhisperRateLimit

      @Deprecated public Bandwidth[] getWhisperRateLimit()
      Veraltet.
      Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimit
      Custom RateLimit for Whispers
    • getJoinRateLimit

      public Bandwidth getJoinRateLimit()
      Custom RateLimit for JOIN/PART
    • getAuthRateLimit

      public Bandwidth getAuthRateLimit()
      Custom RateLimit for AUTH
    • getPerChannelRateLimit

      public Bandwidth getPerChannelRateLimit()
      Custom RateLimit for Messages per Channel

      For example, this can restrict messages per channel at 100/30 (for a verified bot that has a global 7500/30 message limit).

    • getIrcMessageBucket

      public Bucket getIrcMessageBucket()
      Shared bucket for messages
    • getIrcWhisperBucket

      @Deprecated public Bucket getIrcWhisperBucket()
      Veraltet.
      Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimit
      Shared bucket for whispers
    • getIrcJoinBucket

      public Bucket getIrcJoinBucket()
      Shared bucket for joins
    • getIrcAuthBucket

      public Bucket getIrcAuthBucket()
      Shared bucket for auths
    • getScheduledThreadPoolExecutor

      public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
      Scheduler Thread Pool Executor
    • getChatQueueTimeout

      public long getChatQueueTimeout()
      Millisecond wait time for taking items off chat queue. Default recommended
    • getProxyConfig

      public 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 the TwitchChat instance.
    • isRemoveChannelOnJoinFailure

      public boolean isRemoveChannelOnJoinFailure()
      Whether join failures should result in removal from current channels.
      Siehe auch:
    • getMaxJoinRetries

      public int getMaxJoinRetries()
      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.
    • getChatJoinTimeout

      public long getChatJoinTimeout()
      The amount of milliseconds to wait after queuing a JOIN before classifying the attempt as a failure.

      If this value is configured too low, the chat instance could mistake a successfully joined channel for a failure. This can be especially problematic when removeChannelOnJoinFailure has been set to true.

    • getWsPingPeriod

      public int getWsPingPeriod()
      WebSocket RFC Ping Period in ms (0 = disabled)
    • getWsCloseDelay

      public int getWsCloseDelay()
      Websocket Close Delay in ms (0 = minimum)
      Siehe auch:
    • getConnectionBackoffStrategy

      public IBackoffStrategy getConnectionBackoffStrategy()
      WebSocket Connection Backoff Strategy
    • isVerifyChatAccountOnReconnect

      public boolean isVerifyChatAccountOnReconnect()
      Whether the getChatAccount() should be validated on reconnection failures.

      If enabled and the token has expired, chat will connect in read-only mode instead.

      If the network connection is too slow, you may want to disable this setting to avoid disconnects while waiting for the result of the validate endpoint.

    • withWebsocketConnection

      protected TwitchChatBuilder withWebsocketConnection(WebsocketConnection websocketConnection)
      WebsocketConnection

      can be used to inject a mocked connection into the TwitchChat instance

      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withClientId

      public TwitchChatBuilder withClientId(String clientId)
      Client Id
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withClientSecret

      public TwitchChatBuilder withClientSecret(String clientSecret)
      Client Secret
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withRequestQueueSize

      public TwitchChatBuilder withRequestQueueSize(Integer requestQueueSize)
      HTTP Request Queue Size
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEventManager

      public TwitchChatBuilder withEventManager(EventManager eventManager)
      Event Manager
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withDefaultEventHandler

      public TwitchChatBuilder withDefaultEventHandler(Class<? extends com.github.philippheuer.events4j.api.service.IEventHandler> defaultEventHandler)
      EventManager
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withCredentialManager

      public TwitchChatBuilder withCredentialManager(CredentialManager credentialManager)
      Credential Manager
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatAccount

      public TwitchChatBuilder withChatAccount(OAuth2Credential chatAccount)
      IRC User Id
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withBaseUrl

      public TwitchChatBuilder withBaseUrl(String baseUrl)
      A custom websocket url for TwitchChat to connect to. Must include the scheme (e.g. ws:// or wss://).
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withSendCredentialToThirdPartyHost

      public TwitchChatBuilder withSendCredentialToThirdPartyHost(boolean sendCredentialToThirdPartyHost)
      Whether the OAuth2Credential password 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.

      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • setBotOwnerIds

      public TwitchChatBuilder setBotOwnerIds(Collection<String> botOwnerIds)
      User IDs of Bot Owners for applying CommandPermission.OWNER
      Gibt zurück:
      this.
    • setCommandPrefixes

      public TwitchChatBuilder setCommandPrefixes(Set<String> commandPrefixes)
      IRC Command Handlers
      Gibt zurück:
      this.
    • withChatQueueSize

      public TwitchChatBuilder withChatQueueSize(Integer chatQueueSize)
      Size of the ChatQueue
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatRateLimit

      public TwitchChatBuilder withChatRateLimit(Bandwidth chatRateLimit)
      Custom RateLimit for ChatMessages
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withWhisperRateLimit

      @Deprecated public TwitchChatBuilder withWhisperRateLimit(Bandwidth[] whisperRateLimit)
      Veraltet.
      Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimit
      Custom RateLimit for Whispers
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withJoinRateLimit

      public TwitchChatBuilder withJoinRateLimit(Bandwidth joinRateLimit)
      Custom RateLimit for JOIN/PART
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withAuthRateLimit

      public TwitchChatBuilder withAuthRateLimit(Bandwidth authRateLimit)
      Custom RateLimit for AUTH
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withPerChannelRateLimit

      public TwitchChatBuilder withPerChannelRateLimit(Bandwidth perChannelRateLimit)
      Custom RateLimit for Messages per Channel

      For example, this can restrict messages per channel at 100/30 (for a verified bot that has a global 7500/30 message limit).

      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withIrcMessageBucket

      public TwitchChatBuilder withIrcMessageBucket(Bucket ircMessageBucket)
      Shared bucket for messages
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withIrcWhisperBucket

      @Deprecated public TwitchChatBuilder withIrcWhisperBucket(Bucket ircWhisperBucket)
      Veraltet.
      Twitch will decommission whispers over IRC on February 18, 2023; please migrate to TwitchHelix#sendWhisper and TwitchLimitRegistry#setLimit
      Shared bucket for whispers
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withIrcJoinBucket

      public TwitchChatBuilder withIrcJoinBucket(Bucket ircJoinBucket)
      Shared bucket for joins
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withIrcAuthBucket

      public TwitchChatBuilder withIrcAuthBucket(Bucket ircAuthBucket)
      Shared bucket for auths
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withScheduledThreadPoolExecutor

      public TwitchChatBuilder withScheduledThreadPoolExecutor(ScheduledThreadPoolExecutor scheduledThreadPoolExecutor)
      Scheduler Thread Pool Executor
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatQueueTimeout

      public TwitchChatBuilder withChatQueueTimeout(long chatQueueTimeout)
      Millisecond wait time for taking items off chat queue. Default recommended
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withProxyConfig

      public TwitchChatBuilder withProxyConfig(ProxyConfig proxyConfig)
      Proxy Configuration
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withAutoJoinOwnChannel

      public TwitchChatBuilder withAutoJoinOwnChannel(boolean autoJoinOwnChannel)
      Whether one's own channel should automatically be joined
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEnableMembershipEvents

      public TwitchChatBuilder withEnableMembershipEvents(boolean enableMembershipEvents)
      Whether JOIN/PART events should be enabled for the TwitchChat instance.
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withRemoveChannelOnJoinFailure

      public TwitchChatBuilder withRemoveChannelOnJoinFailure(boolean removeChannelOnJoinFailure)
      Whether join failures should result in removal from current channels.
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
      Siehe auch:
    • withMaxJoinRetries

      public TwitchChatBuilder withMaxJoinRetries(int maxJoinRetries)
      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.
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatJoinTimeout

      public TwitchChatBuilder withChatJoinTimeout(long chatJoinTimeout)
      The amount of milliseconds to wait after queuing a JOIN before classifying the attempt as a failure.

      If this value is configured too low, the chat instance could mistake a successfully joined channel for a failure. This can be especially problematic when removeChannelOnJoinFailure has been set to true.

      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withWsPingPeriod

      public TwitchChatBuilder withWsPingPeriod(int wsPingPeriod)
      WebSocket RFC Ping Period in ms (0 = disabled)
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withWsCloseDelay

      public TwitchChatBuilder withWsCloseDelay(int wsCloseDelay)
      Websocket Close Delay in ms (0 = minimum)
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
      Siehe auch:
    • withConnectionBackoffStrategy

      public TwitchChatBuilder withConnectionBackoffStrategy(IBackoffStrategy connectionBackoffStrategy)
      WebSocket Connection Backoff Strategy
      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withVerifyChatAccountOnReconnect

      public TwitchChatBuilder withVerifyChatAccountOnReconnect(boolean verifyChatAccountOnReconnect)
      Whether the getChatAccount() should be validated on reconnection failures.

      If enabled and the token has expired, chat will connect in read-only mode instead.

      If the network connection is too slow, you may want to disable this setting to avoid disconnects while waiting for the result of the validate endpoint.

      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withOutboundCommandFilter

      @Deprecated @Internal public TwitchChatBuilder withOutboundCommandFilter(BiPredicate<TwitchChat,String> outboundCommandFilter)
      Veraltet.
      Filter for outbound messages. The command will not be sent to the IRC server if the predicate yields true.

      Only intended for internal use by twitch4j.

      Gibt zurück:
      a clone of this object, except with this updated property (returns this if an identical value is passed).