#djs-help-v14

78874 messages · Page 40 of 79

iron void

I have an unknown interaction problem and I don't know why

iron void

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'
}

dense jackal
iron void
sharp ginkgoBOT

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

rigid ridgeBOT
dense jackal

its about the size limit you can send per request I think

iron void
dense jackal 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

dense jackal
proud arrow
humble fern

Hello!

gleaming locust
humble fern

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>

snow onyx

addButtonComponents is, indeed, not a function

sharp ginkgoBOT
humble fern

I have tried in several ways, including the documentation, and nothing works...

snow onyx

You need to use action rows and then add them to the container

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

humble fern

How do I use action rows to add buttons?

snow onyx
iron void
sharp ginkgoBOT

guide suggestion for @humble fern:
guide Interactive Components: Buttons
read more

main sail

why doesnt allowedMentions ping when i do with components (cv2)? do mentions only work in the content?

wary coral

allowedMentions does work with cv2

could you share the code your having an issue with

halcyon vault

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

wary coral
halcyon vault

I mean instead of this txt

wary coral

Their is no system message like that.

any Missing Permission message comes for the bot

halcyon vault

What?

halcyon vault

Let me search that message again, soon!

dense jackal
halcyon vault
dense jackal

but afaik you cannot do anything about that, its more of a Discord error

main sail
wary coral
main sail
dense jackal

it is yes, edits do never send out notifications

main sail

all good now, thanks mafia, b3ssel

heavy sparrow

Good afternoon, when will the feature to change the status of a voice channel appear?

proud arrow

When discord decides to document it

halcyon vault

-# I am sorry for ping-ing you!

dense jackal

I said, its a Discord error

halcyon vault
dense jackal

what?

halcyon vault

I mean, can you tell clearly that this is discord side issue or the bot config?

dense jackal

I search for similar issues from other people, and they got answered with that is an issue on Discord’s side

halcyon vault

ohh. thank for your ans.

Got it!

proud arrow

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

halcyon vault
wary coral

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

proud arrow
halcyon vault
lunar jewel

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...

wary coral
lunar jewel

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

lunar jewel
wary coral
lunar jewel

here's the entire log. That code block was just the npm ls

wary coral
lunar jewel

use what? the console log part?

wary coral

yes, what is the resalt of npm install discord.js in the console

lunar jewel
wary coral
lunar jewel

I think something is up with your npm try reinstalling node.js

lunar jewel

still nothing

i uninstalled node.js and reinstalled it and got the same thing

wary coral

if you do npm -v what do you get? also node -v

lunar jewel

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>

wary coral

current version of npm is 11.4.2 so I think you have a problem thier

try npm install -g npm@latest

lunar jewel

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```
wary coral

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

bleak owl

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

lunar jewel

thanks guys. Now I can't do crap with any of my bots in the terminal...you essentially bricked my terminal.

bleak owl

no one here did anything to ruin your terminal

it's on your end, not due to discord.js

lunar jewel

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...

snow onyx

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.

lunar jewel

I can't. nothing will let me do anything at all

in any terminals atleast

snow onyx

Unless you be more specific we can't help

lunar jewel

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

snow onyx

try these commands

nvm uninstall 22.12.0
nvm install 22.12.0
nvm use 22.12.0
lunar jewel

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

snow onyx

All good, this is just a corrupt node installation it seems, no bot progress lost

iron void

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'
}
»
lunar jewel
dense jackal
iron void
dense jackal 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

lunar jewel
dense jackal

no

iron void
lunar jewel
iron void
dense jackal

${index + 1}. ${song.name} has a variable length, depending on the title length of a song

iron void

Only 12 on queue

lunar jewel

Imma go eat something. I'll be back once my node stuff is done doing it's thing so I can test

dense jackal

so if the song title is about 96 characters long, it wouldn’t fit

iron void
snow onyx

100 just like it says

iron void
dense jackal

then slice it off

iron void

Thanks man for help

turbid stream

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?

red coral

Won’t be djs’s problem, can ask in ddevs but I did see some issues related to images not showing in ddevs

cinder osprey

Is it possible to use a custom emote in ButtonBuilder.setEmoji() ?

wraith cedar

What is animated webp
How to setup

dense jackal
dense jackal

or I think .setEmoji("\:emoji1:") works as well

cinder osprey
dense jackal

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

cinder osprey
// Works
.setEmoji({ name: "link", id: "1412145014087356558", animated: false })

// Doesn't work
.setEmoji("<: link: 1412145014087356558>")
cinder osprey
dense jackal

if it doesn't work without the spaces in between (which I assume you do) then I know that for next time

cinder osprey
dense jackal if it doesn't work without the spaces in between (which I assume you do) then I ...

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>)
sharp ginkgoBOT

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
rose tangle

and uninstall /builders

sharp ginkgoBOT

discord.js includes multiple sub-packages, installing these separately can mess with internal code:

npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
cinder osprey
rose tangle

ah, it's inside a setButtonAccessory, are you using the one from the callback?

cinder osprey
rose tangle 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))
      )
)
rose tangle

makes sense then, that can't be fixed

you could however make your own ButtonBuilder but from djs

lunar jewel
rose tangle

setButtonAccessory(new ButtonBuilder(...))

then it should work

cinder osprey
cinder osprey
proud arrow

This is not the channel, or the server for that. Please take it somewhere else

bright cradle
/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
bleak owl

one or more of your commands are missing a data property

sharp ginkgoBOT

guide Creating Your Bot: Command handling
read more

guide Creating Your Bot: Event handling
read more

bright cradle

but thats not possible, i made this code 2 years back, and it worked perfectly back then

bleak owl

well, your error disagrees

so check your commands and see which one is missing that property

bright cradle
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."})
    }
}```
bleak owl

