Skip to content

Class: SubEvent ​

Represents a new subscription on the channel (Twitch channel.subscribe event).

Remarks ​

Handed to the callback of k.twitch.onSub. This event fires for new subscriptions only. A re-subscription with a shared message is a distinct event — listen to k.twitch.onResub for that. Gift subscriptions are also distinct — see k.twitch.onSubGift.

Example ​

ts
k.twitch.onSub((event) => {
    k.chat.say(`Welcome ${event.user_name} — tier ${event.getTier()} sub! 🎉`);
});

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.


is_gift ​

ts
is_gift: boolean;

Whether this subscription was received as a gift (always false here).


received_at ​

ts
received_at: number;

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


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 ​

getTier() ​

ts
getTier(): 1 | 2 | 3;

Returns the subscription tier as a number.

Returns ​

1 | 2 | 3

1, 2 or 3.

See ​

getTierRaw for the raw Twitch value.


getTierRaw() ​

ts
getTierRaw(): string;

Returns the raw Twitch tier string ("1000", "2000", "3000").

Returns ​

string

The raw tier.

See ​

getTier for the numeric level.


getUser() ​

ts
getUser(): Promise<User>;

Resolves the full Kappapps viewer who subscribed.

Returns ​

Promise<User>

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

Remarks ​

Requires a lookup — the event only carries the Twitch identity. Use user_name directly if you only need to display the name.


isGift() ​

ts
isGift(): boolean;

Indicates whether the subscription was received as a gift.

Returns ​

boolean

Always false for this event — gifts arrive via k.twitch.onSubGift. Exposed for clarity/parity only.