It shows quite some stuff: what time it is - UTC timezone (can change), what date it is, if it is already weekend and how many days untill weekend.
let lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let now = new Date();
let month = now.getMonth() + 1;
let day = now.getDate();
let hour = now.getHours() + 1; // To get other TimeZones add a certain value to now.getHours() like is 1 there - if no number is addded it says 16.00
let min = now.getMinutes();
let year = now.getFullYear();
let seconds = now.getSeconds();
let time = `${hour}:${min}:${seconds}`;
let date = `${month}/${day}/${year}`;
switch (new Date().getDay()) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
}
let status;
switch (new Date().getDay()) {
default:
status = "It's still not weekend : (";
break;
case 6:
status = "It is weekend! Let's gooo";
}
let untill;
switch (new Date().getDay()) {
case 0:
untill = "There is **5** days untill weekend.";
break;
case 1:
untill = "There is **4** days untill weekend.";
break;
case 2:
untill = "There is **3** days untill weekend.";
break;
case 3:
untill = "There is **2** days untill weekend.";
break;
case 4:
untill = "There is **1** day untill weekend.";
}
let message = context.params.event.content;
if(message.startsWith(`>handwatch`)) {
await lib.discord.channels['@0.0.6'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `It is currently **${time}** CET
Weekend status: **${status}** - ${untill}
Today's date: **${date}** - ` +day
});
}