Skip to content

Class: ResubEvent ​

Represents a re-subscription with a shared message (Twitch channel.subscription.message event): a returning subscriber renews and posts a message, along with their streak / cumulative months.

Remarks ​

Handed to the callback of k.twitch.onResub. This is separate from a brand-new subscription (k.twitch.onSub): to react to every sub, register both.

Example ​

ts
k.twitch.onResub((event) => {
    k.chat.say(`${event.user_name} resubbed for ${event.getCumulativeMonths()} months! ${event.getMessage()}`);
});

Properties ​

broadcaster_user_id ​

ts
broadcaster_user_id: string;

Twitch id of the broadcaster (the channel).


broadcaster_user_login ​

ts
broadcaster_user_login: string;

Twitch login of the broadcaster.


broadcaster_user_name ​

ts
broadcaster_user_name: string;

Twitch display name of the broadcaster.


cumulative_months ​

ts
cumulative_months: number;

Total number of months the viewer has been subscribed (cumulative).


duration_months ​

ts
duration_months: number;

Number of months covered by this renewal (e.g. a 3-month sub).


message ​

ts
message: string;

Text of the shared re-sub message (empty string if none).


received_at ​

ts
received_at: number;

Timestamp (in milliseconds) at which the SDK received the event.


streak_months ​

ts
streak_months: number;

Consecutive-months streak, or null if the viewer hides it.


tier ​

ts
tier: string;

Raw Twitch subscription tier: "1000", "2000" or "3000".


user_id ​

ts
user_id: string;

Twitch id of the subscriber.


user_login ​

ts
user_login: string;

Twitch login (lowercase username) of the subscriber.


user_name ​

ts
user_name: string;

Twitch display name of the subscriber.

Methods ​

getCumulativeMonths() ​

ts
getCumulativeMonths(): number;

Returns the cumulative months the viewer has been subscribed.

Returns ​

number

The total number of months.


getDurationMonths() ​

ts
getDurationMonths(): number;

Returns the number of months covered by this renewal.

Returns ​

number

The duration in months, or null if not provided.


getMessage() ​

ts
getMessage(): string;

Returns the shared re-sub message text.

Returns ​

string

The message, or an empty string if none was shared.


getStreakMonths() ​

ts
getStreakMonths(): number;

Returns the viewer's consecutive-months streak.

Returns ​

number

The streak in months, or null if the viewer hides it.


getTier() ​

ts
getTier(): 1 | 2 | 3;

Returns the subscription tier as a number.

Returns ​

1 | 2 | 3

1, 2 or 3.


getUser() ​

ts
getUser(): Promise<User>;

Resolves the full Kappapps viewer who re-subscribed.

Returns ​

Promise<User>

The matching User, or null if unknown to the platform.