#djs-in-dev-version

1 messages · Page 24 of 1

small mica
#

I just set it to edit the message, not reply

dawn phoenix
#

you respond to the interaction twice, don't do that

small mica
#

How did I respond two times? The message edits itself and then the select menu becomes disabled after a certain time that I have set in the collector.

dawn phoenix
#

i don't know why you overcomplicate this so much anyways
if someone chooses a category, just interaction#update, which edits the message the select menu is on
that should be the only response you need here

#

each selection/button press is it's own interaction instance

#

that error means you responded to the same instance twice.

small mica
copper jetty
#

Why you deferUpdate but never edit the defer

#

And you deferUpdate every interaction

small mica
#

I defer the update because all the menus will be updated if I dont. If I type help 2 times, both will get updated

copper jetty
#

So you have to editReply every interaction and it will cause an error if you use a command

small mica
#

also it will show interaction failed even tho it doesnt

copper jetty
#

You deferUpdate every interaction so this error can happen anywhere where you reply to an interaction

small mica
#

how do I fix it? I cant remove the defer update as it will edit all embeds then

dawn phoenix
#

on a more meta level this all looks like a giant bandaid you stick onto things to not have to use slash commands, which would make that entire thing largely obsolete

small mica
#

If I don't defer, and I have two help menus (if 2 people use the help command), both the embeds are getting edited

dawn phoenix
#

pardon?

knotty plover
#

That's a really annoying way to share screenshots

small mica
#

But... is there anything I am doing wrong?

knotty plover
#

Sounds like your collectors and/or custom ids aren't sufficiently unique

#

So they listen to interactions from both

small mica
#

I just noticed even without deferUpdate all embeds are getting edited wtf

vague coyote
#

well yes, you dont update nor reply, so that defer is useless

small mica
#

How to only edit the embed of which the category was chosen from?

vague coyote
#

use a proper filter that only returns true if the message id is equal with the embed one

#

and consider using interaction.update()

knotty plover
#

I just make my customIds unique

#

So I know exactly what I'm listening for

small mica
#

How do I make it so each embed has different customids?

vague coyote
#

again, you dont need that. You have the initial message object, so just compare message ids in the filter

small mica
vague coyote
small mica
#

tysm @vague coyote hat worked :)

#

how can I fix this? It works but still..

nocturne kayak
#

either call deferUpdate() or update() the message instead (it's the same as edit interaction.message)

small mica
#
const schema = require("../../Database/custom-commands");
const { EmbedBuilder, Util } = require("discord.js");

module.exports = {
  name: "cc-list",
  run: async (client, message, args) => {
    const data = await schema.find({ Guild: message.guild.id });
    if (data.length <= 0) {
      const noEmbed = new EmbedBuilder()
        .setTitle("No data")
        .setDescription("There are no custom commands in this server")
        .setColor(Util.resolveColor("DarkPurple"));
      return message.channel.send({ embeds: [noEmbed] });
    } else {
      const embed = new EmbedBuilder()
        .setColor(Util.resolveColor("DarkPurple"))
        .setTitle(`A list of custom commands in ${message.guild.name}`)
        .setDescription(`There a total of ${data.length} custom commands in this server!\n ${data.map((cmd, i) => `\`\`\`fix\n${cmd.Command}\`\`\``).join(", ")}`);
      message.channel.send({ embeds: [embed] });
    }
  },
};

#

why does it show like this?

#

If I remove the codeblocks part it works fine

#

I want it like this

vague coyote
#

use `text` then

#

new codeblock -> new line

#

or put all in one codeblock

small mica
#

how do I put all in one cb?

#

ok wait i'll try

vague coyote
#

wrap it around the whole thing and not in .map()

small mica
#

ah yes that worked thanks

copper latch
#

how can i save my stuff in a object?

scarlet tangle
copper latch
#

leme get the cmd

#

wait

copper latch
# scarlet tangle How is it djs related?

i have ```js
client.on('messageCreate', async message => {
const prefix = 'm-';
let party = []
if(message.content === prefix + 'join'){
if(party.length === 0){
party.push({
name: ${message.author.username},
type: 'Party leader'
})

} else {
  party.push({
    name: `${message.author.username}`,
    type: 'Player'
  })
}

await message.channel.send({ content: ${party[0].name} joined and he is ${party[0].type} })
console.log(party)
}
})``` the user who join is not getting saved in the object

knotty plover
#

Your let party = [] is inside the messageCreate event

#

That means it gets reset every single message

copper latch
#

ahhh

copper latch
#

i think

knotty plover
#

I dont see what this has to do with discord.js v14 though

copper latch
#

leme try

knotty plover
#

This is the v14 channel and this is a basic JS scoping issue

scarlet tangle
copper latch
knotty plover
#

np

copper jetty
copper latch
#

ty @knotty plover and @copper jetty

#

@knotty plover like i said the object is not saving the stuff

knotty plover
#

where are you declaring it?

copper latch
#

nvm ty it is fixed

brazen knoll
#

can bots not set guild vanities?

forest elm
brazen knoll
#

whats the request path

brazen knoll
#

thank you

main basin
#

how i fix it?

#

ohh

#

i fix

copper jetty
#

intents are PascalCased

somber mirage
#

Hi i'm trying to send the user few menus but I have this problem:

with this code:

            const res = [];
            let currentMenu = new SelectMenuBuilder()
            .setCustomId("value")
            .setPlaceholder("Select a value.");

            for(let i = 0; i < arr.size; i++) {
                console.log(i);
                if(i % 25 == 0 && i != 0) {
                    console.log("New Menu");
                    res.push(new ActionRowBuilder().setComponents(
                        currentMenu
                    ));

                    currentMenu = new SelectMenuBuilder()
                    .setCustomId("value")
                    .setPlaceholder("Select a value.");
                }

                const currentOption = arr.at(i);

                console.log(currentOption.name);
                currentMenu.addOptions({
                    label: prefix + currentOption.name,
                    value: currentOption.id
                });
            }

            if(currentMenu.options.length > 0) {
                res.push(new ActionRowBuilder().setComponents(
                    currentMenu
                ));
            }

            interaction.reply({content: "f", components: res});
tame gazelle
#

.setComponents and .addOptions now take an Array

somber mirage
#

I want to kill myself now.

somber mirage
urban belfry
somber mirage
#
            const res = [];
            let currentMenu = new SelectMenuBuilder()
            .setCustomId("value")
            .setPlaceholder("Select a value.");

            for(let i = 0; i < arr.size; i++) {
                if(i % 25 == 0 && i != 0) {
                    res.push(new ActionRowBuilder().setComponents([
                        currentMenu
                    ]));

                    currentMenu = new SelectMenuBuilder()
                    .setCustomId("value")
                    .setPlaceholder("Select a value.");
                }

                const currentOption = arr.at(i);

                currentMenu.addOptions([
                    {
                        label: prefix + currentOption.name,
                        value: currentOption.id
                    }
                ]);
            }

            if(currentMenu.options.length > 0) {
                res.push(new ActionRowBuilder().setComponents([
                    currentMenu
                ]));
            }

            interaction.reply({content: "f", components: res})
tame gazelle
#

.addOptions([{ label, value }])

somber mirage
#

I updated the code and It's still not working

urban belfry
#

check the stack then

heavy pasture
#

i am using modals
error: DiscordAPIError: Invalid Form Body
data.components[0]: The specified component type is invalid in this context

copper jetty
heavy pasture
# copper jetty You used modal in wrong context

its wrong?

new Modal()
  .setCustomId('REQUEST_VIP_TAG')
  .setTitle('❗» REQUEST VIP TAG')
  .setComponents(
    new TextInputComponent()
      .setCustomId('EVIDENCE')
      .setLabel('EVIDENCE')
      .setStyle('SHORT')
      .setMinLength(10)
      .setMaxLength(100)
      .setPlaceholder('LINK')
      .setRequired(true)
  )```
urban belfry
#

setComponents would take in an array

copper jetty
#

Yes Modal takes action rows

urban belfry
#

and it would be ModalBuilder?

copper jetty
#

and TextInputBuilder unless you use old version

heavy pasture
#

thx

#

with actionRow it worked

dusky agate
#

is there any way to know the people who have entered through an invitation or which invitation a person entered with?

copper jetty
dusky agate
#

ok

short tapir
#

I assume MessageAttachment has changed to Attachment

urban belfry
#

indeed

copper jetty
#

Their removing Message from every class name

short tapir
#

Ah

#

At one point I wondered if it would be AttachmentBuilder

urban belfry
#

still a pr

short tapir
#

No, maybe not yet 😂

urban belfry
#

why?

#

not yet potentially, it's still a pr

copper jetty
#

Attachment don't have any builder methods like setName so its kinda useless

copper jetty
#

nvm it has builder methods ive never seen anyone using it

short tapir
#

Did setting a presence/status change at all?

urban belfry
short tapir
#

Ah, cheers

#

Im glad enums exist now lmao

copper jetty
#

Same

heavy pasture
#

DiscordAPIError: Invalid Form Body
data.components[0].components[1]: The specified component exceeds the maximum width
data.components[0].components[2]: The specified component exceeds the maximum width
data.components[0].components[3]: The specified component exceeds the maximum width

#
new Modal()
  .setCustomId('REPORT_PLAYER_MODAL')
  .setTitle('❗» Denúnciar jogador')
  .setComponents(
    new MessageActionRow().addComponents([
      new TextInputComponent()
        .setCustomId('PLAYER_NAME')
        .setLabel('Nome do jogador')
        .setStyle('SHORT')
        .setMinLength(1)
        .setMaxLength(16)
        .setPlaceholder('Insira o nome do jogador que deseja denúnciar.')
        .setRequired(true),        
      new TextInputComponent()
        .setCustomId('REASON')
        .setLabel('Motivo')
        .setStyle('PARAGRAPH')
        .setMinLength(50)
        .setMaxLength(500)
        .setPlaceholder('Insira o motivo pelo qual está denúnciando este jogador.')
        .setRequired(true),
      new TextInputComponent()
        .setCustomId('SERVER')
        .setLabel('Servidor')
        .setStyle('SHORT')
        .setMinLength(1)
        .setMaxLength(16)
        .setPlaceholder('Insira o nome do servidor em que ocorreu esta denúncia.')
        .setRequired(true),
      new TextInputComponent()
        .setCustomId('EVIDENCE')
        .setLabel('Prova')
        .setStyle('SHORT')
        .setMinLength(10)
        .setMaxLength(100)
        .setPlaceholder('Insira um link de uma imagem que comprove esta denúncia.')
        .setRequired(true)```
vague coyote
#

you can only have one textinput per row, 5 rows per modal

urban belfry
#

how come... what version is this? aren't these suffixed with Builder now?

vague coyote
#

yes, they probably just didnt update

heavy pasture
#

13.06.0

urban belfry
#

whaaaa

vague coyote
#

I'm not familiar with a version like that?

urban belfry
#

are you using djs v13.6.0 with builders 0.13?

#

i wouldn't recommend that, see djs 13.6 uses builders 0.11 internally, so it's probably not the best idea to mash different versions and stick with the version djs uses internally

heavy pasture
#

i am installed by repo

#

npm i discordjs/discord.js#v13

urban belfry
#

ah okay

#

i really think we should have a channel for v13-dev to avoid confusions like these
especially since it'll get more updates

heavy pasture
heavy pasture
urban belfry
#

on every actionrow, you can have up to 1 text input

#

and as usual, up to 5 rows on a modal

copper jetty
heavy pasture
#

yes i fixed it

#

thx

kind pulsar
#

Is there a way to check if a message has been deleted? (I ask it because the .deleted method no longer exists in the version 14)

urban belfry
#

try and fetch it, if it fails, it doesn't exist

kind pulsar
urban belfry
#

message.fetch()

#

but like what, you're trying to delete a message? just call delete and handle the error

kind pulsar
#

ok, thanks :D

restive bear
#

How would I go through a list of users with the same name, then ban them if they have the same username?

copper jetty
#

Fetch all members and loop through the collection

velvet jasper
woeful pollen
knotty plover
#

Theres a rate limit on everything

copper jetty
#

why

knotty plover
#

So people cant abuse the APIs

velvet jasper
cinder bane
#

can a GuildNews channel be a GuildText channel as well?

knotty plover
#

No

cinder bane
#

okay

fluid summit
#

Is the embed setFooter still broken?

knotty plover
#

Never was?

#

Or if it was it was too long ago for me to remember so no, is fixed

fluid summit
#

Hmm just adding a footer causes my embed to crash. Only thing I changed

scarlet tangle
knotty plover
#

whats the crash

fluid summit
#

I actually opened a issue ticket in the discordjs github but wasn't sure if it's implemented in the recent discord.js@dev release

#
  const secretEmbed = new EmbedBuilder()
    .setColor('#e7cb04')
    .setTitle('test1')
    .setDescription('test2')
    .setImage(`attachment://${test3.name}`)
    .setFooter('testFail');
knotty plover
#

setFooter takes an object

#

setFooter({ text: "testFail" })

fluid summit
#

omg...

#

Ah right. I forgot my old issue ticket was about footer not taking attachments correctly

knotty plover
#

Looks like thats using the old error message though, I did do a PR to improve the output so its more meaningful

fluid summit
#

Thanks. Dumb error by me

wintry bear
#

in modals anyway to change the character limit per text box?

tame gazelle
#

.setMaxLength / .setMinLength

wintry bear
#

ty

scarlet tangle
#
TypeError: Cannot read properties of null (reading 'id')
    at InteractionCollector._handleMessageDeletion (C:\RolexBot\node_modules\discord.js\src\structures\InteractionCollector.js:214:29)
    at RolexBot.emit (node:events:527:28)
    at MessageDeleteAction.handle (C:\RolexBot\node_modules\discord.js\src\client\actions\MessageDelete.js:22:16)
    at module.exports [as MESSAGE_DELETE] (C:\RolexBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_DELETE.js:4:32)
    at WebSocketManager.handlePacket (C:\RolexBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (C:\RolexBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (C:\RolexBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (C:\RolexBot\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:527:28)
    at Receiver.receiverOnMessage (C:\RolexBot\node_modules\ws\lib\websocket.js:1137:20)
    at Receiver.emit (node:events:527:28)
    at Receiver.dataMessage (C:\RolexBot\node_modules\ws\lib\receiver.js:528:14)
    at Receiver.getData (C:\RolexBot\node_modules\ws\lib\receiver.js:446:17)
    at Receiver.startLoop (C:\RolexBot\node_modules\ws\lib\receiver.js:148:22)
    at Receiver._write (C:\RolexBot\node_modules\ws\lib\receiver.js:83:10)
    at writeOrBuffer (node:internal/streams/writable:390:12) uncaughtException
``` is this a bug or smth it works properly sometimes after it stops and gives this error which results in a interaction failed message
outer bane
#

it's a bug but it has already been fixed, update

scarlet tangle
lucid spade
#

does dev version have attachments?

urban belfry
lucid spade
#

yes in slash commands

urban belfry
#

yeah we have that and it'll drop in version 13.7 too

compact falcon
#

i have a problem using flags in v14 and some ppl told me to change intents to IntentsBitField because it got renamed
but if i change intents to ... then i'll get more problems

jaunty vault
compact falcon
urban belfry
#

read the guide for updating

jaunty vault
compact falcon
#

oh rly?

jaunty vault
# compact falcon oh rly?

only the client option btw, not Intents.FLAGS you still have to change Intents.FLAGS to IntentsBitField.Flags

urban belfry
#

they didn't tell you to change the property, they told you to change the flag accessing

#

again, there's a guide for updating and it's pinned

compact falcon
forest elm
#

read the guide for updating

again, there's a guide for updating and it's pinned

compact falcon
#

i try to fix that code for hours and i looked for so much information ;-; i just want help

compact falcon
#

i am and it didnt helped me

proper jetty
#

can anyone help?
code:

  if(cmd == `!h`){
       
      
                    
    let channel = message.member.voice.channel
    if(channel) {
    channel = "**מחכה בחדר: ** <#" + message.member.voice.channel + ">"
    }else{
    channel = ':x: **לא מחובר לשום חדר** :x: '
    }
                var reason = args.join(" ");
    if(!reason) reason = "לא צויינה סיבה";
            const embed = new EmbedBuilder()
            .addField( "**__ממבר__**:\n",` ${message.author} | **זקוק לעזרתך!**`)
            .addField("**__וויס__**:", `${channel}`)
            .addField("**__סיבה__**:\n", reason)
            .setColor(`#11CCEE`)
            .setThumbnail(message.author.displayAvatarURL({dynamic: true}))
            .setFooter(message.author.username + "#" + message.author.discriminator, message.author.avatarURL)
    .setTimestamp(new Date())
            message.channel.send({ content: '<@&968138149429649469>',embeds: [embed] });


        setTimeout(function(){

        }, 20000);
    }```
jaunty vault
proper jetty
# jaunty vault use addField**s**

Now saying Im not connected to voice, even when I am.

  if(cmd == `!h`){
       
      
                    
    let channel = message.member.voice.channel
    if(channel) {
    channel = "**מחכה בחדר: ** <#" + message.member.voice.channel + ">"
    }else{
    channel = ':x: **לא מחובר לשום חדר** :x: '
    }
                var reason = args.join(" ");
    if(!reason) reason = "לא צויינה סיבה";
            const embed = new EmbedBuilder()
            .addFields(
            { name: ` **__ממבר__**:\n`, value: ` ${message.author} | **זקוק לעזרתך!**`},
            {name: "**__וויס__**:", value: channel},
            {name: "**__סיבה__**:\n",value: reason}
            )
            .setColor(`#11CCEE`)
            .setThumbnail(message.author.displayAvatarURL({dynamic: true}))

    .setTimestamp(new Date())
            message.channel.send({ content: '<@&968138149429649469>',embeds: [embed] });


        setTimeout(function(){

        }, 20000);
    }```
jaunty vault
proper jetty
proper jetty
#

Why not?

urban belfry
#

bad idea, just use the ones you need, easy way to know, read the guide

jaunty vault
#

just use the ones you need

proper jetty
#

Easier to do isn't?

vague coyote
#

Cuz you get payloads you dont need.
Its not easier.

urban belfry
#

it takes like 3 minutes to learn, saves up a lot of resource use

regal mason
#

How I can create an message component collector on a interaction reply ?

#

(How I can listen to button interactions on a interaction reply)

urban belfry
regal mason
#

okay, thanks

urban belfry
#

and the it's simple, create a collector on the the message

velvet jasper
urban belfry
#

whaa

regal mason
#

So I just have to resolve the promise without adding fetchReply

velvet jasper
#

yeah await it

urban belfry
#

since when? how
and why'd the source button on the docs break again

dull mulchBOT
regal mason
#

But I get this error

#

The same as I tried to use interaction.fetchReply()

velvet jasper
#

Are you on the latest dev version?

regal mason
#

no

velvet jasper
#

You’ll need to be on the latest dev version

#

This channel is for people on v14 dev

regal mason
#

I am on v14

#

I am not at the latest commit

urban belfry
#

then just update..

regal mason
#

I was*

#

Updated and the error still, but does this work with editReply ?

velvet jasper
#

Oh edit reply always gives the message back anyways you just need to cast it as a message

urban belfry
scarlet tangle
#

(intermediate value).setColor is not a function what does this supposed to mean?

woeful pollen
#

show the code

scarlet tangle
# woeful pollen show the code
let emb = new Embed()
            .setColor(0x2F3136)
            .setFooter({
                text: `Page ${page}/${Math.ceil(ctx.client.guilds.cache.size / 10)}`
            })
            .setDescription(description);
woeful pollen
#

its EmbedBuilder

scarlet tangle
#

is the import from builders or djs?

urban belfry
#

both work actually
djs just adds more functionality on the builders one

scarlet tangle
#

ok

#

@urban belfry@woeful pollen both of you thanks for the help

uncut kelp
somber mirage
#

How can I put hex code in embed color?

velvet jasper
#

Or just use a hex string

versed trench
#

When is v14 coming out ?

vague coyote
#

when its ready

#

we dont do eta's

scarlet tangle
#

Hi, can sb help me?

TypeError: components.map is not a function

const adContentModal = new TextInputBuilder();
adContentModal.setCustomId('adContentModal').setLabel('Treść reklamy').setStyle(TextInputStyle.Paragraph);

const firstActionRow = new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents([adContentModal]);
setAdModal.addComponents(firstActionRow);

await interaction.showModal(setAdModal);
#

This line returns error

setAdModal.addComponents(firstActionRow);
copper jetty
#

it takes an array

scarlet tangle
#

where

vague coyote
#

addComponents

#

takes an array of actionrows

scarlet tangle
#

oh, okay..

#

Thank you

vague coyote
#

You tell us, how did you register them

sharp pine
#

oopsie dayse

#

i accidently overrided my old files 😬

lavish snow
#

Hey, cannot figure out why this is happening

knotty plover
#

Not our package, not supported

copper jetty
knotty plover
#

Theyre not even using the dev version

copper jetty
#

how

knotty plover
#

Because I know they arent

#

It would be called ModalBuilder if they were

copper jetty
#

then install dev version @lavish snow

knotty plover
#

Also because I'd already spoken to them in another channel

copper jetty
rocky elk
#

algum br kkkkkkkkkk

#

?

knotty plover
#

no

flint lark
#

Good morning. meow_wave Any ETA for when Discord.JS V14 would release, as in the date?

spare fiber
#

no eta

carmine bridge
#

what is this

idle galleon
#

Smth expected an array

#

Show the stack trace

knotty plover
#

Looks like it expected a number and didn't get one

idle galleon
#

I believe it’s from a item.length constraint, where the item doesn't have a length property

knotty plover
#

ahh

carmine bridge
#

client.ws.ping

#

cant this

knotty plover
#

what

carmine bridge
#

npm 8.7

#

cant use client.ws.ping

covert cipher
#

🤔 where are the other get functions

#

oh nvm

#

it was CommandInteraction not ChatInputCommandInteraction

idle galleon
carmine bridge
idle galleon
carmine bridge
#

have err ?

idle galleon
#

No

#

Unless ur using the latest dev version builders Thinkeng

idle galleon
carmine bridge
idle galleon
#

Provide arrays for addFields

#

.addFields([ { name, value } ])

carmine bridge
#

oh

#

thx

carmine bridge
idle galleon
scarlet tangle
#

how can i install dev and will it break my v13?

fluid bronze
#

Check the pins

#

And yes, it will break unless you update your code

small mica
#

do you have the message content intents in your code?

#

is there any error?

forest elm
#

that slice (probably) returned an empty array

#

check for the length .options.length, an empty array is truthy

regal mason
urban belfry
regal mason
urban belfry
#

that really does not help
i asked where it was, and for additional context

regal mason
#

I'm not modifying .token, i'm not calling destroy

urban belfry
#

ah so maybe that's just undefined

#

but this shouldn't be connected to the code you've shown though

regal mason
#

Yes that's why I find that weird

outer bane
#

any other errors before this one?

#

like invalid token for a webhook?

regal mason
#

A lot of errors like this

outer bane
#

and at the start?

regal mason
outer bane
#

the stack trace shows minified code which means you are not on the latest dev commit, you should update

regal mason
#

deprecation 👀

outer bane
#

There's a high possibility that whatever lead to you getting those errors is already fixed, there was a fix for invalid webhook tokens resetting the bot token

regal mason
#

ah

stiff mantle
#

why does it appear like this? was fine before

TypeError: Cannot read properties of undefined (reading 'permissions')
proper jetty
#

How do you make the bot's status member count of a specific guild in v14?
current code:

client.on('ready', () => {
    console.log("online")
     setInterval(() => {
         const totalMembers = client.guilds.cache.map(guild => guild.memberCount).reduce((a,b) => a + b, 0);
          client.user.setPresence({ game: { name: totalMembers, type: 'WATCHING' }, status: 'online'  })
                .then(console.log)
                .catch(console.error);
       
     }, 1000 * 60 * 5);
})```
nocturne kayak
#

pretty sure game.name expects a string
stringify the number from totalMembers

proper jetty
nocturne kayak
#

same as v13 pretty much

urban belfry
#

except the ActivityType enum

proper jetty
#

Can't be simple as this?

client.on('ready', () => {
    console.log("online")
    client.user.setPresence({ activity: { name: `${client.users.cache.size} members` , type: 'WATCHING'}, status: 'online' })
});```
jaunty vault
urban belfry
#

it's fine

#

client.users.cache though, no that's not reliable really
your previous implementation was better

proper jetty
jaunty vault
proper jetty
#

right.

proper jetty
forest elm
#

now fix the syntax

jaunty vault
plain roverBOT
#

Getting your bot's member count
client.users.cache.size is unreliable because it will only return cached users
• The preferred method is using collection.reduce() on client.guilds.cache

client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)
proper jetty
proper jetty
#

ActivityType is not defined.

nocturne kayak
#

import it from djs then

jaunty vault
proper jetty
#

okay.

#

Thanks, finally works.

jaunty vault
#

👍

unborn aurora
#

hey, how do I get v14 ?

jaunty vault
unborn aurora
#

thanks, are there docs too?

unborn aurora
#

thanks sir

brazen knoll
#
  const m = await cmd.reply({
    components: buttons,
    content: question,
    ephemeral: true,
  });
  const buttonsCollector = m.createMessageComponentCollector({ time: 60000 });

  buttonsCollector.on('collect', (interaction) => {
    console.log(interaction);
  });```

why is interaction not collected, is there a different way for collecting ephermeral interactions?
nocturne kayak
#

specify fetchReply: true on your reply option

brazen knoll
#

will try

jaunty vault
urban belfry
#

you shouldn't need to fetchReply anymore just to create a collector

brazen knoll
#

that worked, thank you

brazen knoll
urban belfry
#

@brazen knoll could you try and update to the latest commit first?

brazen knoll
#

i did just yesterday

urban belfry
#

if this doesn't work, that's an issue right there

brazen knoll
#

lemme do taht rq

#

nope only works with fetchReply

urban belfry
#

could you log m?

brazen knoll
#

(i cut away client)

#

ping if u need more

urban belfry
#

i can't test it now, but well it is an InteractionResponse, maybe it being ephemeral is the issue

brazen knoll
#

probably, well the fetchReply fixed it so im happy

brazen knoll
#
  new Builders.ModalBuilder()
    .setCustomId(`suggestionReason_${i.createdTimestamp}`)
    .setTitle('Add Details')
    .addComponents([
      new Builders.ActionRowBuilder().setComponents(
        new Builders.TextInputBuilder()
          .setCustomId('longReason')
          .setLabel('Put long Text here')
          .setPlaceholder('optional')
          .setStyle(Discord.TextInputStyle.Paragraph)
          .setRequired(false)
          .setMinLength(0)
          .setMaxLength(4000),
      ),
    ]);```
data.components[0].components[BASE_TYPE_REQUIRED]: This field is required

now im trying to do modal stuff but i cant figure out how to make it work
#

issue was .addComponents([]), shouldnt be given an array

vague coyote
brazen knoll
#

woh

#

but its not working with array

vague coyote
#

setComponents takes an array as well

brazen knoll
#

bots cant delete ephemeral messages can they?

dawn phoenix
#

no

brazen knoll
undone yew
#

how to fix?

brazen knoll
#

remove ...

undone yew
#

line

brazen knoll
#

on components ...

spare fiber
#

it must be array

undone yew
#

ok

brazen knoll
#

they made it accept arrays now

copper jetty
#

update node

#

addComponents takes an array

#

they made it work with arrays for some reason

lavish snow
#

Anyway to fix this?

copper jetty
lavish snow
vague coyote
#

isText() is a typeguard, use it like one

lavish snow
#

Hey, my code doesnt log it

copper jetty
#

modalSubmit isn't discord.js event, use interactionCreate

obtuse plaza
#

Are we able to create confirmation modals like this?

copper jetty
#

no

worn gyro
#

How I can install discord.js v14 ?

vague coyote
somber mirage
worn gyro
#

Is there a guide for modals?

copper jetty
#

yes

somber mirage
#

Yes, Check the pinned messages

proud stump
obtuse plaza
half barn
#

is slashCommandBuilder not integrated into djs 14?

copper jetty
#

no

outer bane
#

it is re-exported though

copper jetty
#

ok i dikdnt know sorry

outer bane
#

no worries, everything from builders is being re-exported nowadays

marble blade
#

Why are these methods removed?

#

How do I get the name SubCommand?

copper jetty
forest elm
#

eg

plain roverBOT
half barn
#

Any clue why this is happening? Pretty sure I'm setting the name?

marble blade
#

Why did they leave only getUser and getMember? How do you get a Subcommand?

forest elm
copper jetty
half barn
copper jetty
#

you would have to check if its ChatInputCommand

forest elm
#

it has to be an array of objects, { name: 'Name', value: 'name' }

marble blade
forest elm
#

who else knows

#

what

forest elm
marble blade
#

what is this

forest elm
#

read my message

#

its a function that narrows the type of the interaction

copper jetty
#

if (!<Interaction>.isChatInputCommand()) return

#

do this

forest elm
#

marble blade
#

I need subcommand

copper jetty
#

you can only get subcommand from chatinputcommand

#

you cant from contextmenucommands

#

because you cant add any options to contextmenus

marble blade
#

hm

#

okay...

#

thanks)

copper jetty
undone yew
#

how to fix?

copper jetty
#

what is action

undone yew
#

const action = new Menu()

copper jetty
#

Menu isn't discord.js constructor unless you renamed it

undone yew
half barn
undone yew
#

this is official discord.js constructor

idle galleon
#

You need to put the menu in a Row

#

And provide the row when calling uodate

undone yew
brazen knoll
#

can i find out if a user has their DMs closed before doing a post request

copper jetty
#

NO

brazen knoll
#

OH OKAY :(

vague coyote
#

No, only way to check is to catch the error from .send

brazen knoll
#

it'd be nice of discord to add something to the user object where you can figure that out

#

would also lessen ratelimit possibilities

marble blade
#

How can I remove the APIInteractionDataResolvedChannel type?

hoary fox
#

typeguard

marble blade
#

I don't understand why it's needed at all.

undone yew
#

how to fix?

hoary fox
#

or 0 number - guildTextChannel

rain bramble
undone yew
hoary fox
rain bramble
half barn
#

Kind of confused as to why I'm getting this error

hoary fox
idle galleon
#

It’s missing a string name, and a string value property

plain roverBOT
#

property Guild#commands
A manager of the application commands belonging to this guild

half barn
forest elm
#

are you on the latest versions? because it used to take an array, and then rest parameters, and now an array again

idle galleon
#

Try spreading the Array

#

The current main branch takes rest parameters for addChoices

forest elm
#

oh yeah what peepoThink

copper jetty
velvet jasper
marble blade
#

How to use descriptionLocalizations correctly? I tried to set the Ukrainian text, but the description is still in English. How does it work?

half barn
#

how do you set rest parameters for addChoices then? never heard of that

tame gazelle
#

.addChoices({ name, value }, { name, value })

copper jetty
lost berry
#

wha

half barn
vague coyote
half barn
#

apparently it only takes rest parameters but I just get an error if I put in 2 objects like that with no array

forest elm
#

are you using the latest version of builders? aka 0.14.0-dev.1650931748-df64d3e

#

because it takes rest parameters

half barn
#

I'm on 14.0.0-dev.1650931749-df64d3e

ngl I have no clue what rest parameters are but I put it in like that with no array and it just gives me an error. MDN docs didn't make much sense to me

vague coyote
#

again, it should take an array

vague coyote
marble blade
#

okay)

#

thanks)

half barn
idle galleon
#

It should take an array, but it doesn't

#

It’ll likely be changed in the future

void abyss
#
 "rawError": {
        "message": "405: Method Not Allowed",
        "code": 0
      },
      "code": 0,
      "status": 405,
      "method": "put",
      "url": "https://discord.com/api/v10/applications/962304955971174440/guilds/626102413857652746/commands/permissions",
      "requestBody": {
        "json": [
          {
            "id": "965298369247453294",
            "permissions": [
              {
                "id": "658779239117750285",
                "type": 1,
                "permission": true
              }
            ]
          },
          {                                                                                                                                                                                
            "id": "964957793205514300",
            "permissions": [
              {
                "id": "658779239117750285",
                "type": 1,
                "permission": true
              }
            ]
          }
        ]
      }
    }
const fullPermissions = [
        // Ping - pong?
        {
            id: '965298369247453294',
            permissions: [{
                id: process.env.ADMIN_ROLE_ID!,
                type: 1,
                permission: true,
            }],
        },
        // Mod Suggestions
        {
            id: '964957793205514300',
            permissions: [{
                id: process.env.MODERATOR_ROLE_ID!,
                type: 1,
                permission: true,
            }],
        }
    ];


    if (!client.application?.owner) await client.application?.fetch();
    await client.guilds.cache.get(guildId)?.commands.permissions.set({fullPermissions});
idle galleon
dull mango
#
DiscordAPIError: Bots cannot use this endpoint

when setting command perms

idle galleon
#

Same issue

void abyss
copper jetty
#

you can't set permissions...

idle galleon
#

Discord trying to roll out slash cmd perms v2

knotty plover
#

The whole point of permissions V2 is that you don't need to set permissions

dull mango
#

how to fix it?>

knotty plover
#

The admins of the server do

copper jetty
#

maybe add this to faq because many people will try this

knotty plover
#

Using a UI

dull mango
#

UI?

idle galleon
#

User Interface

vague coyote
dull mango
idle galleon
#

Only a 30 min warning? blobsweats

idle galleon
#

Did Discord give an earlier warning?

vague coyote
#

not that I know

#

but does that matter smirkel

copper jetty
#

no

idle galleon
#

Right, totally won’t affect bots that currently use it

dull mango
copper jetty
#

yes

dull mango
#

ok

void abyss
#

Okay but can i set default perm for command?

dull mango
idle galleon
#

Nope

#

It’s a present for everyone

copper jetty
# dull mango ok

unless your bot is in guilds that dont have permissions v2 yet

knotty plover
#

Which they're rolling out to all of them now

void abyss
dull mango
#

how much time till the set method will be removed from djs docs?

#

curious

copper jetty
#

it will be removed in v14 probably

void abyss
#

There will be way to set perms from API soon?

restive bear
#

Question, is addComponent array or not? Some say its a rest param?

idle galleon
#

Prob when Discord removes it from their docs

dull mango
vague coyote
#

addComponents should definitely already take array

idle galleon
dull mango
#

or add a deprication tag

idle galleon
#

Bots can’t just not use it

copper jetty
restive bear
#

Alr 👌

dull mango
vague coyote
#

thats automatic

idle galleon
#

Discord has to process all of the guilds

dull mango
#

where to look on the guild to set the perms?

idle galleon
#

Discord heavily relies on the eventual consistency model

knotty plover
#

See blog post

#

It has instructions

copper jetty
#

or something like that

dull mango
half barn
#

ur looking at it

copper jetty
#

In Bots and Apps section

vague coyote
#

read, do

dull mango
vague coyote
#

then its not on that guild yet

dull mango
#

my client is getting the error and also doesnt see the commands tab on his server

vague coyote
#

again, they are rolling out perms v2, you will have to wait

dull mango
#

do i shut down the bot till it appears?

vague coyote
#

you do what you wanna do

restive bear
#

Does anyone see anything that is been changed? Cause I get a component.toJson error whenever I try to run this cmd

urban belfry
#

and make sure all the packages are up to date

restive bear
#

I mean i'm using the absolutely newest v14 version, could it be something with the package itself?

copper jetty
restive bear
#

I don't, more or less getting the same error for every button I click

urban belfry
#

either way try updating builders to dev and djs to dev

marble blade
#

How can I send components?

copper jetty
#

addComponents takes an array

marble blade
hoary fox
marble blade
restive bear
# restive bear

Alr well updating builder & rest package doesn't work, I assume its just a bug in the latest dev version

forest elm
outer bane
restive bear
#

Well it was just a button I clicked randomly, none of my buttons work but sure i'll show it

outer bane
#

cannot reproduce the error with latest dev, is your builders package up to date? if you have it installed manually remove it, d.js exports re-everything from it

copper jetty
restive bear
#

Lemme see

#

Highlighted one is

knotty plover
#

That intent still exists

#

There's also MessageContent to access content

copper jetty
#

Guilds

#

not GUILDS

#

Its the same they just made it PascalCase

#

GuildMessages

copper jetty
#

don't do this it will slow down your bot

pallid ice
#

you can't use SCREAMING_SNAKE_CASE for things like styles anymore in v14 dev

#

see the changes/guide in pins

knotty plover
#

Create a new InteractionCollector

#

No

plain roverBOT
#

class InteractionCollector (extends Collector)
Collects interactions. Will automatically stop if the message (Client#event:messageDelete messageDelete or Client#event:messageDeleteBulk messageDeleteBulk), channel (Client#event:channelDelete channelDelete), or guild (Client#event:guildDelete guildDelete) is deleted. (more...)

knotty plover
#

Modals arent message components

rapid lintel
#

On the subject of modals, it is not impossible to modify the OG interaction once the modal has been shown, correct?

plain roverBOT
rapid lintel
#

Whenever I try to make edits to the original ephemeral interaction after a modal is shown, it tells me the interaction has already been acknowledged.

#

Hm

#

Let me give it the ole try

knotty plover
#

Or just interaction.editReply on the original

rapid lintel
#

^ Now that I know fails

knotty plover
#

Why?

#

Already acknowledged means you're using the default reply again

#

editReply would work for up to 15 minutes

rapid lintel
#

I really couldn't tell you why, but if I showModal() and then follow it up with editReply, then it fails. You're welcome to give it a quick shot on your end if you'd like

#

Been struggling with this all day

knotty plover
#

So uhh... what triggers the modal?

rapid lintel
#

A button in an ephemeral message

knotty plover
#

So if a Slash Command triggers the modal, theres nothing to edit. Just reply to the modal

#

A button in a message, you should still be able to use ButtonInteraction.editReply I would have thought

#

But still, might as well use ModalSubmitInteraction#update to achieve the same thing

rapid lintel
#

Since I need to do that on the modalSubmit event anyways

plain roverBOT
#

Suggestion for @scarlet tangle:
guide Popular Topics: Interaction collectors
read more

knotty plover
#

No?

#

Maybe Discord is just being fucky with ephems then

rapid lintel
#

No it worked perfectly.

knotty plover
#

oh good lol

rapid lintel
#

I didn't think to do an update on the ModalSubmit interaction because I figured you can't update a Modal

#

I mean the verbiage Discord's API uses is weird. You're not updating the Modal, and a ModalSubmit stems from a modal interaction. Maybe I am just an idiot, but the wording is a bit strange.

#

A .reply() on a Modal makes sense to me, though.

knotty plover
#

all good yeah

#

Thats why we try to make it a bit clearer

rapid lintel
#

Thank you

quick musk
#

is there a bug on Guildmeber.displayAvatarURL in current dev version?

#

my code is iconLink: guild.members.cache.get(userid).displayAvatarURL({ format: 'png', dynamic: true, size: 2048 }), but it only return .webp url

white nebula
#

format was replaced with extension, and the dynamic option was removed

quick musk
#

oh thx

proven wolf
#

Hello,
I followed the instructions I found on https://discord.com/blog/slash-commands-permissions-discord-apps-bots but despite that I can't modify the permissions of my commands: when I click on "manage" on my bot line in my server's integrations list I don't have the part that allows me to allow or deny permissions for commands.
If it helps it's a certified bot on a partner server

white nebula
proven wolf
scarlet tangle
#

will djs14 use the permissions v2 system? and how will that work with updating the permissions since now bearer token from oauth2 is required?

spare fiber
knotty plover
#

Its unclear if we will or wont support the oauth endpoints but its would be up to you to get oauth bearer tokens to use with them if thats the case

scarlet tangle
#

but for developer commands, you want to set permissions programatically and restrict it only to few selected users

knotty plover
#

What do you mean by "developer commands"

scarlet tangle
knotty plover
#

eval is a terrible command to have

scarlet tangle
#

Yep

knotty plover
#

But if you do have one

#

It probably shouldnt be global at all

#

Restrict default_member_permisisons

#

And then go into your server and add an override for yourself

pallid ice
scarlet tangle
knotty plover
#

Well those commands will be available to every admin/server owner

#

For guilds they're deployed to

exotic adder
#

will there be new commits?

#

on Dev branch

knotty plover
#

At some point in the future yes, a new commit will be on the dev branch

copper jetty
#

There are new commits every day

small mica
#

So as the new addFields() takes arrays, can I have multiple addFields() or just multiple objects in a single array?

knotty plover
#

both

small mica
#

okay

marble blade
#

How can I extend the class CommandInteraction<"cached">?

forest elm
#

whats the point of doing that, discord.js will not use your extended class

warm basin
#

Is localisation already in v14 ? 0.o

forest elm
#

yes

warm basin
#

nice

tame gazelle
#

how does SlashCommandSubcommandBuilder#setDescriptionLocalizations() work?

plain roverBOT
tame gazelle
#

I didn't for ask that

knotty plover
#

What do you mean by "how does it work" then?

tame gazelle
#

when I change my discord language to french it still show me the text in english

knotty plover
#

Client-side, theyre still locked behind the experiment

tame gazelle
knotty plover
#

Whatever the docs say, I dont use builders

#

But thats probably why its not working

#

The experiment

slow storm
tame gazelle
#

it's only for discord website no?

#

not the application

tame gazelle
#

web-slash-command-loc... ?

#

it means what I said?

forest elm
#

try it and see

tame gazelle
#

I tried and what I did still doesn't work ._.

warm basin
#

Why do i get an Message out of Fetch ? after i updated ? Shouldn't i get an Collection of Messages ? Am i missing something ?

forest elm
tame gazelle
#

rip

knotty plover
#

Which is why it says +1 overload

haughty lava
#

what is wrong with this now?

copper jetty
#

message is null

haughty lava
#

it's not

warm basin
copper jetty
#

Because it says it is

small mica
warm basin
#

Okay, i just restarted VS Code and that did the trick

exotic wind
#
const { GatewayIntentBits } = require('discord.js');
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
#

bot not responding to commands

nocturne kayak
#

are you still using text command? you gotta need MessageContent intent as well

exotic wind
#

I write a bot for both text commands and slashes

#
const { GatewayIntentBits } = require('discord.js');
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
```?
nocturne kayak
#

i said 'as well'

#

yep

exotic wind
#

ths

#
TypeError: Found non-callable @@iterator
copper jetty
#

you passed rest parameters where you should pass an array

exotic wind
#
await command.execute([client, message, args]);
```?
copper jetty
#

this code has nothing to do with discord.js

elder sluice
#

Hello Admin & Mods!

Today, we have a new update for slash commands in your servers: Permissions! If you don’t know, slash commands are a new, easier way to use bots on Discord. You might already have some to use—type / to find out!

With this new system, you can:
dotControl who can use slash commands in your servers
dotControl in which channels commands can be used
dotSync or unsync commands like channels and categories, making mass management and special cases easy to handle

You can find these permissions in Server Settings → Integrations → Pick an app! If the app supports slash commands, you’ll see the UI.

warning If a bot you use has integrated slash commands, the old way of denying the bot Read Messages will not work to moderate commands usage. You’ll need to use this new system to control access.

Not sure if your bots support slash commands? Check out in Server Settings → Integrations, or just type /!

Check out our blog post to learn more and see a detailed walkthrough: https://discord.com/blog/slash-commands-permissions-discord-apps-bots

#

Does djs support it?

copper jetty
elder sluice
copper jetty
#

in dev v14

velvet jasper
#

We don’t support it yet

tame gazelle
#

^

copper jetty
#

how

#

you can set default permissions

tame gazelle
velvet jasper
#

The pr for perms v2 isn’t merged

cinder bane
#
rawError: { message: 'Bots cannot use this endpoint', code: 20001 },
copper jetty
#

its disabled

cinder bane
#

do you know any alternative

copper jetty
#

yes you go to server settings and integrations and choose your bot and edit permissions

cinder bane
#

cant the bot set the permissions anymore?

#

in v2

copper jetty
#

no

tame gazelle
#

only server admins

#

or members who have the ManageGuild permission dunno

cinder bane
#

the bot has admin perms

tame gazelle
#

bots can't set permissions

cinder bane
#

ohkay

#

I wonder why would they remove the ability of the bots to add or remove permissions

keen bobcat
#

That's not a discussion for here

cobalt swallow
#

Ok so bots can't set slash commands permissions now, but what happens if we want to clear them? Like for example I have some commands that I allow me to have explicit access to them and I can't seem to clear that extra permissions. The integrations panel says I cannot manage this user.

cobalt swallow
#

Well those explicit permissions where set through d.js so how is it unrelated?

nocturne kayak
#

djs doesnt manage those perms

scarlet tangle
#

are you removing those with djs?

cinder bane
copper jetty
exotic wind
# copper jetty you passed rest parameters where you should pass an array
let menuOptions = [];
commandDir.forEach(folder => {
    menuOptions.push({ name: `${folder}`, value: `**\`${client.commands.filter(x => x.folder === folder).map(x => x.name).join('`**, **`')}\`**`});
});
embed
    .setTitle(`${lang.titleNoArgs.replace('%bot%', client.user.username)}`)
    .setDescription(`${lang.descriptionNoArgs.replace('%prefix%', guildData.prefix)}`)
    .setColor(cfg.colors.good)
    .addFields(menuOptions);
exotic wind
#

menuOptions.push

copper jetty
#

then idk

cobalt swallow
# scarlet tangle are you removing those with djs?

I have tried putting an empty permissions array through the endpoint which as expected gives out a "Bots cannot use this endpoint"

I am only asking for a way to clear those extra permissions. Through discord it can't be done, the API is now updated, how can I achieve that?

Edit: nvm figured it out

exotic wind
#
let menu = []
commandDir.forEach(x => {
    menu.push({ label: x, value: x });
});
const row = new BeQuite.ActionRow().addComponents(
    new BeQuite.SelectMenu()
        .setCustomId('help_menu')
        .setPlaceholder(`${lang.selectCategory}`)
        .addOptions(menu)
);
#

here are 2 pieces of code in which i use arrays

copper jetty
#

addComponents needs array

exotic wind
#

but i dont know where is the mistake

#

oh, ok

#

ths

#

everything is working now

scarlet tangle
cinder bane
undone yew
#

How to fix? This channel id is correct

tame gazelle
tame gazelle
undone yew
tame gazelle
#

log channel

undone yew
#

?

scarlet tangle
#

console.log(channel)

undone yew
#

null

tame geyser
#

Just use a webhook

undone yew
#

its worked

undone yew
#

how to edit channel permissions?

#

on an existing channel

tame gazelle
#

channel.permissionOverwrites.edit(...)

undone yew
plain roverBOT
#

Documentation suggestion for @undone yew:
method PermissionOverwriteManager#edit()
Edits permission overwrites for a user or role in this channel, or creates an entry if not already present.

undone yew
#

thx

#

how to edit channel topic?

#

?

scarlet tangle
#
                                   ^

TypeError: Cannot read properties of null (reading 'roles')
    at Client.<anonymous> (/root/Generaly/app.js:1026:36)
    at Client.emit (node:events:539:35)
    at MessageCreateAction.handle (/root/Generaly/node_modules/discord.js/src/client/actions/MessageCreate.js:26:14)
    at Object.module.exports [as MESSAGE_CREATE] (/root/Generaly/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/root/Generaly/node_modules/discord.js/src/client/websocket/WebSocketManager.js:351:31)
    at WebSocketShard.onPacket (/root/Generaly/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/root/Generaly/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/root/Generaly/node_modules/ws/lib/event-target.js:199:18)
    at WebSocket.emit (node:events:527:28)
    at Receiver.receiverOnMessage (/root/Generaly/node_modules/ws/lib/websocket.js:1137:20)
    at Receiver.emit (node:events:527:28)
    at Receiver.dataMessage (/root/Generaly/node_modules/ws/lib/receiver.js:528:14)
    at Receiver.getData (/root/Generaly/node_modules/ws/lib/receiver.js:446:17)
    at Receiver.startLoop (/root/Generaly/node_modules/ws/lib/receiver.js:148:22)
    at Receiver._write (/root/Generaly/node_modules/ws/lib/receiver.js:83:10)```
what can couse this error is used to require a specific role to run a command only some times not all time if giving this eror
outer bane
#

a message without a member. DM, webhook or system message

scarlet tangle
undone yew
outer bane
plain roverBOT
undone yew
#

how to fix?

tame gazelle
undone yew
#

ok

chilly zephyr
#

When showing a modal, does it automatically defer the interaction?

#

Ah right right. I got confused with slash commands, thank you

cinder bane
#
// Code
const userEmbedOptions = [{...}, {...}, {...}];
new ActionRowBuilder()
    .addComponents(
        new SelectMenuBuilder()
            .setCustomId('ViewUser')
            .setMaxValues(1)
            .addOptions(...userEmbedOptions)
    );
// Error
TypeError: options.map is not a function
    at SelectMenuBuilder.addOptions

what's wrong with my code?

hoary fox
#

in addOptions u must put array

cinder bane
#

since it says options.map is not a function i tried to remove the spread operator but it too resulted in an error

hoary fox
cinder bane
#

so

#
.addComponents([new SelectMenuBuilder()])

like this?

hoary fox
#

yea

half barn
#

Any clue why this aint working?

vague coyote
#

put the textinput in an actionrow

#

and the actionrow in the modal

half barn
#

ty

cinder bane
#

still having problem with this, I checked the docs as well and it seems that addOptions and setOptions now take an array instead of objects

// Code
const userEmbedOptions = [
    new SelectMenuOptionBuilder()
        .setLabel('Overview')
        .setValue('overview')
        .setDefault(true),
    new SelectMenuOptionBuilder()
        .setLabel('Roles')
        .setValue('roles'),
    new SelectMenuOptionBuilder()
        .setLabel('Avatar')
        .setValue('avatar')
];

let x = new ActionRowBuilder()
    .addComponents(
        new SelectMenuBuilder()
            .setCustomId('ViewUser')
            .setMaxValues(1)
            .setOptions(userEmbedOptions)
    );
#

what am I doing wrong here?

tame gazelle
#

addComponents takes an array

cinder bane
#

but im getting the same error even after giving an array in .addComponents

#
let userEmbedComponents = new ActionRowBuilder()
    .addComponents([
        new SelectMenuBuilder()
            .setCustomId('ViewUser')
            .setMaxValues(1)
            .setOptions(userEmbedOptions)
    ]);
#

im getting the exact same error from .setOptions() line

#

im stuck with this for 2 hours now

#

this didnt have in the earlier versions of v14

#

i updated to the latest v14 version today

copper jetty
cinder bane
#

..

#

can someone please help me this is really frustrating

forest elm
#

edit the message manually

plain roverBOT
forest elm
#

showModal() is a reply to the interaction

#

no, show the modal and then edit the message manually
interaction.message.edit()

cinder bane
#
// Code
const userEmbedOptions = [
    {
        label: 'Overview',
        value: 'overview',
        default: true
    },
    {
        label: 'Roles',
        value: 'roles'
    },
    {
        label: 'Avatar',
        value: 'avatar'
    }
];

let userEmbedComponents = new ActionRowBuilder()
    .addComponents([
        new SelectMenuBuilder()
            .setCustomId('ViewUser')
            .setMaxValues(1)
            .addOptions(userEmbedOptions)
    ]);
#

updated the code a bit

forest elm
#

are you on the latest version?

#

that error message makes it seem like addOptions is expecting rest parameters

#

(and the latest version doesnt, it takes an array)

forest elm
uncut kelp
forest elm
#

GuildDefaultMessageNotifications.OnlyMentions

#

and you'd have to import that from discord-api-types as its not exported in djs

uncut kelp
#

Ah thank you, that (:

uncut kelp
forest elm
#

yeah idk why some of the enums that have an EnumResolver aren't reexported

unreal blaze
#

How can I use messageCreate when Im not getting its content?

#

MessageContent its blocked look like it

forest elm
#

enable it in the dev portal

plain roverBOT
#

Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.

If you are using the GUILD_MEMBERS, GUILD_PRESENCES, or MESSAGE_CONTENT intents, you need to enable them in the developer portal:
Developer Portal > Your app > Bot > Privileged Gateway Intents

unreal blaze
#

Ahh, there is something new

#

Thank you

scarlet tangle
scarlet tangle
plain roverBOT
#

• Websocket intents limit events and decrease memory usage: learn more
• See what intents you need here

idle galleon
#

emoji name is invalid

scarlet tangle
#

what would the name be
?

idle galleon
#

The error just said it’s on name

#

Are you sure that’s the only button?

scarlet tangle
#

yes

tame gazelle
jagged marsh
#

in my threadCreate event, client returns true (the readyState, even though I'm not using that...), in the exact same usage in other events that work perfectly. it functions fine on v13. any reason why this might be?

cinder bane
#

well not latest but the commit where these changes were made

cinder bane
#

Ill just open an issue then, since both rest parameters and array returns an error

knotty plover
#

where are the errors

#

nvm I see

knotty plover
knotty plover
knotty plover
#

Yeah, cant replicate that issue

cinder bane
#

i just ran the same thing again and I got this

#

I didnt make a single change in the code either

#

its the same one that i posted above

knotty plover
#

Can you show me the full output of npm why @discordjs/builders

cinder bane
#

okay 1min

knotty plover
#

I get this

@discordjs/builders@0.14.0-dev.1650672503-3617093
node_modules/@discordjs/builders
  @discordjs/builders@"^0.14.0-dev" from discord.js@14.0.0-dev.1651147765-679dcda
  node_modules/discord.js
    discord.js@"^14.0.0-dev.1651147765-679dcda" from the root project
cinder bane
knotty plover
#

Its almost like it thinks theres a nested array?

cinder bane
#
@discordjs/builders@0.14.0-dev.1650240529-9ef7ffd
node_modules/@discordjs/builders
  @discordjs/builders@"^0.14.0-dev" from discord.js@14.0.0-dev.1651147765-679dcda
  node_modules/discord.js
    discord.js@"^14.0.0-dev.1651147765-679dcda" from the root project
knotty plover
#

hmm so you have a different builders dev version

#

I wonder why

cinder bane
#

do i need to update them separately? I have just done npm i discord.js@dev

knotty plover
#

You shouldnt

#

Uninstall discord.js fully first, then run npm why @discordjs/builders and make sure it errors

#

Then reinstall

cinder bane
#

okay

#

it wont error

#

oh, nvm

#

removed @\dev

knotty plover
#

hmm its still installed from somewhere

#

oh did you fix it?

cinder bane
#

i tried to uninstall discord.js instead of discord.js@\dev and it got removed

knotty plover
#

okay cool

#

Just reinstall now then

cinder bane
#

its done now

knotty plover
#

that looks better, the builders tag matches the discord.js tag

cinder bane
#

let me try the code once

#

yup works

#

thanks @knotty plover

knotty plover
#

cool, no idea how they got out of sync

cinder bane
#

i dont either, I just remember that I had updated my dev version and thats it, the errors started coming up after i updated the version

cinder bane
#

receiving this error from one the fields but I cant figure out which

// Code
.addFields(
    { name: 'Sent By', value: `${target}`, inline: true },
    { name: 'Sent On', value: `<t:${Math.floor(message.createdTimestamp / 1000)}>`, inline: true },
    { name: 'Deleted By', value: `${executor}`, inline: true },
    { name: 'Message Id', value: message.id, inline: true },
    { name: 'Author Id', value: target.id, inline: true },
    { name: 'Executor User Id', value: executor.id, inline: true }
);
knotty plover
#

takes an array now

cinder bane
#

oh right

#

my bad

scarlet tangle
#

in the v13 to v14 switch guide that the functions have been renamed but isVoice()/isText() still exists and aren't even deprecated?

knotty plover
#

Yeah they got added back

#

What isText() used to do, is now isTextBased()

#

isText() now specifically checks the GUILD_TEXT type of channel

scarlet tangle
#

but what's the difference between isText() and isTextBased()?

knotty plover
#

TextChannel, DMChannel, probably ThreadChannel are all text based

#

NewsChannel

scarlet tangle
#

ohh

#

ty

cinder bane
knotty plover
#

nope

cinder bane
#

then, how do we find which message was pinned or unpinned in channelPinsUpdate event?

#

this is a separate question

#

im trying to fetch pinned and unpinned events from audit logs

#

but since I dont know which event has triggered, unpinned or pinned i cant fetch the exact data from audit logs

#
const { executor, target, extra } = (await channel.guild.fetchAuditLogs({ type: AuditLogEvent.MessagePin })).entries.first();
const message = (await channel.messages.fetchPinned()).find(({ id }) => id === extra.messageId);
console.log(message);

this will return the message data if the message was pinned but will return undefined if it was unpinned since im searching for MessagePin Events and not MessageUnpin

scarlet tangle
#

fetch 2 times, first for pin and again for unpin, it isn't possible to fetch both at the same time as the api also takes an integer for the action_type..

cinder bane
#

any way to get the message that was pinned or unpinned from the channels? that way I could fetch the AuditLogs after wards and decide if type should be MessagePin or MessageUnpinned depending on the value of pinned property

jagged marsh
uncut kelp
jagged marsh
# uncut kelp Can you show how you are using it

I'll just paste it here as it is small:

const { ThreadChannel, Client } = require('discord.js');
const { logEmbed, getChannelInfo } = require('../../util/functions');

module.exports = {
    name: 'threadCreate',
    /**
     * @param {ThreadChannel} thread
     * @param {Client} client
     */
    async execute(thread, client) {
        logEmbed({ client, guild: thread.guild.id, channel: thread.parent, description: `A new thread, ${thread.toString()}, was created:\n\n${getChannelInfo(thread).join('\n')}`, title: `Thread Created`, color: 'Green', isEvent: true });
    },
};
function logEmbed(input) {
    const { client, guild, channel, description, title, color, thumbnail, attachment } = input;

...
    client.channels.cache.get(targetChannel).send(attachment ? { embeds, files: [attachment] } : { embeds });

I can't see any issue with this at all, and nothing has changed since I migrated from v13

uncut kelp
#

The second parameter isn't the client

jagged marsh
#

I pass it through to each event from my events handler

#
client.once(event.name, (...args) => event.execute(...args, client));
uncut kelp
#

In that case, the third parameter is your client

#

You are not using it

jagged marsh
#

ah well that explains it– I didn't know that was updated–

uncut kelp
#

This worked for you on version 13 because this did not exist in version 13

jagged marsh
#

thank you so much!!

uncut kelp
#

You're welcome

jagged marsh
#

do you know if there were similar changes to any other events? (I'll look through anyway)

uncut kelp
#

You can also access the client via thread.client, you know that right? Just curious why you're passing it

uncut kelp
jagged marsh
jagged marsh
uncut kelp
#

[:

plain roverBOT
#

Tag suggestion for @scarlet tangle:
Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.

If you are using the GUILD_MEMBERS, GUILD_PRESENCES, or MESSAGE_CONTENT intents, you need to enable them in the developer portal:
Developer Portal > Your app > Bot > Privileged Gateway Intents

wary holly
#

I want to change the permissions of the bot when joining the server, not the role, nor the permissions of the channel.
what should I do?

wary holly
tame gazelle
urban belfry
#

If a bot could change it's permission right after joining meguFace

#

What are you talking about specifically

wary holly
tame gazelle
wary holly
#

If there are multiple roles after the bot is added, how do I know which one I should edit?
(Some bots will add roles for newly joined members.)

tame gazelle
#

execpt for the server owner

wary holly
#

OK.

#

how do I know which one I should edit?

tame gazelle
#

you can find a role by the bot name and check it it’s managed

#

but two bots can have the same so it isn’t reliable

tame estuary
#

a bit of topic but do you need to cache mysql data for a pokemon bot
data must be accessed and changed quickly

forest elm
#

there's also <Guild>.roles.botRoleFor(<User>)

scarlet tangle
#

how do i use status in v14
?

jaunty vault
scarlet tangle
hoary fox
scarlet tangle
#

ok

urban belfry
#

32767 doesn't mean all the intents anymore dogeHaHa
nor should you be using all of them

urban belfry
#

well no you should use the ActivityType enum instead

#

magic numbers are not recommended

hoary fox
urban belfry
#

it's easy to explain
instead of it being in all caps, the property is just in PascalCase, ActivityType.Streaming for example