fixed youtube / discord calls

This commit is contained in:
Joe-Dowd 2020-04-01 19:28:21 +01:00
parent f1ee7bb430
commit 1bff019a64
2 changed files with 8 additions and 5 deletions

View file

@ -8,6 +8,7 @@ var YouTubeAPI = require('../utils/youtubeAPI.js');
var getHash = require('../utils/getHash.js');
var getIP = require('../utils/getIP.js');
var getFormattedTime = require('../utils/getFormattedTime.js');
// TODO: might need to be a util
//returns true if the user is considered trustworthy
@ -146,8 +147,8 @@ module.exports = async function submitSponsorTimes(req, res) {
part: "snippet",
id: videoID
}, function (err, data) {
if (err) {
console.log(err);
if (err || data.items.length === 0) {
err && console.log(err);
return;
}

View file

@ -3,11 +3,13 @@ var config = JSON.parse(fs.readFileSync('config.json'));
var getHash = require('../utils/getHash.js');
var getIP = require('../utils/getIP.js');
var getFormattedTime = require('../utils/getFormattedTime.js');
var databases = require('../databases/databases.js');
var db = databases.db;
var privateDB = databases.privateDB;
var YouTubeAPI = require('../utils/youtubeAPI.js');
var request = require('request');
module.exports = async function voteOnSponsorTime(req, res) {
let UUID = req.query.UUID;
@ -93,8 +95,8 @@ module.exports = async function voteOnSponsorTime(req, res) {
part: "snippet",
id: submissionInfoRow.videoID
}, function (err, data) {
if (err) {
console.log(err);
if (err || data.items.length === 0) {
err && console.log(err);
return;
}
@ -117,7 +119,7 @@ module.exports = async function voteOnSponsorTime(req, res) {
}
}]
}
});
}, () => {});
});
}
}