diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-10-03 22:57:40 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-10-03 22:57:40 -0400 |
commit | 612ed820a0600ec11ed642005377cd7f5a8a8b77 (patch) | |
tree | 6bca4e7268fd0063ff53cf64fa44df62a23dba50 /lib/utils/Utils.ts | |
parent | ed98ff7e2679f362f2657e77a6cf8dd3ce9b3d43 (diff) | |
download | tanzanite-612ed820a0600ec11ed642005377cd7f5a8a8b77.tar.gz tanzanite-612ed820a0600ec11ed642005377cd7f5a8a8b77.tar.bz2 tanzanite-612ed820a0600ec11ed642005377cd7f5a8a8b77.zip |
wip
Diffstat (limited to 'lib/utils/Utils.ts')
-rw-r--r-- | lib/utils/Utils.ts | 16 |
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)] + }); +} |