@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
58 lines (57 loc) • 1.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelFollow = void 0;
const Base_1 = require("./Base");
const BaseUser_1 = require("./BaseUser");
/**
* Represents a channel follow event.
*/
class ChannelFollow extends Base_1.Base {
/**
* The broadcaster of the channel who was followed.
*/
broadcaster;
/**
* The follower who followed the channel.
*/
follower;
/**
* The date when the follower followed the channel.
*/
followedAt;
/**
* The data of the follow event returned from the EventSub.
*/
data;
/**
* Creates a new instance of the channel follow event.
* @param chatbot The current instance of the chatbot.
* @param data The data of the follow event returned from the EventSub.
*/
constructor(chatbot, data) {
super(chatbot);
this.data = data;
this.broadcaster = new BaseUser_1.BaseUser(chatbot, { ...data.broadcaster, display_name: data.broadcaster.displayName });
this.follower = new BaseUser_1.BaseUser(chatbot, { ...data.follower, display_name: data.follower.displayName });
this.followedAt = data.followedAt;
}
/**
* The Id of the broadcaster who was followed.
*/
get broadcasterId() {
return this.data.broadcaster.id;
}
/**
* The Id of the follower who followed the channel.
*/
get followerId() {
return this.data.follower.id;
}
/**
* The Id of the chatroom where the follow event occurred.
*/
get chatroomId() {
return this.data.broadcaster.id;
}
}
exports.ChannelFollow = ChannelFollow;