1.0.1 • Published 2 years ago

discord-arab v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

alt text

Install

npm i discord-arab

Make A new Client :

const {Client} = require('discord-arab')
const client = new Client('your token')

client.on('ready' , () => {
  console.log('Super  Hero Bot Is Ready')
})

Discord Modals

  • Make A new Button Creator
const {Client,EmbedCreateor,rowCreator,ModalRow,TextInput,buttonCreateor} = require('discord-arab')

client.on('messageCreate',message => {
  if(message.content === 'tst') {
  let row = new rowCreator()
  .addComponents(
    new buttonCreateor()
    .setCustomId('my_button')
     .setLabel('Click Here !!')
    .setStyle(1)
    
  )
  message.send({content : 'Hello Pong Ping !',components : [row.toJSON()]})
  }
  })

alt text

  • Receive Interactions
client.on('interactionCreate',interaction => {
if(interaction.type === 3) {

  let modal = new ModalRow()
  .setLabel('MyFirst Modal')
  .setCustomId('modal')
  .addComponents(
new TextInput()
.setLabel("name")
.setStyle("short")
    .setPlaceholder('Click Me ')
.setCustomId("option1")
.setMax(10)
.setMin(2)
.setRequired(true),
new TextInput()
.setLabel("about_you")
.setStyle("paragraph")
.setCustomId("option2")
.setMax(100)
.setMin(10)
.setPlaceholder('Click Me ')
.setRequired(true),


)
interaction.viewModal(modal)
  }
})

alt text

  • Receive Modal InterAction
client.on('interactionCreate',interaction = > {
  if(interaction.type === 5) {
  cosnt option1 = interaction.getTextValue('option1')
    cosnt option2 = interaction.getTextValue('option2')
  console.log(option1)
  console.log(option2)
  
  }
})