Update node.js

This commit is contained in:
ZyLacx 2020-12-02 17:57:57 +01:00
parent 93ceaec93a
commit ffeb9354c8

73
node.js
View file

@ -72,7 +72,9 @@ client.on('message', message => {
message.channel.send("Henlooo " + message.author.username + " " + emojis[randomNum]);
}
else if (message.mentions.channels.first() && yes) {
message.channel.send("Láskavo ma necrashuj...");
/*
if (args.length === 1) {
message.react('🐮');
let channelId = "";
@ -94,7 +96,7 @@ client.on('message', message => {
getChannel.send(storedLink);
}
yes = false;
yes = false;*/
}
else if (msg.startsWith("how ye") && message.author.bot === false) {
let randomNum = Math.floor(Math.random() * 5);
@ -111,35 +113,6 @@ client.on('message', message => {
});
function countdowns(plus) {
now = new Date().getTime();
remainingSjl = calcTime(sjl - now);
remainingMat = calcTime(mat - now);
remainingDok = calcTime(dokument - now);
remainingMartin = calcTime(martinovOdpocet - now);
remainingPeter = calcTime(petrovOdpocet - 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)
.addField("", "")
.addField("Martinov nenápadný odpočet: ", remainingMartin)
.addField("", "")
.addField("Odpočet do Peťovho sklamania: ", remainingPeter)
.setColor("RANDOM");
if(remainingPeter > 0){
embed.spliceFields(8);
}
if (remainingMartin > 0) {
embed.spliceFields(6, 3);
}
left += plus;
if(first == true || plus == 0){
@ -152,19 +125,17 @@ function countdowns(plus) {
countdownChannel.send(responses[responseNo]);
}
else{
countdownChannel.send(embed);
sendEmbed();
}
}
else {
countdownChannel.send(embed);
sendEmbed();
}
}
if (left == ping) {
left = 0;
countdownChannel.send(embed);
sendEmbed();
}
};
@ -209,4 +180,36 @@ function calcTime(time){
return returnNo;
}
function sendEmbed(){
now = new Date().getTime();
remainingSjl = calcTime(sjl - now);
remainingMat = calcTime(mat - now);
remainingDok = calcTime(dokument - now);
remainingMartin = calcTime(martinovOdpocet - now);
remainingPeter = calcTime(petrovOdpocet - 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)
.addField("", "")
.addField("Martinov nenápadný odpočet: ", remainingMartin)
.addField("", "")
.addField("Odpočet do Peťovho sklamania: ", remainingPeter)
.setColor("RANDOM");
if(remainingPeter > 0){
embed.spliceFields(8);
}
if (remainingMartin > 0) {
embed.spliceFields(6, 3);
}
countdownChannel.send(embed);
}
client.login(process.env.token);