mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 12:37:00 +03:00
Fixed discord tests
This commit is contained in:
@@ -45,15 +45,18 @@ function sendDiscordNotification(userID, videoID, UUID, segmentInfo) {
|
|||||||
err && console.log(err);
|
err && console.log(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let startTime = parseFloat(segmentInfo.segment[0]);
|
||||||
|
let endTime = parseFloat(segmentInfo.segment[1]);
|
||||||
|
|
||||||
request.post(config.discordFirstTimeSubmissionsWebhookURL, {
|
request.post(config.discordFirstTimeSubmissionsWebhookURL, {
|
||||||
json: {
|
json: {
|
||||||
"embeds": [{
|
"embeds": [{
|
||||||
"title": data.items[0].snippet.title,
|
"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 +
|
"description": "Submission ID: " + UUID +
|
||||||
"\n\nTimestamp: " +
|
"\n\nTimestamp: " +
|
||||||
getFormattedTime(segmentInfo.segment[0]) + " to " + getFormattedTime(segmentInfo.segment[1]) +
|
getFormattedTime(startTime) + " to " + getFormattedTime(endTime) +
|
||||||
"\n\nCategory: " + segmentInfo.category,
|
"\n\nCategory: " + segmentInfo.category,
|
||||||
"color": 10813440,
|
"color": 10813440,
|
||||||
"author": {
|
"author": {
|
||||||
@@ -234,8 +237,6 @@ module.exports = async function postSkipSegments(req, res) {
|
|||||||
let UUID = getHash("v2-categories" + videoID + segmentInfo.segment[0] +
|
let UUID = getHash("v2-categories" + videoID + segmentInfo.segment[0] +
|
||||||
segmentInfo.segment[1] + segmentInfo.category + userID, 1);
|
segmentInfo.segment[1] + segmentInfo.category + userID, 1);
|
||||||
|
|
||||||
console.log(UUID)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(videoID, segmentInfo.segment[0],
|
db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(videoID, segmentInfo.segment[0],
|
||||||
segmentInfo.segment[1], startingVotes, UUID, userID, timeSubmitted, 0, segmentInfo.category, shadowBanned);
|
segmentInfo.segment[1], startingVotes, UUID, userID, timeSubmitted, 0, segmentInfo.category, shadowBanned);
|
||||||
|
|||||||
@@ -4,12 +4,10 @@ var app = express();
|
|||||||
var config = require('../src/config.js');
|
var config = require('../src/config.js');
|
||||||
|
|
||||||
app.post('/ReportChannelWebhook', (req, res) => {
|
app.post('/ReportChannelWebhook', (req, res) => {
|
||||||
console.log("report mock hit");
|
|
||||||
res.status(200);
|
res.status(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/FirstTimeSubmissionsWebhook', (req, res) => {
|
app.post('/FirstTimeSubmissionsWebhook', (req, res) => {
|
||||||
console.log("first time submisson mock hit");
|
|
||||||
res.status(200);
|
res.status(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,14 @@ const YouTubeAPI = {
|
|||||||
{
|
{
|
||||||
contentDetails: {
|
contentDetails: {
|
||||||
duration: "PT1H23M30S"
|
duration: "PT1H23M30S"
|
||||||
|
},
|
||||||
|
snippet: {
|
||||||
|
title: "Example Title",
|
||||||
|
thumbnails: {
|
||||||
|
maxres: {
|
||||||
|
url: "https://sponsor.ajay.app/LogoSponsorBlockSimple256px.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user