that's your subcommand, not your main command

bright cradle

hold on, lemme check the main one

bleak owl

honestly, i would change your command and event handling to what we suggest in our guide

bright cradle

:/

okay ill do that then, thank you

bright cradle

im getting an error saying disallowed intents?, how do i know which intents i need to allow

sharp ginkgoBOT

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

bright cradle

thank you

bleak owl

no problem :)

sharp ginkgoBOT
tardy sable

is there something similar to EmbedBuilder.from() but for new components

icy hamlet

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.

tardy sable

lol im kinda asking the same question

icy hamlet

I'm baking with you

sharp ginkgoBOT

documentation suggestion for @tardy sable:
function createComponentBuilder discord.js@14.22.1
Factory for creating components from API data.

rose tangle
icy hamlet
rose tangle

you have the message so you have the components

rose tangle
icy hamlet
rose tangle you have the message so you have the components

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.

rose tangle

you have the message though, you need it to create the collector

use it on the end event and get the components

sharp ginkgoBOT
rose tangle

or if its your message for that last point

icy hamlet
rose tangle you have the message though, you need it to create the collector

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?

rose tangle

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

sharp ginkgoBOT

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(…)
icy hamlet
rose tangle

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

sharp ginkgoBOT

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
icy hamlet
rose tangle

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

icy hamlet

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.

rose tangle

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

unique shoal

I mean if no updates, also not a problem

Because not updated

rose tangle

oh yeah true lol

icy hamlet

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);
});
rose tangle

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

icy hamlet

Or I can change message from a const so that I can update it whenever the reply is edited.

rose tangle

you shouldn't update state manually of djs objects

you could however have a components array

icy hamlet

Hmm could be because it's ephemeral. I'll test it without

icy hamlet
unique shoal

The events arent emitting at the same time are they?

What triggers the end here?

icy hamlet

no

expiration of the button triggers the end

rose tangle

maybe djs could use the update or editReply payload to update manually the cache

loud quartz

we never did that

because it adds a lot of overhead for a lot of cases

icy hamlet

Thanks for the help and suggestion to switch from channel collector

loud quartz

what if the call fails

what if it gets stuck in queue of ratelimit

rose tangle

do it after the call ¯_(ツ)_/¯

loud quartz

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

unique shoal

creates race conditions

rose tangle

it could be used for every call given you won't receive the event either if it's a user app

loud quartz

that too

icy hamlet

I vote for discord adding an option to disable all components in a message

loud quartz
rose tangle
loud quartz

when users who use the app have no clue what they are using

rose tangle
loud quartz

the lib user?

rose tangle

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

rain forum
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

bleak owl

code looks fine

rain forum
client.user.bannerURL({ size: 4096, extension: "png" })
bleak owl

ah i thought you meant for a user, not the client user

eternal drift

Can messages only be ephemeral if they're a reply to something?

red coral

Only interaction responses can be

eternal drift

hmmm okok ty

icy hamlet
rose tangle you could however have a components array

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. 🙂

rose tangle

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

jagged rock

is there a way to get cmd id thru bot like fetching it or somet

rose tangle

for a global or guild command?

