simplifieddjs v1.0.2
SimplifiedDJS
This NPM package is created in order to assist developers, and allow for quicker methods in creating code, without risking faliure of the code.
Installation
Run npm install simplifieddjs
, to import it into your file, ensure it is a javascript / typescript file, then put either:const SimplifiedDJS = require('simplifieddjs')
orimport SimplifiedDJS from 'simplifieddjs'
Another method of installation is importing the specific classes for example:const { Button } = require('simplifieddjs')
Examples
For this first example, we will be looking at a Button
.
const ExampleButton = new Button({})
There are 5 possible inputs able to be put in this.
- label
- id
- style
In which are all required. Then there is
- emoji
- disabled (default value false)
Which are optional.
An example button would be:
const ExampleButton = new Button({
label: 'Click me',
style: 'Primary',
id: 'button_id',
emoji: '🔥',
disabled: true,
});
You can reply with the button using an ActionRow, which leads me onto the next example. The ActionRow
const ActionRow = new ActionRow({})
The ActionRow takes in an Array of components, such as a Button. For example:
const ActionRow = new ActionRow({components: [button, button2]})
creates 2 buttons on the action row.
You would then reply to the message as a usual ActionRow would be replied with.