Added usernames to NB Discord webhooks

This commit is contained in:
Andrew Lee
2020-09-07 12:29:13 -04:00
parent 8b132c37a0
commit ce36806169

View File

@@ -106,14 +106,20 @@ function sendWebhooksNB(userID, videoID, UUID, startTime, endTime, category, pro
//[userID]); //[userID]);
let submissionCount = db.prepare('get', "SELECT COUNT(*) count FROM sponsorTimes WHERE userID=?", [userID]); let submissionCount = db.prepare('get', "SELECT COUNT(*) count FROM sponsorTimes WHERE userID=?", [userID]);
let disregardedCount = db.prepare('get', "SELECT COUNT(*) disregarded FROM sponsorTimes WHERE userID=? and votes <= -2", [userID]); let disregardedCount = db.prepare('get', "SELECT COUNT(*) disregarded FROM sponsorTimes WHERE userID=? and votes <= -2", [userID]);
//let uName = db.prepare('get', "SELECT userName FROM userNames WHERE userID=?", [userID]); let uName = db.prepare('get', "SELECT userName FROM userNames WHERE userID=?", [userID]);
let submittedBy = userID;//"";
// If there's no userName then just show the userID let submittedBy = "";
// if (uName.userName == userID){ try {
// submittedBy = userID; // If a userName was created then show both
// } else { // else show both if (uName.userName !== userID){
// submittedBy = uName.userName + "\n " + userID; submittedBy = uName.userName + "\n " + userID;
// } } else {
submittedBy = userID;
}
} catch {
//Catch in case User is not in userNames table
submittedBy = userID;
}
// Send discord message // Send discord message
if (config.discordNeuralBlockRejectWebhookURL === null) return; if (config.discordNeuralBlockRejectWebhookURL === null) return;