jagged rock
sharp ginkgoBOT

method 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);

rose tangle

don't pass an id to get a collection of all commands

jagged rock

no like can i get a command id thru the command name

rose tangle

yes, that's what I'm suggesting

you can .find on the collection by name

jagged rock

alr cheers

sharp ginkgoBOT

method 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');

jagged rock
rose tangle

subcommands don't have an id

since they're just options

only the parent command does

lean star

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]
            });```
unique shoal

you need to set with_components: true in the payload

lunar jewel

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 😅

polar karma

Do you have the correct intents?

lunar jewel
const client = new Client({ 
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessageReactions,] },
 { partials: [Partials.Message, Partials.Channel, Partials.Reaction] });
polar karma

Your partials are not in the client options object

Everything goes in one object, not separate objects

lunar jewel

that was it 🤦‍♂️ told you it was something simple lol appreciate it. My dislexia kills me sometimes 😅

wary coral
heavy sparrow

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: '🐛' }
                        }
                    ])
                )
            )
        );
clear garnet

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

heavy sparrow
clear garnet

Because there is no stable release of discord.js that supports that new feature right now

heavy sparrow

The news is written, but there is no stable version, nonsense

clear garnet

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

rigid ridgeBOT
clear garnet

Feel free to follow this PR

heavy sparrow

ok

frosty epoch

message.guildId is the only way to know if it is a dm or inside a server?

sharp ginkgoBOT
frosty epoch

same as doing message.guildId then

stable sun

inGuild is a typeguard

cosmic grotto

Can I use setAccentColor with hex codes as well (for example #ffffff), or only with the format of 0x[some color code]

loud quartz

The latter

It's the same thing anyway

Just that one is a string using hexadecimal and other an actual hexadecimal number

versed current

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.

cosmic grotto
loud quartz
versed current

could've been something I'm missing. Can you imagine what else I could've done wrong?

loud quartz

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

versed current

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]);
...
loud quartz

Go ask in ddevs

versed current

I did 👍

loud quartz

We have no idea why you aren't getting the event

Not our call

versed current

ok, thanks so far!

steel yacht

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

crimson gale

there is no autocomplete component, so none

iron void

How do I hide a sign that the message worked from an command?

crimson gale

"hide" as in "only show the person using the command"?

dapper cave

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 XXFreaky

burnt quartz

is it possible to edit/delete the message that a button interaction occured on when used as a user app?

dapper cave

im pretty sure you can but only if its an actual message and not ephemeral

burnt quartz

im getting missing access

dapper cave

then I think my pretty sure is wrong

burnt quartz

just trying to ```js
interaction.message.delete()

but it errors with missing access
crimson gale

you can respond to the button with a delete response
wait... is that a thing firT

burnt quartz

theres only deleteReply, which deletes the reply to the button interaction, NOT the message the interaction came from

crimson gale

you might have to use the webhook delete route firT

polar karma
dapper cave anyone

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

dapper cave

Yeah i'd need to use discordjs voice is there a help channel for that cuz I can't find it

polar karma

Again, parsing it is not a library question

dapper cave

I need more help checking for who is saying what if that is even possible

polar karma
dapper cave

yeah thanks

crimson gale

trying to figure out how we expose that firT

burnt quartz

i found interaction.webhook.deleteMessage() but that just crashes with cannot read id of undefined

crimson gale

how do you use it?

burnt quartz

ah wait i see nvm

crimson gale

on the other hand, interaction#webhook will be bound to the interaction instance, but that one didn't send the message, hmm

burnt quartz

yeah now crashes with unknown webhook

interaction.webhook.deleteMessage(interaction.message)
crimson gale

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

burnt quartz

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

crimson gale

SCagreed yup, still thought that'd be possible, TIL

modest surge

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 })
cinder osprey

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

loud quartz

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

loud quartz
cinder osprey
versed current

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?

thorn bridge

update the message with the same components

versed current

It's a componentsV2 message. So idk about that.

thorn bridge

i guess it's the same

versed current

Hm, I gotta try that

okay, so it works but it feels a bit clumsy.

thorn bridge

afaik there is no other method

thorn bridge
rose tangle

iirc calling .update() on the select interaction passing nothing also works

obviously the interaction mustn't have been replied to already

modest surge

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 })
verbal plinth

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?

proud arrow

The former, you do not need more than one listener

verbal plinth
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.

proud arrow

Yes

radiant epoch

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

rose tangle

tipaka asked you for more info

