Fixed discord tests

This commit is contained in:
Ajay Ramachandran
2020-04-06 20:12:12 -04:00
parent 9807d3e9c7
commit 557c6ad05a
3 changed files with 13 additions and 6 deletions

View File

@@ -46,14 +46,17 @@ function sendDiscordNotification(userID, videoID, UUID, segmentInfo) {
return;
}
let startTime = parseFloat(segmentInfo.segment[0]);
let endTime = parseFloat(segmentInfo.segment[1]);
request.post(config.discordFirstTimeSubmissionsWebhookURL, {
json: {
"embeds": [{
"title": data.items[0].snippet.title,
"url": "https://www.youtube.com/watch?v=" + videoID + "&t=" + (segmentInfo.segment.toFixed(0) - 2),
"url": "https://www.youtube.com/watch?v=" + videoID + "&t=" + (startTime.toFixed(0) - 2),
"description": "Submission ID: " + UUID +
"\n\nTimestamp: " +
getFormattedTime(segmentInfo.segment[0]) + " to " + getFormattedTime(segmentInfo.segment[1]) +
getFormattedTime(startTime) + " to " + getFormattedTime(endTime) +
"\n\nCategory: " + segmentInfo.category,
"color": 10813440,
"author": {
@@ -234,8 +237,6 @@ module.exports = async function postSkipSegments(req, res) {
let UUID = getHash("v2-categories" + videoID + segmentInfo.segment[0] +
segmentInfo.segment[1] + segmentInfo.category + userID, 1);
console.log(UUID)
try {
db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(videoID, segmentInfo.segment[0],
segmentInfo.segment[1], startingVotes, UUID, userID, timeSubmitted, 0, segmentInfo.category, shadowBanned);

View File

@@ -4,12 +4,10 @@ var app = express();
var config = require('../src/config.js');
app.post('/ReportChannelWebhook', (req, res) => {
console.log("report mock hit");
res.status(200);
});
app.post('/FirstTimeSubmissionsWebhook', (req, res) => {
console.log("first time submisson mock hit");
res.status(200);
});

View File

@@ -26,6 +26,14 @@ const YouTubeAPI = {
{
contentDetails: {
duration: "PT1H23M30S"
},
snippet: {
title: "Example Title",
thumbnails: {
maxres: {
url: "https://sponsor.ajay.app/LogoSponsorBlockSimple256px.png"
}
}
}
}
]