Interface ITwitchChat

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
TwitchChat, TwitchChatConnectionPool

public interface ITwitchChat extends AutoCloseable
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    ban(String channel, String user, String reason)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#banUser
    default boolean
    clearChat(String channel)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#deleteChatMessages
    void
     
    default boolean
    delete(String channel, String targetMsgId)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#deleteChatMessages
     
     
    Returns a set of all currently joined channels (without # prefix)
    com.github.philippheuer.events4j.core.EventManager
     
    long
     
    default boolean
    isChannelJoined(String channelName)
    Check if Chat is currently in a channel
    void
    joinChannel(String channelName)
    Joins a channel
    boolean
    leaveChannel(String channelName)
    Parts from a channel
    default boolean
    sendActionMessage(String channel, String message)
    Sends an action message (/me) in a joined channel.
    default boolean
    sendAnnouncement(String channel, String message)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#sendChatAnnouncement
    default boolean
    sendMessage(String channel, String message)
    Sends a message in a joined channel.
    boolean
    sendMessage(String channel, String message, @Nullable Map<String,Object> tags)
    Sends a message to the channel while including the specified message tags.
    default boolean
    sendMessage(String channel, String message, String nonce, String replyMsgId)
    Sends a message to the channel while including an optional nonce and/or reply parent.
    default boolean
    setEmoteOnly(String channel, boolean enable)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettings
    default boolean
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettings
    default boolean
    setSlowMode(String channel, int seconds)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettings
    default boolean
    setSubscribersOnly(String channel, boolean enable)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettings
    default boolean
    setUniqueChat(String channel, boolean enable)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#updateChatSettings
    default boolean
    timeout(String channel, String user, Duration duration, String reason)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#banUser
    default boolean
    unban(String channel, String user)
    Deprecated.
    Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#unbanUser
  • Method Details

    • getEventManager

      com.github.philippheuer.events4j.core.EventManager getEventManager()
    • joinChannel

      void joinChannel(String channelName)
      Joins a channel
      Parameters:
      channelName - The target channel name.
    • leaveChannel

      boolean leaveChannel(String channelName)
      Parts from a channel
      Parameters:
      channelName - The target channel name.
      Returns:
      whether the channel was previously joined
    • sendMessage

      default boolean sendMessage(String channel, String message)
      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

      boolean sendMessage(String channel, String message, @Nullable @Nullable Map<String,Object> tags)
      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

      Set<String> getChannels()
      Returns a set of all currently joined channels (without # prefix)
      Returns:
      a set of channel names
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
    • getLatency

      long getLatency()
      Returns:
      the most recently measured round-trip latency for the socket(s) in milliseconds, or -1 if unknown
    • getChannelIdToChannelName

      Map<String,String> getChannelIdToChannelName()
      Returns:
      cached mappings of channel ids to names
    • getChannelNameToChannelId

      Map<String,String> getChannelNameToChannelId()
      Returns:
      cached mappings of channel names to ids
    • isChannelJoined

      default boolean isChannelJoined(String channelName)
      Check if Chat is currently in a channel
      Parameters:
      channelName - channel to check (without # prefix)
      Returns:
      boolean
    • sendActionMessage

      default boolean sendActionMessage(String channel, String message)
      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#updateChatSettings
      Configures 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#updateChatSettings
      Configures 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#updateChatSettings
      Configures 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#updateChatSettings
      Configures 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#updateChatSettings
      Configures 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 @ScheduledForRemoval(inVersion="2.0.0") default boolean clearChat(String channel)
      Deprecated.
      Twitch will decommission this method on February 18, 2023; migrate to TwitchHelix#deleteChatMessages
      Clears 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#deleteChatMessages
      Deletes 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#banUser
      Timeout a user
      Parameters:
      channel - channel
      user - username
      duration - duration
      reason - 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#banUser
      Ban a user
      Parameters:
      channel - channel
      user - username
      reason - 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#unbanUser
      Unban a user
      Parameters:
      channel - channel
      user - 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#sendChatAnnouncement
      Send 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: