aboutsummaryrefslogtreecommitdiff
path: root/lib/utils/Utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/Utils.ts')
-rw-r--r--lib/utils/Utils.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/utils/Utils.ts b/lib/utils/Utils.ts
index 13806ec..ea70abf 100644
--- a/lib/utils/Utils.ts
+++ b/lib/utils/Utils.ts
@@ -1,9 +1,11 @@
+import { Util as AkairoUtil } from '@notenoughupdates/discord-akairo';
import { humanizeDuration as humanizeDurationMod } from '@notenoughupdates/humanize-duration';
+import deepLock from '@tanzanite/deep-lock';
import assert from 'assert/strict';
import cp from 'child_process';
-import deepLock from 'deep-lock';
-import { Util as AkairoUtil } from 'discord-akairo';
import {
+ ActionRowBuilder,
+ APITextInputComponent,
Constants as DiscordConstants,
EmbedBuilder,
Message,
@@ -11,6 +13,8 @@ import {
PermissionFlagsBits,
PermissionsBitField,
PermissionsString,
+ TextInputBuilder,
+ TextInputComponentData,
type APIEmbed,
type APIMessage,
type CommandInteraction,
@@ -159,7 +163,7 @@ export async function slashRespond(
delete (newResponseOptions as InteractionReplyOptions).ephemeral; // Cannot change a preexisting message to be ephemeral
return (await interaction.editReply(newResponseOptions)) as Message | APIMessage;
} else {
- await interaction.reply(newResponseOptions);
+ await interaction.reply(newResponseOptions as SlashSendMessageType);
return await interaction.fetchReply().catch(() => undefined);
}
}
@@ -547,3 +551,9 @@ export function deepWriteable<T>(obj: T): DeepWritable<T> {
export function formatPerms(permissions: PermissionsString[]) {
return permissions.map((p) => `\`${mappings.permissions[p]?.name ?? p}\``).join(', ');
}
+
+export function ModalInput(options: Partial<TextInputComponentData | APITextInputComponent>): ActionRowBuilder<TextInputBuilder> {
+ return new ActionRowBuilder<TextInputBuilder>({
+ components: [new TextInputBuilder(options)]
+ });
+}