Components

Modals

Modals can also be created in Seyfert. They are created with a builder like other components do and then TextInput components, inside an ActionRow, are attached to it.

Here is an example of how to create a modal with two text inputs:

import { , ,  } from 'seyfert';
 
import {  } from 'seyfert/lib/types';
 
const  = new ()
  .('name')
  .(.)
  .('Name');
 
const  = new <>().([]);
 
const  = new ()
  .('age')
  .(.)
  .('Age');
 
const  = new <>().([]);
 
const  = new ()
  .('mymodal')
  .('My Modal')
  .([, ]);

Handling Modals

To handle modals, as they aren't components, Seyfert provides ModalCommmand class which has the same logic as the ComponentCommand class.

import { , type  } from 'seyfert';
 
export default class  extends  {
  (: ) {
    return . === 'mymodal';
  }
 
  async (: ) {
    const  = .;
    
    //we are getting the textinput values by passing their custom ids in the getInputValue method.
 
    const  = .('name', true);
 
    const  = .('age', true);
 
    return .({
      : `You are ${} and you have ${} years`
    });
  }
} 

On this page