added welcome msg

This commit is contained in:
2025-01-03 23:56:37 +01:00
parent 2592aea260
commit edacc747b3
7 changed files with 81 additions and 17 deletions

View File

@@ -1,10 +1,12 @@
import { Commands, type CommandsType } from "commands";
import type {
ButtonInteraction,
CacheType,
ChatInputCommandInteraction,
Interaction,
ModalSubmitInteraction,
import {
Client,
IntentsBitField,
type ButtonInteraction,
type CacheType,
type ChatInputCommandInteraction,
type Interaction,
type ModalSubmitInteraction,
} from "discord.js";
import client from "lib/client";
import EventEmitter from "node:events";
@@ -15,6 +17,7 @@ import { MedicationService } from "actions/medication/medication.service";
import { HelpService } from "actions/help/help.service";
import { custom } from "zod";
import { GreetingService } from "actions/greeting/greeting.service";
import { ActivityService } from "actions/activity/activity.service";
export default class DiscordController extends EventEmitter {
private discordService!: DiscordService;
@@ -22,6 +25,7 @@ export default class DiscordController extends EventEmitter {
greetingService: GreetingService;
medicationService: MedicationService;
helpService: HelpService;
activityService: ActivityService;
constructor() {
super();
@@ -30,6 +34,7 @@ export default class DiscordController extends EventEmitter {
this.greetingService = new GreetingService();
this.medicationService = new MedicationService();
this.helpService = new HelpService();
this.activityService = new ActivityService();
// log when running
client.once("ready", async () => {
this.setActivity();
@@ -38,10 +43,14 @@ export default class DiscordController extends EventEmitter {
// listen for interactions
client.on("interactionCreate", this.handleInteraction.bind(this));
client.on("guildMemberAdd", async (member) => {
console.log("client on guildMemberAdd");
await this.greetingService.welcome(member);
});
}
async setActivity() {
client.user?.setActivity("meine website ist online! :o", { type: 4 });
client.user?.setActivity(":3", { type: 4 });
console.log("set activity");
client.user?.setPresence({
status: "online",