Closed V1rtuaI closed 3 years ago
It will be added once discord.js commits the PR to master. Right now its still an unfinished draft so it might take a while.
Are you able to add buttons support to djs light as per the djs update?
Released and now supported by discord.js-light π
Next up support for Eris library? π₯Ίπ₯Ί
How do you add buttons ?
When I want to use discord-buttons
, I need to bypass the version of Discord like this
const { version } = require("discord.js");
const Discord = require("discord.js-light");
Discord.version = version;
or else I got a error saying that .\v3\Classes
doesn't exist.
But now I get a new error:
Error: The class/prototype returned from the extender function must extend the existing structure class/prototype (received function ExtendedTextChannel extends TextChannel; expected extension of ExtendedTextChannel).
at Function.extend (C:\Users\vexit\Documents\GitHub\rikka-discord\node\node_modules\discord.js\src\util\Structures.js:82:13)
at module.exports (C:\Users\vexit\Documents\GitHub\rikka-discord\node\node_modules\discord-buttons\src\index.js:22:16)
at Object.runCommand (C:\Users\vexit\Documents\GitHub\rikka-discord\node\src\core\command-handler\command-handler.js:185:40)
at module.exports (C:\Users\vexit\Documents\GitHub\rikka-discord\node\src\core\event-handler\events\message.js:115:46)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
and here is my code:
const buttons = require("discord-buttons")(client);
// The button is from discord-buttons examples.
const button = new buttons.MessageButton()
.setStyle("red")
.setLabel("My First Button!")
.setID("click_to_function")
.setDisabled();
So why ? Please π₯π
you will need to fork discord-buttons and replace all require("discord.js") with require("discord.js-light") in their v12 classes folder, because they are trying to extend the base discord.js classes instead of the already extended discord.js-light classes.
Not sure what else could be done, discord-buttons was not made to be compatible with djs-light.
Okay ; Sorry for the troubles, but in fact I made a mistake.
In my command handler I've wrote that
const buttons = require("discord-buttons")(client);
well it was only
const buttons = require("discord-buttons");
The only modification I need to do is to backup the real discord.js
package version with this
const { version } = require("discord.js");
const Discord = require("discord.js-light");
Discord.version = version;
Sorry, but thanks too !
@Vexcited please use official discord.js version of buttons. https://discord.js.org/#/docs/main/master/class/MessageButton
@DomeQdev ; How do I do that ? Can I have one example please π ?
@Vexcited you can see some examples in discord.js guide: https://deploy-preview-674--discordjs-guide.netlify.app/interactions/buttons.html
this is now supported in v4, so im gonna go ahead and close this
Are you able to add buttons support to djs light as per the djs update?