Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #46 from Nepgupmixpro/dev
Browse files Browse the repository at this point in the history
Added a latest command
  • Loading branch information
Zaph-x authored Oct 10, 2020
2 parents 868decf + 6edf674 commit b1965d8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bot/commands/latest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const config = require('../../config.json');
const Discord = require('discord.js');
const request = require('request');

module.exports.execute = async (client, message, args) => {
request('https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCNmheQMf9sK1Axv3NCEhbSA&maxResults=1&q=%5BOinkcraft%5D&type=video&key=' + config.bot.integrations.youtube.key, function (error, response, data) {
response.setEncoding('utf8')
if (!error && response.statusCode == 200) {
let obj = JSON.parse(data)
await message.channel.send("Here is the latest video related to Oinkcraft: https://www.youtube.com/watch?v=" + obj.items[0].id.videoId)
}
});
}

module.exports.config = {
name: 'latest video',
aliases: ['latest', 'latest vid', 'latest video', 'recent', 'recent video', 'recent vid'],
description: 'Get the latest video relating to Oinkcraft from Marks channel',
}

0 comments on commit b1965d8

Please sign in to comment.