I am making a Discord bot which when you run a command by typing **-yt ** then the channel name after, I want it to show info about that channel using Javascript. Here is my code so far of which I want it to show info about a channel with the name of whatever they input after typing **-yt **
Here is my code so far and I changed areas to show where the channel id should come from the input:
if(command === "-yt") {
var request = require('request');
const input = args.join(" ");
const config = require("config.json");
var id = `${input}`;
var key = `${config.key}`;
var url = "https://www.googleapis.com/youtube/v3/channels?part=statistics&id=" + id + "&key=" + key;
request({
method: 'GET',
url: url
}, function (err, response, text) {
if (err) {
return;
}
var json = JSON.parse(text);
message.channel.send({embed: {
color: 3092790,
description: "```"+ `Name: ${input}`+ "```"+ "```"+ `Subscribers: ${json.items[0].statistics.subscriberCount}`+ "```"+ "```"+ `\nViews: ${json.items[0].statistics.viewCount}`+ "```"+ "```"+ `Other: Coming Soon`+ "```"
}})})}})