Closed Trinitui closed 3 years ago
// X. This gets a toh result when the user asks for one, using !toh *
if (msgContent.startsWith("!toh")) {
let q = msg.content;
//search yt for toh+searchterm
axios
.get(
`https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=${q}&key=${YOUTUBE_APIKEY}`
)
.then((response) => {
//send output to channel
let vid = response.data.items[0].id.videoId;
msg.channel.send(`https://www.youtube.com/watch?v=${vid}`);
})
.catch((error) => {
console.log(error);
});
}
This has been done as well, and is actually pending refactor in issue #39
"toh flip swing"