Do you need my help? Visit our Discord server.
Node Version: 16.15.0
Installation
npm i @livecord/notify --save
yarn add @livecord/notify
Twitch
const { Twitch } = require("@livecord/notify");
const twitch = new Twitch({
client: {
id: "YOUR_CLIENT_ID",
token: "YOUR_TOKEN_HERE",
},
interval: 60000
});
twitch.on("ready", (ready) => {
twitch.follow([ "clqu_" ]);
twitch.unfollow([ "clqu_" ]);
console.log("Twitch connected at: ", ready);
});
twitch.on("live", channel => {
console.log(channel.user_name + " is live!");
});
twitch.on("offline", channel => {
console.log(channel.user_name + " is offline!");
});
How to get Twitch Token?
const { Twitch } = require("@livecord/notify");
Twitch.getToken("CLIENT_ID", "CLIENT_SECRET").then(token => {
console.log(token);
}).catch(err => {
console.log(err);
})
Data of Channel
{
"id": "",
"user_id": "",
"user_login": "",
"user_name": "",
"game_id": "",
"game_name": "",
"type": "live",
"title": "",
"viewer_count": 0,
"started_at": "",
"language": "",
"thumbnail_url": "",
"tag_ids": [ "" ],
"is_mature": true
}
Youtube
const { YouTube } = require("@livecord/notify");
const youtube = new YouTube({
interval: 60000,
useDatabase: true
});
youtube.on("ready", (ready) => {
youtube.subscribe("UC00_j4mtyaMbWX62JWBMmWA");
youtube.unsubscribe("UC00_j4mtyaMbWX62JWBMmWA");
console.log("Youtube connected at: ", ready);
});
youtube.on("upload", video => {
console.log("Youtube new video!", video);
})
Data of Video
{
"title": "",
"link": "",
"pubDate": "",
"author": "",
"id": "",
"isoDate": ""
}
Developed with ❤️ by Livecord