discord greting service update

This commit is contained in:
mo
2026-03-06 22:31:32 +01:00
parent b138b8378b
commit 73b1d82f43
4 changed files with 17 additions and 5 deletions

View File

@@ -1,8 +1,9 @@
import { GreetingService } from "@avocadi/bot-core/features/greeting/greeting.service"; import { GreetingService } from "@avocadi/bot-core/features/greeting/greeting.service";
import { i18nService } from "@avocadi/bot-core/lib/i18n"; import { i18nService } from "@avocadi/bot-core/lib/i18n";
import type { Channel, Message, User } from "discord.js";
import { messagesService } from "entities/messages/messages.service"; import { messagesService } from "entities/messages/messages.service";
export const greetingService = new GreetingService( export const greetingService = new GreetingService<User, Message, Channel>(
messagesService, messagesService,
i18nService, i18nService,
"de", "de",

View File

@@ -1,6 +1,7 @@
import type { MessagesServiceInterface } from "entities/messages/messages.service"; import type { MessagesServiceInterface } from "entities/messages/messages.service";
import type { BaseChannel, BaseMessage, BaseUser } from "lib/common"; import type { BaseChannel, BaseMessage, BaseUser } from "lib/common";
import type { I18nService } from "lib/i18n/i18n.service"; import type { I18nService } from "lib/i18n/i18n.service";
import { createLogger } from "lib/logger";
export class GreetingService< export class GreetingService<
U extends BaseUser = BaseUser, U extends BaseUser = BaseUser,
@@ -11,6 +12,7 @@ export class GreetingService<
i18nService: I18nService; i18nService: I18nService;
lang: "en" | "de"; lang: "en" | "de";
ns = "greeting"; ns = "greeting";
private logger = createLogger("GreetingService");
constructor( constructor(
messagesService: MessagesServiceInterface<U, M, C>, messagesService: MessagesServiceInterface<U, M, C>,
@@ -22,7 +24,8 @@ export class GreetingService<
this.lang = lang; this.lang = lang;
} }
async sendDmGreeting(user: U, _userName: string) { async sendDmGreeting(user: U) {
this.logger.debug("send dm");
const greetingMessage: string = await this.i18nService.t( const greetingMessage: string = await this.i18nService.t(
"dmGreeting", "dmGreeting",
this.lang, this.lang,
@@ -32,11 +35,13 @@ export class GreetingService<
await this.messagesService.sendToUser(user, greetingMessage); await this.messagesService.sendToUser(user, greetingMessage);
} }
async sendGreeting(userName: string, channel: C) { async sendGreeting(userId: string, channel: C) {
this.logger.debug("send greeting");
const greetingMessage: string = const greetingMessage: string =
(await this.i18nService.t("greeting1", this.lang, this.ns)) + (await this.i18nService.t("greeting1", this.lang, this.ns)) +
(await this.i18nService.t("greeting2", this.lang, this.ns, { (await this.i18nService.t("greeting2", this.lang, this.ns, {
member: userName, memberId: userId,
})) + })) +
(await this.i18nService.t("greeting3", this.lang, this.ns)) + (await this.i18nService.t("greeting3", this.lang, this.ns)) +
(await this.i18nService.t("greeting4", this.lang, this.ns)) + (await this.i18nService.t("greeting4", this.lang, this.ns)) +

View File

@@ -20,11 +20,14 @@ export default {
], ],
greeting4: [". ", "! "], greeting4: [". ", "! "],
emoji: ["😊", "💕", "✨", "💖", ":3", ":)", "c:", "<3", "<333"], emoji: ["😊", "💕", "✨", "💖", ":3", ":)", "c:", "<3", "<333"],
dm: `hey! ich bin avocadi von avocadi study!! dmGreeting: `hey! ich bin avocadi von avocadi study!!
um auf den rest des servers zugreifen zu koennen, musst du dich noch vorstellen! um auf den rest des servers zugreifen zu koennen, musst du dich noch vorstellen!
--- ---
z.b.: name, alter, pronomen, klasse/studiengang/beruf, hobby, ueber mich: z.b.: name, alter, pronomen, klasse/studiengang/beruf, hobby, ueber mich:
--- ---
sobald wir deine nachricht ueberprueft haben, bekommst du die rolle **lernende:r** :)`, sobald wir deine nachricht ueberprueft haben, bekommst du die rolle **lernende:r** :)`,
log: `neues mitglied: <@{{memberId}}> ({{memberUserName}}) ist dem server beigetreten.`, log: `neues mitglied: <@{{memberId}}> ({{memberUserName}}) ist dem server beigetreten.`,
} as const; } as const;

View File

@@ -22,10 +22,13 @@ export default {
greeting4: [". ", "! "], greeting4: [". ", "! "],
emoji: ["😊", "💕", "✨", "💖", ":3", ":)", "c:", "<3", "<333"], emoji: ["😊", "💕", "✨", "💖", ":3", ":)", "c:", "<3", "<333"],
dmGreeting: `hey! i'm avocadi from avocadi study!! dmGreeting: `hey! i'm avocadi from avocadi study!!
in order to access the rest of the server, you still need to introduce yourself! in order to access the rest of the server, you still need to introduce yourself!
--- ---
e.g.: name, age, pronouns, class/degree/profession, hobbies, about me e.g.: name, age, pronouns, class/degree/profession, hobbies, about me
--- ---
once we have reviewed your message, you will be assigned the role **member** :)`, once we have reviewed your message, you will be assigned the role **member** :)`,
log: `new member: <@{{memberId}}> ({{memberUserName}}) joined the server.`, log: `new member: <@{{memberId}}> ({{memberUserName}}) joined the server.`,
} as const; } as const;