added welcome msg
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user