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 Details

    • botOwnerIds

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

      protected final java.util.List<java.lang.String> commandPrefixes
      IRC Command Handlers
    • chatQueueSize

      protected java.lang.Integer chatQueueSize
      Size of the ChatQueue
    • chatRateLimit

      protected io.github.bucket4j.Bandwidth chatRateLimit
      Custom RateLimit for ChatMessages
    • whisperRateLimit

      protected io.github.bucket4j.Bandwidth[] whisperRateLimit
      Custom RateLimit for Whispers
    • joinRateLimit

      protected io.github.bucket4j.Bandwidth joinRateLimit
      Custom RateLimit for JOIN/PART
    • ircMessageBucket

      protected io.github.bucket4j.Bucket ircMessageBucket
      Shared bucket for messages
    • ircWhisperBucket

      protected io.github.bucket4j.Bucket ircWhisperBucket
      Shared bucket for whispers
    • ircJoinBucket

      protected io.github.bucket4j.Bucket ircJoinBucket
      Shared bucket for joins
  • Method Details

    • builder

      public static TwitchChatBuilder builder()
      Initialize the builder
      Returns:
      Twitch Chat Builder
    • build

      public TwitchChat build()
      Twitch API Client (Helix)
      Returns:
      TwitchHelix
    • withCommandTrigger

      public TwitchChatBuilder withCommandTrigger​(java.lang.String commandTrigger)
      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

      public TwitchChatBuilder withBotOwnerId​(java.lang.String userId)
      With a Bot Owner's User ID
      Parameters:
      userId - the user id
      Returns:
      TwitchChatBuilder
    • withBotOwnerIds

      public TwitchChatBuilder withBotOwnerIds​(java.util.Collection<java.lang.String> botOwnerIds)
      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 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 java.util.Collection<java.lang.String> getBotOwnerIds()
      User IDs of Bot Owners for applying CommandPermission.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 the TwitchChat instance.
    • withClientId

      public TwitchChatBuilder withClientId​(java.lang.String clientId)
      Client Id
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withClientSecret

      public TwitchChatBuilder withClientSecret​(java.lang.String clientSecret)
      Client Secret
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withRequestQueueSize

      public TwitchChatBuilder withRequestQueueSize​(java.lang.Integer requestQueueSize)
      HTTP Request Queue Size
      Returns:
      a clone of this object, except with this updated property (returns this if 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 this if 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 this if 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 this if 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 this if an identical value is passed).
    • withBaseUrl

      public TwitchChatBuilder withBaseUrl​(java.lang.String baseUrl)
      A custom websocket url for TwitchChat to connect to. Must include the scheme (e.g. ws:// or wss://).
      Returns:
      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.

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

      public TwitchChatBuilder setBotOwnerIds​(java.util.Collection<java.lang.String> botOwnerIds)
      User IDs of Bot Owners for applying CommandPermission.OWNER
      Returns:
      this.
    • withChatQueueSize

      public TwitchChatBuilder withChatQueueSize​(java.lang.Integer chatQueueSize)
      Size of the ChatQueue
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withChatRateLimit

      public TwitchChatBuilder withChatRateLimit​(io.github.bucket4j.Bandwidth chatRateLimit)
      Custom RateLimit for ChatMessages
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withWhisperRateLimit

      public TwitchChatBuilder withWhisperRateLimit​(io.github.bucket4j.Bandwidth[] whisperRateLimit)
      Custom RateLimit for Whispers
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withJoinRateLimit

      public TwitchChatBuilder withJoinRateLimit​(io.github.bucket4j.Bandwidth joinRateLimit)
      Custom RateLimit for JOIN/PART
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withIrcMessageBucket

      public TwitchChatBuilder withIrcMessageBucket​(io.github.bucket4j.Bucket ircMessageBucket)
      Shared bucket for messages
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withIrcWhisperBucket

      public TwitchChatBuilder withIrcWhisperBucket​(io.github.bucket4j.Bucket ircWhisperBucket)
      Shared bucket for whispers
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withIrcJoinBucket

      public TwitchChatBuilder withIrcJoinBucket​(io.github.bucket4j.Bucket ircJoinBucket)
      Shared bucket for joins
      Returns:
      a clone of this object, except with this updated property (returns this if 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 this if an identical value is passed).
    • withChatQueueTimeout

      public TwitchChatBuilder withChatQueueTimeout​(long chatQueueTimeout)
      Millisecond wait time for taking items off chat queue. Default recommended
      Returns:
      a clone of this object, except with this updated property (returns this if 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 this if an identical value is passed).
    • withAutoJoinOwnChannel

      public TwitchChatBuilder withAutoJoinOwnChannel​(boolean autoJoinOwnChannel)
      Whether one's own channel should automatically be joined
      Returns:
      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.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).