Class ChatCommandHelixForwarder

java.lang.Object
com.github.twitch4j.internal.ChatCommandHelixForwarder
All Implemented Interfaces:
BiPredicate<TwitchChat,String>

public final class ChatCommandHelixForwarder extends Object implements BiPredicate<TwitchChat,String>
Intercepts and forwards outbound IRC messages containing commands to the Helix API, when able.

Allows for a smoother transition when chat commands can no longer be sent over IRC; users simply just need to add the latest scopes to their user access token.

This class is marked as internal, and could face breaking changes at any time.

See Also:
  • Field Details

    • ENABLE_AFTER

      public static final Instant ENABLE_AFTER
      The forwarder will be enabled by default on 2023-02-21 (shortly before the 24-hour brown-out period, and three days before complete shutdown).
  • Constructor Details

    • ChatCommandHelixForwarder

      public ChatCommandHelixForwarder(TwitchHelix helix, com.github.philippheuer.credentialmanager.domain.OAuth2Credential token, TwitchIdentityProvider identityProvider, ScheduledExecutorService executor, io.github.bucket4j.Bandwidth channelHelixLimit)
      Constructs a forwarder of chat commands over IRC to Helix.
      Parameters:
      helix - the helix instance to execute api calls
      token - the user access token to be specified in api calls
      identityProvider - the twitch identity provider to query token characteristics
      executor - the scheduled executor service for performing api calls asynchronously
      channelHelixLimit - the per channel helix rate limit
  • Method Details

    • test

      public boolean test(TwitchChat chat, String rawIrcCommand)
      Specified by:
      test in interface BiPredicate<TwitchChat,String>
      Parameters:
      chat - the chat instance with the outbound message call
      rawIrcCommand - the raw irc command to be sent to the server, if not intercepted
      Returns:
      whether the irc command was forwarded to helix, indicating it does not need to be sent via the chat socket