Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-buttons

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-buttons - npm Package Compare versions

Comparing version 2.4.1 to 3.0.0

examples.md

12

package.json
{
"name": "discord-buttons",
"version": "2.4.1",
"version": "3.0.0",
"description": "Discord.js buttons",

@@ -8,4 +8,4 @@ "main": "src/index.js",

"funding": {
"type" : "individual",
"url" : "https://ko-fi.com/angelocore"
"type": "individual",
"url": "https://ko-fi.com/angelocore"
},

@@ -20,4 +20,4 @@ "keywords": [

"button",
"angeloii",
"src"
"src",
"clickbois"
],

@@ -33,3 +33,3 @@ "author": "Angelo II#0007",

},
"homepage": "https://angelocore.gitbook.io/discord-buttons",
"homepage": "https://discord-buttons.js.org",
"devDependencies": {

@@ -36,0 +36,0 @@ "@types/node": "^15.3.0"

<div align="center">
<h1>discord-buttons</h1>
<p>

@@ -7,16 +7,17 @@ <a href="https://www.npmjs.com/package/discord-buttons"><img src="https://img.shields.io/npm/v/discord-buttons?maxAge=3600" alt="NPM version" /></a>

</p>
<p>
<a href="https://www.npmjs.com/package/discord-buttons"><img src="https://nodei.co/npm/discord-buttons.png?downloads=true&stars=true" alt="NPM Banner"></a>
</p>
<img src="http://pays.host/uploads/390c2d6f-7281-4ebd-9429-5dbff5bcee44/RBcQvq7V_.png">
</div>
<div align="center">
<img src="https://cdn.discordapp.com/attachments/846455339419172874/848300816288055296/Main.png">
<br> <br>
</div>
## Install
## 📂 | Installation
```sh
$ npm i discord-buttons
npm i discord-buttons
```
## Setup
## 📜 | Setup
```js

@@ -28,98 +29,8 @@ const discord = require('discord.js'); //Define the discord.js module

<br />
## ✍ | Examples
All of our Examples and Button Styles are in [examples.md]([http://](https://github.com/AngeloCore/discord-buttons/blob/main/examples.md))
Also you can check our [Documentation](https://discord-buttns.js.org), if you have any other problems/questions, you can join our [Support Server!](https://discord.gg/5JtyYqW)
> For more examples check our [Documentation](https://angelocore.gitbook.io/discord-buttons)
<br />
## Example
```js
let button = new disbut.MessageButton()
.setStyle('red') //default: blurple
.setLabel('My First Button!') //default: NO_LABEL_PROVIDED
.setID('click_to_function') //note: if you use the style "url" you must provide url using .setURL('https://example.com')
.setDisabled(); //disables the button | default: false
message.channel.send('Hey, i am powered by https://npmjs.com/discord-buttons', button);
```
### Multiple Buttons
```js
let button = new disbut.MessageButton()
.setStyle('red') //default: blurple
.setLabel('My First Button!') //default: NO_LABEL_PROVIDED
.setID('click_to_function') //note: if you use the style "url" you must provide url using .setURL('https://example.com')
.setDisabled(); //disables the button | default: false
let button2 = new disbut.MessageButton()
.setStyle('url') //default: blurple
.setLabel('My Second Button!') //default: NO_LABEL_PROVIDED
.setURL('[click_to_function](https://npmjs.com/discord-buttons)') //note: if you use other style you must provide id using .setID('myid')
message.channel.send('Hey, i am powered by https://npmjs.com/discord-buttons', {
buttons: [
button, button2
]
});
```
### With embed
```js
let myembed = new discord.MessageEmbed()
.setDescription('Hi!');
let btn = new disbut.MessageButton()
.setStyle('red') //default: blurple
.setLabel('My First Button!') //default: NO_LABEL_PROVIDED
.setID('click_to_function') //note: if you use the style "url" you must provide url using .setURL('https://example.com')
.setDisabled(); //disables the button | default: false
message.channel.send('Hey, i am powered by https://npmjs.com/discord-buttons', { button: btn, embed: myembed });
```
### Using command handler?
```js
const { MessageButton } = require('discord-buttons');
module.exports = {
name: 'test',
run: async (client, message, args) => {
let button = new disbut.MessageButton()
.setStyle('red') //default: blurple
.setLabel('My First Button!') //default: NO_LABEL_PROVIDED
.setID('click_to_function') //note: if you use the style "url" you must provide url using .setURL('https://example.com')
.setDisabled(); //disables the button | default: false
await message.channel.send('Hey, i am powered by https://npmjs.com/discord-buttons', button);
}
}
```
## Handle Button
```js
client.on('clickButton', async (button) => {
if (button.id === 'click_to_function') {
button.channel.send(`${button.clicker.user.tag} clicked button!`);
}
});
```
## Note: don't forgot to put `require('discord-buttons')(client)` after your client
<br>
## Documentation
Checkout more examples on our [docs](https://angelocore.gitbook.io/discord-buttons)
<br>
## Don't see the buttons?
The buttons are beta, so to see them you have to be a discord-tester or just wait for the update
<br>
> For any questions or errors, join in our server and report the bug on the #errors channel https://discord.gg/5JtyYqW
<hr>
## Contact
[Youtube](https://www.youtube.com/channel/UCxxK71QFN4_PrBhCFmH2Jmw), [Discord](https://discord.gg/5JtyYqW)
## 👥 | Contact
<a href="https://www.youtube.com/channel/UCxxK71QFN4_PrBhCFmH2Jmw"><img widhtsrc="https://raw.githubusercontent.com/MikeCodesDotNET/ColoredBadges/master/png/streaming/youtube%402x.png"></a></br>
<a href="https://discord.gg/5JtyYqW"><img src="https://discord.com/api/guilds/748098690874474567/widget.png?style=banner1"></a>
const { Structures } = require("discord.js");
const Message = require('./Classes/Message');
const TextChannel = require('./Classes/TextChannel');
const DMChannel = require('./Classes/DMChannel');
const MessageButton = require('./Classes/MessageButton');
const INTERACTION_CREATE = require('./Classes/INTERACTION_CREATE.js');
var version = require('discord.js').version.split('');
version = parseInt(version[0] + version[1]);
module.exports = (client) => {
if (require('./Util').checkDjsVersion() === false) {
if (version < 11 || version === 11) {
throw new Error('The discord.js version must be v12 or high');
}
Structures.extend("Message", () => Message);
Structures.extend("TextChannel", () => TextChannel);
Structures.extend("DMChannel", () => DMChannel);
const TextChannel = require('./v12/Classes/TextChannel');
const DMChannel = require('./v12/Classes/DMChannel');
const NewsChannel = require('./v12/Classes/NewsChannel');
client.ws.on('INTERACTION_CREATE', data => {
Structures.extend('TextChannel', () => TextChannel);
Structures.extend('DMChannel', () => DMChannel);
Structures.extend('NewsChannel', () => NewsChannel);
if (version === 12) {
const Message = require('./v12/Classes/Message');
Structures.extend('Message', () => Message);
} else if (version === 13) {
const Message = require('./v13/Classes/Message');
Structures.extend('Message', () => Message);
}
client.ws.on('INTERACTION_CREATE', (data) => {
if (!data.message) return;
if (data.data.component_type === 2) {
const button = new INTERACTION_CREATE(client, data);
if (version === 12) {
const INTERACTION_CREATE = require('./v12/Classes/INTERACTION_CREATE');
const button = new INTERACTION_CREATE(client, data);
client.emit('clickButton', button);
client.emit('clickButton', button);
}
}
});
return {
MessageButton: MessageButton
};
return;
}
module.exports.MessageButton = MessageButton;
module.exports.MessageButton = require('./v12/Classes/MessageButton');
module.exports.MessageActionRow = require('./v12/Classes/MessageActionRow');
module.exports.ButtonInteraction = require('./v12/Classes/INTERACTION_CREATE');

@@ -1,9 +0,9 @@

declare function _exports(client: Client): {
MessageButton: typeof MessageButton;
};
declare function _exports(client: Client): void;
declare namespace _exports {
export { MessageButton };
const MessageButton: typeof import("./v12/Classes/MessageButton");
const MessageActionRow: typeof import("./v12/Classes/MessageActionRow");
const ButtonInteraction: typeof import("./v12/Classes/INTERACTION_CREATE");
}
export = _exports;
import MessageButton = require("./Classes/MessageButton");
import { Client } from 'discord.js';
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc