additional changes

This commit is contained in:
mo
2026-03-01 16:55:23 +01:00
parent 0e014dd08d
commit 93788b9873
11 changed files with 54 additions and 14 deletions

View File

@@ -42,6 +42,7 @@
"./entities/messages/messages.service": "./dist/entities/messages/messages.service.js",
"./entities/roles/roles.schema": "./dist/entities/roles/roles.schema.js",
"./entities/roles/roles.service": "./dist/entities/roles/roles.service.js",
"./features/accept-user/accept-user.service": "./dist/features/accept-user/accept-user.service.js",
"./features/dynamic-voice-channels/dynamic-voice-channels.schema": "./dist/features/dynamic-voice-channels/dynamic-voice-channels.schema.js",
"./features/dynamic-voice-channels/dynamic-voice-channels.service": "./dist/features/dynamic-voice-channels/dynamic-voice-channels.service.js",
"./features/greeting/greeting.service": "./dist/features/greeting/greeting.service.js",

View File

@@ -0,0 +1,39 @@
import type { MessagesServiceInterface } from "entities/messages/messages.service";
import type { BaseUser } from "lib/common";
import type { I18nService } from "lib/i18n/i18n.service";
import { createLogger } from "lib/logger";
export class AcceptUserService<U extends BaseUser = BaseUser> {
messagesService: MessagesServiceInterface<U>;
i18nService: I18nService;
lang: "en" | "de";
ns = "acceptUser";
private logger = createLogger("AcceptUserService");
constructor(
messagesService: MessagesServiceInterface<U>,
i18nService: I18nService,
lang: "en" | "de",
) {
this.messagesService = messagesService;
this.i18nService = i18nService;
this.lang = lang;
}
async sendDmAcceptUser(user: U) {
this.logger.info("test");
this.logger.info(`accepting ${user.id}...`);
const acceptUserMessage: string = await this.i18nService.t(
"dmAcceptUser",
this.lang,
this.ns,
);
this.logger.info(`accepting ${user.id}...`);
await this.messagesService.sendToUser(user, acceptUserMessage);
}
}

View File

@@ -6,6 +6,7 @@ export const DynamicVoiceChannelKeyOptions = [
VoiceChannels.enum["for-three"],
VoiceChannels.enum["for-four"],
VoiceChannels.enum["for-group"],
VoiceChannels.enum.custom,
] as const;
export const DynamicVoiceChannelKeys = z.enum(DynamicVoiceChannelKeyOptions);

View File

@@ -30,15 +30,13 @@ export class DynamicVoiceChannelsService<
);
}
async createDynamicVoiceChannel(id: string): Promise<C | void> {
async createDynamicVoiceChannel(id: string): Promise<C | undefined> {
if (this.validChannelIds.has(id)) {
// Channel is one of the dynamic voice channels, create a new one based on it
const channel = await this.voiceChannelsService.getVoiceChannelById(id);
if (!channel) {
throw new Error(`Channel with id ${id} not found`);
}
if (!channel) return;
const newChannel = await this.voiceChannelsService.cloneVoiceChannel(
channel,