you're the one not replying

modest surge
verbal plinth
proud arrow Yes

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.

bleak owl
iron void

In component v2, can I put a photo gallery at the top? Or wherever

proud arrow
modest surge
proud arrow
bleak owl
proud arrow
radiant epoch

why I can't send message tf

this is not dm

bleak owl
radiant epoch

I get "my message can't be delivered" error in server chat

bleak owl

im not sure how this is related to discord.js

radiant epoch

of course, but you didn't get the point

bleak owl

i don't, but this isn't d.js related. sorry

radiant epoch

I can't send the code in here aka the message

bleak owl
radiant epoch
radiant epoch
gleaming locust

How to transform Date.now() in timestamp of Discord?

sharp ginkgoBOT

documentation suggestion for @gleaming locust:
function time discord.js@14.22.1
Formats a date into a short date-time string.

proud arrow

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

radiant epoch
snow onyx ManageRoles

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

snow onyx

ManageRoles is Manage Permissions

radiant epoch
radiant epoch
proud arrow

That is just how it is displayed on the ui, there is no such permission in the api

radiant epoch

when I tried to overwrite the channel permission by allowing ManageRoles to bot even bot has permission of ManageRoles

proud arrow
gleaming locust
radiant epoch

tried again to be sure, yes it still says missing permission

proud arrow

Make sure other overwrites or roles aren't denying bot the permissions

radiant epoch
proud arrow 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.

proud arrow

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

radiant epoch

Let me try that on user then

proud arrow

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)

radiant epoch

I am just trying to make the button unlock/lock voice channel and that requires manage permissions to edit it for @ everyone role

proud arrow
radiant epoch
radiant epoch
uneven crater

I remember this particular thing being super fucky lemme see if I can find the article

proud arrow
uneven crater
radiant epoch
radiant epoch
radiant epoch

somehow manage roles throws error with missing permission

uneven crater
radiant epoch
iron void

How many pictures and texts can I add?

uneven crater
radiant epoch yes, when I try to give manage roles permission to bot on the voice channel -# ...

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.

radiant epoch
iron void

How can I fix this?

radiant epoch

letme try to give admin permission and try to add manage roles

uneven crater
topaz bluff
uneven crater
topaz bluff

Oh ya that would make sense....

topaz bluff
uneven crater

YES IT IS

uneven crater
iron void
topaz bluff

Yup that's it. I tested it as well. Even Unicode emojis don't work inside of the mask

uneven crater
topaz bluff

You can substitute it with a instead if you really want the heart

rough tree

is there a visualiser for this new component do u know

uneven crater
rough tree

yes

thansk you

wary coral

What are you trying to do?

iron void

Starting project error

rose tangle

we don't support bots that break the ToS (you're using distube which is against the ToS)

bleak owl

and 3rd party modules, such as commandkit

eternal drift

Is it only modals that do not have an interaction channel?

golden laurel

They do

eternal drift

Oh they do? I was making an assumption tbh. Which channels do not?

loud quartz

why are you even asking?

sharp ginkgoBOT
eternal drift

Because when checking interaction.channel, channel is potentially undefined, so I want to know which interactions do not have one

unique shoal

Its potentially undefined because it might not be cached

eternal drift

Ah okok ty

unique shoal

Thonk actually it should just be potentially null in that case - it may be potentially undefined if you havent typeguarded it against being raw data

eternal drift

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

unique shoal

Its just a getter for the channel cache, if channelId is potentially null/undefined, that would be more related to your question

iron void

const collector = dataDessage m.createMessageComponentCollector({ time: 60000 });
Is not function

unique shoal

uhh, not sure if theres some typos in there

But that means whatever m is, does not have that function

iron void

dataMessage withRespones from interaction reply

unique shoal

Then what is m

sharp ginkgoBOT

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
iron void
unique shoal

Im lost

If you use withResponse, the message object is <InteractionCallbackResponse>.resource.message

unique shoal

Which has that function

iron void

When edit message
Use

<InteractionCallbackResponse>.resource.message.edit
Or

<InteractionCallbackResponse>.edit

unique shoal

Neither

interaction.editReply

iron void
iron void
unique shoal

queueMessage is not interaction

iron void
unique shoal

yes

and now

use interaction.editReply like I said

At no point did i say queueMessage.editReply, so dont do that please

iron void
iron void
halcyon zephyr

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?

bleak owl

that property doesn't exist on a ChatInput

halcyon zephyr

