Update node.js

This commit is contained in:
ZyLacx 2021-03-05 13:02:22 +01:00
parent ca893b5792
commit 9525a4c1da

164
node.js
View file

@ -26,8 +26,8 @@ var setNew = true;
client.once('ready', () => {
console.log('Im online!');
countdownChannel = client.channels.cache.find(channel => channel.id === "765243559758397470");
setInterval(countdowns, 1000, 1);
// countdownChannel = client.channels.cache.find(channel => channel.id === "765243559758397470");
// setInterval(countdowns, 1000, 1);
});
client.on('message', message => {
@ -106,105 +106,103 @@ client.on('message', message => {
});
function countdowns(plus) {
left += plus;
// function countdowns(plus) {
// left += plus;
let now = new Date().toDateString;
// let now = new Date().toDateString;
if(now == "Fri Sep 10 2021"){
let messageChannel = client.channels.cache.find(channel => channel.id === "490610642106056707");
messageChannel.send("@everyone \n https://cdn.discordapp.com/attachments/247090228802748426/795334429693575188/judgment_day.mp4");
}
// if(now == "Fri Sep 10 2021"){
// let messageChannel = client.channels.cache.find(channel => channel.id === "490610642106056707");
// messageChannel.send("@everyone \n https://cdn.discordapp.com/attachments/247090228802748426/795334429693575188/judgment_day.mp4");
// }
if(now == "Fri Sep 6 2024"){
let genshinchannel = client.channels.cache.find(channel => channel.id === "787776123454619648");
genshinchannel.send("<@787776123454619648> SIGNORA WOOOO SIGNORAAAAA HAHAHAHAHAHAHA");
genshinchannel.send("dnasoifhiasjfoasif SIGNORAAAA doiasfoasfasfi");
genshinchannel.send("<@787776123454619648> KOKOT NESPI, PULLUJ SIGNORU, ČO ROBÍŠ???");
genshinchannel.send("som zvedavý či bude tento server existovať za 3 roky, to je celkom v piči doba, podľa mňa");
}
// if(now == "Fri Sep 6 2024"){
// let genshinchannel = client.channels.cache.find(channel => channel.id === "787776123454619648");
// genshinchannel.send("<@787776123454619648> SIGNORA WOOOO SIGNORAAAAA HAHAHAHAHAHAHA");
// genshinchannel.send("dnasoifhiasjfoasif SIGNORAAAA doiasfoasfasfi");
// genshinchannel.send("<@787776123454619648> KOKOT NESPI, PULLUJ SIGNORU, ČO ROBÍŠ???");
// genshinchannel.send("som zvedavý či bude tento server existovať za 3 roky, to je celkom v piči doba, podľa mňa");
// }
if(first == true || plus == 0){
first = false;
if(plus == 0){
var random = Math.floor((Math.random() * 100) + 1);;
if(random == 1){
let responseNo = Math.floor(Math.random() * 3);
var responses = ["idk", "to by si mal vedieť 😉", "nie"];
countdownChannel.send(responses[responseNo]);
}
else{
sendEmbed();
}
}
else {
sendEmbed();
}
}
// if(first == true || plus == 0){
// first = false;
// if(plus == 0){
// var random = Math.floor((Math.random() * 100) + 1);;
// if(random == 1){
// let responseNo = Math.floor(Math.random() * 3);
// var responses = ["idk", "to by si mal vedieť 😉", "nie"];
// countdownChannel.send(responses[responseNo]);
// }
// else{
// sendEmbed();
// }
// }
// else {
// sendEmbed();
// }
// }
if (left == ping) {
left = 0;
sendEmbed();
}
};
// if (left == ping) {
// left = 0;
// sendEmbed();
// }
// };
function calcTime(time){
// function calcTime(time){
let returnNo = Math.floor(time / (1000 * 60 * 60 * 24));
// let returnNo = Math.floor(time / (1000 * 60 * 60 * 24));
if(returnNo > 5 && returnNo > 1)
returnNo += " dni ";
else if(returnNo == 1)
returnNo += " deň ";
else
returnNo += " dní ";
// if(returnNo > 5 && returnNo > 1)
// returnNo += " dni ";
// else if(returnNo == 1)
// returnNo += " deň ";
// else
// returnNo += " dní ";
let hours = Math.floor((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
// let hours = Math.floor((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
if(hours > 5 && returnNo > 1)
returnNo += hours + " hodiny ";
else if(returnNo == 1)
returnNo += hours + " hodina ";
else
returnNo += hours + " hodín ";
// if(hours > 5 && returnNo > 1)
// returnNo += hours + " hodiny ";
// else if(returnNo == 1)
// returnNo += hours + " hodina ";
// else
// returnNo += hours + " hodín ";
let minutes = Math.floor(( time % ( 1000 * 60 * 60)) / (1000 * 60));
// let minutes = Math.floor(( time % ( 1000 * 60 * 60)) / (1000 * 60));
if(minutes > 5 && returnNo > 1)
returnNo += minutes + " minúty ";
else if(returnNo == 1)
returnNo += minutes + " minúta ";
else
returnNo += minutes + " minút ";
// if(minutes > 5 && returnNo > 1)
// returnNo += minutes + " minúty ";
// else if(returnNo == 1)
// returnNo += minutes + " minúta ";
// else
// returnNo += minutes + " minút ";
let seconds = Math.floor(( time % ( 1000 * 60)) / 1000);
// let seconds = Math.floor(( time % ( 1000 * 60)) / 1000);
if(seconds > 5 && returnNo > 1)
returnNo += seconds + " sekundy ";
else if(returnNo == 1)
returnNo += seconds + " sekunda ";
else
returnNo += seconds + " sekúnd ";
// if(seconds > 5 && returnNo > 1)
// returnNo += seconds + " sekundy ";
// else if(returnNo == 1)
// returnNo += seconds + " sekunda ";
// else
// returnNo += seconds + " sekúnd ";
return returnNo;
}
// return returnNo;
// }
function sendEmbed(){
now = new Date().getTime();
// function sendEmbed(){
// now = new Date().getTime();
remainingSjl = calcTime(sjl - now);
remainingMat = calcTime(mat - now);
remainingDok = calcTime(dokument - now);
// remainingSjl = calcTime(sjl - now);
// remainingMat = calcTime(mat - now);
// remainingDok = calcTime(dokument - now);
const embed = new Discord.MessageEmbed()
.addField("Čas do odovzdania dokumentácie: ", remainingDok)
.addField("", "")
.addField("Čas do maturity zo Slovenského jazyka: ", remainingSjl)
.addField("", "")
.addField("Čas do maturity z Matematiky: ", remainingMat)
;
// const embed = new Discord.MessageEmbed()
// .addField("Čas do maturity zo Slovenského jazyka: ", remainingSjl)
// .addField("", "")
// .addField("Čas do maturity z Matematiky: ", remainingMat)
// ;
countdownChannel.send(embed);
}
// countdownChannel.send(embed);
// }
client.login(process.env.token);