Interface ITwitchChat

All Superinterfaces:
java.lang.AutoCloseable
All Known Implementing Classes:
TwitchChat, TwitchChatConnectionPool

public interface ITwitchChat
extends java.lang.AutoCloseable
  • Method Summary

    Modifier and Type Method Description
    default boolean ban​(java.lang.String channel, java.lang.String user, java.lang.String reason)
    Ban a user
    default boolean clearChat​(java.lang.String channel)
    Clears the history for first-party chat clients.
    void close()  
    default boolean delete​(java.lang.String channel, java.lang.String targetMsgId)
    Deletes a message.
    java.util.Map<java.lang.String,​java.lang.String> getChannelIdToChannelName()  
    java.util.Map<java.lang.String,​java.lang.String> getChannelNameToChannelId()  
    java.util.Set<java.lang.String> getChannels()
    Returns a set of all currently joined channels (without # prefix)
    com.github.philippheuer.events4j.core.EventManager getEventManager()  
    default boolean isChannelJoined​(java.lang.String channelName)
    Check if Chat is currently in a channel
    void joinChannel​(java.lang.String channelName)
    Joins a channel
    boolean leaveChannel​(java.lang.String channelName)
    Parts from a channel
    default boolean sendActionMessage​(java.lang.String channel, java.lang.String message)
    Sends an action message (/me) in a joined channel.
    default boolean sendMessage​(java.lang.String channel, java.lang.String message)
    Sends a message in a joined channel.
    boolean sendMessage​(java.lang.String channel, java.lang.String message, @Nullable java.util.Map<java.lang.String,​java.lang.Object> tags)
    Sends a message to the channel while including the specified message tags.
    default boolean sendMessage​(java.lang.String channel, java.lang.String message, java.lang.String nonce, java.lang.String replyMsgId)
    Sends a message to the channel while including an optional nonce and/or reply parent.
    default boolean setEmoteOnly​(java.lang.String channel, boolean enable)
    Configures emote only mode in a channel.
    default boolean setFollowersOnly​(java.lang.String channel, java.time.Duration time)
    Configures followers only mode in a channel.
    default boolean setSlowMode​(java.lang.String channel, int seconds)
    Configures the slow mode setting for a channel.
    default boolean setSubscribersOnly​(java.lang.String channel, boolean enable)
    Configures subscribers only mode in a channel.
    default boolean setUniqueChat​(java.lang.String channel, boolean enable)
    Configures unique chat mode (r9k) in a channel.
    default boolean timeout​(java.lang.String channel, java.lang.String user, java.time.Duration duration, java.lang.String reason)
    Timeout a user
    default boolean unban​(java.lang.String channel, java.lang.String user)
    Unban a user
  • Method Details

    • getEventManager

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

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

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

      default boolean sendMessage​(java.lang.String channel, java.lang.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

      @Unofficial default boolean sendMessage​(java.lang.String channel, java.lang.String message, java.lang.String nonce, java.lang.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

      @Unofficial boolean sendMessage​(java.lang.String channel, java.lang.String message, @Unofficial @Nullable @Nullable java.util.Map<java.lang.String,​java.lang.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 (unofficial).
      Returns:
      whether the message was added to the queue
    • getChannels

      java.util.Set<java.lang.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 java.lang.AutoCloseable
    • getChannelIdToChannelName

      java.util.Map<java.lang.String,​java.lang.String> getChannelIdToChannelName()
      Returns:
      cached mappings of channel ids to names
    • getChannelNameToChannelId

      java.util.Map<java.lang.String,​java.lang.String> getChannelNameToChannelId()
      Returns:
      cached mappings of channel names to ids
    • isChannelJoined

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

      default boolean sendActionMessage​(java.lang.String channel, java.lang.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

      default boolean setSlowMode​(java.lang.String channel, int seconds)
      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

      default boolean setFollowersOnly​(java.lang.String channel, java.time.Duration time)
      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

      default boolean setSubscribersOnly​(java.lang.String channel, boolean enable)
      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

      default boolean setUniqueChat​(java.lang.String channel, boolean enable)
      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

      default boolean setEmoteOnly​(java.lang.String channel, boolean enable)
      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

      default boolean clearChat​(java.lang.String channel)
      Clears the history for first-party chat clients.
      Parameters:
      channel - The target channel name.
      Returns:
      whether the command was added to the queue
    • delete

      default boolean delete​(java.lang.String channel, java.lang.String targetMsgId)
      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:
      IRCMessageEvent.getMessageId()
    • timeout

      default boolean timeout​(java.lang.String channel, java.lang.String user, java.time.Duration duration, java.lang.String reason)
      Timeout a user
      Parameters:
      channel - channel
      user - username
      duration - duration
      reason - reason
      Returns:
      whether the command was added to the queue
    • ban

      default boolean ban​(java.lang.String channel, java.lang.String user, java.lang.String reason)
      Ban a user
      Parameters:
      channel - channel
      user - username
      reason - reason
      Returns:
      whether the command was added to the queue
    • unban

      default boolean unban​(java.lang.String channel, java.lang.String user)
      Unban a user
      Parameters:
      channel - channel
      user - username
      Returns:
      whether the command was added to the queue