additional changes
This commit is contained in:
@@ -3,5 +3,5 @@ import { logger } from "lib/common-logger";
|
|||||||
|
|
||||||
export const handleShutdown = async () => {
|
export const handleShutdown = async () => {
|
||||||
logger.info("bot is shutting down...");
|
logger.info("bot is shutting down...");
|
||||||
await logChannelService.sendLogMessage("ich geh schlafen...");
|
await logChannelService.sendLogMessage("**S H U T T I N G D O W N**");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export const ConfigSchema = z.object({
|
|||||||
}),
|
}),
|
||||||
guildId: z.string(),
|
guildId: z.string(),
|
||||||
version: z.number(),
|
version: z.number(),
|
||||||
|
commandPrefix: z.string().default("!"),
|
||||||
discord: z.object({
|
discord: z.object({
|
||||||
token: z.string(),
|
token: z.string(),
|
||||||
applicationId: z.string(),
|
applicationId: z.string(),
|
||||||
|
|||||||
@@ -26,5 +26,10 @@ export const dynamicVoiceChannelService = new DynamicVoiceChannelsService(
|
|||||||
key: VoiceChannels.enum["for-group"],
|
key: VoiceChannels.enum["for-group"],
|
||||||
size: 99,
|
size: 99,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
channelId: config.channelMapping.voice.custom,
|
||||||
|
key: VoiceChannels.enum.custom,
|
||||||
|
size: 99,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ client.on(Events.GuildMemberAdd, async (member: GuildMember) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const channel = await client.channels.fetch(
|
const channel = await client.channels.fetch(
|
||||||
config.channelMapping.text.welcome,
|
process.env.NODE_ENV === "production"
|
||||||
|
? config.channelMapping.text.welcome
|
||||||
|
: config.channelMapping.text.testing,
|
||||||
);
|
);
|
||||||
|
|
||||||
await logChannelService.sendLogMessage(
|
await logChannelService.sendLogMessage(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import "./ready.listener";
|
import "./ready.listener";
|
||||||
import "./stop.listener";
|
import "./stop.listener";
|
||||||
import "./messages/messages.listener";
|
import "./messages/messages.listener";
|
||||||
|
import "./reactions/reactions.listener";
|
||||||
import "./guild-members/guild-members.listener";
|
import "./guild-members/guild-members.listener";
|
||||||
|
|||||||
@@ -7,14 +7,6 @@ import { logger } from "lib/common-logger";
|
|||||||
import { handleCommand } from "./handle-command";
|
import { handleCommand } from "./handle-command";
|
||||||
|
|
||||||
client.on(Events.MessageCreate, async (message: Message) => {
|
client.on(Events.MessageCreate, async (message: Message) => {
|
||||||
// if (
|
|
||||||
// message.channel?.id !== config.channelMapping.text.log &&
|
|
||||||
// message.channel?.id !== config.channelMapping.text.bot
|
|
||||||
// ) {
|
|
||||||
// return;
|
|
||||||
// // await messagesService.logMessage(message);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (message.content?.startsWith(config.commandPrefix) && message.channel) {
|
if (message.content?.startsWith(config.commandPrefix) && message.channel) {
|
||||||
await messagesService.logMessage(message);
|
await messagesService.logMessage(message);
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
"./entities/messages/messages.service": "./dist/entities/messages/messages.service.js",
|
"./entities/messages/messages.service": "./dist/entities/messages/messages.service.js",
|
||||||
"./entities/roles/roles.schema": "./dist/entities/roles/roles.schema.js",
|
"./entities/roles/roles.schema": "./dist/entities/roles/roles.schema.js",
|
||||||
"./entities/roles/roles.service": "./dist/entities/roles/roles.service.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.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/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",
|
"./features/greeting/greeting.service": "./dist/features/greeting/greeting.service.js",
|
||||||
|
|||||||
39
core/src/features/accept-user/accept-user.service.ts
Normal file
39
core/src/features/accept-user/accept-user.service.ts
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ export const DynamicVoiceChannelKeyOptions = [
|
|||||||
VoiceChannels.enum["for-three"],
|
VoiceChannels.enum["for-three"],
|
||||||
VoiceChannels.enum["for-four"],
|
VoiceChannels.enum["for-four"],
|
||||||
VoiceChannels.enum["for-group"],
|
VoiceChannels.enum["for-group"],
|
||||||
|
VoiceChannels.enum.custom,
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const DynamicVoiceChannelKeys = z.enum(DynamicVoiceChannelKeyOptions);
|
export const DynamicVoiceChannelKeys = z.enum(DynamicVoiceChannelKeyOptions);
|
||||||
|
|||||||
@@ -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)) {
|
if (this.validChannelIds.has(id)) {
|
||||||
// Channel is one of the dynamic voice channels, create a new one based on it
|
// Channel is one of the dynamic voice channels, create a new one based on it
|
||||||
|
|
||||||
const channel = await this.voiceChannelsService.getVoiceChannelById(id);
|
const channel = await this.voiceChannelsService.getVoiceChannelById(id);
|
||||||
|
|
||||||
if (!channel) {
|
if (!channel) return;
|
||||||
throw new Error(`Channel with id ${id} not found`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const newChannel = await this.voiceChannelsService.cloneVoiceChannel(
|
const newChannel = await this.voiceChannelsService.cloneVoiceChannel(
|
||||||
channel,
|
channel,
|
||||||
|
|||||||
Reference in New Issue
Block a user