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,6 +1,7 @@
import type { MessagesServiceInterface } from "entities/messages/messages.service";
import type { BaseChannel, BaseMessage, BaseUser } from "lib/common";
import type { I18nService } from "lib/i18n/i18n.service";
import { createLogger } from "lib/logger";
export class GreetingService<
U extends BaseUser = BaseUser,
@@ -11,6 +12,7 @@ export class GreetingService<
i18nService: I18nService;
lang: "en" | "de";
ns = "greeting";
private logger = createLogger("GreetingService");
constructor(
messagesService: MessagesServiceInterface<U, M, C>,
@@ -22,7 +24,8 @@ export class GreetingService<
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(
"dmGreeting",
this.lang,
@@ -32,11 +35,13 @@ export class GreetingService<
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 =
(await this.i18nService.t("greeting1", 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("greeting4", this.lang, this.ns)) +