Adds some more polish

This commit is contained in:
Michel Fedde 2025-06-26 21:38:03 +02:00
parent b3d0b3a90c
commit 11bd836ec3
18 changed files with 272 additions and 29 deletions

View file

@ -1,7 +1,7 @@
import {ElementCreatedEvent} from "../EventClasses/ElementCreatedEvent";
import {PlaydateModel} from "../../Database/Models/PlaydateModel";
import PlaydateTableConfiguration from "../../Database/tables/Playdate";
import {EmbedBuilder, roleMention, time} from "discord.js";
import {EmbedBuilder, roleMention, time, userMention} from "discord.js";
import {ArrayUtils} from "../../Utilities/ArrayUtils";
import {Container} from "../../Container/Container";
import {GroupConfigurationRepository} from "../../Database/Repositories/GroupConfigurationRepository";
@ -12,6 +12,7 @@ import {
GroupConfigurationProvider,
RuntimeGroupConfiguration
} from "../../Configuration/Groups/GroupConfigurationProvider";
import {EmbedLibrary} from "../../Discord/EmbedLibrary";
const NEW_PLAYDATE_MESSAGES = [
'A new playdate was added. Lets hope, your GM has not planned to kill you. >:]',
@ -37,7 +38,7 @@ export async function sendCreatedNotificationEventHandler(event: ElementCreatedE
)
);
const targetChannel = groupConfig.getConfigurationByPath('channels.newPlaydates').value;
const targetChannel = groupConfig.getConfigurationByPath('channels.notifications').value;
if (!targetChannel) {
return;
}
@ -55,17 +56,14 @@ export async function sendCreatedNotificationEventHandler(event: ElementCreatedE
return;
}
const embed = new EmbedBuilder()
.setTitle("New Playdate added")
.setDescription(
ArrayUtils.chooseRandom(NEW_PLAYDATE_MESSAGES)
)
const embed = EmbedLibrary.withGroup(
playdate.group,
"New Playdate added",
ArrayUtils.chooseRandom(NEW_PLAYDATE_MESSAGES)
)
.addFields({
name: "Playdate:",
value: `${time(playdate.from_time, "F")} - ${time(playdate.to_time, 'F')}`,
})
.setFooter({
text: `Group: ${playdate.group.name}`
});
channel.send({