Class SubscriptionEvent

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

public final class SubscriptionEvent
extends AbstractChannelEvent
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 Summary

    Constructors
    Constructor Description
    SubscriptionEvent​(com.github.twitch4j.common.events.domain.EventChannel channel, com.github.twitch4j.common.events.domain.EventUser user, java.lang.String subPlan, java.util.Optional<java.lang.String> message, java.lang.Integer months, java.lang.Boolean gifted, com.github.twitch4j.common.events.domain.EventUser giftedBy, java.lang.Integer subStreak, java.lang.Integer giftMonths, java.lang.Integer multiMonthDuration, java.lang.Integer multiMonthTenure, java.util.List<AutoModFlag> flags)
    Event Constructor
  • Method Summary

    Modifier and Type Method Description
    protected boolean canEqual​(java.lang.Object other)  
    boolean equals​(java.lang.Object o)  
    java.util.List<AutoModFlag> getFlags()
    The regions of getMessage() that were flagged by AutoMod (Unofficial)
    java.lang.Boolean getGifted()
    Was this sub gifted?
    com.github.twitch4j.common.events.domain.EventUser getGiftedBy()
    User that gifted the sub
    java.lang.Integer getGiftMonths()
    The number of months gifted as part of a single, multi-month gift
    java.util.Optional<java.lang.String> getMessage()
    Subscription Message
    java.lang.Integer getMonths()
    Cumulative months subscribed
    java.lang.Integer getMultiMonthDuration()
    The number of subscription months just purchased.
    @Nullable java.lang.Integer getMultiMonthTenure()
    The length of multi-month subscription tenure that has already been served.
    com.github.twitch4j.common.enums.SubscriptionPlan getSubPlan()
    Subscription Plan, in enum form
    java.lang.String getSubscriptionPlan()
    Subscription Plan
    SubscriptionPlan getSubscriptionPlanName()
    Deprecated.
    will be removed in favor of .getSubPlan()
    java.lang.Integer getSubStreak()
    Consecutive months subscribed
    com.github.twitch4j.common.events.domain.EventUser getUser()
    Event Target User
    int hashCode()  
    java.lang.String toString()  

    Methods inherited from class com.github.twitch4j.chat.events.AbstractChannelEvent

    ban, getChannel, timeout, unban

    Methods inherited from class com.github.twitch4j.chat.events.TwitchEvent

    getTwitchChat

    Methods inherited from class com.github.philippheuer.events4j.core.domain.Event

    getEventId, getFiredAt, getFiredAtInstant, getServiceMediator, setEventId, setFiredAt, setFiredAtInstant, setServiceMediator

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SubscriptionEvent

      public SubscriptionEvent​(com.github.twitch4j.common.events.domain.EventChannel channel, com.github.twitch4j.common.events.domain.EventUser user, java.lang.String subPlan, java.util.Optional<java.lang.String> message, java.lang.Integer months, java.lang.Boolean gifted, com.github.twitch4j.common.events.domain.EventUser giftedBy, java.lang.Integer subStreak, java.lang.Integer giftMonths, java.lang.Integer multiMonthDuration, java.lang.Integer multiMonthTenure, java.util.List<AutoModFlag> flags)
      Event Constructor
      Parameters:
      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

    • getSubscriptionPlanName

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

      public com.github.twitch4j.common.events.domain.EventUser getUser()
      Event Target User
    • getSubscriptionPlan

      public java.lang.String getSubscriptionPlan()
      Subscription Plan
    • getMessage

      public java.util.Optional<java.lang.String> getMessage()
      Subscription Message
    • getMonths

      public java.lang.Integer getMonths()
      Cumulative months subscribed
    • getGifted

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

      public com.github.twitch4j.common.events.domain.EventUser getGiftedBy()
      User that gifted the sub
    • getSubStreak

      public java.lang.Integer getSubStreak()
      Consecutive months subscribed
    • getGiftMonths

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

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

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

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

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class AbstractChannelEvent
    • canEqual

      protected boolean canEqual​(java.lang.Object other)
      Overrides:
      canEqual in class AbstractChannelEvent
    • hashCode

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

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

      public com.github.twitch4j.common.enums.SubscriptionPlan getSubPlan()
      Subscription Plan, in enum form