Moved deployment code to class
This commit is contained in:
parent
aef26b1cc3
commit
83209f642c
6 changed files with 61 additions and 39 deletions
|
|
@ -13,10 +13,10 @@ import {
|
|||
InteractionCallbackResponse,
|
||||
InteractionEditReplyOptions,
|
||||
InteractionReplyOptions,
|
||||
InteractionUpdateOptions, italic,
|
||||
InteractionUpdateOptions, italic, MessageFlags,
|
||||
SelectMenuBuilder,
|
||||
StringSelectMenuBuilder,
|
||||
StringSelectMenuOptionBuilder,
|
||||
StringSelectMenuOptionBuilder, TextBasedChannel,
|
||||
UserSelectMenuBuilder
|
||||
} from "discord.js";
|
||||
import {Logger} from "log4js";
|
||||
|
|
@ -35,6 +35,8 @@ import {RuntimeGroupConfiguration} from "./RuntimeGroupConfiguration";
|
|||
import {ChannelId} from "../types/DiscordTypes";
|
||||
import {IconCache} from "../Icons/IconCache";
|
||||
import {ifError} from "node:assert";
|
||||
import {DiscordClient} from "../Discord/DiscordClient";
|
||||
import {channel} from "node:diagnostics_channel";
|
||||
|
||||
type UIElementCollection = Record<string, UIElement>;
|
||||
type UIElement = {
|
||||
|
|
@ -100,7 +102,6 @@ export class GroupConfigurationRenderer {
|
|||
|
||||
public async setup(interaction: ChatInputCommandInteraction) {
|
||||
let response = await interaction.reply(this.getReplyOptions());
|
||||
|
||||
let exit = false;
|
||||
let eventResponse;
|
||||
const filter = i => i.user.id === interaction.user.id;
|
||||
|
|
@ -111,15 +112,15 @@ export class GroupConfigurationRenderer {
|
|||
}
|
||||
|
||||
try {
|
||||
|
||||
eventResponse = await response.resource?.message?.awaitMessageComponent({
|
||||
dispose: true,
|
||||
filter: filter,
|
||||
time: 60_000
|
||||
});
|
||||
} catch (e) {
|
||||
Container.get<Logger>("logger").error("awaiting message component failed: ", e)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!eventResponse || eventResponse.customId === 'exit') {
|
||||
exit = true;
|
||||
continue;
|
||||
|
|
@ -157,8 +158,13 @@ export class GroupConfigurationRenderer {
|
|||
return;
|
||||
}
|
||||
|
||||
if (interaction.replied) {
|
||||
await interaction.deleteReply();
|
||||
const message = response.resource?.message
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.deletable) {
|
||||
await message.delete()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -190,6 +196,7 @@ export class GroupConfigurationRenderer {
|
|||
embeds: [embed],
|
||||
components: [...this.createActionRowBuildersForMenu(), actionrow],
|
||||
withResponse: true,
|
||||
flags: MessageFlags.Ephemeral
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue