refactor(menu): Made sure the menu can be used for more than group
This commit is contained in:
parent
a79898b2e9
commit
1d73ee8a78
16 changed files with 650 additions and 406 deletions
|
|
@ -1,12 +1,15 @@
|
|||
import {
|
||||
SlashCommandBuilder,
|
||||
ChatInputCommandInteraction,
|
||||
MessageFlags,
|
||||
InteractionReplyOptions,
|
||||
GuildMember,
|
||||
EmbedBuilder,
|
||||
AutocompleteInteraction,
|
||||
roleMention, time, userMention, GuildMemberRoleManager
|
||||
ChatInputCommandInteraction,
|
||||
EmbedBuilder,
|
||||
GuildMember,
|
||||
GuildMemberRoleManager,
|
||||
InteractionReplyOptions,
|
||||
MessageFlags,
|
||||
roleMention,
|
||||
SlashCommandBuilder,
|
||||
time,
|
||||
userMention
|
||||
} from "discord.js";
|
||||
import {AutocompleteCommand, ChatInteractionCommand, Command} from "./Command";
|
||||
import {GroupModel} from "../../Models/GroupModel";
|
||||
|
|
@ -21,6 +24,10 @@ import {GroupConfigurationTransformers} from "../../Groups/GroupConfigurationTra
|
|||
import {GroupConfigurationRepository} from "../../Repositories/GroupConfigurationRepository";
|
||||
import {PlaydateRepository} from "../../Repositories/PlaydateRepository";
|
||||
import {Nullable} from "../../types/Nullable";
|
||||
import {MenuRenderer} from "../../Menu/MenuRenderer";
|
||||
import {MenuItemType} from "../../Menu/MenuRenderer.types";
|
||||
import {ConfigurationMenuHandler} from "../../Groups/ConfigurationMenuHandler";
|
||||
import {MenuTraversal} from "../../Menu/MenuTraversal";
|
||||
|
||||
export class GroupCommand implements Command, ChatInteractionCommand, AutocompleteCommand {
|
||||
private static GOODBYE_MESSAGES: string[] = [
|
||||
|
|
@ -232,16 +239,23 @@ export class GroupCommand implements Command, ChatInteractionCommand, Autocomple
|
|||
|
||||
private async runConfigurator(interaction: ChatInputCommandInteraction) {
|
||||
const group = GroupSelection.getGroup(interaction);
|
||||
|
||||
const configurationRenderer = new GroupConfigurationRenderer(
|
||||
const menuHandler = new ConfigurationMenuHandler(
|
||||
new GroupConfigurationHandler(
|
||||
Container.get<GroupConfigurationRepository>(GroupConfigurationRepository.name),
|
||||
group
|
||||
),
|
||||
new GroupConfigurationTransformers(),
|
||||
)
|
||||
|
||||
await configurationRenderer.setup(interaction);
|
||||
|
||||
const menu = new MenuRenderer(
|
||||
new MenuTraversal(
|
||||
menuHandler.getMenuItems(),
|
||||
'Group Configuration',
|
||||
"This UI allows you to change settings for your group."
|
||||
)
|
||||
)
|
||||
|
||||
menu.display(interaction);
|
||||
}
|
||||
|
||||
private async transferLeadership(interaction: ChatInputCommandInteraction) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue