Package com.github.twitch4j.internal
Class ChatCommandHelixForwarder
java.lang.Object
com.github.twitch4j.internal.ChatCommandHelixForwarder
- All Implemented Interfaces:
BiPredicate<TwitchChat,
String>
@Internal
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.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Instant
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 Summary
ConstructorDescriptionChatCommandHelixForwarder
(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. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiPredicate
and, negate, or
-
Field Details
-
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 callstoken
- the user access token to be specified in api callsidentityProvider
- the twitch identity provider to query token characteristicsexecutor
- the scheduled executor service for performing api calls asynchronouslychannelHelixLimit
- the per channel helix rate limit
-
-
Method Details
-
test
- Specified by:
test
in interfaceBiPredicate<TwitchChat,
String> - Parameters:
chat
- the chat instance with the outbound message callrawIrcCommand
- 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
-