This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

discord.js-better-buttons

1.0.5 • Public • Published

PLEASE DO NOT USE THIS PACKAGE YET ITS NOT FINISHED!!!!!!!!

About

discord.js-better-buttons is a package that makes message buttons easier (and fun) to use.

Features

  • a

Installation

npm i discord.js discord.js-better-buttons

Example Comparison

If you want to create and use a button with just discord.js, here's how you currently do it:

const row = new Discord.MessageActionRow()
	.addComponents(
		new Discord.MessageButton()
			.setLabel('My button')
			.setCustomId('mybutton')
			.setStyle('PRIMARY'),
	);

await interaction.reply({ content: 'Here\'s a button!', components: [row] });

const filter = i => i.user.id == interaction.user.id;

const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 });

collector.on('collect', async i => {
	if (i.customId == 'mybutton') {
		console.log('A button was clicked!');
	}
});

That's cool and all, but it could be better. Here's how you can create and send a button using discord.js-better-buttons:

const { Button, ButtonBundle, ButtonPackage, ButtonStyles } = require('discord.js-better-buttons');

const button = new Button({ label: 'My button', style: ButtonStyles.primary });
const bundle = new ButtonBundle([ button ]);
const package = new ButtonPackage([ bundle ], interaction.client);

button.on('click', async i =>{
	console.log('A button was clicked!');
});

await interaction.reply({ content: 'Here\'s a button!', components: package.format() });

Yes, yes, I know. It's amazing. But you know what's even more amazing? Your code, once you start using this package!

Readme

Keywords

none

Package Sidebar

Install

npm i discord.js-better-buttons

Weekly Downloads

2

Version

1.0.5

License

ISC

Unpacked Size

6.41 kB

Total Files

8

Last publish

Collaborators

  • jiltq