Class SubscriptionEvent
java.lang.Object
com.github.philippheuer.events4j.core.domain.Event
com.github.twitch4j.chat.events.TwitchEvent
com.github.twitch4j.chat.events.AbstractChannelEvent
com.github.twitch4j.chat.events.channel.SubscriptionEvent
- 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 booleancanEqual(java.lang.Object other)booleanequals(java.lang.Object o)java.util.List<AutoModFlag>getFlags()The regions ofgetMessage()that were flagged by AutoMod (Unofficial)java.lang.BooleangetGifted()Was this sub gifted?com.github.twitch4j.common.events.domain.EventUsergetGiftedBy()User that gifted the subjava.lang.IntegergetGiftMonths()The number of months gifted as part of a single, multi-month giftjava.util.Optional<java.lang.String>getMessage()Subscription Messagejava.lang.IntegergetMonths()Cumulative months subscribedjava.lang.IntegergetMultiMonthDuration()The number of subscription months just purchased.@Nullable java.lang.IntegergetMultiMonthTenure()The length of multi-month subscription tenure that has already been served.com.github.twitch4j.common.enums.SubscriptionPlangetSubPlan()Subscription Plan, in enum formjava.lang.StringgetSubscriptionPlan()Subscription PlanSubscriptionPlangetSubscriptionPlanName()Deprecated.will be removed in favor of .getSubPlan()java.lang.IntegergetSubStreak()Consecutive months subscribedcom.github.twitch4j.common.events.domain.EventUsergetUser()Event Target UserinthashCode()java.lang.StringtoString()Methods inherited from class com.github.twitch4j.chat.events.AbstractChannelEvent
ban, getChannel, timeout, unbanMethods inherited from class com.github.twitch4j.chat.events.TwitchEvent
getTwitchChatMethods inherited from class com.github.philippheuer.events4j.core.domain.Event
getEventId, getFiredAt, getFiredAtInstant, getServiceMediator, setEventId, setFiredAt, setFiredAtInstant, setServiceMediatorMethods 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 touser- User that subscribedsubPlan- Sub Planmessage- Sub Messagemonths- Cumulative number of months user has been subscribed (not consecutive)gifted- Is gifted?giftedBy- User that gifted the subsubStreak- Consecutive number of months user has been subscribed (not cumulative); 0 if no streak or user chooses not to share their streakgiftMonths- The number of months gifted as part of a single, multi-month giftmultiMonthDuration- The number of subscription months just purchasedmultiMonthTenure- The length of multi-month subscription tenure that has already been servedflags- The regions of the message that were flagged by AutoMod.
-
-
Method Details
-
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
The regions ofgetMessage()that were flagged by AutoMod (Unofficial) -
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classAbstractChannelEvent
-
canEqual
protected boolean canEqual(java.lang.Object other)- Overrides:
canEqualin classAbstractChannelEvent
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractChannelEvent
-
toString
public java.lang.String toString()- Overrides:
toStringin classAbstractChannelEvent
-
getSubPlan
public com.github.twitch4j.common.enums.SubscriptionPlan getSubPlan()Subscription Plan, in enum form
-