Class 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

    • IRCMessageEvent

      public IRCMessageEvent(String rawMessage, Map<String,String> channelIdToChannelName, Map<String,String> channelNameToChannelId, Collection<String> botOwnerIds)
      Event Constructor
      Parameters:
      rawMessage - The raw message.
      channelIdToChannelName - Mapping used to lookup a missing channel name in the event
      channelNameToChannelId - Mapping used to lookup a missing channel id in the event
      botOwnerIds - The bot owner ids.
  • Method Details

    • isValid

      public Boolean isValid()
      Checks if the Event was parsed correctly.
      Returns:
      Is the Event valid?
    • parseTags

      public Map parseTags(String raw)
      Parse Tags from raw list
      Parameters:
      raw - The raw list of tags.
      Returns:
      A key-value map of the tags.
    • parseClientName

      public Optional<String> parseClientName(String raw)
      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
    • 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
    • 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
    • toString

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

      public Map<String,String> getTags()
      Tags
    • getRawTags

      public Map<String,Object> getRawTags()
      Raw Tags
    • getBadges

      public Map<String,String> getBadges()
      Badges
    • getBadgeInfo

      public Map<String,String> getBadgeInfo()
      Metadata related to the chat badges in the badges tag
    • getClientName

      public Optional<String> getClientName()
      Client
    • getCommandType

      public String getCommandType()
      Message Type
    • getChannelId

      public String getChannelId()
      Channel Id
    • getChannelName

      public Optional<String> getChannelName()
      Channel Name
    • getMessage

      public Optional<String> getMessage()
      Message
    • getPayload

      public Optional<String> getPayload()
      IRC Command Payload
    • getClientPermissions

      public Set<CommandPermission> getClientPermissions()
      Client Permissions
    • 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