ah sorry I was reading code for a button interaction facepalm thank you

unique shoal
iron void
unique shoal 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 🙂

unique shoal

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

rare citrus

Does container have a file upload component?

unique shoal

no

rare citrus

Do they have any method for users uploading files without typing?

unique shoal

slash command attachment options

Containers do not, no

rare citrus

Dang.. Thank you for your help

halcyon zephyr

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?

unique shoal

Yeah

fetching reaction.users should do it

Each MessageReactionAdd event only includes the user who is currently adding

tardy sable

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)
rose tangle

every section needs an accessory

should be if (data.image) { add section with thumbnail } else { add text display }

tardy sable

thanks

trail raven

is the MemberUpdate triggered when a user adds another boost to their current boost? like from 1->3 ? etc. ?

unique shoal

no, i dont think so

trail raven

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

sharp ginkgoBOT

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.
    }
});
rose tangle

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

unique shoal

thta property doesnt change when a boost increases though, so yeah, messages

trail raven

Yeah but this wont trigger because the user is already boosting

rose tangle

yeah, skipped the "only but incomplete" lol

trail raven

Wait. Does boosting trigger any other events?

rose tangle

maybe guildUpdate for the boost count

or the tier

trail raven

Thats what I was hoping for

rose tangle

if you only want to know when the guild was boosted and not by whom, yeah that sounds good

trail raven

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

rose tangle

discord doesn't want to encourage scam boost guilds probably

trail raven

It would just put all the scamming off discord and onto like some webpage or even worse

pearl roost

is there anything wrong in this code? I tried it, and the message just won't show up

trail raven
rose tangle

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

rose tangle

with workarounds and whatnot

but we're just speculating anyways, no idea about the actual reason

pearl roost
rose tangle

you shouldn't need partials for guild member add

do you have the Guilds intent?

pearl roost

my index now look like this after I add the partials

trail raven
rose tangle

it's a per case thing, some people want it, others don't

trail raven
rose tangle
pearl roost
pearl roost

Hmmmm

rose tangle

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

trail raven

Can you show where you have your events handled by djs?

pearl roost

I just realize I set it data instead of name on line 9 🤦‍♂️

I'm sorry it's on me

rose tangle

no worries

trail raven

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?

rose tangle

yes, it adds a listener per file, each listener executes its own file

trail raven

Isnt this like insanely memory inefficient? I thought it is better to have just 1 listener handling everything for that event?!

rose tangle

why insanely memory inefficient?

unique shoal

Not sure I understand

trail raven

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

rose tangle

imo there should only be a difference depending on your implementation of how you call that many handlers per event

unique shoal

We generally do only have one listener per event

Each is in a separate file for the sake of modularisation/readability

rose tangle

maybe you got the memory leak warning from node?

trail raven
unique shoal

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

rose tangle

it's a warning just in case you added many listeners that you no longer need and they're now doing nothing

trail raven

dont remember. I switched to a more advanced handling of events (calling one function per event that handles all the code for that event)

unique shoal

Thats what the guide does

rose tangle

as long as you don't have unused listeners, I think it should be fine to listen many times

rose tangle

the guide doesn't have folders for events unlike commands

trail raven
unique shoal Thats what the guide does

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

unique shoal

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

trail raven
rose tangle

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

unique shoal

The only time I see it does is making every command a separate interactionCreate listener

But only when they havent followed the guide

rose tangle

the complexity of handleMaybeAsync and .apply should be negligible

trail raven
trail raven
rose tangle

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

trail raven

Then nodejs tricked me back then

rose tangle

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

unique shoal

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

trail raven
rose tangle
wary pendant

how to register slash commands

sharp ginkgoBOT

guide suggestion for @wary pendant:
guide Creating Your Bot: Registering slash commands
read more

wary pendant

@halcyon bison deployed.js file make

I will try 15 times commands not registered

halcyon bison

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?

wary pendant
halcyon bison

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

halcyon bison
wary pendant

@nocturne tendon i have a question register commands work in prefix

halcyon bison

(also you @d the wrong duck)

dense jackal

is your previous issue solved?

wary pendant
dense jackal no they don’t

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

dense jackal

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

wary pendant
dense jackal 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'

snow onyx

However you set guild and client ID is not working

wary pendant
snow onyx 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

snow onyx

that error is self explaining, nor does it have anything to do with discord.js

dense jackal
humble fern

how to add this?

the commands

dense jackal
humble fern

how to verify the bot?

dense jackal
wary pendant

for fast response

snow onyx

you should very much read #rules

dense jackal
humble fern
dense jackal
mystic terrace
polar karma

@mystic terrace there is no need to be rude

mystic terrace
sinful shoal

why doesnt the options exist on commandinteraction?

everywhere ive seen it says that it has a property options

snow onyx

it exists on ChatInputCommandInteraction

sinful shoal
snow onyx

since its a general type for both ChatInput and Context interactions, no

If you use the proper typeguards, typescript won't cry about it

sharp ginkgoBOT
sinful shoal

thanks

fallow finch

Does isTextBased() not return ForumChannel? I am reading the docs but I think I am not getting it properly

snow onyx

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

fallow finch

Alright, thanks

tardy sable

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

red coral

Why not just pass message.components

tardy sable
frigid lynx

got a quick question, is there any api for the new (ish) "apply to join" feature?

snow onyx

bots cant read applications, if thats what you mean

frigid lynx

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

storm snow

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

loud quartz

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

storm snow
loud quartz

we didn't release a silent update yesterday to break half of your code specifically

storm snow

I just can't find the issue, it's the hosting or the code or what

loud quartz

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

storm snow

Ikr, it isnt discord.js issue, I am asking for help

loud quartz

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

storm snow

;-; discord api is fine lookin other bots, My code, even i am not able to understand where's the issue, all optimized

loud quartz

we have no idea

rocky arrow

Do webhook messages trigger the messageCreate event? Or is there a different way of getting them?

loud quartz

the only difference about webhook message is who sends it

it's still a message like any other

rocky arrow

ShibaThink Wrong thing, brb

i see

tardy sable

is there a way to get the guild tag through guild and not user?

dense jackal

afaik you cannot and idk why that is

tardy sable

yh kinda weird the only way is to get the guild tag through user and not the actual guild

bleak owl

this is because discord did not document it

dense jackal

yeah the “idk why that is” was to meant “idk why that is decided by discord”

sudden grove

So what exactly is sharding

sharp ginkgoBOT

guide Sharding: Getting started - How does sharding work?
read more

vivid totem

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

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

halcyon zephyr

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?

