#djs-help-v14
78874 messages · Page 40 of 79
HTTPError: Internal Server Error
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:755:11)
at SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:1163:29)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:994:14)
at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1307:22)
at async InteractionWebhook.editMessage (/home/container/node_modules/discord.js/src/structures/Webhook.js:351:15)
at async ChatInputCommandInteraction.editReply (/home/container/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:254:17)
at async Object.run (/home/container/src/commands/music/nowplaying.js:42:7)
at async Client.<anonymous> (/home/container/node_modules/commandkit/dist/index.js:643:7) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: undefined,
components: [Array],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 32768,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: undefined
}
},
status: 500,
method: 'PATCH',
url: 'https://discord.com/api/v10/webhooks/1411963365810638908/aW50ZXJhY3Rpb246MTQxMjAwMjkyMjk3OTUyODc4Nzp0eDVKZDllckl2SFVTTUdxVjFqN2FXN05PVnB5WFBTQkIzVUtKeUZQTXk3TlE4NXh0UE5VQWxQakNGYU1OMjFOOXhjamlhZjRnMndHQU5wdXBGaFBYYjZNRTVRYlBLTUo3WW43aE93cFRDSG5WbVdDNWRDSlVQak9scHdBSXBYVw/messages/%40original'
}
this isn’t an Unknown Interaction error
After fixing it, I got this error
Common causes of DiscordAPIError[10062]: Unknown interaction:
- Initial response took more than 3 seconds ➞ defer the response *.
- Wrong interaction object inside a collector.
- Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance)
* Note: you cannot defer modal or autocomplete value responses
@dense jackal
oh I see you sent that 25 minutes later, but afaik this is more of a discord issue rather than a d.js issue
#7528 in discord/discord-api-docs by panley01 opened <t:1745798859:R>
64 media items in Components V2 results in 500 error
its about the size limit you can send per request I think
{
"type": 17,
"components": [
{
"type": 10,
"content": "▶️ Now Playing"
},
{
"type": 10,
"content": "[علّق بشيء تُؤجر عليه \ud835\ud835\ud835\ud835\ud835\ud835 → [ @quran_islam ] ︎ #ياسر_الدوسري #سورة_النمل #قران #قران_كريم #اكسبلور #quran #explore](https://www.instagram.com/reel/DNbTEZNNb42/?igsh=aG1zbGY5andrZjdl)"
},
{
"type": 14,
"spacing": 1
},
{
"type": 10,
"content": "Duration: `0:04 / 02:31`"
},
{
"type": 14,
"spacing": 1
},
{
"type": 10,
"content": "Requested by: @iron void"
},
{
"type": 14,
"spacing": 1
},
{
"type": 10,
"content": "Progress: ⏱ `▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱` 3%"
},
{
"type": 14,
"spacing": 1
},
{
"type": 12,
"items": [
{
"media": {
"url": "https://scontent-lax3-1.cdninstagram.com/v/t51.2885-15/534492024_767567912335000_773481716958474085_n.jpg?stp=dst-jpg_e15_tt6&_nc_ht=scontent-lax3-1.cdninstagram.com&_nc_cat=104&_nc_oc=Q6cZ2QF6jnCVJG4jy6JGMzOe1yjvjHvFYCSi40MDlGlNFPENXbBXwYbiC_Mla6JgQU1GRqE&_nc_ohc=67NgMT8QwCYQ7kNvwGuJPhb&_nc_gid=htWe7KeH3HQq8dcjPtw_ZQ&edm=APs17CUBAAAA&ccb=7-5&oh=00_AfVhQp509HAwj4aYFK-NLY20A9peQHYAUtRaSmV0j5mL8Q&oe=68BB31EE&_nc_sid=10d13b"
},
"description": "علّق بشيء تُؤجر عليه \ud835\ud835\ud835\ud835\ud835\ud835 → [ @quran_islam ] ︎ #ياسر_الدوسري #سورة_النمل #قران #قران_كريم #اكسبلور #quran #explore thumbnail",
"spoiler": false
}
]
}
]
}
@dense jackal look
what if you remove that instagram url link inside the media gallery component? does it then work?
It's highly likely due to unpaired surrogate (\ud835) in you description or content, which is invalid utf8 char. Check here for more https://github.com/discord/discord-api-docs/issues/6561#issuecomment-1839512039
Hello!
Br?
C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\Commands\Pontos\loja.js:55
container.addButtonComponents(buttons => {
^
TypeError: container.addButtonComponents is not a function
at Object.execute (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\Commands\Pontos\loja.js:55:19)
at Object.execute (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\Events\Interaction\interactionCreate.js:19:17)
at Client.<anonymous> (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\Handlers\eventHandler.js:31:58)
at Client.emit (node:events:530:35)
at InteractionCreateAction.handle (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
at WebSocketManager.<anonymous> (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\node_modules\discord.js\src\client\websocket\WebSocketManager.js:235:12)
at WebSocketManager.emit (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\node_modules@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.<anonymous> (C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews\node_modules@discordjs\ws\dist\index.js:1190:51)
Node.js v22.15.0
PS C:\Users\manue\OneDrive\Ambiente de Trabalho\SaintAndrews>
addButtonComponents is, indeed, not a function
ContainerBuilder#addActionRowComponents() discord.js@14.22.1
Adds action row components to this container.
ActionRowBuilder discord.js@14.22.1
Represents an action row builder.
I have tried in several ways, including the documentation, and nothing works...
You need to use action rows and then add them to the container
How do I use action rows to add buttons?
Refer to the linked guide
@gleaming locust use #app-commands for personal use please.
Sorry, my Wi-Fi was disconnected, it was fixed with the default link library
guide suggestion for @humble fern:
Interactive Components: Buttons
read more
why doesnt allowedMentions ping when i do with components (cv2)? do mentions only work in the content?
allowedMentions does work with cv2
could you share the code your having an issue with
Hi! In discord interaction reply. what flag is to return the interaction with the Missing Permsiion to the user with official defualt discord message?
Or please suggest me the guide[discord js]
Like, to use this command, that user doesnt have proper permission
what do you mean "Missing Permission ... official default discord message"?
Like, if we the user uses any / cmd, it should reply with the message, so, i see a bot telling Missing Permission when i used. But, the bot has a admin power in that server. Like the official message, like we see as Interection failure like
I mean instead of this txt
Their is no system message like that.
any Missing Permission message comes for the bot
What?
Let me search that message again, soon!
no you are right, that message with "Missing Permissions" exist
oh I have not seen that before
Yah, excatly! Thanks for pointing it out!
but afaik you cannot do anything about that, its more of a Discord error
Got it!
ah, here's mine
const sent = await interaction.editReply({ flags: MessageFlags.IsComponentsV2, components: [container], allowedMentions: { roles: [role.id], users: [interaction.user.id] } });
that will parse the mention for role and user. what issue are you have with it? It is also an edit So idk if it will send a push notification. don't think it will
prolly thats why, yeah. in edit. thanks @wary coral
it is yes, edits do never send out notifications
all good now, thanks mafia, b3ssel
Good afternoon, when will the feature to change the status of a voice channel appear?
When discord decides to document it
I have the message permission, also and the bot too have it?
-# I am sorry for ping-ing you!
I said, its a Discord error
you should contact Discord about it: https://dis.gd/devsupport
They give when we dont have only know?
what?
I mean, can you tell clearly that this is discord side issue or the bot config?
I search for similar issues from other people, and they got answered with that is an issue on Discord’s side
ohh. thank for your ans.
Got it!
You most likely do not have permission to use that command
Though I can't be too sure. It's likely visible to you because the command may have been cached to your client, try restarting your app and see if it still shows
Its not my app, its the public bot.
The same thing applies, It is a error from Discord possibly from a cached command. You should ask in DDevs. To my knowledge it is not possible to trigger this message using the documented API
I'm talking about restarting your discord app (not the bot app)
Yah, i done it too. No changes.
-# 👍
Is anyone else having issues installing discord,js into their bot files? I'm doing npm install discord.js but I keep getting a debug log and not the node module...
I have not had this issue. could you share the log and the resalts of running npm ls
I'm assuming nothing vital for privacy is in the log? also here's the results for the other one
(node:24448) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
prometheusticketsystem@0.0.0 D:\prometheusticketsystem
└── dotenv@17.2.1 extraneous
npm ERR! extraneous: dotenv@17.2.1 D:\prometheusticketsystem\node_modules\dotenv
npm ERR! not ok code 0
I am literally just now starting this one so there is nothing but the config file, the dotenv module, the package.json, and the main .js file
no rush but just confused af lol
does the code block include the debug log from npm install discord.js if you would not mind seperating it from the resalt of npm ls
here's the entire log. That code block was just the npm ls
what does the does the command say in the CLI when you try to use it
use what? the console log part?
yes, what is the resalt of npm install discord.js in the console
I think something is up with your npm try reinstalling node.js
still nothing
i uninstalled node.js and reinstalled it and got the same thing
if you do npm -v what do you get? also node -v
npm -v
1.4.2 (node:6156) [DEP0040] DeprecationWarning: The punycodemodule is deprecated. Please use a userland alternative instead. (Usenode --trace-deprecation ... to show where the warning was created)
node -v
v22.12.0 PS D:\prometheusticketsystem>
current version of npm is 11.4.2 so I think you have a problem thier
try npm install -g npm@latest
this is the newest npm -v
C:\Users\Sam\AppData\Roaming\npm\node_modules\npm\lib\cli\validate-engines.js:29
throw err
^
Error: Cannot find module '@npmcli/redact'
Require stack:
- C:\Users\Sam\AppData\Roaming\npm\node_modules\npm\lib\utils\error-message.js
- C:\Users\Sam\AppData\Roaming\npm\node_modules\npm\lib\cli\exit-handler.js
- C:\Users\Sam\AppData\Roaming\npm\node_modules\npm\lib\cli\entry.js
- C:\Users\Sam\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\Sam\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
at Function._load (node:internal/modules/cjs/loader:1075:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
at require (node:internal/modules/helpers:138:16)
at Object.<anonymous> (C:\Users\Sam\AppData\Roaming\npm\node_modules\npm\lib\utils\error-message.js:3:36)
at Module._compile (node:internal/modules/cjs/loader:1565:14)
at Object..js (node:internal/modules/cjs/loader:1708:10)
at Module.load (node:internal/modules/cjs/loader:1318:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Sam\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\utils\\error-message.js',
'C:\\Users\\Sam\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli\\exit-handler.js',
'C:\\Users\\Sam\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli\\entry.js',
'C:\\Users\\Sam\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js',
'C:\\Users\\Sam\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'
]
}
Node.js v22.12.0```
listen IDK what to tell you at this point your npm install looks broken and this is not a Djs issue try in #1081585952654360687 or see #useful-servers other places to ask for help
you can try uninstalling node, restarting your computer, and reinstalling it
but yeah moving to those channels is best since it's not a d.js issue anymore
thanks guys. Now I can't do crap with any of my bots in the terminal...you essentially bricked my terminal.
no one here did anything to ruin your terminal
it's on your end, not due to discord.js
everything else was working fine though until I was getting help from you. I restarted my pc and can't even start my other bots...
Sounds like you need to install nodejs, like asked to
And if you did, you most likely only need to add it to PATH, plenty guides on how to.
I can't. nothing will let me do anything at all
in any terminals atleast
Unless you be more specific we can't help
How am I supposed to be more specific? I get the same log I posted a bit ago for everything I do. All I can do in any terminal is change file paths
I'm not blaming anyone for this messing up but I was atleast able to run other bots before all this.
I don't even know what to google at this point to see what's going on
try these commands
nvm uninstall 22.12.0
nvm install 22.12.0
nvm use 22.12.0
redownloading node then I will. I am sorry I acted out. I'm just worried that all my work i've down is useless 😅 I hope you guys can forgive me. Let me redownload node and try those and I will update and see if I still need to move channels
All good, this is just a corrupt node installation it seems, no bot progress lost
Uncaught Exception: DiscordAPIError[50035]: Invalid For m Body
data.choices[0].name[BASE_TYPE_BAD_LENGTH]: Must be bet ween 1 and 100 in length.
data.choices[3].name[BASE_TYPE_BAD_LENGTH]: Must be bet ween 1 and 100 in length.
data.choices[4].name[BASE_TYPE_BAD_LENGTH]: Must be bet ween 1 and 100 in length.
at handleErrors (/home/container/node_modules/@disc
ordjs/rest/dist/index.js:762:13)
at process.processTicksAndRejections (node:internal
process/task_queues:105:5)
at async BurstHandler.runRequest (/home/container/n
ode_modules/@discordjs/rest/dist/index.js:866:23)
at async _REST. request (/home/container/node_module
s/@discordjs/rest/dist/index.js:1307:22)
at async AutocompleteInteraction.respond
(/home/con
tainer/node_modules/discord.js/src/structures/Autocomp1
eteInteraction.js:86:5
at async Object.autocomplete (/home/container/src/c
ommands/music/queue/remove.js:28:5)
at async Client. ‹anonymous> (/home/container/node_m
odules/commandkit/dist/index.js:643:7)
requestBody: { files: undefined, json: { type: 8, dat
a: [Object] }}, rawError:
message: 'Invalid Form Body', code: 50035,
errors: { data: [Object] }
3, code:
50035, status: 400, method:
'POST'
url: 'https://discord.com/api/v10/interactions/141211
1588608966810/aW50ZXJhYЗRpb246MTQxMjExMTU40DYwODk2Njg×M
DpNaTc1RVRWcG9wYk1QZnVYVDdpUkU2VTNDRDZHNUxCZ2FoQUNkaVF2
N@xpcD]DUGJvUnhqWGpiak96NlpvWUNUT2VqY1JKSWdPMEFsbDU4d21
XU3VsdDBjNEs0NG1JSUdkZWlaMHdPdWw3UmhCUWJnQ0dMS1NGekNuOW
FqWGhTeg/callback'
}
»
yeah but if I'm unable to get node working all my other bot codes are useless. I really need to figure out how to get them hosted somewhere else. Maybe a secondary computer lol
choices cannot exceed 100 characters limit—it tells you quite literally
autocomplete: async ({ interaction, client }) => {
const queue = client.distube.getQueue(interaction.guildId);
if (!queue) return interaction.respond([]);
const focusedValue = interaction.options.getFocused();
const choices = queue.songs.map((song, index) => ({
name: `${index + 1}. ${song.name}`,
value: `${index}`
}));
const filtered = choices.filter(choice => choice.name.toLowerCase().includes(focusedValue.toLowerCase()));
await interaction.respond(filtered.slice(0, 25));
},
This happens without using the command
you either have too few or too many choices
no
Only 12
can you verify that?
yes, my queue command
${index + 1}. ${song.name} has a variable length, depending on the title length of a song
Only 12 on queue
Imma go eat something. I'll be back once my node stuff is done doing it's thing so I can test
so if the song title is about 96 characters long, it wouldn’t fit
How long is allowed for each option?
100 just like it says
the error tells you
Yes, the problem is because some Instagram videos describe more than 200
then slice it off
Thanks man for help
sometimes images in embeds loads for a split second then disappears right after, anyone know if this could be a bug or a discord issue?
Won’t be djs’s problem, can ask in ddevs but I did see some issues related to images not showing in ddevs
Is it possible to use a custom emote in ButtonBuilder.setEmoji() ?
What is animated webp
How to setup
yes .setEmoji({ name: "emoji1", id: "1234", animated: false });
Thanks !
or I think .setEmoji("\:emoji1:") works as well
That's what I tried... Dont know why it doesnt work
okay it won't work in chat lol, < : emoji1 : 1234 >, but then without spaces ofc
if you tried that then its only possible with { name, id, animated }
can leave animated out if its a non-animated emoji, default is false
// Works
.setEmoji({ name: "link", id: "1412145014087356558", animated: false })
// Doesn't work
.setEmoji("<: link: 1412145014087356558>")
Alright, thx ! Seems strange but yeah with a test you're right !
if it doesn't work without the spaces in between (which I assume you do) then I know that for next time
Yep it doesn't work, I have this :
Error: Expected the value to be an object, but received string instead
at _ObjectValidator.handle (/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2070:9)
at _ObjectValidator.parse (/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at ButtonBuilder.setEmoji (/node_modules/@discordjs/builders/dist/index.js:714:38)
at resolveBuilder (/node_modules/@discordjs/builders/dist/index.js:2224:12)
at SectionBuilder.setButtonAccessory (/node_modules/@discordjs/builders/dist/index.js:2115:61)
at resolveBuilder (/node_modules/@discordjs/builders/dist/index.js:2224:12)
at /node_modules/@discordjs/builders/dist/index.js:1815:75
at Array.map (<anonymous>)
The fetchReply option when replying to an interaction will be removed in v15.
- {..., fetchReply: true}
+ {..., withResponse: true}
```This returns an [InteractionCallbackResponse](https://discord.js.org/docs/packages/discord.js/14.17.3/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
import ButtonBuilder from djs, not from /builders
and uninstall /builders
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
[0;31mnpm [0;0muninstall discord-api-types @discordjs/rest @discordjs/builders
[0;34myarn [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
[0;33mpnpm [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
That's what I did
ah, it's inside a setButtonAccessory, are you using the one from the callback?
Yes !
.addSectionComponents(
section => section
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent([
`### \`>> Récompenses giveaway\``,
`- Félicitations !`
].join("\n"))
)
.setButtonAccessory(
buttonAccessory => buttonAccessory
.setCustomId("ticket-giveaway")
.setLabel("Ouvrir un ticket")
.setStyle(ButtonStyle.Secondary)
.setEmoji(Core.serializeEmote(client.config.emote.link))
)
)
makes sense then, that can't be fixed
you could however make your own ButtonBuilder but from djs
Also going to ping @bleak owl and @wary coral Sorry again for earlier. everything is working now. Had to uninstall and reinstall node.js a few times but all good now 👍 now just slowly reinstalling all my node modules lol
setButtonAccessory(new ButtonBuilder(...))
then it should work
Lets try 😎 Thx
You're right, it works well, lets do that :)
This is not the channel, or the server for that. Please take it somewhere else
Oke sorry
/Users/macbookair/Desktop/MaronBot-Dev-main/Handlers/commandHandler.js:19
client.commands.set(command.data.name, command);
^
TypeError: Cannot read properties of undefined (reading 'name')
at /Users/macbookair/Desktop/MaronBot-Dev-main/Handlers/commandHandler.js:19:38
at Array.forEach (<anonymous>)
at loadCommands (/Users/macbookair/Desktop/MaronBot-Dev-main/Handlers/commandHandler.js:13:9)
``` im getting this error can someone help me?
async function loadCommands(client) {
const { loadFiles } = require("../Functions/fileLoader");
const ascii = require("ascii-table");
const table = new ascii().setHeading("Commands", "Status");
await client.commands.clear();
await client.subCommands.clear();
let commandsArray = [];
const Files = await loadFiles("Commands");
Files.forEach((file) => {
const command = require(file);
if(command.subCommands)
return client.subCommands.set(command.subCommands, command);
client.commands.set(command.data.name, command);
commandsArray.push(command.data.toJSON());
table.addRow(command.data.name, "✔");
});
client.application.commands.set(commandsArray);
return console.log(table.toString(), "\nCommands Loaded.");
}
module.exports = { loadCommands };
``` this is the code
one or more of your commands are missing a data property
Creating Your Bot: Command handling
read more
Creating Your Bot: Event handling
read more
but thats not possible, i made this code 2 years back, and it worked perfectly back then
well, your error disagrees
so check your commands and see which one is missing that property
const { ChatInputCommandInteraction, Client } = require("discord.js");
const { loadCommands } = require("../../../Handlers/commandHandler")
module.exports = {
subCommand: "reload.commands",
/**
*
* @param {ChatInputCommandInteraction} interaction
* @param {Client} client
*/
execute(interaction, client) {
loadCommands(client);
interaction.reply({content: "Reloaded commands."})
}
}```
```js
const { ChatInputCommandInteraction, Client } = require("discord.js");
const { loadEvents } = require("../../../Handlers/eventHandler");
module.exports = {
subCommand: "reload.events",
/**
*
* @param {ChatInputCommandInteraction} interaction
* @param {Client} client
*/
execute(interaction, client) {
for(const[key, value] of client.events)
client.removeListener(`${key}`, value, true)
loadEvents(client);
interaction.reply({content: "Reloaded events."})
}
}```
that's your subcommand, not your main command
hold on, lemme check the main one
https://github.com/ItsMrSpiky/MaronBot-Dev can you please have a look at this, i havent done this in a while now
honestly, i would change your command and event handling to what we suggest in our guide
:/
okay ill do that then, thank you
im getting an error saying disallowed intents?, how do i know which intents i need to allow
Error: Used disallowed intents
If you are using the GuildMembers, GuildPresences, or MessageContent intents, you need to enable them via Developer Portal > Your app > Bot > Privileged Gateway Intents
thank you
no problem :)
Rate Limits
read more
hi @formal carbon, please use #app-commands
is there something similar to EmbedBuilder.from() but for new components
Is there an easy way to disable the buttons/menus in a components v2 container after the 'end' event is emitted for the collector? For components v1, I could just remove all components at the end.
lol im kinda asking the same question
I'm baking with you
documentation suggestion for @tardy sable:
createComponentBuilder discord.js@14.22.1
Factory for creating components from API data.
only the manual way, iterate through your component builders and disable the ones that are disable-able
Sounds like I'll have to store the current set of component builders that are active on the interaction. The 'end' event doesn't pass the interaction so there's no way to parse the message and disable components. Do I have this right?
you have the message so you have the components
map to this and you'll get the builders
This sounds like, either way, I have to store some data (the current message or component array) and update it every time the message changes so that I can extract the component builders to update them when the end event is emitted. I guess it would be nice if discord provided a option to disable all components in a v2 message.
you have the message though, you need it to create the collector
use it on the end event and get the components
Message#components discord.js@14.22.1
An array of components in the message. This property requires the GatewayIntentBits.MessageContent privileged intent in a guild for messages that do not mention the client.
or if its your message for that last point
For interaction.channel.createMessageComponentCollector I have the original interaction but if I'm paginating the current set of components could be completely different than what I originally used to create the collector and out of scope for the 'end' event of that collector unless I'm storing the updated interaction/message. Am I missing something?
ah, any reason in particular you're creating it on the channel and not the message?
it'll collect every interaction coming from that channel
usually you create it on the message
If you are waiting for button or select menu input from a specific message, don't create the collector on the channel.
- Channel collectors return component interactions for any component within that channel.
- <Channel>.createMessageComponentCollector(…)
+ <Message>.createMessageComponentCollector(…)
Maybe poor understanding of the collectors several years ago when I built this function haha
when you do the initial reply you can use withResponse: true to get the message you just created, then create the collector on the message and use it on the end event to get the components and iterate to disable them
The fetchReply option when replying to an interaction will be removed in v15.
- {..., fetchReply: true}
+ {..., withResponse: true}
```This returns an [InteractionCallbackResponse](https://discord.js.org/docs/packages/discord.js/14.17.3/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
I see. So your suggested solution is to fetch the current version of the message within the end event?
no, you'd already have the message to begin with
since that's what you'd use to create the collector
const response = await interaction.reply({ ..., withResponse: true });
const message = response.resource.message;
const collector = message.createComponentCollector(...);
collector.on('end', () => {
const builders = message.components.map(createComponentBuilder);
});
something like that
But if I update that message anytime after creating the messageComponentCollector, the components that message contain do not reflect the current state of the updated message. They are the old set of components that were originally present on the message.
it should be updated unless you disabled the message cache
though I think it's limited by default so maybe it could be an issue if you get many messages for that channel and no updates from that message
I mean if no updates, also not a problem
Because not updated
oh yeah true lol
The message components returned on the 'end' event are not reflecting the changes made from pressing this button. You're saying that they should be?
Message cache is not disabled.
const response = await interaction.reply({ ..., withResponse: true });
const message = response.resource.message;
const collector = message.createComponentCollector(...);
collector.on('collect', (buttonInteract) => {
const testContainer = new ContainerBuilder()
.addTextDisplayComponents((textDisplay) =>
textDisplay.setContent('Updated content'),
);
await buttonInteract.editReply({
components: [testContainer],
flags: [MessageFlags.IsComponentsV2, MessageFlags.Ephemeral],
allowedMentions: {
parse: [],
},
});
});
collector.on('end', () => {
console.log(message) // The components in this message are still the original components
const builders = message.components.map(createComponentBuilder);
});
hmm yeah that should be
well worst case you can fetchReply then
maybe it has to do with the fact that its ephemeral so discord doesn't emit message update for it
Or I can change message from a const so that I can update it whenever the reply is edited.
you shouldn't update state manually of djs objects
you could however have a components array
Hmm could be because it's ephemeral. I'll test it without
I'm glad we are back to my original suggestion haha
The events arent emitting at the same time are they?
What triggers the end here?
no
expiration of the button triggers the end
yeah that'd probably be the best given discord won't emit the update event for that
maybe djs could use the update or editReply payload to update manually the cache
we never did that
because it adds a lot of overhead for a lot of cases
Thanks for the help and suggestion to switch from channel collector
what if the call fails
what if it gets stuck in queue of ratelimit
do it after the call ¯_(ツ)_/¯
it's situational here basing on if you replied ephemerally
discord can force your non-ephem to be ephem
discord sends no data at all when you respond, unless you ask for it
creates race conditions
it could be used for every call given you won't receive the event either if it's a user app
that too
I vote for discord adding an option to disable all components in a message
and how exactly would we as the lib know that
yeah that'd work as well
when users who use the app have no clue what they are using
you wouldn't need to know it
the lib user?
I'm saying there'd be no if()
I'm just throwing ideas just in case something would stick, it'd be useful if possible
await client.users
.fetch(client.user.id, { force: true })
.then((user) => user.bannerURL({ size: 4096, extension: "png" }));
guys is that any way to get banner easiest
code looks fine
client.user.bannerURL({ size: 4096, extension: "png" })
ah i thought you meant for a user, not the client user
Can messages only be ephemeral if they're a reply to something?
Only interaction responses can be
hmmm okok ty
Going back to this. It seems the most portable way is to create a message variable outside of the collector and update it whenever editReply is called. Then, create the builders from message when end is emitted. Similar to passing around a components array but allow for more generic updates to the message.
Thanks again for the help. 🙂
I'd recommend just going with the array method since it's simpler and the only thing you can set with cv2 is components anyways
you could also save a reference to the last interaction and then fetchReply on that, it'll return the updated message
is there a way to get cmd id thru bot like fetching it or somet
for a global or guild command?
global
ApplicationCommandManager#fetch() discord.js@14.22.1
Obtains one or multiple application commands from Discord, or the cache if it's already available.
// Fetch a single command
client.application.commands.fetch('123456789012345678')
.then(command => console.log(`Fetched command ${command.name}`))
.catch(console.error);
don't pass an id to get a collection of all commands
no like can i get a command id thru the command name
yes, that's what I'm suggesting
you can .find on the collection by name
alr cheers
Collection#find() discord.js@14.22.1
Searches for a single item where the given function returns a truthy value. This behaves like Array.find(). All collections used in Discord.js are mapped using their id property, and if you want to find by id you should use the get method. See MDN for details.
collection.find(user => user.username === 'Bob');
wont work for subcommands though will it?
subcommands don't have an id
since they're just options
only the parent command does
How can I make a webhook display buttons in Discord?
new ButtonBuilder()
.setCustomId("#ShareA!_" + message.author.id)
.setLabel("ตกลง")
.setEmoji("1254766753548865556")
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setCustomId("#ShareD!_" + message.author.id)
.setLabel("ยกเลิก")
.setEmoji("1254766751032410223")
.setStyle(ButtonStyle.Danger),
)
await webhook.send({
content: "testMessage",
files,
components: [button]
});```
you need to set with_components: true in the payload
this might not be discord.js but I think it might be. Does anyone know why this won't console log anything when I react to a message? I know it doesn't have anything to do with it being cached. The message was sent after bot start up. https://sourceb.in/kBgvhHfq65 I'm trying to trouble shoot it before putting it into it's own event file. It's probably something easy I'm overlooking as well 😅
Do you have the correct intents?
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessageReactions,] },
{ partials: [Partials.Message, Partials.Channel, Partials.Reaction] });
Your partials are not in the client options object
Everything goes in one object, not separate objects
that was it 🤦♂️ told you it was something simple lol appreciate it. My dislexia kills me sometimes 😅
that is only for cv2. action rows should still work. right? never mind I was wrong
What am I doing wrong?
const modal = new ModalBuilder()
.setCustomId('bug_modal')
.setTitle('Опрос о насекомых')
.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setLabel('Выберите ваше любимое насекомое:')
.setComponent(
new StringSelectMenuBuilder()
.setCustomId('favorite_bug')
.setPlaceholder('Выберите вариант')
.addOptions([
{
label: 'Муравей',
value: 'ant',
description: '(лучший вариант)',
emoji: { name: '🐜' }
},
{
label: 'Бабочка',
value: 'butterfly',
emoji: { name: '🦋' }
},
{
label: 'Гусеница',
value: 'caterpillar',
emoji: { name: '🐛' }
}
])
)
)
);
In the future, I suggest giving more detail than just asking what's wrong - i.e. providing any errors/unexpected behavior. With that being said, I can already see one mishap: There is no setComponent() method on a TextInputBuilder, because text inputs don't hold other components
I'm asking about the structure of creating a modal window, the news was that this feature was added, but for some reason, StringSelectMenu does not want to be added to the modal window.
Because there is no stable release of discord.js that supports that new feature right now
The news is written, but there is no stable version, nonsense
Sorry if it disappoints you, but there's a bit of a process that has to take place in order for some API features to get supported by the lib. Not everything is implicitly supported already
#11034 in discordjs/discord.js by Jiralite opened <t:1754556886:R> (review required)
feat(builders)!: Support select in modals
Feel free to follow this PR
ok
message.guildId is the only way to know if it is a dm or inside a server?
documentation suggestion for @frosty epoch:
Message#inGuild() discord.js@14.22.1
Whether this message is from a guild.
same as doing message.guildId then
inGuild is a typeguard
Can I use setAccentColor with hex codes as well (for example #ffffff), or only with the format of 0x[some color code]
The latter
It's the same thing anyway
Just that one is a string using hexadecimal and other an actual hexadecimal number
Lads, I got a question.
I'm connecting my bot to the Gateway with the following intents, but not receiving any audit log events for MemberBanAdd.
Any idea why?
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildModeration,
The bot has Admin perms.
Edit: I get logs for role and invite create and role update, but not ban add.
alright, thanks
If you're receiving some stuff but not other, sounds like it's a better idea to ask in ddevs as it's not us who sends the events
could've been something I'm missing. Can you imagine what else I could've done wrong?
early return?
If not, then it's the same event
We don't randomly choose which gateway event we emit and which we don't
Seems to work for some audit logs for you, so your listener is working and we emit it at all
And GBA has no entry update
I'm logging any event and still can't see it.
export default async function (entry: GuildAuditLogsEntry, guild: Guild) {
sendLog(["Incoming event", entry.toJSON(), "Guild ID: " + guild.id]);
...
Go ask in ddevs
I did 👍
We have no idea why you aren't getting the event
Not our call
ok, thanks so far!
Hi,
I need to allow a user to input both arbitrary text and autocompleted Discord usernames at once coming from a button, not a slash command.
What are my options ?
Thanks
there is no autocomplete component, so none
How do I hide a sign that the message worked from an command?
"hide" as in "only show the person using the command"?
Is it possible to put a bot in VC and listen to what people are saying and then check who is saying what (for the what part ofc speech recognition I care more about the who is saying what)?
I know its possible to listen for audio and put it in speech recognition but like can I see who is saying what somehow?
For Voice Commands 
is it possible to edit/delete the message that a button interaction occured on when used as a user app?
im pretty sure you can but only if its an actual message and not ephemeral
im getting missing access
just trying to ```js
interaction.message.delete()
but it errors with missing access
you can respond to the button with a delete response
wait... is that a thing 
anyone
what delete response
theres only deleteReply, which deletes the reply to the button interaction, NOT the message the interaction came from
you might have to use the webhook delete route 
Parsing the incoming audio is far outside the scope of d.js. it's possible but not a topic for here. Iirc you can subscribe to the incoming stream to get the audio
Yeah i'd need to use discordjs voice is there a help channel for that cuz I can't find it
#998942774994927646 if you have questions about getting the stream
Again, parsing it is not a library question
I need more help checking for who is saying what if that is even possible
That's a question for #1081585952654360687 or a general server in #useful-servers once you have the stream
thanks
what would that be?
trying to figure out how we expose that 
i found interaction.webhook.deleteMessage() but that just crashes with cannot read id of undefined
how do you use it?
https://discord.js.org/docs/packages/discord.js/14.22.1/InteractionWebhook:Class#deleteMessage if you just call it with () yes, that'll not work. the message is not optional
ah wait i see nvm
on the other hand, interaction#webhook will be bound to the interaction instance, but that one didn't send the message, hmm
yeah now crashes with unknown webhook
interaction.webhook.deleteMessage(interaction.message)
unless you still have the token from the interaction that caused the message (and it's still valid, so within 15m) i don't think that works
message.delete() requires the bot to be in the channel, assuming it isn't hence missing access
i needed this for a persistent delete button that existed on the message to allow the user to delete it at any time.
i realise now that when used as a user install, they can delete the bot message as if it were there own, so i can just not have the button in this instance and not have to deal with this issue
yup, still thought that'd be possible, TIL
yo little confused how i got error on createMessageCollector part
let dmChannel = interaction.user.dmChannel
if (!dmChannel) dmChannel = await interaction.user.createDM()
const collector = dmChannel.createMessageCollector({ filter, time: 600000 })
Hi, what's can be the problem with this type of error?
Error: Received one or more errors
at _UnionValidator.handle (node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1965:23)
at _UnionValidator.parse (node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at SectionBuilder.toJSON (node_modules/@discordjs/builders/dist/index.js:2169:37)
at node_modules/@discordjs/builders/dist/index.js:1870:64
at Array.map (<anonymous>)
at ContainerBuilder.toJSON (node_modules/@discordjs/builders/dist/index.js:1870:35)
at node_modules/discord.js/src/structures/MessagePayload.js:151:46
at Array.map (<anonymous>)
at MessagePayload.resolveBody (node_modules/discord.js/src/structures/MessagePayload.js:150:49)
at InteractionWebhook.editMessage (node_modules/discord.js/src/structures/Webhook.js:344:50)
I'm using components V2
That's not the full error
But given the stack, I'm guessing that you didn't add accessory to the section
If you don't need accessory, don't use a section
Just use the text display directly
any help
You were right, thanks man ;p
I feel like this has been answered countless times - I have forgotton it again.
How to clear the selection of a selectmenu after someone selected something?
update the message with the same components
It's a componentsV2 message. So idk about that.
i guess it's the same
Hm, I gotta try that
okay, so it works but it feels a bit clumsy.
afaik there is no other method
At least if you wanna do it via code.
You could reload your Discord Client to reset the selection
iirc calling .update() on the select interaction passing nothing also works
obviously the interaction mustn't have been replied to already
Please help little error on createMessageCollector
let dmChannel = interaction.user.dmChannel
if (!dmChannel) dmChannel = await interaction.user.createDM()
const filter = m => m.author.id === interaction.user.id && m.channel.type === 1
const collector = dmChannel.createMessageCollector({ filter, time: 600000 })
https://canary.discord.com/channels/222078108977594368/1412418714434928652
please do not ask in multiple channels
If I have an event such as guildAuditLogCreate and two of my modules need this event, is it wise to register one event and then use the modules with two if functions, or to use a separate event for each module?
The former, you do not need more than one listener
const { Client, GatewayIntentBits, AuditLogEvent } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildModeration, // Required for audit log events
],
});
function logAuditEntry(auditLogEntry) {
console.log(`New audit log event detected by user: ${executor.tag}`);
if (module1.enabled) {
await Test1.execute(auditLogtEntry)
}
if (module2.enabled) {
await Test2.execute(auditLogtEntry)
}
}
client.on('guildAuditLogEntryCreate', async (auditLogEntry, guild) => {
console.log(`Received an audit log entry in guild: ${guild.name}`);
// Pass the received audit log entry to the processing function
logAuditEntry(auditLogEntry);
});
So something like that has no negative impact on performance.
Yes
what is permission flag for "manage permissions" in a voice channel? Even though my bot has manage channel permission, it cannot overwrite everyone's connection permission somehow
uh cuz no one helpin
tipaka asked you for more info
you're the one not replying
Okay, thank you. I have a problem where individual shards have a ping of 15000ms for a short period of time. I thought that might be a problem.
that’s not the full error
In component v2, can I put a photo gallery at the top? Or wherever
Make sure it also has connect and virw channel permission
well the error is on this part
Permissions are implicit in discord
please look in the thread
Yes. That's the point of cv2, you control the layout
why I can't send message tf
this is not dm
?
I get "my message can't be delivered" error in server chat
im not sure how this is related to discord.js
of course, but you didn't get the point
i don't, but this isn't d.js related. sorry
I can't send the code in here aka the message
if you need help, please look at #how-to-get-help
It has nothing to do with that ig:
I need that "Manage Permissions"
ManageRoles
This is the code with Missing Permission:
https://gist.github.com/Neodevils/c51aadb4fe7f2b0b2d70a51701363074
ManageRoles
Going to try now
How to transform Date.now() in timestamp of Discord?
documentation suggestion for @gleaming locust:
time discord.js@14.22.1
Formats a date into a short date-time string.
You can just pass the Date object to it
If yoy have timestamp instead then you'll have to convert it to seconds and floor it
But what ManageRoles have to do with editing channel's permission? You can't add that because that permission doesn't exist which will throw missing permission again
ManageRoles is Manage Permissions
it throws missing permission again even I gave "Manage Roles" to bot globally
Okay, permissionOverwrite doesn't need manage roles but bot globally requires it
But still, there is no enum to set for "manage permissions" permission; like you can't overwrite that permission
^^
That is just how it is displayed on the ui, there is no such permission in the api
it throws missing permission
when I tried to overwrite the channel permission by allowing ManageRoles to bot even bot has permission of ManageRoles
And does it also have these ?? ^^
Its time(floorAndInSeconds, styleOfTimestamp)
yes
tried again to be sure, yes it still says missing permission
Make sure other overwrites or roles aren't denying bot the permissions
the code works by simply adding manage roles permission to bot's role. but the issue in here is you cannot overwrite "manage permission" role in a channel since that permission does not exist.
Viewing channel and connect permissions will be changed but ManagePermissions won't be updated. I hope you understand what I am pointing. ManageRoles is not a thing in a channel so...
-# And Manage Permission is not Manage Roles as I tested
I am asking for a direct permission to overwrite the permission.
Because it is the same as ManageRoles, and it seems your are using your bot to grant itself such permission which obviously won't work, because it doesn't have the said permission. When you give the said permission manually it works.
Bot cannot magically grant itself permission to ManageRoles, that would be problematic
technically that's true
Let me try that on user then
It needs to have ManageRoles, before it can manage others permission, so an admin has to grant it, either through channel overwrites or globally (which you were doing)
how that's going to happen ahahah
this has to be automated
also adding manageroles to user gives missing permission error again
I am just trying to make the button unlock/lock voice channel and that requires manage permissions to edit it for @ everyone role
hows that's going to happen?
Umm.. bot cannot grant itself permissions it does not have, that's not how it works. If that were possible, then any bot can just grant itself admin and boom.
Also make sure you gave the bot ManageRoles/Permission permission before trying to add it to user
bot has manage roles permission as role as I mentioned above.
but still throwing error as missing permission. that's the thing.
the code works by simply adding manage roles permission to bot's role. but the issue in here is you cannot overwrite "manage permission" role in a channel since that permission does not exist.
I remember this particular thing being super fucky lemme see if I can find the article
Are you bulk setting the overwrite? If you gave your bot role manageroles, make sure when overwriting the permissions to include these permissions in your bot's overwrites, might be causing conflicts
I give what it has, I don't add any additional permissions
yeah but somehow ManageRoles is not ManagePermissions
Note that permission names may be referred to differently in the Discord client. For example, "Manage Permissions" refers to MANAGE_ROLES, "Use Voice Activity" refers to USE_VAD, and "Timeout Members" refers to MODERATE_MEMBERS.
somehow manage roles throws error with missing permission
It throws an error when you try to give the bot that permission on the voice channel, yes?
yes, when I try to give manage roles permission to bot on the voice channel
-# Note that bot has manage roles as role permission already
How many pictures and texts can I add?
Did you read the screenshot I sent? Particularly the last sentence?
"Setting MANAGE_ROLES permissions in channel overwrites is only possible for guild administrators or users with MANAGE_ROLES as a permission overwrite in the channel".
-# Emphasis mine.
Since the bot cannot have the permission overwrite in the channel it just created, the bot needs to have admin to set that permission on voice channels.
yeah, it needs admin permission—which we don't want.
How can I fix this?
letme try to give admin permission and try to add manage roles
That's it. That's your choice. Give it admin permission, or accept that you cannot grant it MANAGE_ROLES on the specific channel.
[text to be masked](url to link to)
You have to follow that format exactly. You have an emote in between the ] and the (
Do they? Doesn't Arabic trigger RtL, so the 🎶 is actually at the beginning of the text?
Oh ya that would make sense....
When Arabic and Latin characters are combined, I know formatting breaks...so I genuinely don't know if you're correct or not
I'm just assuming not since the mask is broken
They have a functioning example here which shows how the link behaves.
I think the issue might actually be the ❤️ in the middle?
YES IT IS
Can't have the ❤️ in the text
What wait
Yup that's it. I tested it as well. Even Unicode emojis don't work inside of the mask
Masked links do not render if you include emoji in the link text
You can substitute it with a ♡ instead if you really want the heart
[this is a test with a ♡ emoji instead](https://google.com/)
is there a visualiser for this new component do u know
Are you talking about a visualiser for Components V2?
If so: https://discord.builders
yes
thansk you
What are you trying to do?
Starting project error
we don't support bots that break the ToS (you're using distube which is against the ToS)
and 3rd party modules, such as commandkit
ok
Is it only modals that do not have an interaction channel?
They do
Oh they do? I was making an assumption tbh. Which channels do not?
why are you even asking?
BaseInteraction discord.js@14.22.1
Represents an interaction.
Because when checking interaction.channel, channel is potentially undefined, so I want to know which interactions do not have one
Its potentially undefined because it might not be cached
Ah okok ty
actually it should just be potentially null in that case - it may be potentially undefined if you havent typeguarded it against being raw data
You're right, it's channel | null, my bad lol
But either way, I was confused why an interaction might not have a channel
But caching makes sense
Its just a getter for the channel cache, if channelId is potentially null/undefined, that would be more related to your question
const collector = dataDessage m.createMessageComponentCollector({ time: 60000 });
Is not function
uhh, not sure if theres some typos in there
But that means whatever m is, does not have that function
dataMessage withRespones from interaction reply
Then what is m
The fetchReply option when replying to an interaction will be removed in v15.
- {..., fetchReply: true}
+ {..., withResponse: true}
```This returns an [InteractionCallbackResponse](https://discord.js.org/docs/packages/discord.js/14.17.3/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
Oh
const collector = queueMessage.createMessageComponentCollector({ time: 60000 });
Im lost
If you use withResponse, the message object is <InteractionCallbackResponse>.resource.message
ok
Which has that function
When edit message
Use
<InteractionCallbackResponse>.resource.message.edit
Or
<InteractionCallbackResponse>.edit
Neither
interaction.editReply
thx
Look, it’s the button page system
queueMessage is not interaction
I use
const queueMessage = interaction.reply()
yes
and now
use interaction.editReply like I said
At no point did i say queueMessage.editReply, so dont do that please
Sorry
My language is bad
I don’t use deferReply
May be a stupid question but in the documentation for ChatInputCommandInteraction message is not listed as a properly but interaction.message exists in ChatInputCommandInteractions, am I looking in the wrong place?
that property doesn't exist on a ChatInput
ah sorry I was reading code for a button interaction
thank you
Okay. That's still how you edit replies
module.exports = {
data: {
name: 'queue',
description: 'Show a generic paginated list'
},
run: async ({ interaction }) => {
const items = [
{ name: "Item 1", url: "#", thumbnail: null},
…
];
const pageSize = 3;
let currentPage = 0;
const totalPages = Math.ceil(items.length / pageSize);
const buildPage = (page) => {
const start = page * pageSize;
const end = Math.min(start + pageSize, items.length);
const pageItems = items.slice(start, end);
const sections = [
{ text: `📃 List (Page ${page + 1}/${totalPages})` },
...pageItems.map((item, index) => ({
text: `${start + index + 1}. ${maskText(shortText(cleanText(item.name), 50), item.url)}`,
thumbnail: item.thumbnail ? { url: item.thumbnail, description: 'thumbnail' } : null,
showLine: true
}))
];
return new RichMessage().addSections(sections).build();
};
const buildRow = (page) => new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId("prev_page")
.setLabel("Previous")
.setStyle(ButtonStyle.Secondary)
.setDisabled(page === 0),
new ButtonBuilder()
.setCustomId("next_page")
.setLabel("Next")
.setStyle(ButtonStyle.Secondary)
.setDisabled(page === totalPages - 1)
);
const messageResponse = await interaction.reply({
components: [buildPage(currentPage), buildRow(currentPage)],
flags: 32768,
withResponse: true
});
const collector = messageResponse.resource.message.createMessageComponentCollector({ time: 60000 });
collector.on("collect", async i => {
if (i.user.id !== interaction.user.id) return;
if (i.customId === "prev_page") currentPage--;
else if (i.customId === "next_page") currentPage++;
await i.update({
components: [buildPage(currentPage), buildRow(currentPage)],
flags: 32768
});
});
collector.on("end", async () => {
const disabledRow = new ActionRowBuilder()
.addComponents(buildRow(currentPage).components.map(c => ButtonBuilder.from(c.data).setDisabled(true)));
await messageResponse.edit({
components: [buildPage(currentPage), disabledRow],
flags: 32768
});
});
},
options: {
devOnly: false,
userPermissions: [],
botPermissions: [],
deleted: false
}
};
I don't understand what you mean by it 🙂
I dont know how else to explain it, sorry
messageResponse.edit is incorrect. You should not try to edit interaction responses directly.
You should instead use interaction.editReply as I've said already
ohhhhhhhhhhhhhh
Does container have a file upload component?
no
Do they have any method for users uploading files without typing?
slash command attachment options
Containers do not, no
Dang.. Thank you for your help
I understand the only way to get a reaction's users unless you have them cached is by fetching them, but what if we just want the IDs is that included in the data for a MessageReactionAdd event or do we just have to call fetch on reaction.users?
Yeah
fetching reaction.users should do it
Each MessageReactionAdd event only includes the user who is currently adding
why i get error 2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ThumbnailBuilder]
const section = new SectionBuilder()
.addTextDisplayComponents(new TextDisplayBuilder().setContent(desc))
if (data.image) section.setThumbnailAccessory(new ThumbnailBuilder().setURL(data.image))
const container = new ContainerBuilder()
.addSectionComponents(section)
.addActionRowComponents(row)
every section needs an accessory
should be if (data.image) { add section with thumbnail } else { add text display }
thanks
is the MemberUpdate triggered when a user adds another boost to their current boost? like from 1->3 ? etc. ?
no, i dont think so
hmmm... Ok. Thats unlucky. I am trying to make like a boost tracking for an ingame reward system. But Without the event being triggered I wouldnt know how to accomplish that
The Discord API does not provide a dedicated event for guild boosts, but you can check for it in the guildMemberUpdate event:
client.on("guildMemberUpdate", (oldMember, newMember) => {
// Check if the member wasn't boosting before, but is now.
if (!oldMember.premiumSince && newMember.premiumSince) {
// Member started boosting.
}
});
seems to be the only way
or by setting up a boosting channel and listening to the messages
but it may or not be feasible depending on your use case
thta property doesnt change when a boost increases though, so yeah, messages
Yeah but this wont trigger because the user is already boosting
yeah, skipped the "only but incomplete" lol
Wait. Does boosting trigger any other events?
maybe guildUpdate for the boost count
or the tier
Thats what I was hoping for
if you only want to know when the guild was boosted and not by whom, yeah that sounds good
I mean. I want to kinda make my own thing to track who boosted how many times. But idk if it is even possible even with workarounds
I got it working right when a user first starts boosting to send a message
discord doesn't want to encourage scam boost guilds probably
Even with the info from discord wouldnt stop these scam boosts guilds. So idk if thats the reason
It would just put all the scamming off discord and onto like some webpage or even worse
is there anything wrong in this code? I tried it, and the message just won't show up
Intents, Partials set correctly?
well giving that option would make it supported in-house, which isn't something they'd desire
they would probably rather it require more setup
I guess yeah... 😂
with workarounds and whatnot
but we're just speculating anyways, no idea about the actual reason
well I haven't set the partials part, should I?
Yes
you shouldn't need partials for guild member add
do you have the Guilds intent?
my index now look like this after I add the partials
true but partials are always good to set xD
it's a per case thing, some people want it, others don't
true
and this ends up in the client?
can you place a console.log in the first line of that execute() to see if that's executing in the first place? it probably isn't
Yeah, nothing happened when I rejoin the server. Now what part is wrong here?
The event parsing if so
Hmmmm
yeah those intents should be sufficient to get the event, either your event handler is wrong (you can check that by adding a listener directly to your client, client.on(...)) or maybe the bot isn't a member in that guild
Can you show where you have your events handled by djs?
I just realize I set it data instead of name on line 9 🤦♂️
I'm sorry it's on me
no worries
haha xD. Well there you have it
Wait. When I see the djs guide. Where event-handling is done. Isnt it like creating multiple event-listeners if you have multiple files with the Event being set as the same?
yes, it adds a listener per file, each listener executes its own file
Isnt this like insanely memory inefficient? I thought it is better to have just 1 listener handling everything for that event?!
why insanely memory inefficient?
Not sure I understand
Idk when it was but I was getting some messages in my console like a couple years ago when I started with djs that having multiple listeners does something with the memory or something
imo there should only be a difference depending on your implementation of how you call that many handlers per event
We generally do only have one listener per event
Each is in a separate file for the sake of modularisation/readability
maybe you got the memory leak warning from node?
could be
If you set the event as the same thing in multiple files yes it duplicates them... but we dont do that in the guide either
it's a warning just in case you added many listeners that you no longer need and they're now doing nothing
dont remember. I switched to a more advanced handling of events (calling one function per event that handles all the code for that event)
Thats what the guide does
that's also a good approach since it won't give you that warning 
as long as you don't have unused listeners, I think it should be fine to listen many times
it adds a listener per file, regardless of whether they handle the same event
the guide doesn't have folders for events unlike commands
yeah and no. I mean if you want like more readability, you would create multiple files, always creating a new listener. Not calling like 1 function and only having 1 listener
I guess, but at no point does it really suggest you should make multiple files per event
So the approach it takes is exporting a single function per event
Right but this is what most unexperienced devs do
that wouldn't be a matter of readability though, at most maybe a matter of efficiency, but as I mentioned that'd depend on your implementation
The only time I see it does is making every command a separate interactionCreate listener
But only when they havent followed the guide
regardless of whether you implement it on separate listeners or in the same, you're still iterating over many functions and calling them https://github.com/vladfrangu/async_event_emitter/blob/main/src/index.ts#L522-L524
the complexity of handleMaybeAsync and .apply should be negligible
Or if someone wants to have like better readability then creates like idk messageCreate or multiple files with the same function to have like different methods which all of them listen to 1 event but have different tasks. And like I see it, it calls the client.on for each file so the client.on gets called multiple times for any event I guess.
I'll already made mine async 😂 thats the good thing. Thats why I am saying that creating multiple event-listeners is a bad approach
client.on adds the callback to an internal map on the emitter, and then it iterates over them when the event is emitted
which is basically the same thing you do if you were to aggregate all of them
just outside the emitter instead of inside
Oh damn. Didnt know.
Then nodejs tricked me back then
the message is kinda scary but it is useful as well since if you do have that bug then it'd be a really bad thing
but I think the default limit is like 10 so you shouldn't reach it ever
Well it depends, if you fire out the message to all functions yes
But if you hashmap lookup which functions to run (like we do for commands) its not so bad
I reached it with my beginners code. Like I had a index file with like 7k lines and a lot of event-listeners when I started coding 😂
I mean node's message about the listener leak
how to register slash commands
guide suggestion for @wary pendant:
Creating Your Bot: Registering slash commands
read more
@halcyon bison deployed.js file make
I will try 15 times commands not registered
any issues when running the script?
did it properly log Successfully reloaded n application (/) commands. with the correct number?
do your commands appear in the integrations tab of your server's settings?
if so, have you refreshed your discord client?
noo bot start and online but commands not registered
did you actually run the deployment script?
it's specifically separate from the rest of your bot since it doesn't need to run everytime you start your bot
yes
then please answer these questions
I will show you error
@nocturne tendon i have a question register commands work in prefix
no they don’t
(also you @d the wrong duck)
is your previous issue solved?
node:fs:1508
const result = binding.readdir(
^
Error: ENOENT: no such file or directory, scandir '/project/workspace/commands'
at Object.readdirSync (node:fs:1508:26)
at Object.<anonymous> (/project/workspace/deploy-commands.js:9:27)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/project/workspace/commands'
}
Node.js v20.12.1
node deploy-commands.js
pretty self explanatory—the directory commands does not exist in your workspace folder
you have to check the file path again to make sure it scans the correct one
Started refreshing 0 application (/) commands.
DiscordAPIError[50035]: Invalid Form Body
application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
at handleErrors (/project/workspace/node_modules/@discordjs/rest/dist/index.js:762:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/project/workspace/node_modules/@discordjs/rest/dist/index.js:1163:23)
at async SequentialHandler.queueRequest (/project/workspace/node_modules/@discordjs/rest/dist/index.js:994:14)
at async _REST.request (/project/workspace/node_modules/@discordjs/rest/dist/index.js:1307:22)
at async /project/workspace/deploy-commands.js:42:18 {
requestBody: { files: undefined, json: [] },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { application_id: [Object], guild_id: [Object] }
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/undefined/guilds/undefined/commands'
However you set guild and client ID is not working
node:fs:1508
const result = binding.readdir(
^
Error: ENOTDIR: not a directory, scandir '/project/workspace/commands/antiLink.js'
at Object.readdirSync (node:fs:1508:26)
at Object.<anonymous> (/project/workspace/deploy-commands.js:15:6)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
errno: -20,
code: 'ENOTDIR',
syscall: 'scandir',
path: '/project/workspace/commands/antiLink.js'
}
Node.js v20.12.1
add command this error showing
that error is self explaining, nor does it have anything to do with discord.js
how to fix
use the method to scan a file and not to scan a directory
as this isn’t a discord.js issue, you should create a post on #1081585952654360687 if you still face issues
how to add this?
the commands
You don’t, Discord does that for you when your bot is verified and your bot/commands are used enough
how to verify the bot?
developer portal, app verification tab
can you give me main.js commands with mangodb
for fast response
you should very much read #rules
we don’t spoonfeed here, go to https://fiverr.com/ if you need people to code for you
I've already checked the bot. What now?
wait, and make sure enough people use your commands
how hard is it to read for you
@mystic terrace there is no need to be rude
thats true, my bad Mark
why doesnt the options exist on commandinteraction?
everywhere ive seen it says that it has a property options
it exists on ChatInputCommandInteraction
so the CommandInteration doesnt have options?
since its a general type for both ChatInput and Context interactions, no
If you use the proper typeguards, typescript won't cry about it
CommandInteraction#isChatInputCommand() discord.js@14.22.1
Indicates whether this interaction is a ChatInputCommandInteraction.
thanks
Does isTextBased() not return ForumChannel? I am reading the docs but I think I am not getting it properly
a forum channel is not text based
you can't send messages in a forum channel
you can send messages in a ThreadChannel inside a forum channel
Alright, thanks
i want to reset a select menu on a componenet v2 with each interaction.
should i do it like this?
await message.edit({ components: message.components.map(createComponentBuilder) });
this gives me error Expected a string primitive
Why not just pass message.components
oh bruh how i didnt thought of that
got a quick question, is there any api for the new (ish) "apply to join" feature?
bots cant read applications, if thats what you mean
yeah that's sorta what i was going for, just wanted to make a quick little bot to read applications and if there's new ones ping staff
So yea guys
A bot that was working fine all over the months, but from an week it's causing real chaos. Yesterday the bot was all slow even on a USA VPS . Then I moved it into Heroku , the ping latency of prefix commands ( API ) is only 18-24 ms . But the commands, they were too fast like at the best state yesterday but today suddenly all became same again, prefixes are fine but slash commands takes 1 minute to complete the reply after deffering.
What's exactly the issue, please help
sounds like it's not something to do with your code if the same commands work fine from messages
which implies it's also nothing we have any impact on either
so you're probably better of asking in ddevs
even slashes were fine yesterday
we didn't release a silent update yesterday to break half of your code specifically
I didn't update anything bro ;-;
I just can't find the issue, it's the hosting or the code or what
that was.. a joke
we - discord.js - did not break your code over night
if it worked 2 days ago
and doesn't today
then it's not us
if it doesn't work on one hosting
Ikr, it isnt discord.js issue, I am asking for help
and doesn't work on other hosting
then it's also not you by the sound of it
there's only 2 constants here
your code and discord's api
we are not discord, so we cannot help you with the latter
;-; discord api is fine lookin other bots, My code, even i am not able to understand where's the issue, all optimized
Do webhook messages trigger the messageCreate event? Or is there a different way of getting them?
the only difference about webhook message is who sends it
it's still a message like any other
Wrong thing, brb
i see
is there a way to get the guild tag through guild and not user?
afaik you cannot and idk why that is
yh kinda weird the only way is to get the guild tag through user and not the actual guild
this is because discord did not document it
yeah the “idk why that is” was to meant “idk why that is decided by discord”
So what exactly is sharding
Sharding: Getting started - How does sharding work?
read more
hi so was wondering what i needed to do to have m bot do the lines between the texts or if there is documentation on where it talks about that
documentation suggestion for @vivid totem:
ContainerBuilder#addSeparatorComponents() discord.js@14.22.1
Adds separator components to this container.
Popular Topics: Display Components
read more
Hey! So I have this message with 1 super reaction of the same emoji, and 1 normal by another user
When I loop over the reactions of the message, it only goes over the first emoji once, only the super reacted one, and then skips the normal one, am I doing something wrong?

[ '510655770866483221' ]

[ '510655770866483221', '533692379777990656' ]

[ '510655770866483221', '533692379777990656', '1113876215896473612' ]
😀
[ '510655770866483221', '533692379777990656' ]
for (const reaction of interaction.targetMessage.reactions.cache.values()) {
const reactionString = formatReaction(reaction.emoji);
console.log(reactionString);
const reactionUsers = await reaction.users.fetch();
const reactionUserIds = reactionUsers.map(user => user.id);
console.log(reactionUserIds);
}
The message in question
i just deploy global slash commands, the bot profile, supports command badge didn't appear. can you fix it for me?
Discord.js is not affiliated with Discord and we have no power to help you with the badge...it can take 24-48 hours for the dev portal to update but you should ask in the DDev server instead of here, #useful-servers
ok
If I specify the Intent MessageContent when starting the bot but do not register a messageCreate event, will it still cache the messages? Do I then have to disable them again in makeCache?
And is there any way I can cache the AuditLog items in Redis without registering the event?
The MessageContent intent doesn’t cache anything, that just says to discord to send content in messages. The GuildMessages or DirectMessages says to discord to send messages. For caching, basically everything is enabled by default unless you say otherwise, but the message manager cache is capped at 200 (I think) by default. No, you’ll have to listen to the event and cache them yourself
Just becuase you don’t client.on an event, doesn’t mean it’s not emitted. You’ll recieve any events you have the intents for
Does that also mean that if I don't have client.on(“messageCreate”), things will be cached and could lead to problems?
What problems would it lead to? If you have an intent it’ll emit the events attached to that intent
Okay, well, I just thought that I would only get it if I registered for the event and that the intent didn't matter for the time being.
In terms of caching everything will be cached if you have the intent for that event. In terms of memory usage listening to ab event, I’m not too sure on how the inner workings of the event emitters work
Hi everyone, I was wondering if it was possible to make subcommands appear in the commands list once the user types the command and not before
If I have two subcommands /get profile and /get role, I’d like these two commands to appear once /get is typed and not when / is typed to improve readability
Thanks 🙂
you can't change what commands are shown first in what order based on what the user types in the slash menu
I mean the search discord uses will end up favouring the beginning of the string. So as long as there’s not a whole load of stuff beginning with ge then typing get will basically show that
if a message is out of cache does it also get cached again if an interaction is done on it? like clicking button on a message
Yes, I believe so since discord sends the message
yh i also was thinking that but wasnt sure
So there’s no way of showing only certain commands when only / is typed ?
no
Ok thanks ! 👍
I mean yes, by only allowing your command in that channel. But that’s down to the admins and not something you can enforce
Make a post in #986520997006032896 tbf. As I’m not too sure…
it does
Do you know where it does? I couldn’t find it in the source code
or well, assuming it comes from a cached channel, that is
As if you send a message to a channel with a button, reboot the bot the click it there’s no message creat event emitted
no since the message was there already
but the message does get cached
The message was there but it got lost since the bot rebooted.
Ahhh that’s cool, thanks for that lol
where this.channel is a getter for client.channels.cache.get(), in other words it'll only get cached the channel is cached
otherwise it fallsback to the new Message()
can you have more than one actionrow inside a container?
Sure
how many?
As many as you can fit within the 40 component limit, so ~19 action rows if they each have one component
how do i display an mp4 inside my codebase with mediagalleryitembuilders?
just put the file into the gallery
how though
i only see a setURL method on the item builder
Which is correct? ```js
reply({ embeds: [embed], flags: MessageFlags.Ephemeral }) // not array
reply({ embeds: [embed], flags: [MessageFlags.Ephemeral] }) // array
same way as you always put images into embeds
Files in embeds should be attached via the message option object and referenced in the embed:
const attachment = new AttachmentBuilder('./image.png', { name: 'image1.png' });
const embed = new EmbedBuilder()
.setTitle('Attachments')
.setImage(`attachment://${attachment.name}`);
channel.send({
embeds: [embed],
files: [attachment]
});
both work
ohhh i have to use the attachment builder
const attachment = new AttachmentBuilder(`path to file`, {
name: `fileName.mp4`
});
// ...
const gallery = new MediaGalleryBuilder()
.addItems([
new MediaGalleryItemBuilder()
.setURL(`attachment://${attachment.name}`)
]);
```(I think)
Ah I see. But array if multiple flags right?
yeah or through bitwise addition
arrays with single elements are perfectly valid
MessageFlagsResolvable discord.js@14.22.1
Data that can be resolved to give a message flags bit field. This can be:* A string (see Flags)* A message flag* An instance of MessageFlagsBitField* An array of MessageFlagsResolvable
that's the list of what you can use
Asking cause I just replaced all ephemeral: true to flags: MessageFlags.Ephemeral in my codebase and wasn't sure if I had to replace it all again with arrays 😆
But if it works as non arrays as well, great 😁
you'll have to do something anyway when you use cv2
Already do that 😅
I just hadn't replaced it for ephemeral responses until now, but thanks for clarifying it ^^
Question, you know how if you use a prefix command, like sapphires ?ban and you put an attachment with the message, can a bot using discord.js use the messages raw data to fetch that attachment
you get the attachment url and you can fetch that
though we advise not using prefix commands, you're mostly on your own for that
side note: while I've never used sapphire, I was also under the impression they exposed the djs structure somehow, so I figure you'd be able to handle it there as well
I was just wondering as I’m making a certain type of sync bot that takes audit logs and such but also fetches certain data
oh yeah, I based my answer assuming you have the djs Message
if sapphire doesn't expose that, ask sapphire
Cause I was thinking about the MessageContent
You know how message information and data when fetched can be in a json style?
I don't quite understand
you can't fetch an attachment and show it as json, it's not json data
it's binary data
(assuming the attachment isn't a json file, obviously)
if you're fetching a structure with djs, you'll get a djs structure
e.g. <TextChannel>.messages.fetch() resolves with a Message object
as I mentioned, afaik sapphire exposes this same structure
<Message>.attachments is an array of Attachment objects
<Attachment>.url exists
Makes sense
if you're getting raw json, likely you aren't fetching with <TextChannel>.messages.fetch()
that's the Message object, you're printing it in json, but we're talking about attachments
Look at the arrow
It says “attachments”: [],
Like can I somehow fetch that using discord.js or would I have to use some other method
it's a property on the object you're printing (a jsonified message)
like duck said, <Message>.attachments
Aha
Makes sense. For reference in audit logs bots can add reasons. In my case when using a prefix command, I’d if I find a way to fetch it I believe it would be very useful for the bot I’m making
we've shared the way though 
Hold on
All this coding of mine got me in overthinking mode even though I love coding lol I apologize
I'm trying to edit a components v2 message but can't seem to get around this error
Expected a string primitive
Received:
| undefined
What am I missing? I've tried to simplify it to this and am still stuck. Eventually, I'd like to use the builders to update the message.
const updatedComponents = interaction.message.components.map(createComponentBuilder);
await interaction.message.edit({
components: updatedComponents,
flags: MessageFlags.IsComponentsV2,
});
fwiw the message is a container that has a section (text + button)
try .map((component) => createComponentBuilder(component.toJSON()))
welp, that worked. Thanks!
hey, so if i have a UserContextMenu interaction, why would interaction.targetUser be null?
it wouldn't
only targetMember can be
ok, gotcha, i know for a fact im getting an interaction within the command so its not that idt
can always console.log it
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn more
Is it possible to set my command so that, only certain people can see them? like how if you go into the intergrations section you can override to stop a specific role or @everyone from seeing the command
I just haven't figured out how to do it programatically via discord.js
you need to get an oauth token from a guild admin
djs doesn't support oauth
but you can use the token with djs once you have it, if you decide to implement that
ah so I can't do it natively (without doing that) through djs, good to know
GuildApplicationCommandManager#permissions discord.js@14.22.1
The manager for permissions of arbitrary commands on arbitrary guilds
I'm trying to add a select menu using StringSelectMenuBuilder and it's giving me some type errors
Your modals guide says that only TextInputBuilder is allowed in modals, but the Discord guide shows a select menu. Is this just a discord.js limitation? o.O
djs support for select menus in Modals is not out yet
ahh okok
A PR is open for it tho
Is it a recent addition from Discord?
#11087 in discordjs/discord.js by Jiralite opened <t:1756852595:R>
Select menus and text display support for modals for @discordjs/builders
I think it’s this?
Ah yea, I see. tyty
Quick question, when I respond to an interaction by deffering it, does interaction.message change? Or is it still the original message from which the interaction originates?
interaction.message is always the origin of the interaction
hi all, i'm getting that error on my bot when trying to play music,
PS D:\DiscordBot> node .\dist\index.js
file:///D:/DiscordBot/node_modules/@discordjs/voice/dist/index.mjs:687
throw new Error(
^
Error: Cannot utilize the DAVE protocol as the @snazzah/davey package has not been installed.
-
Use the generateDependencyReport() function for more information.
at new DAVESession (file:///D:/DiscordBot/node_modules/@discordjs/voice/dist/index.mjs:687:13)
at Networking.createDaveSession (file:///D:/DiscordBot/node_modules/@discordjs/voice/dist/index.mjs:1408:21)
at Networking.onWsPacket (file:///D:/DiscordBot/node_modules/@discordjs/voice/dist/index.mjs:1543:20)
at VoiceWebSocket.emit (node:events:520:35)
at VoiceWebSocket.onMessage (file:///D:/DiscordBot/node_modules/@discordjs/voice/dist/index.mjs:1180:10)
at VoiceWebSocket.ws.onmessage (file:///D:/DiscordBot/node_modules/@discordjs/voice/dist/index.mjs:1123:39)
at callListener (D:\DiscordBot\node_modules\ws\lib\event-target.js:290:14)
at WebSocket.onMessage (D:\DiscordBot\node_modules\ws\lib\event-target.js:209:9)
at WebSocket.emit (node:events:508:28)
at Receiver.receiverOnMessage (D:\DiscordBot\node_modules\ws\lib\websocket.js:1220:20)
Node.js v24.6.0
PS D:\DiscordBot>
i've already installed @snazzah/davey package but keeps getting the error, isn't node.js v.24.6 supported¿?
It's best to post for VC related issues in #998942774994927646 then general djs-14 Help Chanel
Hi,
Since this introduces TypeScript errors on upgrade, why wasn't it considered a breaking change ?
https://github.com/discordjs/discord.js/pull/10816/files
It was just correcting the wrong typings on the already fine behavior, also we don't consider typing changes as breaking
hey team, can discordjs see discord tags yet? have i missed an announcement or something? 🙂
User#primaryGuild discord.js@14.22.1
The primary guild of the user
you have, it's the penultimate in #announcements
Hi, what the problem?
Section takes an accessory
If you don't need accessory, don't use a section
Use text display directly
okay
Honestly Discord should just make an HTML-like language at this point 😭
they specifically don't want full customizability but specific components to have a consistent design
Yeah, that's why it wouldn't be actual HTML, just a similar thing with a limited number of tags and stricter rules
Or just send json with defined rules
No matter how you wrap it, section has 2 parts
Honestly I would really love a markup language, e.g. at some point I seriously contemplated creating a Vue wrapper for the Discord UI system
Then I realized it changes way too regularly for this to be maintainable unless I wanna spend my life working for Discord, which I don't 😭
<text></text>
<accessory>
<image />
</accesory>
</section>```
Exactly the same error when you don't pass an accessory
Doesn't matter how you build it
there's already projects for wrapping components in react
but at the end of the day they'll still be sent in json
which is how it's supposed to be
I need help, my bot is continuously showing 'Unknown Integration' after I switched hosting providers from Railway to Render. I re-deployed commands but it won't work after hours of waiting. I use a 5 min ping service to keep it alive, no issue with the link (applications.commands and bot)
Integration or interaction
Integration, like when you do a command it'll show 'Unknown Integration' to the user.
Then that's nothing we can help with
How can I get it fixed?
No idea, like i said
Try asking in ddevs
Where do I go to get it fixed?
Anyone have an idea as to why these images are not displaying correctly? This recently started happening and I'm not sure why—I haven't touched the codebase in years so I am not sure if there is a breaking change somewhere else. The standalone image is what it should display and the image in the embed is simply set by a URL which displays correctly when you open it in the browser. An important clue I noticed is that the bot displays the image correctly when I run it locally, but not when it is hosted; however, it did not do that for years up until recently.
that sounds like a client issue
djs doesn't handle how the client renders the image
Yeah I was just about to note just now that pasting the URL into the chat also distorts the image compared to the image taking from a browser? Not sure if you see that as well
it looks like some kind of dark mode addon though, if you're in browser or with a modded client
I'll chalk it up to the client, that's likely what it is but wasn't sure if I missed something else. Thanks!
When I'm getting input values from a modal submission, is there a built-in way of getting the values, or am I just supposed to sift through the interaction's component array?
documentation suggestion for @eternal drift:
ModalSubmitFields#getTextInputValue() discord.js@14.22.1
Gets the value of a text input component given a custom id
<Interaction>.fields is ModalSubmitFields
Ah nice, ty
for FetchReactionUsersOptions if I want to fetch all the users should I pass limit as null?
that's not how paginated endpoints work, no
How would I go about fetching them all sorry 
Thank you sm! 
what to do if the library breaks when adding a selection menu to a modal window?
say more info
or, preferably, wait for us to actually merge and release version that actually supports this
nothing is broken, really
// @ts-ignore
const modal = await interaction.showModal({
custom_id: `commentModal${interaction.id}`,
title: "Оставить отзыв",
components: [
{
type: 18,
label: "Выберите оценку",
description: "123",
component: {
type: 3,
custom_id: "select_rating",
placeholder: "Выберите оценку",
options: [
{
label: "1",
value: "star_1",
emoji: {
name: "⭐"
}
},
{
label: "2",
value: "star_2",
emoji: {
name: "⭐"
}
},
{
label: "3",
value: "star_3",
emoji: {
name: "⭐"
}
},
{
label: "4",
value: "star_4",
emoji: {
name: "⭐"
}
},
{
label: "5",
value: "star_5",
emoji: {
name: "⭐"
}
},
]
}
},
{
type: 18,
label: "Отзыв:",
component: {
type: 4,
custom_id: "comment",
style: 2,
min_length: 1,
max_length: 300,
placeholder: "Ваш комментарий",
required: true
}
}
]
});
was moreso asking about d.js version you're using
but that's before i re-read what's the issue
when I interact with such a modal window, I get an error
14.17.3
update
you're using a version from january (even before components v2)
we're on .22.1 now
still; that does not have support for selects in modals yet
this feature has barely been released by discord
Well, I updated it but the error with the new modal window didn't go away. How can I simply make it so that the bot doesn't crash from it and receive information about the window?
dont' create such modals
(((
if you dont' send such modals, you can't receive them
I was able to send it only because I wanted to get at least some kind of crutch
I use a translator so my words may be distorted
in general i would like to send such modal windows and somehow get information from them
you'll be able to do so once djs supports it
for now you can't
you can only send with workarounds as you notice, but can't receive without getting errors, so sending in the first place is pretty much useless
but can't you write your own function and change the override in js how it will be used
this.fields = components.reduce((accumulator, next) => {
next.components.forEach(component => accumulator.set(component.customId, component));
return accumulator;
}, new Collection());
well if you don't want any wrapping from djs that can work
but djs has to be concerned about more stuff, like mapping to the actual component class, so it's not just adding that
you're on your own if you modify your djs copy though
I see, but how long will it take approximately?
there's no eta as always
these are the most recent PRs/issues we have
like 3 days old or something
I’m getting error “Missing access to age-gated content” but it doesn’t say more about it just that, what is that
where are you getting that
Happens to be affecting bots hosted in the UK
#7805 in discord/discord-api-docs by MurrayGroves closed <t:1757006964:R>
50269 - Missing access to age-gated content for bots hosted in the UK
does cleanContent also remove any discord formatting?
you could try it out
it doesnt
but i found escapeMarkdown https://discord.js.org/docs/packages/discord.js/main/escapeMarkdown:Function
escape means removes right?
Yes, it means to add an escape character \ so Discord doesn't interpret something as markdown
thanks
why am i getting "autocomplete timed out" errors when my autocomplete seems to be working fine? how can i fix these
what makes you say it works fine
it works how id thought it would
i have an array of data that im responding to the AutocompleteInteraction with and its showing up in the autocomplete and narrowing it down as I type through startsWith
yet i get an Autocomplete timed out error in my console even though to me it looks like its fine
How to hide alt
by disabling it in your user settings OR by not providing alt text
I mean, this can't be canceled from the bot
no
I hope you remove it
i do not work for discord, and neither does discord.js
if its not your bot you can hide all alt text in your user settings
if it is your bot you just do not pass the alt_text when sending the media
discord.js is a 3rd party library and only adopts features that discord documents
show the log
؟ url: 'attachment://progress.png', description: ''
what is this supposed to mean?
How to define a pre-defined group of positions that can be chosen in a Role Select Menu?
const options = item.choices.map(id => ({ label: `Cor ${id}`, value: id }));
const row = new ActionRowBuilder().addComponents(
new StringSelectMenuBuilder()
.setCustomId(`loja_choice_${userId}_${itemKey}`)
.setPlaceholder("Escolhe a tua cor")
.addOptions(options)
);```
How to transform this in the role select menu?
You cant
Only string select menus have customisable options
import { InteractionType, APIChatInputApplicationCommandInteraction, APIMessageButtonInteractionData,
APIModalSubmitInteraction,
APIMessageComponentSelectMenuInteraction,
APIApplicationCommandAutocompleteInteraction} from "discord-api-types/v10";
Is this type correct for slash command, Button, Modal Submit, SelectMenu and Autocomplete respectively for callbacks i receive to my interaction endpoint?
Are you already working on adding select menus to modals? If so, when will you release a discord.js update?
yes, and as always - no eta
role.position count upside down ?
is this new update ?
i mean is the last role postion is 1 ? or the first one
Last role's position would be 1, yes
is this new ? cause it wasn't like this as i remember
No, it's always been that way
the code in question hasn't changed in 2 years and it was for a performance reason, before and the commit before that was done 8 years ago which was when it looks like it was implemented
is there a way to send ComponentV2 inside webhooks?
There was an error while executing this command. Error: TypeError: (intermediate value).setContent is not a function
that error has nothing to do with webhooks
and yes, you can do that
you need withComponents option though
WebhookMessageCreateOptions#withComponents discord.js@14.22.1
Whether to allow sending non-interactive components in the message. For application-owned webhooks, this property is ignored
here is my file that im having an error.
webhookClient = new WebhookClient({ url: 'link'})
if(!webhookClient) return;
const container = new ContainerBuilder();
container.addTextDisplayComponents(
new TextDisplayBuilder()
.setContent(`Number`),
new TextDisplayBuilder()
.setContent(`Number`)
)
container.addSeparatorComponents(new SeparatorBuilder())
container.addSectionComponents(
new SectionBuilder()
.setContent(`Number`)
)
await webhookClient.send({
flags: MessageFlags.IsComponentsV2,
components: [container]
});```
guide suggestion for @scenic berry:
Popular Topics: Display Components - Container
read more
SectionBuilder doesn't have a setContent method
you most likely meant to add a text display component
SectionBuilder#addTextDisplayComponents() discord.js@14.22.1
Adds text display components to this section.
that's what "(intermediate value).setContent is not a function" means
thank you
how to set the visibility of the seperator in the container builder?
documentation suggestion for @halcyon vault:
SeparatorBuilder#setDivider() discord.js@14.22.1
Sets whether this separator should show a divider line.
-# 👍
Did Model component realeased? in discord js?
Would be in #announcements if so
Does the library cover https://discord.com/developers/docs/topics/oauth2 ?
how to send component v2 through webhook ?
await webhook.send({
withComponents: true,
username: client.user.username,
avatarURL: client.user.displayAvatarURL(),
components: [conatiner],
allowedMentions: { parse: [] },
})
I am using this and giving this error
[2025-09-05 13:44:07] [ERROR] Unhandled Rejection at: [object Promise] reason: DiscordAPIError[50035]: Invalid Form Body
components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
What’s ur d.js version? npm ls discord.js
d.js doesn’t cover OAuth
Aerith on main [!?] is 📦 v1.0.0 via v22.17.1 took 17m51s
❯ npm ls discord.js
aerith@1.0.0 /home/maneeth/Projects/Aerith
├── discord.js@14.21.0
└─┬ dokdo@1.1.0
└── discord.js@14.21.0 deduped
Aerith on main [!?] is 📦 v1.0.0 via v22.17.1 took 7s
❯
.
Oh right, need the IsComponentsV2 flag enabled
ok i will try.
Not sure why it took me that long to see it
thanks, it worked
where can i get docs/guide for components v2?
guide suggestion for @flint zenith:
Popular Topics: Display Components
read more
ok thank you
alr ty
Is there a page or similar that lists how to sanity check discord values.
IE, I'm loading config, it has a channel id in there. Do I check it's a number, and a minimum number of digits?
No
Snowflakes are just 64 bit (unsigned) ints
So checking is number is valid?
Back in the olden days, we had a bot Clyde with an id of 1
no sneaky hexadecimals appearing
You would have to be careful with implementation, but yes
and I guess check value <64bit
- Discord ids follow the snowflake format: learn more
- Discord ids must be represented as strings as they are larger than
Number.MAX_SAFE_INTEGER, the largest integer that can be represented in JavaScript
- client.guilds.cache.get(123456789012345678)
+ client.guilds.cache.get("123456789012345678")
Pretty sure people have observed a minimum length (in base 10) of ids
Well, most ids since not many users were created close to Discord’s epoch
Max base10 length is implicitly checked if you are checking the number of bits
if (typeof BigInt(value) !== "bigint") {
throw new Error('Invalid or missing `value`');
}
Should be a valid test?
Not really
I don't see why?
If it's a string representation of a 64bit value, if this fails it's not?
BigInt accepts values that aren’t normally a snowflake
Ah, hex values, I see
"0x01” and "0o01" aren’t snowflakes