This Command makes a bot that sends the time when someone says a specific command.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
var today = new Date();
var Minutes = 0;
var Seconds = 0;
if (today.getMinutes() < 10) {
Minutes = String(0) + String(today.getMinutes());
} else {
Minutes = today.getMinutes();
}
if (today.getSeconds() < 10) {
Seconds = String(0) + String(today.getSeconds());
} else {
Seconds = today.getSeconds();
}
await lib.discord.channels['@0.3.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content:
`Hello. Today is ` +
today.getFullYear() +
`-` +
(today.getMonth() + 1) +
`-` +
today.getDate() +
` at ` +
today.getHours() +
`:` +
Minutes +
`:` +
Seconds +
` GMT.`,
});
await lib.discord.users['@0.2.1'].dms.create({
recipient_id: `${context.params.event.member.user.id}`,
content:
`Hello. Today is ` +
today.getFullYear() +
`-` +
(today.getMonth() + 1) +
`-` +
today.getDate() +
` at ` +
today.getHours() +
`:` +
Minutes +
`:` +
Seconds +
` GMT.`,
tts: true,
});