Skip to content

Conversation

brooke-ec
Copy link
Contributor

Checklist

  • Related issue:
  • Changesets done
  • Docs Updated
  • Tests Added

Body

I've modified the modal plugin to contain a fields property. This is used to add automatic typing to a new fields object in ctx. This system could also be added to commands for typing options.

import { TextInputStyle } from 'discord.js';
import { modal } from 'jellycommands';

export default modal({
	id: 'test',
	fields: [
		{
			customId: 'nameInput',
			label: 'What is your name?',
			style: TextInputStyle.Short,
		},
	],

	async run({ interaction, fields }) {
		interaction.reply({
			content: `Hello, ${fields.nameInput}`,
		});
	},
});

image

However, at the moment modals must still be created manually. This is not ideal when they are already being defined here. A system would need to be devised that allows this to be used when responding to interactions while also playing nicely with the "custom id" system. Once decided, this could be reused for buttons and dropdown selects.

Copy link

changeset-bot bot commented May 19, 2025

🦋 Changeset detected

Latest commit: eee9113

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
jellycommands Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant