Class SubscriptionEvent

java.lang.Object
com.github.philippheuer.events4j.core.domain.Event
All Implemented Interfaces:
com.github.philippheuer.events4j.api.domain.IEvent, ReplyableEvent

public final class SubscriptionEvent extends AbstractChannelEvent implements ReplyableEvent
This event gets called when a user gets a new subscriber or a user resubscribes.

This event will be called simultaneously with the chat announcement, not necessary when the user presses the subscription button.

  • Constructor Details

    • SubscriptionEvent

      public SubscriptionEvent(IRCMessageEvent event, EventChannel channel, EventUser user, String subPlan, Optional<String> message, Integer months, Boolean gifted, EventUser giftedBy, Integer subStreak, Integer giftMonths, Integer multiMonthDuration, Integer multiMonthTenure, List<AutoModFlag> flags)
      Event Constructor
      Parameters:
      event - The raw message event.
      channel - ChatChannel the user subscribed to
      user - User that subscribed
      subPlan - Sub Plan
      message - Sub Message
      months - Cumulative number of months user has been subscribed (not consecutive)
      gifted - Is gifted?
      giftedBy - User that gifted the sub
      subStreak - Consecutive number of months user has been subscribed (not cumulative); 0 if no streak or user chooses not to share their streak
      giftMonths - The number of months gifted as part of a single, multi-month gift
      multiMonthDuration - The number of subscription months just purchased
      multiMonthTenure - The length of multi-month subscription tenure that has already been served
      flags - The regions of the message that were flagged by AutoMod.
  • Method Details

    • reply

      public void reply(ITwitchChat chat, String message)
      Replies to this sub event, if a message was included when the subscription was shared.

      Sends a reply to this chat message.

      Specified by:
      reply in interface ReplyableEvent
      Parameters:
      chat - the ITwitchChat instance to send the message from.
      message - the message to be sent.
    • getSubscriptionPlanName

      @Deprecated public SubscriptionPlan getSubscriptionPlanName()
      Deprecated.
      will be removed in favor of .getSubPlan()
      Gets the Subscription Plan
      Returns:
      SubscriptionPlan
    • getMessageEvent

      public IRCMessageEvent getMessageEvent()
      Raw IRC Message Event
      Specified by:
      getMessageEvent in interface ReplyableEvent
    • getUser

      public EventUser getUser()
      Event Target User
    • getSubscriptionPlan

      public String getSubscriptionPlan()
      Subscription Plan
    • getMessage

      public Optional<String> getMessage()
      Subscription Message
    • getMonths

      public Integer getMonths()
      Cumulative months subscribed
    • getGifted

      public Boolean getGifted()
      Was this sub gifted?
    • getGiftedBy

      public EventUser getGiftedBy()
      User that gifted the sub
    • getSubStreak

      public Integer getSubStreak()
      Consecutive months subscribed
    • getGiftMonths

      public Integer getGiftMonths()
      The number of months gifted as part of a single, multi-month gift
    • getMultiMonthDuration

      public Integer getMultiMonthDuration()
      The number of subscription months just purchased. (Unofficial)
    • getMultiMonthTenure

      @Nullable public @Nullable Integer getMultiMonthTenure()
      The length of multi-month subscription tenure that has already been served. Can be null for gifts. (Unofficial)
    • getFlags

      public List<AutoModFlag> getFlags()
      The regions of getMessage() that were flagged by AutoMod (Unofficial)
    • equals

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

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

      public int hashCode()
      Overrides:
      hashCode in class AbstractChannelEvent
    • toString

      public String toString()
      Overrides:
      toString in class AbstractChannelEvent
    • getSubPlan

      public SubscriptionPlan getSubPlan()
      Subscription Plan, in enum form