Package com.github.twitch4j.chat
Interface ITwitchChat
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
TwitchChat,TwitchChatConnectionPool
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanDeprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#banUserdefault booleanDeprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#deleteChatMessagesvoidclose()default booleanDeprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#deleteChatMessagesReturns a set of all currently joined channels (without # prefix)com.github.philippheuer.events4j.core.EventManagerlongdefault booleanisChannelJoined(String channelName) Check if Chat is currently in a channelvoidjoinChannel(String channelName) Joins a channelbooleanleaveChannel(String channelName) Parts from a channeldefault booleansendActionMessage(String channel, String message) Sends an action message (/me) in a joined channel.default booleansendAnnouncement(String channel, String message) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#sendChatAnnouncementdefault booleansendMessage(String channel, String message) Sends a message in a joined channel.booleanSends a message to the channel while including the specified message tags.default booleansendMessage(String channel, String message, String nonce, String replyMsgId) Sends a message to the channel while including an optional nonce and/or reply parent.default booleansetEmoteOnly(String channel, boolean enable) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsdefault booleansetFollowersOnly(String channel, Duration time) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsdefault booleansetSlowMode(String channel, int seconds) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsdefault booleansetSubscribersOnly(String channel, boolean enable) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsdefault booleansetUniqueChat(String channel, boolean enable) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsdefault booleanDeprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#banUserdefault booleanDeprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#unbanUser
-
Method Details
-
getEventManager
com.github.philippheuer.events4j.core.EventManager getEventManager() -
joinChannel
Joins a channel- Parameters:
channelName- The target channel name.
-
leaveChannel
Parts from a channel- Parameters:
channelName- The target channel name.- Returns:
- whether the channel was previously joined
-
sendMessage
Sends a message in a joined channel.- Parameters:
channel- The target channel name.message- The message to be sent.- Returns:
- whether the message was added to the queue
-
sendMessage
default boolean sendMessage(String channel, String message, @Unofficial String nonce, String replyMsgId) Sends a message to the channel while including an optional nonce and/or reply parent.- Parameters:
channel- the name of the channel to send the message to.message- the message to be sent.nonce- the cryptographic nonce (optional).replyMsgId- the msgId of the parent message being replied to (optional).- Returns:
- whether the message was added to the queue
-
sendMessage
Sends a message to the channel while including the specified message tags.- Parameters:
channel- the name of the channel to send the message to.message- the message to be sent.tags- the message tags.- Returns:
- whether the message was added to the queue
-
getChannels
Returns a set of all currently joined channels (without # prefix)- Returns:
- a set of channel names
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-
getLatency
long getLatency()- Returns:
- the most recently measured round-trip latency for the socket(s) in milliseconds, or -1 if unknown
-
getChannelIdToChannelName
- Returns:
- cached mappings of channel ids to names
-
getChannelNameToChannelId
- Returns:
- cached mappings of channel names to ids
-
isChannelJoined
Check if Chat is currently in a channel- Parameters:
channelName- channel to check (without # prefix)- Returns:
- boolean
-
sendActionMessage
Sends an action message (/me) in a joined channel.- Parameters:
channel- The target channel name.message- The message to be sent.- Returns:
- whether the message was added to the queue
-
setSlowMode
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean setSlowMode(String channel, int seconds) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsConfigures the slow mode setting for a channel.Non-positive values would disable slow mode. Positive values must not be greater than 1800.
- Parameters:
channel- The target channel name.seconds- The slow mode seconds.- Returns:
- whether the command was added to the queue
-
setFollowersOnly
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean setFollowersOnly(String channel, Duration time) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsConfigures followers only mode in a channel.Passing null (or a negative duration) for time disables followers only. The amount of time must not exceed 3 months.
- Parameters:
channel- The target channel name.time- The amount of time users must be followed.- Returns:
- whether the command was added to the queue
-
setSubscribersOnly
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean setSubscribersOnly(String channel, boolean enable) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsConfigures subscribers only mode in a channel.- Parameters:
channel- The target channel name.enable- Whether the setting should be enabled or disabled.- Returns:
- whether the command was added to the queue
-
setUniqueChat
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean setUniqueChat(String channel, boolean enable) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsConfigures unique chat mode (r9k) in a channel.- Parameters:
channel- The target channel name.enable- Whether the setting should be enabled or disabled.- Returns:
- whether the command was added to the queue
-
setEmoteOnly
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean setEmoteOnly(String channel, boolean enable) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettingsConfigures emote only mode in a channel.- Parameters:
channel- The target channel name.enable- Whether the setting should be enabled or disabled.- Returns:
- whether the command was added to the queue
-
clearChat
Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#deleteChatMessagesClears the history for first-party chat clients.- Parameters:
channel- The target channel name.- Returns:
- whether the command was added to the queue
-
delete
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean delete(String channel, String targetMsgId) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#deleteChatMessagesDeletes a message.- Parameters:
channel- the name of the channel to delete the message from.targetMsgId- the unique id of the message to be deleted.- Returns:
- whether the command was added to the queue
- See Also:
-
timeout
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean timeout(String channel, String user, Duration duration, String reason) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#banUserTimeout a user- Parameters:
channel- channeluser- usernameduration- durationreason- reason- Returns:
- whether the command was added to the queue
-
ban
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean ban(String channel, String user, String reason) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#banUserBan a user- Parameters:
channel- channeluser- usernamereason- reason- Returns:
- whether the command was added to the queue
-
unban
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean unban(String channel, String user) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#unbanUserUnban a user- Parameters:
channel- channeluser- username- Returns:
- whether the command was added to the queue
-
sendAnnouncement
@Unofficial @Deprecated @ScheduledForRemoval(inVersion="2.0.0") default boolean sendAnnouncement(String channel, String message) Deprecated.Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#sendChatAnnouncementSend a mod announcement (accented message)- Parameters:
channel- the name of the channel to send the announcement in.message- the message to be announced.- Returns:
- whether the command was added to the queue
- See Also:
-