added "newYear"

This commit is contained in:
2025-01-01 18:53:33 +01:00
parent e7cd840c48
commit b46dc8d3ae
5 changed files with 53 additions and 9 deletions

View File

@@ -4,6 +4,18 @@ import { getRandomInt } from "lib/utils";
import { greetContent, sleepContent } from "./greeting.components.ts";
export class GreetingService {
async customMessage() {
console.log("custom message");
const channels = client.channels;
const channel = channels.cache.get(config.discord.channelId);
if (channel?.isTextBased && channel?.isSendable()) {
await channel.send({ content: " " });
}
}
async greet() {
client.user?.setActivity("guten morgen! :3", { type: 4 });
console.log("set activity: awake");
@@ -36,6 +48,22 @@ export class GreetingService {
}
}
async newYear() {
client.user?.setActivity("frohes neues! :)", { type: 4 });
console.log("set activity: happy new Year");
client.user?.setPresence({
status: "online",
});
/*const channels = client.channels;
const channel = channels.cache.get(config.discord.channelId);
if (channel?.isTextBased && channel?.isSendable()) {
await channel.send({ content: "frohes neues! @everyone" });
}*/
}
getContent(asleep: boolean) {
if (asleep) {
return sleepContent[getRandomInt(0, sleepContent.length - 1)];

View File

@@ -13,6 +13,7 @@ new CronJob(
true, // start
"Europe/Berlin", // timeZone
);
// job.start() is optional here because of the fourth parameter set to true.
new CronJob(
"0 30 22 * * *",
@@ -23,4 +24,15 @@ new CronJob(
null,
true,
"Europe/Berlin",
);
new CronJob(
"0 0 0 1 1 *",
async () => {
console.log("happy new year");
await greetingService.newYear();
},
null,
true,
"Europe/Berlin",
);

View File

@@ -4,7 +4,7 @@ import { WaterMeService } from "actions/waterMe/waterMe.service";
const waterMeService = new WaterMeService();
new CronJob(
"0 * * * * *", // cronTime
"0 0 20 * * *", // cronTime
async () => {
console.log("isThirsty()");
await waterMeService.isThirsty();
@@ -13,4 +13,4 @@ new CronJob(
true, // start
"Europe/Berlin", // timeZone
);
// job.start() is optional here because of the fourth parameter set to true.
// job.start() is optional here because of the fourth parameter set to true.