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

@ -33,6 +33,10 @@ import {ServerConfigurationProvider} from "../../Configuration/Server/ServerConf
import {ServerConfigurationRepository} from "../../Database/Repositories/ServerConfigurationRepository";
import {PermissionError} from "../PermissionError";
import {EmbedLibrary, EmbedType} from "../EmbedLibrary";
import {EventHandler} from "../../Events/EventHandler";
import {ElementChangedEvent} from "../../Events/EventClasses/ElementChangedEvent";
import GroupConfiguration from "../../Database/tables/GroupConfiguration";
import Groups from "../../Database/tables/Groups";
export class GroupCommand implements Command, ChatInteractionCommand, AutocompleteCommand {
private static GOODBYE_MESSAGES: string[] = [
@ -50,7 +54,7 @@ export class GroupCommand implements Command, ChatInteractionCommand, Autocomple
definition(): SlashCommandBuilder {
// @ts-expect-error Slash command expects more than needed.
return new SlashCommandBuilder()
.setName('groups')
.setName('group')
.setDescription(`Manages groups`)
.addSubcommand(create =>
create.setName("create")
@ -289,9 +293,9 @@ export class GroupCommand implements Command, ChatInteractionCommand, Autocomple
type: MenuItemType.Collection,
children: [
{
traversalKey: "newPlaydates",
label: "New Playdates",
description: "Sets the channel, where the group gets notified, when new Playdates are set.",
traversalKey: "notifications",
label: "Notifications",
description: "Sets the channel, where the group gets notified, when things are happening, such as a new playdate is created.",
},
{
traversalKey: "playdateReminders",
@ -369,6 +373,17 @@ export class GroupCommand implements Command, ChatInteractionCommand, Autocomple
group.leader.memberid = newLeader.id
repo.update(group);
Container.get<EventHandler>(EventHandler.name)
.dispatch(new ElementChangedEvent<GroupModel>(
Groups.name,
{
id: group.id,
leader: {
memberid: newLeader.id
}
}
))
await interaction.reply({
embeds: [
EmbedLibrary.base(