![esmile](https://cdn.discordapp.com/emojis/806085498661502996.webp?size=128 "esmile")
[ '510655770866483221' ]
![Heart](https://cdn.discordapp.com/emojis/806085498216644639.webp?size=128 "Heart")
[ '510655770866483221', '533692379777990656' ]
![esunglasses](https://cdn.discordapp.com/emojis/806085498580893728.webp?size=128 "esunglasses")
[ '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

cosmic burrow

i just deploy global slash commands, the bot profile, supports command badge didn't appear. can you fix it for me?

topaz bluff
cosmic burrow

ok

woeful spade

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?

red coral
woeful spade If I specify the Intent MessageContent when starting the bot but do not register...

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

woeful spade

Does that also mean that if I don't have client.on(“messageCreate”), things will be cached and could lead to problems?

red coral

What problems would it lead to? If you have an intent it’ll emit the events attached to that intent

woeful spade

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.

red coral

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

whole current

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 🙂

bleak owl

you can't change what commands are shown first in what order based on what the user types in the slash menu

red coral

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

tardy sable

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

red coral

Yes, I believe so since discord sends the message

tardy sable

yh i also was thinking that but wasnt sure

whole current
bleak owl

no

whole current

Ok thanks ! 👍

red coral

I mean yes, by only allowing your command in that channel. But that’s down to the admins and not something you can enforce

rose tangle

it does

red coral

Do you know where it does? I couldn’t find it in the source code

rose tangle

or well, assuming it comes from a cached channel, that is

red coral

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

rose tangle

no since the message was there already

but the message does get cached

red coral

The message was there but it got lost since the bot rebooted.

Ahhh that’s cool, thanks for that lol

rose tangle

otherwise it fallsback to the new Message()

lean sail

can you have more than one actionrow inside a container?

hallow mesa

Sure

lean sail

how many?

hallow mesa

As many as you can fit within the 40 component limit, so ~19 action rows if they each have one component

lean sail

how do i display an mp4 inside my codebase with mediagalleryitembuilders?

loud quartz

just put the file into the gallery

lean sail

how though

lean sail
safe wigeon

Which is correct? ```js
reply({ embeds: [embed], flags: MessageFlags.Ephemeral }) // not array
reply({ embeds: [embed], flags: [MessageFlags.Ephemeral] }) // array

loud quartz
sharp ginkgoBOT

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]
});
lean sail

ohhh i have to use the attachment builder

safe wigeon
lean sail i only see a setURL method on the item builder
const attachment = new AttachmentBuilder(`path to file`, {
    name: `fileName.mp4`
});
// ...
const gallery = new MediaGalleryBuilder()
    .addItems([
        new MediaGalleryItemBuilder()
            .setURL(`attachment://${attachment.name}`)
    ]);
```(I think)
safe wigeon
rose tangle

yeah or through bitwise addition

loud quartz

arrays with single elements are perfectly valid

rose tangle

whatever you want

sharp ginkgoBOT
rose tangle

that's the list of what you can use

safe wigeon

But if it works as non arrays as well, great 😁

loud quartz

you'll have to do something anyway when you use cv2

safe wigeon

I just hadn't replaced it for ephemeral responses until now, but thanks for clarifying it ^^

sudden grove

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

rose tangle

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

halcyon bison

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

sudden grove

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

rose tangle

if sapphire doesn't expose that, ask sapphire

sudden grove

Cause I was thinking about the MessageContent

You know how message information and data when fetched can be in a json style?

rose tangle

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)

sudden grove
halcyon bison

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

sudden grove

Makes sense

halcyon bison

if you're getting raw json, likely you aren't fetching with <TextChannel>.messages.fetch()

rose tangle
sudden grove

that's the Message object, you're printing it in json, but we're talking about attachments

sudden grove

It says “attachments”: [],

Like can I somehow fetch that using discord.js or would I have to use some other method

rose tangle

it's a property on the object you're printing (a jsonified message)

like duck said, <Message>.attachments

sudden grove

Aha

sudden grove
rose tangle

we've shared the way though Thonk

sudden grove

Hold on

All this coding of mine got me in overthinking mode even though I love coding lol I apologize

icy hamlet

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)

rose tangle

try .map((component) => createComponentBuilder(component.toJSON()))

icy hamlet
hardy minnow

hey, so if i have a UserContextMenu interaction, why would interaction.targetUser be null?

rose tangle

it wouldn't

only targetMember can be

hardy minnow

ok, gotcha, i know for a fact im getting an interaction within the command so its not that idt

rose tangle

can always console.log it

sharp ginkgoBOT

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
proven gate

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

rose tangle

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

proven gate

ah so I can't do it natively (without doing that) through djs, good to know

sharp ginkgoBOT
eternal drift

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

outer plume
eternal drift

ahh okok

outer plume

A PR is open for it tho

eternal drift

Is it a recent addition from Discord?

rigid ridgeBOT
outer plume

I think it’s this?

eternal drift

Ah yea, I see. tyty

versed current

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?

snow onyx

interaction.message is always the origin of the interaction

novel wasp

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¿?

wary coral
steel yacht
little pebble
lusty bramble

hey team, can discordjs see discord tags yet? have i missed an announcement or something? 🙂

sharp ginkgoBOT
rose tangle
empty vault

Hi, what the problem?

loud quartz

Section takes an accessory

If you don't need accessory, don't use a section

Use text display directly

empty vault

okay

steel yacht

Honestly Discord should just make an HTML-like language at this point 😭

rose tangle

they specifically don't want full customizability but specific components to have a consistent design

steel yacht

Yeah, that's why it wouldn't be actual HTML, just a similar thing with a limited number of tags and stricter rules

loud quartz

Or just send json with defined rules

No matter how you wrap it, section has 2 parts

steel yacht

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 😭

loud quartz
  <text></text>
  <accessory>
    <image />
  </accesory>
</section>```

Exactly the same error when you don't pass an accessory

Doesn't matter how you build it

rose tangle

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

timid onyx

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)

loud quartz

Integration or interaction

timid onyx

Integration, like when you do a command it'll show 'Unknown Integration' to the user.

loud quartz

Then that's nothing we can help with

timid onyx

How can I get it fixed?

loud quartz

No idea, like i said

Try asking in ddevs

timid onyx

Where do I go to get it fixed?

loud quartz
dawn quiver

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.

rose tangle

that sounds like a client issue

djs doesn't handle how the client renders the image

dawn quiver

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

rose tangle

it looks like some kind of dark mode addon though, if you're in browser or with a modded client

dawn quiver

I'll chalk it up to the client, that's likely what it is but wasn't sure if I missed something else. Thanks!

eternal drift

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?

sharp ginkgoBOT
proud arrow

<Interaction>.fields is ModalSubmitFields

eternal drift

Ah nice, ty

halcyon zephyr

for FetchReactionUsersOptions if I want to fetch all the users should I pass limit as null?

loud quartz

that's not how paginated endpoints work, no

halcyon zephyr

How would I go about fetching them all sorry SweatingCat

halcyon zephyr

Thank you sm! Prayge

meager meadow

what to do if the library breaks when adding a selection menu to a modal window?

loud quartz

say more info

or, preferably, wait for us to actually merge and release version that actually supports this

nothing is broken, really

meager meadow
        // @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
                    }
                }
            ]
        });
