Mastereye7 / JonBot

Twitch bot for commands and automations
MIT License
1 stars 0 forks source link

Add event listener for subscribing to channel rewards #15

Closed Mastereye7 closed 10 months ago

Mastereye7 commented 10 months ago

https://dev.twitch.tv/docs/eventsub/

Mastereye7 commented 10 months ago
export interface Events {
    action(channel: string, userstate: ChatUserstate, message: string, self: boolean): void;
    anongiftpaidupgrade(channel: string, username: string, userstate: AnonSubGiftUpgradeUserstate): void;
    anonsubmysterygift(
        channel: string,
        numbOfSubs: number,
        methods: SubMethods,
        userstate: AnonSubMysteryGiftUserstate,
    ): void;
    anonsubgift(
        channel: string,
        streakMonths: number,
        recipient: string,
        methods: SubMethods,
        userstate: AnonSubGiftUserstate,
    ): void;
    automod(channel: string, msgID: "msg_rejected" | "msg_rejected_mandatory", message: string): void;
    ban(channel: string, username: string, reason: string, userstate: BanUserstate): void;
    chat(channel: string, userstate: ChatUserstate, message: string, self: boolean): void;
    cheer(channel: string, userstate: ChatUserstate, message: string): void;
    clearchat(channel: string): void;
    connected(address: string, port: number): void;
    connecting(address: string, port: number): void;
    disconnected(reason: string): void;
    emoteonly(channel: string, enabled: boolean): void;
    emotesets(sets: string, obj: EmoteObj): void;
    followersonly(channel: string, enabled: boolean, length: number): void;
    giftpaidupgrade(channel: string, username: string, sender: string, userstate: SubGiftUpgradeUserstate): void;
    hosted(channel: string, username: string, viewers: number, autohost: boolean): void;
    hosting(channel: string, target: string, viewers: number): void;
    join(channel: string, username: string, self: boolean): void;
    logon(): void;
    message(channel: string, userstate: ChatUserstate, message: string, self: boolean): void;
    messagedeleted(channel: string, username: string, deletedMessage: string, userstate: DeleteUserstate): void;
    mod(channel: string, username: string): void;
    mods(channel: string, mods: string[]): void;
    notice(channel: string, msgid: MsgID, message: string): void;
    part(channel: string, username: string, self: boolean): void;
    ping(): void;
    pong(latency: number): void;
    primepaidupgrade(channel: string, username: string, methods: SubMethods, userstate: PrimeUpgradeUserstate): void;
    r9kbeta(channel: string, enabled: boolean): void;
    raided(channel: string, username: string, viewers: number): void;
    "raw_message": (messageCloned: { [property: string]: any }, message: { [property: string]: any }) => void;
    reconnect(): void;
    // additional string literals for autocomplete
    redeem(
        channel: string,
        username: string,
        rewardType: "highlighted-message" | "skip-subs-mode-message" | string,
        tags: ChatUserstate,
    ): void;
Mastereye7 commented 10 months ago

Dammit this might not be possible after all https://github.com/tmijs/tmi.js/releases https://github.com/tmijs/tmi.js/pull/442 Add redeem event. This event will only be received for rewards and custom rewards with user text. client.on('redeem', (channel, username, rewardType, tags, message) => { switch(rewardType) { // Message that appears "highlighted" in the chat. case 'highlighted-message': break; // Message that skips the subscriber-only mode case 'skip-subs-mode-message': break; // Custom reward ID case '27c8e486-a386-40cc-9a4b-dbb5cf01e439': break; }

Mastereye7 commented 10 months ago

Maybe streamer bot has what I need? https://streamer.bot/

Mastereye7 commented 10 months ago

Streamer bot is gonna take care of this and way more integrations