foguete-buttons
v2.5.0
Published
Let's make Discord buttons / dropdowns easier?
Downloads
33
Readme
Foguete-buttons
About
Foguete-buttons is a light-weight npm for use easily buttons & dropdowns.
Supported Versions
| Version | Supported | | ------- | ------------------ | | 2.4.0 | :white_check_mark: | | >= 2.3.0 | :x: | Do NOT report a bug if the version is marked as unsupported.
Changelog
Fixed README.md, added disabled to messageButtons.
Usage of MessageButton
const { MessageButton } = require('foguete-buttons')
new MessageButton()
.createButton({
content: 'Hey!',
embed: {
title: 'Hello, title!',
thumbnail: { url: 'https://someimage.com' }
description: "What's on?",
color: 'a decimal color'
footer: {
text: 'Hi, footer',
iconURL: 'https://someimage.com'
},
image: { url: 'https://someimage.com' }
video: { url: 'https://somevideo.com' }
},
buttons: [{
label: 'click here',
color: '1',
isUrlButton: false,
id: 'test',
emoji_name: 'mouse',
emoji_id: '230127013721301'
}, {
label: 'dont click here',
color: '4',
isUrlButton: true,
url: 'https://google.com',
}
], channel: 'channelID', token: 'token' })
```
## Usage of dropdown
```js
const { messageDropdown } = require('foguete-buttons')
new MessageDropdown()
.createDropdown({
content: 'hey',
embed: null,
custom_id: 'test_message',
text: 'Choose one of them!',
min_values: '1',
max_values: '1',
dropdowns: [{
label: 'abc',
id: 'first_option',
description: 'abc is the first letters!',
emoji_id: '780546909029924894',
emoji_name: 'nodejs'
}, {
label: 'def',
id: 'another_option',
description: "Hey, I'm powered with foguete-buttons!"
}
], channel: 'channelID', token: 'token' })
```
## Respond to the button / dropdown
Obs: I don't recommend using the v13 interactionCreate event.
```js
client.ws.on('INTERACTION_CREATE', (data) => {
client.api.interactions(data.id, data.token).callback.post({
data: {
type: 7,
data: {
content: "What's on?",
}
}
})
})
```
You can see more types in this image.
![Types](https://i.imgur.com/e6qLe3v.png)
# Observation
For use as slash command response, add the field "slash" with "type", "id" and "token" fields