Comments (10)
@Vexcited you can see some examples in discord.js guide: https://deploy-preview-674--discordjs-guide.netlify.app/interactions/buttons.html
from discord.js-light.
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.
from discord.js-light.
Are you able to add buttons support to djs light as per the djs update?
Released and now supported by discord.js-light π
from discord.js-light.
Next up support for Eris library? π₯Ίπ₯Ί
from discord.js-light.
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 π₯π
from discord.js-light.
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.
from discord.js-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 !
from discord.js-light.
@Vexcited please use official discord.js version of buttons. https://discord.js.org/#/docs/main/master/class/MessageButton
from discord.js-light.
@DomeQdev ; How do I do that ? Can I have one example please π ?
from discord.js-light.
this is now supported in v4, so im gonna go ahead and close this
from discord.js-light.
Related Issues (20)
- v13 HOT 3
- DMChannel does not have "recipient" in v3.5.11 HOT 3
- Privileged Intents Support HOT 2
- Threads Support HOT 1
- v13 is now the stable branch for discord.js HOT 2
- TypeError: Cannot read property 'slice' of null HOT 1
- LimitedCollection Typescript Error HOT 3
- Property 'forceSet' does not exist on type 'Collection<string, Channel>' HOT 18
- `guildCreate` doesn't get triggered on init HOT 4
- Can't set maxSize on cache. HOT 9
- Getting an error HOT 3
- Shards: "auto" not working HOT 4
- How to send webhook in the thread? HOT 2
- Error in makePartial and in actions HOT 17
- Cannot read properties of undefined (reading '_add') HOT 3
- MessageManager#forge doesn't set channel or guild data HOT 1
- discord-api-types conflicts HOT 2
- Discord.js V14 HOT 3
- How can I install discord.js-light master using npm? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord.js-light.