Discord bot Stream notifications help

I want my bot to check if a streamer by choice went live and if the stream went live message in a channel that a streamer went live like the bot mee6 does
@everyone {streamer} just went live on {twitch link}
. Could you guys explain me how I can do this? I just started learning js and node.js so I don’t know much about it and I figured maybe I can ask the community for help.

My current index.js:

const botconfig = require("./botconfig.json");
const tokenfile = require("./token.json")
const Discord = require(“discord.js”);
const fs = require(“fs”);
const superagent = require(“superagent”);

const bot = new Discord.Client({disableEveryone: true});
bot.commands = new Discord.Collection();

fs.readdir("./commands/", (err, files) => {

if(err) console.log(err);

let jsfile = files.filter(f => f.split(".").pop() === “js”)
if(jsfile.length <= 0){
console.log(“Couldn’t find commands.”);
return;
}

jsfile.forEach((f, i) =>{
let props = require(./commands/${f});
console.log(${f} loaded!);
bot.commands.set(props.help.name, props);
})

});

bot.on(“ready”, async () => {
console.log(${bot.user.username} is up and running!);
bot.user.setActivity("=help | tornadicgaming.unaux.com", {type: “WATCHING”});
});

bot.on(“message”, async message => {
if(message.author.bot) return;
if(message.channel.type === “dm”) return;

let prefix = botconfig.prefix;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);

let commandfile = bot.commands.get(cmd.slice(prefix.length));
if(commandfile) commandfile.run(bot, message, args);

if(cmd === ${prefix}serverinfo){

let sicon = message.guild.iconURL;
let serverembed = new Discord.RichEmbed()
.setDescription("Server Information")
.setColor("#255684")
.setThumbnail(sicon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You Joined", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);

return message.channel.send(serverembed);

}

if(cmd === ${prefix}botinfo){

let bicon = bot.user.displayAvatarURL;
let botembed = new Discord.RichEmbed()
.setDescription("Equal Information")
.setColor("#255684")
.setThumbnail(bicon)
.addField("Bot Name:", bot.user.username)
.addField("Created On:", bot.user.createdAt)
.addField("Bot version", botconfig.version);

return message.channel.send(botembed);

}
//Beginning of Twitch Live Notifier
/*if(cmd == ${prefix}stream){

let body = new superagent()
.get(‘https://glass.twitch.tv/console/apps/gu5ux906j4an5qt9hdxil68yj9ms7d’);
.set(‘Authorization’, ‘y7ptvx99jbjhxec1u5qwh6bjm7tjkt’);

console.log(“works”)
}*/

})

bot.login(tokenfile.token);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.