loud quartz

was moreso asking about d.js version you're using

but that's before i re-read what's the issue

meager meadow

when I interact with such a modal window, I get an error

meager meadow
loud quartz

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

meager meadow

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?

loud quartz

dont' create such modals

meager meadow
loud quartz

if you dont' send such modals, you can't receive them

meager meadow

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

rose tangle

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

meager meadow
rose tangle

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

meager meadow
rose tangle

there's no eta as always

loud quartz

these are the most recent PRs/issues we have

like 3 days old or something

toxic moat

I’m getting error “Missing access to age-gated content” but it doesn’t say more about it just that, what is that

loud quartz

where are you getting that

dense jackal
rigid ridgeBOT
tardy sable

does cleanContent also remove any discord formatting?

loud quartz

you could try it out

tardy sable

it doesnt

topaz bluff

Yes, it means to add an escape character \ so Discord doesn't interpret something as markdown

tardy sable

thanks

lean sail

why am i getting "autocomplete timed out" errors when my autocomplete seems to be working fine? how can i fix these

loud quartz

what makes you say it works fine

lean sail

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

iron void

How to hide alt

dense jackal
iron void
bleak owl

no

iron void
bleak owl

i do not work for discord, and neither does discord.js

dense jackal
bleak owl

discord.js is a 3rd party library and only adopts features that discord documents

iron void
dense jackal

what is this supposed to mean?

humble fern

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?
unique shoal

You cant

Only string select menus have customisable options

wooden carbon
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?

limpid pecan

Are you already working on adding select menus to modals? If so, when will you release a discord.js update?

loud quartz

yes, and as always - no eta

pearl hazel

role.position count upside down ?
is this new update ?

i mean is the last role postion is 1 ? or the first one

little pebble
pearl hazel
polar karma

No, it's always been that way

rose tangle

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

scenic berry

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

loud quartz

that error has nothing to do with webhooks

and yes, you can do that

you need withComponents option though

sharp ginkgoBOT
scenic berry

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]
    });```
sharp ginkgoBOT

guide suggestion for @scenic berry:
guide Popular Topics: Display Components - Container
read more

rose tangle

SectionBuilder doesn't have a setContent method

you most likely meant to add a text display component

sharp ginkgoBOT
rose tangle
scenic berry
halcyon vault

how to set the visibility of the seperator in the container builder?

sharp ginkgoBOT

documentation suggestion for @halcyon vault:
method SeparatorBuilder#setDivider() discord.js@14.22.1
Sets whether this separator should show a divider line.

halcyon vault

Did Model component realeased? in discord js?

loud quartz
chilly spruce
autumn idol

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,).
stable sun
autumn idol
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 
❯ 
stable sun
autumn idol
stable sun

Not sure why it took me that long to see it

autumn idol
flint zenith

where can i get docs/guide for components v2?

sharp ginkgoBOT

guide suggestion for @flint zenith:
guide Popular Topics: Display Components
read more

flint zenith

ok thank you

stable sun

Just gotta change the lib to builders

chilly spruce
fluid harness

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?

stable sun

Snowflakes are just 64 bit (unsigned) ints

fluid harness

So checking is number is valid?

stable sun

Back in the olden days, we had a bot Clyde with an id of 1

fluid harness

no sneaky hexadecimals appearing

stable sun
fluid harness

and I guess check value <64bit

sharp ginkgoBOT
  • 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")
stable sun

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

fluid harness
if (typeof BigInt(value) !== "bigint") {
    throw new Error('Invalid or missing `value`');
}

Should be a valid test?

stable sun

Not really

fluid harness

I don't see why?

If it's a string representation of a 64bit value, if this fails it's not?

stable sun

BigInt accepts values that aren’t normally a snowflake

fluid harness

Ah, hex values, I see

stable sun

"0x01” and "0o01" aren’t snowflakes