Class IRCMessageEvent

java.lang.Object
com.github.philippheuer.events4j.core.domain.Event
com.github.twitch4j.chat.events.TwitchEvent
com.github.twitch4j.chat.events.channel.IRCMessageEvent
All Implemented Interfaces:
com.github.philippheuer.events4j.api.domain.IEvent

public class IRCMessageEvent extends TwitchEvent
This event gets called when we receive a raw irc message.
  • Field Details

  • Constructor Details

  • Method Details

    • getBadgeInfo

      public Map<String,String> getBadgeInfo()
      Returns:
      metadata related to the chat badges in the badges tag
    • getBadges

      public Map<String,String> getBadges()
      Returns:
      the visible chat badges parsed from tags
    • getClientPermissions

      public Set<CommandPermission> getClientPermissions()
      Returns:
      the permissions of the client that sent this message, based on visible badges
    • isValid

      @Deprecated public Boolean isValid()
      Deprecated.
      MessageParser.parse(String) yields null for invalid messages
      Checks if the Event was parsed correctly.
      Returns:
      Is the Event valid?
    • parseTags

      @Deprecated @ScheduledForRemoval(inVersion="2.0.0") public static Map<String,CharSequence> parseTags(String raw)
      Deprecated.
      This method is no longer used by twitch4j
      Parse Tags from raw list
      Parameters:
      raw - The raw list of tags.
      Returns:
      A key-value map of the tags.
    • parseClientName

      @Deprecated @ScheduledForRemoval(inVersion="2.0.0") public static Optional<String> parseClientName(String raw)
      Deprecated.
      This method is no longer used by twitch4j
      Gets the ClientName from the IRC User Identifier (:user!user@user.tmi.twitch.tv)
      Parameters:
      raw - Raw ClientName
      Returns:
      Client name, or empty.
    • getUserId

      public String getUserId()
      Gets the User Id (from Tags)
      Returns:
      Long userId
    • getUserName

      public String getUserName()
      Gets the User Name (from Tags)
      Returns:
      String userName
    • getUserDisplayName

      public Optional<String> getUserDisplayName()
      Returns:
      the display name of the user who sent this message, if applicable
    • getUserChatColor

      public Optional<String> getUserChatColor()
      Returns:
      hexadecimal RGB color code of the user's chat color, or empty if it is never set.
    • getTargetUserId

      public String getTargetUserId()
      Gets the Target User Id (from Tags)
      Returns:
      Long targetUserId
    • getMessageId

      public Optional<String> getMessageId()
      The message UUID that is used for deletion by a moderator or a chat reply (from Tags)
      Returns:
      the unique ID for the message
    • getNonce

      @Unofficial public Optional<String> getNonce()
      Returns:
      the client nonce for the message.
    • getSubscriberMonths

      public OptionalInt getSubscriberMonths()
      Returns:
      the exact number of months the user has been a subscriber, or empty if they are not subscribed
    • getSubscriptionTier

      public OptionalInt getSubscriptionTier()
      Returns:
      the tier at which the user is subscribed, or empty if they are not subscribed or have the founders badge equipped
    • getCheererTier

      public OptionalInt getCheererTier()
      Returns:
      the tier of the bits badge of the user, or empty if there is no bits badge present (which can also occur for bits leaders)
    • getPredictedChoiceIndex

      public OptionalInt getPredictedChoiceIndex()
      Returns:
      the index of the choice this user is predicting, in an optional wrapper
    • getPredictedChoiceTitle

      public Optional<String> getPredictedChoiceTitle()
      Returns:
      the title of the choice this user is predicting, in an optional wrapper
    • getTagValue

      public Optional<String> getTagValue(String tagName)
      Gets a optional tag from the irc message
      Parameters:
      tagName - The tag of the irc message
      Returns:
      String tagValue
    • getUser

      public EventUser getUser()
      Get User
      Returns:
      ChatUser
    • getTargetUser

      public EventUser getTargetUser()
      Get Target User
      Returns:
      ChatUser
    • getChannel

      public EventChannel getChannel()
      Get ChatChannel
      Returns:
      ChatChannel
    • getChannelName

      public Optional<String> getChannelName()
      Returns:
      the channel name associated with this event, if applicable
    • getPayload

      public Optional<String> getPayload()
      Returns:
      IRC message payload, which includes a colon prefix, unlike getMessage()
    • getMessage

      public Optional<String> getMessage()
      Returns:
      the message sent by a user to an IRC channel
    • getClientName

      public Optional<String> getClientName()
      Returns:
      the client name associated with the message, excluding the hostname
    • getRawTag

      @Nullable @Internal public @Nullable CharSequence getRawTag(@NotNull @NotNull String name)
      Parameters:
      name - the tag key
      Returns:
      the (not escaped) tag value associated with the specified key, in CharSequence form
    • getRawTagString

      @Nullable @Internal public @Nullable String getRawTagString(@NotNull @NotNull String name)
      Parameters:
      name - the tag key
      Returns:
      the (not escaped) tag value associated with the specified key, in String form
    • getTags

      @Deprecated public Map<String,String> getTags()
      Deprecated.
      Returns:
      raw (i.e., not unescaped) IRCv3 tags
    • getRawTags

      @Deprecated public Map<String,Object> getRawTags()
      Deprecated.
      in favor of getEscapedTags()
      Returns:
      IRCv3 tags
    • toString

      public String toString()
      Overrides:
      toString in class TwitchEvent
    • getEscapedTags

      public Map<String,CharSequence> getEscapedTags()
      Tags

      Most applications should utilize getTagValue(String) rather than accessing this map directly.

    • getCommandType

      public String getCommandType()
      Message Type
    • getChannelId

      public String getChannelId()
      Channel Id
    • getRawMessage

      public String getRawMessage()
      RAW Message
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class TwitchEvent
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class TwitchEvent
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TwitchEvent
    • getFlags

      public List<AutoModFlag> getFlags()
      AutoMod Message Flag Indicators, relevant for PRIVMSG and USERNOTICE