#djs-help-v14

78874 messages · Page 48 of 79

terse void

cool smileyes

tardy sable

tip, you can use subcommands instead of doing "-"

young notch
rose tangle
normal abyss

is v13 discontinued?

rose tangle

yes

clear garnet

d.js has nothing to do with file structure

bleak owl

that's not a d.js feature

clear garnet

How you set your commands up file-wise is completely up to you

dry flame

Is there a way to setup a TextInputBuilder so that it only accepts numbers? Or something that would accomplish the same effect

tardy sable

youll have to add check after submit

dry flame
normal abyss

my slash commands got duped, how do i clear the dupe commands

cosmic grotto

I have this code:

              if (i.customId === "MG_channelCreate_btn") {
                MG_channelCreateStatus = !MG_channelCreateStatus;
                GuildDocument.setChannelCreateProtection(
                  MG_channelCreateStatus
                );

                let channelCreateBTNSTATUS = "Danger";
                if (MG_channelCreateStatus === true) {
                  channelCreateBTNSTATUS = "Success";
                }
                buttonOne.setStyle(channelCreateBTNSTATUS);

                await i.update({
                  components: [modGriefContainer]
                });
              }

However when I click the button, it does change the DB value, but doesn't change the button color, so the i.update for some reason doesn't work.

sharp ginkgoBOT

tag suggestion for @normal abyss:
If you have duplicate commands on your server, you registered both global and guild commands.

You can remove the duplicates by resetting either the global or guild commands

  • Resetting global commands: rest.put(Routes.applicationCommands(clientId), { body: [] })
  • Resetting guild commands: rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
normal abyss

didnt work

wary coral
chrome chasm

I tried to use the messagePollVoteAdd event however the event does not emit, even trying to log strings in the console would not log anything

This event used to work a few days ago

flat vigil
rose tangle
cosmic grotto
wary coral
normal abyss

also saved the file before doing that

polar karma
rose tangle
wary coral
normal abyss
rose tangle

try refreshing your client after running it

ctrl + r

flat vigil
normal abyss
polar karma

there's a pr pending

flat vigil

gotcha

cosmic grotto
rose tangle

can you show how you build the container

cosmic grotto

Like so

rose tangle

I'm more interested on where you use buttonOne

cosmic grotto

oh wait

wary coral

so to update the button you need to update the button in the section in the container

cosmic grotto
rose tangle

Thonk I think that should work given it's passed by reference

btw you don't need to do () => buttonOne

you can just pass buttonOne directly

cosmic grotto

oh alrighty

So something like this:

              if (i.customId === "MG_channelCreate_btn") {
                MG_channelCreateStatus = !MG_channelCreateStatus;
                GuildDocument.setChannelCreateProtection(
                  MG_channelCreateStatus
                );

                let channelCreateBTNSTATUS = "Danger";
                if (MG_channelCreateStatus === true) {
                  channelCreateBTNSTATUS = "Success";
                }
                buttonOne.setStyle(channelCreateBTNSTATUS)


                .addSectionComponents(
                    section => section
                      .addTextDisplayComponents(
                        textDisplay => textDisplay
                          .setContent(`> Limit the ability of staff members to create new channels.`),
                      )
                      .setButtonAccessory(buttonOne)
                )

                await i.update({
                  components: [modGriefContainer]
                });
              }

Basically, or do i need to define the button again as well

wary coral

also as an aside recommend using the enum ButtonStyle insted of "Danger" and "Success"

cosmic grotto

Why so?``

wary coral

less room for error using ButtonStyle.Danger intend of "Danger"

wary coral
cosmic grotto So something like this: ```js if (i.customId === "MG_channelCreat...

I cant test right now but the following should get you in the right drection for update

let channelCreateBTNSTATUS = ButtonStyle.Danger;
if (MG_channelCreateStatus === true) {
  channelCreateBTNSTATUS = ButtonStyle.Success;
}

const components = i.message.components
components[containerIndex].components[sectionIndex].accessory.style = channelCreateBTNSTATUS

await i.update({
  components: components
});

there is also a helper function to turn components[containerIndex] into a builder but I forget what it is called

tough island

does djs support modal components

bleak owl

not quite yet

tough island

any eta?

bleak owl

nope

fluid cedar

hi how to get aboutme?

wary coral
fluid cedar
sharp ginkgoBOT
wary coral

you need to add GUILD_PRESENCES intent to your bot

halcyon zephyr

Can webhook messages only be deleted or edited if we deleteMessage using the webhookClient, or if I fetch the message in my bot and try to call message.delete on it it'll work since my bot owns the webhook?

Assuming my bot doesn't have general "Manage Message" permissions in that channel

halcyon zephyr

Thank you Prayge

sharp ginkgoBOT
wary coral

you just need the message Id or message object

wary coral
halcyon zephyr

Gotcha thank you yeah, I'll test the first one out I suppose

orchid radish

Are there any modal options that are dropdown menus or selectable similar to select menus? Or must they all be text fields

fluid cedar
wary coral
fluid cedar
wary coral Yes, it is in the presence status of `custom` <#1142187561729658942>

why this not work?

module.exports = {
    name: 'customstatus',
    aliases: ['cs', 'status'],

    async execute(message, client) {
        const targetMember = message.mentions.members.first() || message.member;

        if (!targetMember.presence || !targetMember.presence.activities) {
            return console.log('Cannot read this user\'s status. They are probably offline.');
        }

        const customStatus = targetMember.presence.activities.find(
            activity => activity.type === 'CUSTOM'
        );

        if (customStatus) {
            const emoji = customStatus.emoji ? customStatus.emoji.toString() : '';
            const state = customStatus.state ? customStatus.state : '';
            const statusText = `${emoji} ${state}`.trim();

            console.log(`Custom status for ${targetMember.user.tag}: ${statusText || 'No custom status set'}`);
        } else {
            console.log(`User ${targetMember.user.tag} has no custom status set.`);
        }
    },
};

User xoxoxoxoxxxxx has no custom status set.

wary coral

did you add the presence intent?

fluid cedar
wary coral
fluid cedar

here?

const { Client, GatewayIntentBits, Collection, ActivityType, Partials } = require('discord.js');

wary coral

also activity.type you want to check for ActivityType.Custom

fluid cedar

so what change

wary coral
wary coral
unique shoal

Not in djs yet

orchid radish
unique shoal

yes

hasty fern

Hey guys, I have this on my Message Component, is there a way to modify its content later in the code?

.addTextDisplayComponents(
    new TextDisplayBuilder()
        .setContent(`${uuidLine}\n${pinLine}\n${screensharerLine}\n${dateLine}\n${durationLine}\n${resultLine}\n${countryLine}\n${vpnLine}\n${platformLine}\n${osLine}\n${vmLine}\n${osInstallationDateLine}\n${recycleBinModifiedLine}`)
)
stable sun
hasty fern
stable sun

As opposed to putting it in a single line "inline"

wary coral
hasty fern

But i'm kinda lost on how to do that :/

sharp ginkgoBOT

documentation suggestion for @hasty fern:
method ButtonInteraction#update() discord.js@14.22.1
Updates the original message of the component on which the interaction was received on.


// Remove the components from the message
interaction.update({
  content: "A component interaction was received",
  components: []
})
  .then(console.log)
  .catch(console.error);

wary coral

The update function is like the edit function but for button interaction.

hasty fern
wary coral

Well yes, you need to reconstruct the components which you wish to update the message with. You are able to pull that from the interaction. But note The components from a message are not builders

hasty fern
wary coral
hasty fern
wary coral When you say single line, are you referring to the content of the text display o...

the content

basically the whole message will be the same everytime, except the content on the TextDisplay I sent above, this will change based on which button the user clicked on.

I have 4 buttons: General, Accounts, Traces and PCA.

When the user clicks for example in the Accounts button, the TextDisplay I sent would be:

.setContent(`${accountsLine}`)

If the user clicks on the Traces button, the content would be:

.setContent(`${tracesLine}`)

etc...

i can upload the code in pastebin or smth if it can help u, idk

wary coral

Oh in that case it's easy. You're basically already there. It would have been more difficult if you were looking to just update one variable in the text display

wary coral
hasty fern What do I need to do?

Look at the code example I linked previously. The components field of a message is an array. If you're using a container in your message that container contains an array of components. Using the position of the text display, change the content of the text display

hasty fern
            if (interaction.customId === "scan_geral" || interaction.customId === "scan_contas" || interaction.customId === "scan_rastros" || interaction.customId === "scan_pca") {
                const messageId = interaction.message.id;

                const redisKeyData = await redis.get(`scan:${messageId}`);

                if (!redisKeyData) {
                    return interaction.reply({
                        content: "❌ Dados do scan não encontrados.",
                        ephemeral: true
                    });
                };

                let newContent;

                if (interaction.customId === "scan_geral") {
                    newContent = generalLine;
                } else if (interaction.customId === "scan_contas") {
                    newContent = accountsLine;
                } else if (interaction.customId === "scan_rastros") {
                    newContent = tracesLine;
                } else if (interaction.customId === "scan_pca") {
                    newContent = pcaLine;
                };

                const components = interaction.message.components;
                components[0].components[5].content = newContent;

                await interaction.update({
                    components: components,
                    flags: MessageFlags.IsComponentsV2
                });
            };

Any idea why?

wary coral
hasty fern
unique shoal

You should really be reconstructing it from builders, or retaining references to the original builders

TextDisplayComponent.content is a read only getter

wary coral

Good to know. Thanks. What is the helper function for recreating builders

unique shoal

They are not raw JSON objects you can work with and repass directly

No helper, just pass to the constructor I think

wary coral

I thought I recalled a function that would create the correct builder based on the top level component

unique shoal

Oh - if there is I dont know 😄

hasty fern

but yeah i'll try to modify it

unique shoal

JSON is fine, but then you'll need to be modifying that JSON

message.components is not the same structure and is not designed to be directly modified and re-sent

sharp ginkgoBOT
unique shoal

Does that also work with discord.js components?

wary coral

It should work on <Top level component>.data

On my phone in bed so pardon my code. It may not be accurate, but I think this would be valid form

Message.components.map(c => createComponentBuilder(c.data))
half rover

anyone knows how are we using select menus in modals?

i couldn't find any docs about discord.js

stable sun
half rover
stable sun

Yea

half rover

i don't know how but someone told it

stable sun

If you DIY, the issue isn’t sending from d.js, it’s receiving it in d.js

half rover

i need that way do you know how are we doing it

stable sun

There is no I in we

crimson gale

repeating what i said, since you seem to want to have this exact discussion in as many places as possible:
client.ws exposes the websocket manager where you can listen to the dispatch events as they are emitted by discord (see the discord api docs for reference), if sending is an issue, client.rest exposes the REST wrapper and likewise allows you to send data as discord api docs document it
if you do, you are on your own, we do not provide support for working around the library

stable sun

I don’t think main even has it yet

frosty epoch

what happens if you try to add a role the user already has?
will the action fail?

stable sun

No

wispy pumice

doesn't seem to make any difference at all.. isn't payload generally doing the same thing, tho?

main axle

I am changing my guild tag but guildMemberUpdate event didn't run am I missing any intent or partials or it doesn't run in this case?

proud shoal
dense jackal

both guildMemberUpdate and userUpdate should emit when changing your server tag

but yeah you need to have the given intent to let Discord know you want that event to be emitted for your client

proud shoal

The GuildMembers intent is a privileged intent so make sure to have that enabled in your Application Page in the Discord Developer portal. Otherwise you still won't receive the event.

loud quartz

We emit it out of the guildMemberUpdate if the underlying User changed

dense jackal

oh

so d.js userUpdate isn't the same as discord api USER_UPDATE gateway events?

but what gets emitted on the discord api USER_UPDATE event then?

loud quartz

user_update only emits for current user change

proud shoal
dense jackal

gotcha

main axle
dense jackal
loud quartz

Unless you enable partials

main axle
red forum

Someone help me pls i need help im on ios idk how to add my code to a bot

main axle
const client = new Discord.Client({
    intents: [
        Discord.GatewayIntentBits.Guilds,
        Discord.GatewayIntentBits.GuildMembers,
        Discord.GatewayIntentBits.GuildVoiceStates,
        Discord.GatewayIntentBits.GuildMessages,
        Discord.GatewayIntentBits.DirectMessages,
        Discord.GatewayIntentBits.MessageContent,
    ],
    partials: [Discord.Partials.Channel, Discord.Partials.GuildMember, Discord.Partials.Message]
});
red forum

Someone help me pls i need help im on ios idk how to add my code to a bot

main axle
main axle
loud quartz

It could

main axle

well its weird but its not working!

this is my code

if (newMember.user.bot || newMember.guild.id !== "1200884800026857602") return;

if (newMember.id === "555688871023869952") {
    console.log("OLD TAG:", oldMember.user.primaryGuild?.identityGuildId);
    console.log("NEW TAG:", newMember.user.primaryGuild?.identityGuildId);
}

for example when I change my roles guildMemberUpdate event starts working and I get this console log

OLD TAG: 1377992498487492710
NEW TAG: 1377992498487492710

but when I change my guild tag there isn't any console log

oh wait its logging but there is a problem oldMember and newMember both has same primaryGuild tag

cosmic grotto

Hello, mentioned this issue yesterday, but the issue still presists, when i click the button, it doesn't change the button color:

              if (i.customId === "MG_channelCreate_btn") {
                MG_channelCreateStatus = !MG_channelCreateStatus;
                GuildDocument.setChannelCreateProtection(MG_channelCreateStatus);

                let channelCreateBTNSTATUS = ButtonStyle.Danger;
                if (MG_channelCreateStatus === true) {
                  channelCreateBTNSTATUS = ButtonStyle.Success;
                }

                const components = i.message.components
                components[containerIndex].components[sectionIndex].accessory.style = channelCreateBTNSTATUS

                await i.update({
                  components: components
                });
              }
red coral

Its because you need to recreate it i believe, its read only. You can use createComponentBuilder I think.

const components = i.message.components.map(createComponentBuilder);

not 100% on that though

loud quartz

It's read only because this way you modify your cache directly, and it would no longer match the reality

formal carbon
sand minnow

I got this role has 165 members, but when i use fetch and get role members size, it only caches 20...

bleak owl

you have to fetch members first before getting the role member size

sand minnow
bleak owl

yes

make sure you have the GuildMembers intent

sand minnow
bleak owl

blobreach

cosmic grotto
cosmic grotto
loud quartz
cosmic grotto

So entire new component (copied into the fnc?)

loud quartz

Yes, as you had to do with some things for years

Embeds, other components

slate tartan

@loud quartz
Can I have questions to you?

loud quartz

If it's about discord.js, just ask it

slate tartan
loud quartz
slate tartan

Ok

cosmic grotto
loud quartz Yes, as you had to do with some things for years

So i'll add entire this:

 const modGriefContainer = new ContainerBuilder()
                  .setAccentColor(Number(colors.metaColor))
                  .addMediaGalleryComponents(
                    gallery => gallery 
                    .addItems(
                      mediaItem => mediaItem
                      .setURL('link'),
                    )
                  )
            
                  .addTextDisplayComponents(
                    textDisplay => textDisplay
                      .setContent(`text`),
                  )

                  .addSeparatorComponents(separator => separator)

                  .addTextDisplayComponents(
                    textDisplay => textDisplay
                      .setContent(`text`),
                  )
                  .addSectionComponents(
                  ...
                  ...

just to update one button? I have 12 buttons, the code would be huge

rose tangle

if you're going to do it that way then do a function instead

loud quartz

For the same years you could reuse the received data

rose tangle

but I really think your first attempt should've worked

I'll try to test it locally

for now just make a function

sand heart

how many slash commands we can register?

wary coral
sand heart

ty

silent mirage

My command list is 65 but i am gonna to stop making slash commands and make prefix commands

tardy sable

huh

why would you switch from slash commands to prefix commands

bleak owl

use subcommands and subcommand groups

dense jackal
silent mirage

That what i been doing

dense jackal

ahh so you have multipurpose bot number 10000th

well anyway you still shouldn’t use prefix (message content) commands, and you have 35 commands left

halcyon bison

If you utilize subcommand groups as well you have ~60k commands left
The limit alone really isn't a reason to switch back to prefix commands

silent mirage

How to delete a global commnd

dense jackal
silent mirage

Just remove it coe

sharp ginkgoBOT

If you have duplicate commands on your server, you registered both global and guild commands.

You can remove the duplicates by resetting either the global or guild commands

  • Resetting global commands: rest.put(Routes.applicationCommands(clientId), { body: [] })
  • Resetting guild commands: rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
topaz bluff

^ by doing that

silent mirage

Oh that is what my bot does on every restart

So for me just by removing the command from CommandHandler will work

wary coral
silent mirage

Yup

wary coral

Delete the folder where your code compiles to

Chances are the removed. Commands are still in JavaScript form

rose tangle

why do you delete your commands on start though

silent mirage

Let me send me command handler code

sharp ginkgoBOT

To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.

silent mirage

Code for CommandHandler

rose tangle

why is everything any

just use js at that point

and use the enum instead of numbers with comments

silent mirage

Cause i did not make Interfaces for them

I was working on that

rose tangle

also that seems to only fill a slashCommands collection, you're not doing anything with it yet

rose tangle

unless you're migrating from js?

polar karma

fwiw you should not be deploying commands on every bot start-up

silent mirage

Instead of loading on startup cause that is how i have it set to

polar karma

the guide has a page on deploying commands using /rest package, so your bot doesn't have to be logged in to do it. you should deploy when changes to the data that's sent to the API are made (description, options, etc)

oh /guide isn't working rn sorry

rain roost

Does anyone know if there a reliable way to check if a bot has the ability to SendMessages in a channel without doing a try/catch? I tried the following but it's returning true for a private channel where the bot doesn't have permissions

return channel.permissionsFor(guild.members.me).has(Discord.PermissionsBitField.Flags.SendMessages);
rose tangle

there's also implicit permissions

rain roost
rose tangle there's also implicit permissions

Not sure what you mean? 🤔 Do mean some permissions are implied, like Admin implies everything? I'm failing to understand why the line of code above would return true for a channel the bot does not have permission to SendMessages in.

stable sun

Even more so with private threads

clear garnet

SendMessages != ViewChannel

rose tangle

discord allows you to do this

your code is only checking for the value below, not the one above

rain roost

Ahh thank you!! I was missing the ViewChannel aspect, and verified this does what I want

  return channel.permissionsFor(bot.user).has(Discord.PermissionsBitField.Flags.ViewChannel | Discord.PermissionsBitField.Flags.SendMessages);
crisp roost
const bottomSection = new SectionBuilder()
                .addSeparatorComponents(
                    new SeparatorBuilder().setSpacing(SeparatorSpacingSize.Large).setDivider(true),
                )
                .setThumbnailAccessory(new ThumbnailBuilder().setURL(iconUrl).setDescription('Server Icon'));```


this is my code currently, when i run the command it's saying that .addSeparatorComponents is not a function but i got no clue what im doing wrong
topaz bluff

Sections can't have separators

Containers can have separators

hollow forge
client.on(Events.InteractionCreate, (interaction) => {
    if (interaction.isChatInputCommand()) {
        console.log(interaction);
    }
});

client.on('interactionCreate', (interaction) => {
    if (interaction.isChatInputCommand()) {
        console.log(interaction);
    }
});

So these two chunks of code do the same thing, but the top one requires Events from discord.js

What is the bottom chunk doing differently to where it doesn't require Events? (I just want to learn for my own understanding rather than fix a problem)

I have a decent understanding of programming, a beginner's understanding of JavaScript, and zero understanding of discord.js so far haha

weary prawn

If you see, the actual value is interactionCreate

red coral

Events as an enum is also useful for whenever djs makes changes, typically breaking ones though. As the enums will change so then you don't rely on just strings

hollow forge

Ah got it. I just wasn't sure if it was a different type of method or not. Thanks!

dry flame

Where can I view rate limits applied to interaction endpoints?

polar karma

discord doesn't publish the rate limits, as they are dynamic and can change at any time. you can listen to the headers on the responses, though

dry flame
red coral

I believe that is the only rate limit hold up

polar karma

you'd be better to ask in ddevs, as that's not anything the library has control over

red coral
dry flame

But I couldn't find exact numbers anywhere either

rose tangle

each interaction has its own ratelimits

red coral

You won't

rose tangle

so it's not something you'll likely reach ever

frosty epoch
role.permissions.has('Administrator')

is it valid?

sharp ginkgoBOT
rose tangle

the docs says it is, so it should ¯_(ツ)_/¯

try it and see

main axle

how can I forward a message?

sharp ginkgoBOT
normal vale
client.on(Events.GuildAuditLogEntryCreate, (entry) => {
    if (AuditLogEvent.RoleCreate) {
        entry.changes?.forEach(change => {
            switch (change.key) {
                case 'name':
                    break;
                case 'hoist':
                    break;
                case 'color':
                    break;
                case 'colors':
                    break;
            }
        })
    }
})

idk if i'm doing something wrong here but isn't 'colors' supposed to be part of the AuditLogChange type?

rose tangle

pass the dm channel

main axle
hollow patrol

has anyone ever had an issue where deploying commands to a server just stalls forever?

until i remove the bot, and then it immediately errors with missing access, its super odd

rose tangle
rose tangle

also this isn't how you check whether the event was a role create

that if will always be true

normal vale

LOL i missed that

wary coral
rose tangle pass the dm channel

Will a DM channel work? Looking at the typing in the doc it doesn't seem to support DM channels. The dock shows guild channel resolvable and group dm channel

normal vale
discord.js@14.22.1 -> .\node_modules\.pnpm\discord.js@14.22.1\node_modules\discord.js
main axle
rose tangle

sorry, I meant if you have the channel cached

like I said initially, passing the channel should always work

if you pass the id it won't work unless you have the channel cached

main axle

then it should work am I right?

for (const member of selectedMembers.values()) {
    const dmChannel = await member.user.createDM();
    await interaction.targetMessage.forward(dmChannel).catch(() => null);
}
rose tangle
normal vale

i looked in auditLog.d.ts and seems like only color is there not colors

wary coral
rose tangle
main axle
rose tangle

you don't need any intents or partials for that

intents and partial are relevant for receiving events

intents tells discord what events you want to receive, partials tell djs whether you want to receive uncached objects

iron needle

How does fetching entitlements work? Can you fetch the ones from a specific user?
client.application.entitlements.fetch()

main axle

okay tnx <3 and what about second question?

rose tangle

there's no event you're showing on that snippet but given you have an interaction and a target message I'll asume it's a message command interaction, in which case you don't need any intents, interactions are always emitted

hollow patrol
        await rest.put(Routes.applicationGuildCommands(clientId, serverId), { body: commands }).then((data) => {
            console.log(`Successfully registered ${data.length} commands to ${server.serverName || serverId}.`)
        }
        )
        return;
    }```

Just in case you want an idea of what I'm running.

It works for all other servers, but on this fresh one

Edit: I just tried one more new server and it worked immediately
rose tangle

for the latter, I'm not sure whether that method errors when the user doesn't receive dms

you can test it

main axle

so member.user.createDM() will always works even if member blocked bot or closed their DM?

rose tangle
main axle

well if I could I wouldn't ask but I don't know which cases should I check XD

rose tangle

you could just block the bot and use the command on yourself

main axle

well fair enough

tnx @stable sun

rose tangle

ah, there you go

stable sun

You get an error once you send a message

rose tangle
sharp ginkgoBOT

discord Entitlements Resource - List Entitlements
read more

main axle

and how can I fetch all members in a role?

rose tangle

and yes, you can fetch one

sharp ginkgoBOT
rose tangle

see the 2nd overload's options

iron needle

So I'd have to fetch it, and then sort them afterwards?

rose tangle
rose tangle
iron needle

for only one specific userId

rose tangle

then you meant filter?

iron needle

yeah sorry

rose tangle

or well, from a single member

I think I worded that poorly

main axle
iron needle

Oh okay, I'll take a look at that one. Thanks

barren nacelle

I have a question about why i'm getting this error because i normally have been able to use SlashCommandBuilder fine with either subcommands or options of any types and never got an error before. Is there something i can do to keep it normal without changing my type?

My Command Class

interface CommandOptions {
  enabled?: boolean;
  developerOnly?: boolean;
}

export default class Command {
  public data: SlashCommandBuilder;
  public execute: (client: Noxify, interaction: ChatInputCommandInteraction<'cached'>) => Promise<void>;
  public enabled: boolean;
  public developerOnly: boolean;

  constructor(
    data: SlashCommandBuilder,
    options: CommandOptions = {},
    execute: (client: Noxify, interaction: ChatInputCommandInteraction<'cached'>) => Promise<void>
  ) {
    this.data = data;
    this.execute = execute;
    this.enabled = options.enabled ?? true;
    this.developerOnly = options.developerOnly ?? false;
  }
}```
red coral

You have to use a mix, like SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder | SlashCommandSubcommandGroupBuilder;

barren nacelle

Is there a reason behind this? first time it's ever happened to me. I mean i did swap over to using Classes now for my handlers and stuff

red coral

Because if you only provide options it becomes that ig, it narrows down depending on what you provide. Theres another way by doing like .toJSON() and typing it as RESTPOST jsom body

barren nacelle

And btw if i changed my type to that do i still use SlashCommandBuilder or SlashCommandOptionsOnlyBuilder when making a new cmd with my class

red coral

RESTPostAPIChatInputApplicationCommandsJSONBody

u use the main one still, slash command builder

barren nacelle

Okay

red coral

Something lke this

barren nacelle

Ah okay thanks for showing me that way too. I'll stick with the builder though for my cmds

red coral

You can still use the builder, you just call .toJSON at the end, but depends if you don’t mind doing builder | other builder | …

rose tangle

I don't think SlashCommandSubcommandGroupBuilder should be there

red coral

Tbh I made it ages ago lol

rose tangle
bleak owl

<@&839912195994812420> ty

dry flame

Can I followUp to an interaction that hasn't been replied to yet?

bleak owl

no, because there's no interaction to followUp from

rose tangle

if you defer and then followUp it'll behave as editReply but that behavior is deprecated

hollow patrol

still getting some funkiness where the same bot will deploy commands fine to a different new server or under a new client id, a bot will deploy to a server the other bot wont

is this just typical discord api wonkiness? or is there some way to sort this out

rose tangle

if you just want the commands to appear in all servers, deploy globally

hollow patrol

i have some commands that are based on unique variables

rose tangle

mmm I see, so if I understand correctly, you're deploying the same commands to two servers but they can't be used in one?

hollow patrol

yeah, its being extremely inconsistent about deploying commands successfully

rose tangle

can you show your deploy code

hollow patrol
        const data = await rest.put(Routes.applicationGuildCommands(clientId, serverId), { body: commands });
        console.log(chalk.green(`✅ Successfully deployed ${data.length} commands to ${server.serverName || serverId}`));
        return data;
    } catch (error) {
        // Re-throw with server context for the calling function to handle
        const enhancedError = new Error(error.message);
        enhancedError.code = error.code;
        enhancedError.status = error.status;
        enhancedError.serverId = serverId;
        enhancedError.serverName = server.serverName;
        throw enhancedError;
    }```
rose tangle

does it show the success message for that server, with the data you expect?

hollow patrol

it legit just stalls forever, no success log

no error either

rose tangle

sounds like you're ratelimited

can you put rest.on('rateLimited', console.log) somewhere before you do the call

ideally right next where you create the REST client

hollow patrol

absolutely

rest.on('rateLimited', console.log(chalk.redBright(`Rate Limited on Guild Command Deployment for ${server.serverName || serverId}`) ))

rose tangle

it receives a callback with data like any listener

just console.log works because technically you're passing a callback that takes a data (like doing (data) => console.log(data))

hollow patrol

on it

    const rest = new REST({ version: "10" }).setToken(discordToken);

    rest.on('rateLimited', console.log);

    // Deploy Commands with error handling
    try {
        const data = await rest.put(Routes.applicationGuildCommands(clientId, serverId), { body: commands });
        console.log(chalk.green(`✅ Successfully deployed ${data.length} commands to ${server.serverName || serverId}`));
        return data;
    } catch (error) {
        // Re-throw with server context for the calling function to handle
        const enhancedError = new Error(error.message);
        enhancedError.code = error.code;
        enhancedError.status = error.status;
        enhancedError.serverId = serverId;
        enhancedError.serverName = server.serverName;
        throw enhancedError;
    }```

even w this, still nothing

no logs

rose tangle

that sounds really weird

are you 100% sure it's saved?

can you place a log right before put just in case

hollow patrol

ill redo it rn after spamming cmd s a million times lol
and added the logs

humble locust

Hello, am I correct in understanding that you can only get the server tag from an invitation link? Or are there some other ways? It's just that I couldn't find anything, neither in the d.js docs nor on the discord.dev.

hollow patrol

frog_shrug halp

still sitting, even now lol

rose tangle

hmm that sounds really weird

what about in the catch?

rose tangle
sharp ginkgoBOT
tardy sable

can a private bot have dm commands?

rose tangle

what do you mean by "private bot" specifically?

tardy sable
rose tangle

in case you mean user installed commands, then you'll have to make it public, add an install link, install it on your user and then make it private

this is for support specifically with djs

wide elk

I have a game bot that uses a large amount of interaction.update() calls to update embed content. Would it be more resource-intensive for the bot to use Containers, or would the performance be similar?

bleak owl
wide elk

bidenW

tardy sable

guildAuditLogEntryCreate event does not emit when audit logs stack?

tardy sable

whats a good way to handle this edge case?

wary coral

you have to listen to the event and get the audit log after

loud quartz
tardy sable

is there another event for update then?

stable sun

Sadly no

Would’ve been better if update was never a thing at all tbh. Just handle combining logs on the client side

honest girder

how do you fetch a GuildPreview for a guild the client is not in?

wary coral

As far as I'm aware that is not possible for bots

pure ridge

I'm creating my first public bot - what is the best way to check for channels, guilds, etc. should I check for the cache or can I fetch?

unique shoal

fetch checks cache first

But if you have the Guilds intent theyll all be cached

pure ridge

when does the app cache the guilds - on startup ?

unique shoal

yes

lime ridge

Hello, I'm wondering, is there a way to open a bot's modal using a url link? I'm thinking of a way to have a small form opened when someone clicks on a button in my game's rich presence. The only thing that comes to mind is checking with DevTools what gets called (not at pc rn)

cobalt valley

why there is no status of this app? Also how to remove that online idle and dnd thing

unique shoal

Because it is an app, not a bot

Slash commands only

unique shoal

Modals require an interaction to respond to

lime ridge

makes sense... damn it

pure ridge

hey guys .. may I miss something

When I check the roles cache I can see a Role a wanna set by Id. When I say

const role: Role | null = await guild.roles.fetch(`${roleId}`); // roleId: number

I'm getting null - roleId == role id in cache list

clear garnet

// roleId: number
Probably because of this. Ensure you're storing Discord IDs (snowflakes) as strings, not numbers

-# And just an FYI, RoleManager#fetch() should either resolve to a Role object or reject - it should never resolve to null

pure ridge
stable sun

JS numbers only supports up to 53 bits. Snowflakes require 64 bits

pure ridge

all right .. I will change that and test again

works, thank you I thougth I could set the id as number to be clear it contains just numbers.

dense jackal
bitter pivot

anyone experimented with client localisations?
whats the best way to register translations and reply with whichever one the person's discord language is set to?

wispy pumice

how could I ignore certain interactions?
like for example, since d.js not supporting any modal components, I decided to go with direct raw API, but d.js at times interrupt. decided to use breaker with:

if (interaction.isModalSubmit()) return;

but that still doesn't seem to work

subtle vigil

Hey I wanted to ask if there is someone here who has made a commercial discord game bot? I had some questions for them

subtle vigil
pliant root
proud arrow
pliant root

(I'm not the person with the issue, I was just replying for them, I already solved it for myself)

proud arrow

Oh, mb. Got confused

pliant root

Np

unique shoal

If it's not your novel though, profiting off someone else's work without permission is not a good start

drifting bison

Getting this TypeError: t.setUrl is not a function error, can't find the issue. can someone help

        const container = new ContainerBuilder()
            .setAccentColor(0x0099ff)
            .addSectionComponents((s) => s
                .addTextDisplayComponents((t) => t
                    .setContent("Test")
                    )
                .setThumbnailAccessory((t) => t.setUrl(user.displayAvatarURL()))
            )
            .addSeparatorComponents((s) => s
                .setDivider(true)
                .setSpacing(1)
            );```
rose tangle

it's setURL

tardy sable

how would i switch to djs dev version. do i just install the dev version and change this to dev?

const { EmbedBuilder } = require("discord.js@dev");

drifting bison
rose tangle

but the dev version has breaking changes since it's v15 in dev

so it's not just changing the version but also changing your code accordingly

tardy sable

oh okay

ill just wait for modal update then myDudes

but does it mean then next release is v15?

rose tangle

no, dev refers to the "dev branch", which is the main branch

it doesn't necessarily mean the next release

it only means the team is already working on v15

mostly removing deprecated features for now, but there are also other changes

sour tendon

How to add options in the </command:commandID> command link?

rose tangle

it's not possible

placid kiln

hello
i saw the changelog for components in modals sadly i cant use them i get that error:

Error showing modal: DiscordAPIError[50035]: Invalid Form Body
data.components[1].components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (4,).
data.components[2].components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (4,).
data.components[3].components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (4,).

docs i saw: https://discord.com/developers/docs/components/using-modal-components

do i miss something and its not public for now?

crimson gale

we're still working on the release for modal components

placid kiln

aaahhh thought its my problem

crimson gale

i mean that IS an api error, so your API payload is wrong

but discord.js does not have that feature set

placid kiln

since im using discord.js i will wait any estimate date?

topaz bluff

SoonTM

ripe cloud

Hey here, I have a bug with Discord.js that appears to already be fixed on the GitHub but there is something I don't understand...

The bug in question, from the ModalSubmitInteraction.js file in my node_modules folder:

  static transformComponent(rawComponent) {
    return rawComponent.components
      ? {
          type: rawComponent.type,
          components: rawComponent.components.map(component => this.transformComponent(component)),
        }
      : {
          value: rawComponent.value,
          type: rawComponent.type,
          customId: rawComponent.custom_id,
        };
  }

The problem here is that it does not account for components having a component entry, only a components one. But labels only have one component. And when I check on the github, the fix is there:

  transformComponent(rawComponent, resolved) {
    if ('components' in rawComponent) {
      return {
        type: rawComponent.type,
        id: rawComponent.id,
        components: rawComponent.components.map(component => this.transformComponent(component, resolved)),
      };
    }

    if ('component' in rawComponent) {
      return {
        type: rawComponent.type,
        id: rawComponent.id,
        component: this.transformComponent(rawComponent.component, resolved),
      };
    }
// ...

But I don't have it in my node_modules folder. So I check what version I have in there:

{
  "$schema": "https://json.schemastore.org/package.json",
  "name": "discord.js",
  "version": "14.22.1",

Alright, and then I go to the package.json that's on the GitHub to check the version there, and...

{
  "$schema": "https://json.schemastore.org/package.json",
  "name": "discord.js",
  "version": "14.16.3",

Huh??? It's older???

So I guess the version in there is somehow not relevant and not linked to what's published on npm? But uh... Yeah I'm just not sure how to grab the right version from there. Any help is appreciated c: .

rose tangle

the fix is implemented, there's no release that has it yet

and yeah the version is patched in the release workflow

but it's not committed

ripe cloud

Ah, that explains it, thank you. Would you know a way for me to get the version that's on the github? I know how to do it when the repo is a 1:1 with what's published on NPM but in this case the repo is every single package, not just the main one, so I'm not sure...

rose tangle

there isn't a supported way

ripe cloud

I cry.

rose tangle

one would be to clone the repo, build it and link it locally but obviously that's not user-friendly

ripe cloud

yeah and I don't really wanna do that in prod :p

rose tangle

the official advice is to wait for a release

ripe cloud

ig no ETA

@signal shore I invoke my holy right to ping you, in case you know when this fix might be published (or even better, if you can publish it now mwehehe)

rose tangle

there isn't an eta as always, and maintainers have probably been asked to release enough times already by the community, but it's entirely up to when they feel it's time and when it's done

signal shore

You I will allow to ping me, but whats up

oh

yeah wait like 30 min or smth

ripe cloud
rose tangle

smh vlad no leeks!

ripe cloud

Woooo ty \o/

I'll take a break in the meantime haha

dapper cave

LETS GOOOOOOOOOO

halcyon bison
pliant root

Just curious, does this also support the upcoming file upload component? (I assume no)

signal shore

no

that'll come after the docs pr for it is merged

pliant root

Alright, thanks!

signal shore

you probs can send it raw, who knows

topaz bluff

im assuming in a 14.23.x

signal shore

.24 but yes

red coral
orchid radish
bleak owl

yes

open glacier

Well done djs maintainers. ❤️❤️❤️ stops the constant requests for this release 😆😆😆😆

visual parrot

finally

chrome chasm

So why is this happening?

topaz bluff

can you show the code snippet too? looks like author is null

wary coral
rose tangle

yeah that'd be a partial message

you enabled partials and are not handling the partial case

halcyon bison
chrome chasm
rough kite

how it works bio and avatar per guild?
Could you explain it to me with an example code?

tardy sable

if i update package, it will break the current modals i made in code?

halcyon bison
upper jay
rustic lantern

i can't seem to figure out how to add a text display component into a modal, i'm searching the docs and code hint but i find nothing from the modal builder

rose tangle

but if it does, open an issue

wary coral
tardy sable

okay thanks

sharp ginkgoBOT
halcyon bison
rustic lantern
golden laurel

You add label components, and a label can have a label (text input label is the same) alongside a description and a component. Seems text display components are missing from builders v1, but you should be able to send JSON

rough kite
golden laurel

.edit() won't work for editing your banner/bio/avatar yeah

chrome chasm

even after the polls update my poll (which was started before client start up) isn't reading votes. Why does this happen? (Yes I have the Poll and PollAnswer partials)

lime lantern

Now I can add Channel selectmenus in modals???

rose tangle
winter merlin

How can I display only text in a modal?
The following code causes an error:

const modal = new ModalBuilder()
  .setTitle('test')
  .setCustomId('test')
  .setLabelComponents(
    new LabelBuilder().setLabel('test test').setDescription('test test test')
  );

await interaction.showModal(modal);
halcyon bison
lime lantern
rose tangle yes

I'm doing smth wrong?

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (4,).
...
}
rose tangle

you don't add the select menu directly

you need to add a label which will have the select menu

rose tangle

ah, nvm I missread it, you need the action row

lime lantern
winter merlin
rose tangle

same with messages, select menus need to be wrapped in an action row

proud arrow
halcyon bison
lime lantern
sharp ginkgoBOT
rose tangle

Thonk so they should be wrapped then, weird

well both methods should work then, but prefer the label

plus you can give it a description

slate tartan
lime lantern If u got it to work, please help me lol
 const modal = new ModalBuilder()
        .setCustomId('bug_modal')
        .setTitle('Bug Report');

    const bugSelect = new StringSelectMenuBuilder()
        .setCustomId('bug_string_select')
        .setPlaceholder("Choose...")
        .addOptions(
            new StringSelectMenuOptionBuilder().setLabel('Ant').setValue('ant').setDescription('(best option)').setEmoji({ name: '🐜' }),
            new StringSelectMenuOptionBuilder().setLabel('Butterfly').setValue('butterfly').setEmoji({ name: '🦋' }),
            new StringSelectMenuOptionBuilder().setLabel('Caterpillar').setValue('caterpillar').setEmoji({ name: '🐛' })
        );

    const bugReason = new TextInputBuilder()
        .setCustomId('bug_explanation')
        .setLabel('Why is it your favorite?')
        .setPlaceholder('Write your explanation here...')
        .setStyle(TextInputStyle.Paragraph)
        .setMinLength(1000)
        .setMaxLength(4000)
        .setRequired(true)
        .setValue('');

    const selectRow = new ActionRowBuilder().addComponents(bugSelect);
    const inputRow = new ActionRowBuilder().addComponents(bugReason);

    modal.addComponents(selectRow, inputRow);

    await interaction.showModal(modal);```
i got this with the same error
proud arrow
rose tangle

just look at the methods of each builder and you'll see which components can be added

there's basically addXComponent methods to every component the builder can hold

you can also check the docs and it'll tell you the types it accepts

chrome chasm

the poll partial can't end polls right?

slate tartan

let me see ...

winter merlin

It turned out really nice.

frosty dagger

umm in new modal
how many labels we can add and in label how many components we can add ?

halcyon bison

the limit is still 5 top level components in modals, that hasn't changed

frosty dagger
          const modal = new ModalBuilder()
            .setCustomId('testingNewModals')
            .setTitle('Testing New Modal')
            .addLabelComponents(
                new LabelBuilder()
                .setLabel('Testing New Modal')
                .setDescription('This is a testing new modal')
                .setRoleSelectMenuComponent(
                    new RoleSelectMenuBuilder()
                    .setCustomId('testingNewModalRoleSelect')
                    .setPlaceholder('Select a role')
                    .setRequired(true)
                ),
                 new LabelBuilder()
                .setLabel('Testing New Modal 2')
                .setDescription('This is a testing new modal')
                .setRoleSelectMenuComponent(
                    new RoleSelectMenuBuilder()
                    .setCustomId('testingNewModalRoleSelect2')
                    .setPlaceholder('Select a role')
                    .setRequired(true)
                )
            )
            .addLabelComponents(
                new LabelBuilder()
                .setLabel('Testing New Modal 3')
                .setDescription('This is a testing new modal')
                .setRoleSelectMenuComponent(
                    new RoleSelectMenuBuilder()
                    .setCustomId('testingNewModalRoleSelect3')
                    .setPlaceholder('Select a role')
                    .setRequired(true)
                )
            )
            await interaction.showModal(modal)
frosty dagger
halcyon bison

well each label can only have 1 component, so no

proud arrow

Label only holds 1 component

frosty dagger
proud arrow

Yes really. Notice it is setX and not addX

frosty dagger

some how its working

proud arrow

That is three separate label component

Not one

frosty dagger

😩 ig I am bugging

rose tangle

your code doesn't have more than one component per label

rose tangle

that's what we're saying

frosty dagger

sorry

slate tartan
const modal = new ModalBuilder()
    .setCustomId('bug_modal')
    .setTitle('Bug Report');

const bugSelect = new StringSelectMenuBuilder()
    .setCustomId('bug_string_select')
    .setPlaceholder("Choose...")
    .addOptions(
        new StringSelectMenuOptionBuilder().setLabel('Ant').setValue('ant').setDescription('(best option)').setEmoji({ name: '🐜' }),
        new StringSelectMenuOptionBuilder().setLabel('Butterfly').setValue('butterfly').setEmoji({ name: '🦋' }),
        new StringSelectMenuOptionBuilder().setLabel('Caterpillar').setValue('caterpillar').setEmoji({ name: '🐛' })
    );

const bugReason = new TextInputBuilder()
    .setCustomId('bug_explanation')
    .setLabel('Why is it your favorite?')
    .setPlaceholder('Write your explanation here...')
    .setStyle(TextInputStyle.Paragraph)
    .setMinLength(10)
    .setMaxLength(4000)
    .setRequired(true);


const selectRow = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(bugSelect);
const inputRow = new ActionRowBuilder<TextInputBuilder>().addComponents(bugReason);

modal.addComponents(selectRow, inputRow);
await interaction.showModal(modal);```
lime lantern
slate tartan ```js const modal = new ModalBuilder() .setCustomId('bug_modal') ...
const modal = new Discord.ModalBuilder()
    .setCustomId(`MenuSelecionarCanal`)
    .setTitle('Selecionar Canal')
    .addLabelComponents(
        new Discord.LabelBuilder()
            .setLabel('Canal')
            .setDescription('Seleciona porra')
            .setChannelSelectMenuComponent(
                new Discord.ChannelSelectMenuBuilder()
                    .setCustomId('canal')
                    .setPlaceholder('Selecione um canal...')
                    .setMinValues(1)
                    .setMaxValues(1)
                    .addChannelTypes(Discord.ChannelType.GuildText)
            )
    )

await interaction.showModal(modal)

Thanks to @frosty dagger

Got it to work

frosty dagger
golden laurel

You can just do addLabelComponents(label => label.setLabel("Canal")) instead of doing new Discord.LabelBuilder() btw

last mango

Can someone give me docs link for new modal menus?

golden laurel

JSON should work. Try it! That's what builders resolve to in the end

frosty dagger
last mango
sharp ginkgoBOT
rose tangle

the docs are updated

the guide isn't

echo anvil

It's still impossible to defer a modal right ? Thus making it populated with data a bit tricky

halcyon bison

correct

golden laurel
echo anvil

That's what I thought. Thank you

frosty dagger

so inside a modal how to handle those select menu does anyone did that ?

last mango

Can y'all drop a code for the new update

golden laurel

It's kind of no different to sending components in a message, you just make a builder

sharp ginkgoBOT
proud arrow

You recieve it like how you would a text input

Same for other types of selects. You can check the docs for their methods

frosty dagger

just noob question can we use discordjs/builder along side with discordjs in same bot same project

last mango

What about getting the value of the field? Same as regular strings?

red coral

djs comes with builders

red coral

/tag query:✅ subpackages nice

last mango

Okay ty

rigid crest

why is this being changed to clientReady? is this due to discords client having a change for connection?
(node:24744) DeprecationWarning: The ready event has been renamed to clientReady to distinguish it from the gateway READY event and will only emit under that name in v15. Please use clientReady instead.

safe wigeon

If I've changed a bot's avatar, banner, nickname and bio, if I wanna reset it back to the default user info, do I just pass in null for all the things such as when changing the avatar?

rose tangle
chrome chasm

you can't end partial polls in any way right? (Just wanted to confirm)

rigid crest

i see that yes but i always though a ready was just telling a response a 200 ok hmm

red coral

This is gateway, not rest

The discord READY event is when discord sends all of the initial stuff. The clientReady is when djs’s client is ready

safe wigeon
rose tangle

try it and see

rigid crest
frosty dagger
bleak owl

does it work?

halcyon bison
rose tangle

clientReady happens when the client has finished processing everything and is ready to be used by you

they're different stuff, the latter is a djs fabrication

which is why it's renamed

rigid crest

so i need to change this with clientReady,

client.on("ready", () => {
  setInterval(() => {
    const statuses = [
      my_statuses
    ];
    const Activity = [
      0,
      1,
      2,
      3,
      5,
    ];
    const s = statuses[Math.floor(Math.random() * statuses.length)];
    const a = Activity[Math.floor(Math.random() * Activity.length)];
    client.user.setPresence({ activities: [{ name: `${s}`, type: a }], status: 'online' }); // Other status 'offline' 'dnd' 'idle' 'invisible'
  }, 20000);
})

but i also have

const fs = require('fs');
module.exports = {
    name: 'ready',
    once: true,
    execute(client) {
        const totalCommandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
        const totalEventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));

        const commandAmount = totalCommandFiles.length;
        const eventAmount = totalEventFiles.length;

const data = [
    { Action: `Ready!`},
    { Action: `Logged in as ${client.user.username}, Latency: ${client.ws.ping}ms`},
    { Action: `Total Commands: ${client.commands.size}`},
    { Action: `Total Command Files: ${commandAmount}`},
    { Action: `Total Event Files: ${eventAmount}` },
    { Action: `Total Servers: ${client.guilds.cache.size}` },
]
console.table(data, ["Action"])
    },
};

do i change both or just the first

red coral

Tbh, just use the Events enum

rose tangle

every usage

halcyon bison

at the very least, every usage that makes its way to <Client>.on() or <Client>.once()

rigid crest

alright

rose tangle

I'm not sure why you have that first client.on though, if you have an event routing system

chrome chasm
halcyon bison
rigid crest

to me it makes sense but i havnt actually tried having both together

rose tangle

well either way both end up in client.on, so I'd say you should use the system you've made to organize your events

jagged rock

how come guild ban add cant display the length of the ban?

bleak owl

bans aren't temporary, not sure what you mean

halcyon bison
jagged rock
bleak owl

that's not a thing

jagged rock
topaz bluff
jagged rock theban duration

bans arent temporary. they dont have a duration

any duration would be completely managed by a bot that does it for you...that's not a thing discord does

jagged rock
topaz bluff

that's to select how old of messages to delete

bleak owl

where do you see that?

jagged rock
topaz bluff
crisp roost

any chance someone can direct me to djs' docs for setting bios/avatars per guild?

jagged rock
topaz bluff

i this how i would fetch it

const audit = await ban.guild.fetchAuditLogs({
type: 22,
limit: 1
}).catch(() => null);

const entry = audit?.entries?.first();
const deleteMessageDays = entry?.extra?.deleteMessageDays;

sharp ginkgoBOT
crisp roost

ty

rose tangle

you get that manager via Guild#members

frosty dagger

@rose tangle we still can not show another modal in response of a modal interaction?

rose tangle

correct

they only added more components to modals

nothing else on how they function, or their limits

golden laurel
rigid crest

im trying to find the modal changes but i cant see them on the link provided unless they are nested deeper

chrome chasm
unreal stone

Hello! I'm so happy with the new update, but where I can found the documentations about, for Modals:
→ Label builder
→ Type of component ? (especially channel and user select)
Thank you for the hard work!

sharp ginkgoBOT

class LabelBuilder discord.js@14.23.0
A builder that creates API-compatible JSON data for labels.

rose tangle

it has methods for adding select menus

peak hare

Is there a way to get my bot bio/editied guild bot bio? I dont see anything.

rigid crest

setLabel is no more hmm? i mean its no big deal as placeholder still looks to be functional for text based
but for this const textGiven = new ActionRowBuilder().addComponents(commentText); modal.addComponents(textGiven); i use addActionRowComponents?

golden laurel
peak hare
topaz bluff

On DDevs someone said you can send an empty payload to receive the data back but I can't confirm this

golden laurel

That should work yeah if you edit nothing

But I don't think discord.js will show you bio

cedar kindle

what kind of error is this? my server truncated the error bc it was too long

...
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: true,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      _header: 'GET /ephemeral-attachments/1423366179119960214/1425103059536576602/q54m1QAAAAZJREFUAwDVQ7mRZzunfwAAAABJRU5ErkJggg.png?ex=68e65e26&is=68e50ca6&hm=23e5379ef4e10821732be0812d374ed6a67cc187ce5e7adfea09643bc07a0898& HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/1.7.9\r\n' +
        'Accept-Encoding: gzip, compress, deflate, br\r\n' +
        'Host: cdn.discordapp.com\r\n' +
        'Connection: keep-alive\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/ephemeral-attachments/1423366179119960214/1425103059536576602/q54m1QAAAAZJREFUAwDVQ7mRZzunfwAAAABJRU5ErkJggg.png?ex=68e65e26&is=68e50ca6&hm=23e5379ef4e10821732be0812d374ed6a67cc187ce5e7adfea09643bc07a0898&',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'cdn.discordapp.com',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kChunkedBuffer)]: [],
      [Symbol(kChunkedLength)]: 0,
      [Symbol(kSocket)]: [TLSSocket],
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 65536,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    data: <Buffer 54 68 69 73 20 63 6f 6e 74 65 6e 74 20 69 73 20 6e 6f 20 6c 6f 6e 67 65 72 20 61 76 61 69 6c 61 62 6c 65 2e>
  },
  status: 404
}```
golden laurel

That's not an error

cedar kindle

oh huh? what then

unreal stone

Hmm, maybe im stupid, but anyone have an example of a "basic" label (with any new components) ? The guide use deprecated (.setLabel) so I'm a little lost
Sorry

golden laurel
rigid crest
golden laurel
golden laurel
rigid crest
unreal stone
rigid crest

and for the other part i use addActionRowComponents instead addComponents now?

golden laurel

But labels on text inputs still work so I'm not sure what you're trying to say

rigid crest

my ide is saying its been depreceated tho on TextInputBuilder

golden laurel

It just means in the future it will be removed, not that it no longer works

rigid crest

hmm, so i should be fine for the next 6 or 8 months or however long before v15 is out when ig its removed?

golden laurel

If you had:
Modal -> Action row -> Text input (with a label)

The current way would be:
Modal -> Label (with a label) -> Text input (no label)

That's the gist

You can move now or later, but ideally now if you have time

rose tangle

discord deprecated it and will probably remove it in the next api version, whenever that is

djs just follows

deprecated features are removed in djs majors, so yeah it won't be a thing in v15, even if it still works in the api (but it's deprecated)

rigid crest
golden laurel

It says to use label or text display components. Might need to refresh your lockfile if you still see that message, there was a new builders version shortly after release that cleared this up

Action rows in modals are what Discord deprecated so don't use action rows in modals any more basically

rose tangle

generic add methods are only a builders v1 thing, deprecated in favor of the specialized addXComponents, which new v1 builders have (and all v2 builders)

eternal moth

Can someone give me a code example of how to change the bot's avatar per guild? I know it's via Guild#members but I'm not exactly sure.

sharp ginkgoBOT
rigid crest

ok well i broke something

Error handling interaction: ValidationError > s.string()
  Expected a string primitive

  Received:
  | undefined

    at _StringValidator.handle (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2615:70)
    at _StringValidator.parse (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
    at TextDisplayBuilder.toJSON (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@discordjs\builders\dist\index.js:1943:33)
    at C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@discordjs\builders\dist\index.js:2734:64
    at Array.map (<anonymous>)
    at ModalBuilder.toJSON (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@discordjs\builders\dist\index.js:2734:35)
    at ButtonInteraction.showModal (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:402:46)
    at Client.<anonymous> (C:\Users\User\Desktop\Discord Applications\PermitV2\index.js:253:25)
    at Client.emit (node:events:536:35)
    at InteractionCreateAction.handle (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
rose tangle

can you show your code

rigid crest
golden laurel

Your text input builder has no label

You also added the action row builder to a text display component

Your modal is modal -> text display -> action row -> text input

It should be:
Modal -> text display
Modal -> label (or action row) -> text input

rose tangle

the ModalBuilder#addTextDisplayComponents() was forgotten missed in the update, which maybe is where the confusion comes from

it'll be in the next release, which will be soon hopefully

half karma

kudos that the team updated the guide theme after so much time. remembering that v11 and v12 guide nostalgic...

btw why does the guide say discordjs.guide**/legacy**?? Are we getting a new guide?

rose tangle

yeah, the plan is to eventually make a new one

half karma

can someone tell me whats new with the modals and if theres a preview available. thanks for the help in advance.

rose tangle

ddocs probably has some previews

in case you mean usages with djs, check the ModalBuilder docs

half karma

in the modals section?

rigid crest

so do i repalce

const textGiven = new ActionRowBuilder().addComponents(commentText);
      modal.addTextDisplayComponents(textGiven);

with just this then?
modal.addTextDisplayComponents(commentText);

half karma

wait is it like a update to the new display components or v2 comps ig?

unique shoal

yes

half karma
unique shoal

no

Why would that need a v15

half karma

i am asking when v15. like i am 20 now

topaz bluff

when it's needed

unique shoal

Why would there be a v15

We dont need v15

topaz bluff

whats the purpose of updating to v15 if theres no reason to? that's just breaking people's code for nothing

half karma

crazy how it was hyped. well thanks for the help

unique shoal

Nobody who actually knows anything about developing the library has hyped a v15 lol

topaz bluff

at least unironically...some of us joke about it

rigid crest
unique shoal

When there's a change to be released that would be considered breaking, we'll release it as a major version incremement as needed

The new modal components are a minor version

half karma
unique shoal

Its just a new guide theme really

rose tangle
rigid crest

oh right

half karma

and btw, why dont we have a proper ts code tab on the codeblocks like other lib docs yet? i mean just a suggestion that its good for advanced programmers

rose tangle

pretty much the code is exactly the same

unique shoal

Because nobody has written them yet

rose tangle

the "biggest" change is probably the action row generic

sharp ginkgoBOT

In TypeScript the ActionRowBuilder class has a generic type parameter that specifies the type of component the action row holds:

const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button)
const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu)
const row = new ActionRowBuilder<TextInputBuilder>().addComponents(textInput)
rigid crest

so for label id use const labelText = new LabelBuilder()?

half karma

djs docs currently are more like information about everything and the best readable docs for new comers. well lets not chat casually here

rigid crest

on hover theres a example what is "component" reffering to?

unreal stone

I feel (again) stupid.
I wrote this :

const userIdInputs: Djs.LabelBuilder = new Djs.LabelBuilder()
        .setLabel(ul("common.user"))
        .setUserSelectMenuComponent(
            new Djs.UserSelectMenuBuilder()
                .setCustomId("userID")
                .setPlaceholder(ul("modals.user.description"))
                .setRequired(true)
                .setDefaultUsers([interaction.user.id])
                .setMaxValues(1)
        );

and i got the user by this :

const userFromField = interaction.fields.getSelectedUsers("userID", true)?.map((u) => u.id)[0]

But when I try to send the modal, i get :

 Cannot read properties of undefined (reading 'users')
Stack:
    at  (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:167)
    at resolveCollection (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:160)
    at ModalSubmitInteraction.transformComponent (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:167)
    at ModalSubmitInteraction.transformComponent (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:139)
    at  (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:83)
    at  ()
    at new ModalSubmitInteraction (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:82)
    at InteractionCreateAction.handle (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\client\actions\InteractionCreate.js:94)
    at module.exports [as INTERACTION_CREATE] (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4)
    at WebSocketManager.handlePacket (\node_modules\.pnpm\discord.js@14.23.0\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352)
coarse bear

its broken

unique shoal

That... does look internally broken

unreal stone

hmm, will try to rebuild my node_modules before creating an issue

rigid crest
unique shoal

Either resolved or this.client appears to be undefined, let me check

golden laurel

Yeah this.client is undefined

unique shoal

oh kek

Oh right because its a static method

Of course

rigid crest
unreal stone

Should I open an issue ?

rigid crest

what am i dong wrong


      const modal = new ModalBuilder()
        .setCustomId('commentResponse')
        .setTitle('Leave a comment');

      const commentText = new TextInputBuilder()
        .setCustomId('comment-text')
        .setPlaceholder('Enter your comment here...')
        .setStyle(TextInputStyle.Paragraph)
        .setRequired(true);

      const labelText = new LabelBuilder({
        label: "label",
        component: commentText,
      }).setLabel('Label');

      modal.addLabelComponents(labelText);
      modal.addTextDisplayComponents(commentText);
Error handling interaction: ValidationError > s.string()
  Expected a string primitive

  Received:
  | undefined

    at _StringValidator.handle (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2615:70)
    at _StringValidator.parse (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
    at TextDisplayBuilder.toJSON (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@discordjs\builders\dist\index.js:1943:33)
    at C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@discordjs\builders\dist\index.js:2734:64
    at Array.map (<anonymous>)
    at ModalBuilder.toJSON (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\@discordjs\builders\dist\index.js:2734:35)
    at ButtonInteraction.showModal (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:402:46)
    at Client.<anonymous> (C:\Users\User\Desktop\Discord Applications\PermitV2\index.js:258:25)
    at Client.emit (node:events:536:35)
    at InteractionCreateAction.handle (C:\Users\User\Desktop\Discord Applications\PermitV2\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
golden laurel

You're adding a text input to a text display

rigid crest

stressedcomputer so i change TextInputBuilder -> TextDisplayBuilder? does textinputstyle stay the same?

unique shoal

Displays have no style

You need to be using the right components and methods

rigid crest

i dont see anything to add text input when i do modal.addtext stressedcomputer

safe wigeon

Is there a way to fetch the bot's guild member bio (user bio if no guild member bio ofc)?

unique shoal

You add a text input component to a label builder

rigid crest

so modal.addLabelComponents(labelText,, commentText);?

unique shoal

We might need to fix our guide

Why are you just making up random stuff....

rigid crest

im not im over-processing and nothing makes sense anymore

unique shoal

There are two ways right now

And Im still wrapping my head around which is which, one sec

rigid crest

i have these:

    const commentText = new TextInputBuilder()
        .setCustomId('comment-text')
        .setPlaceholder('Enter your comment here...')
        .setStyle(TextInputStyle.Paragraph)
        .setRequired(true);

      const labelText = new LabelBuilder({
        label: "label",
        component: commentText,//so this already latches?
      }).setLabel('Label');
unique shoal

no it does not

actually yes it might

Try that

rigid crest

ok it worked

terse void

I'm having an issue where I get the ping highlight but it's not actually pinging me.

await interaction.reply({
            components: [container],
            flags: MessageFlags.IsComponentsV2,
        });

Raw interaction result as seen in screenshot 1

{
    "type": 20,
    "content": "",
    "attachments": [],
    "embeds": [],
    "timestamp": "2025-10-08T20:30:57.773Z",
    "editedTimestamp": null,
    "flags": 32768,
    "components": [
        {
            "type": 17,
            "id": "0",
            "accentColor": "hsla(189, calc(var(--saturation-factor, 1) * 100%), 50.8%, 1)",
            "spoiler": false,
            "components": [
                {
                    "type": 10,
                    "id": "0,0",
                    "content": "@lapis rain\n@terse void"
                },
                {
                    "type": 10,
                    "id": "0,1",
                    "content": "-# :AR_Icon: Summoned by @terse void • Last updated by @terse void • Permission: :SAR: Senior Application Reader"
                }
            ]
        }
    ],
...
}
``` Anything I'm missing here?
rose tangle

can you show your client constructor

terse void
new Client({
            intents: [
                GatewayIntentBits.Guilds,
                GatewayIntentBits.GuildMembers,
                GatewayIntentBits.GuildMessages,
                GatewayIntentBits.MessageContent,
                GatewayIntentBits.GuildMessageReactions,
            ],
            partials: [Partials.Channel, Partials.Message, Partials.Reaction],
        });

I also have a command logger where I explicitly set allowedMentions to none because it was pinging me, so I find it incredibly weird why it won't ping me now

steel trail
red coral
terse void

Let me show you what the expected result is when I take off the allowedMentions from my commandlogger so it pings me

steel trail

I see no difference

terse void

check the 2nd screenshot of both my messages, the red '1' only shows in the latter

while it is expected for the first one as well (it indicates a non suppressed ping)

steel trail

I see no red 1

terse void
steady vale

good afternoon!! The limit for Modal is still 5 elements?

rose tangle

5 top level components, yes

steel trail

Ah, you sent a second screenshot which shows completely black in preview... 🤦‍♂️

radiant epoch

Is this version have code breaking changes by the way since modals are affected?

stable sun

It just adds features w/o breaking existing js code

radiant epoch

Thanks

steel trail

That doesn't look like the original discord app though Thonk

terse void

^^^^

steel trail

We don't support TOS violations

terse void

Okay man

stable sun

Minor changes will never break existing js code

radiant epoch
terse void
rose tangle

that's only for major versions (v14 > v15)

they can break ts code though

radiant epoch

Gotta work on new branch

stable sun

It’s also why I don’t recommend extending classes from d.js or any that you didn’t declare in general

grand slate

There is a doc a doc for modals update?

terse void
tardy sable
terse void

even giving the mention highlight but not sending any notifications

topaz bluff
rose tangle

that's a known "issue" most people encounter and ask here, because they're used to embeds which don't ping

terse void

are you able to test it yourself with a minimal sample? interaction.reply with a container that holds a TextDisplayBuilder with content your userMention

channel.send of the same content does not suppress the mentions, interaction.reply with the same content does

jovial citrus

can i add select menu inside embed?

bleak owl

no, but a container you can

jovial citrus

then what is builder

unique shoal

ContainerBuilder

jovial citrus
unique shoal

That is putting them in modals

Not embeds

jovial citrus

it says v1

unique shoal

builders is a package in the monorepo for building components

This adds that functionality to v1 of the builders package

Not sure where you got "embeds" from any of that

jovial citrus

nvm my 2kb brain cant process that

unique shoal

All good

v1 is the version djs v14 uses so

sudden cedar

maybe not fully djs related but its about discord-api-types
in what cases would applied_tags be undefined in a ThreadCreate event? i havent worked with threads/forums before so im not too sure how they fully work yet

golden laurel
golden laurel
rose tangle
terse void are you able to test it yourself with a minimal sample? interaction.reply with a...
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.on("ready", async () => {
  await client.application?.commands.set([{ name: "container", description: "Container test" }]);
});

client.on("interactionCreate", async (interaction) => {
  if (!interaction.isChatInputCommand()) return;

  const channel = client.channels.cache.get("1290575358948671502");
  if (channel && channel.isSendable()) {
    const container = new ContainerBuilder().addTextDisplayComponents((text) =>
      text.setContent("@rose tangle")
    );

    await interaction.reply({
      components: [container],
      flags: MessageFlags.IsComponentsV2,
    });

    await channel.send({
      components: [container],
      flags: MessageFlags.IsComponentsV2,
    });
  }
});

client.login(process.env.DISCORD_TOKEN);

works fine for me

terse void

That's a channel.send, it won't ping you in the interaction.reply (no red 1), move away from the channel right before it sends the reply to check

rose tangle

check 0:13

terse void

Thanks, realised my issue was with deferring

unreal stone

And there again :

 TypeError  Cannot read properties of null (reading 'get')
Stack:
    at ModalSubmitInteraction.transformComponent (\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:185)
    at ModalSubmitInteraction.transformComponent (\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:145)
    at  (\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:83)
    at  ()
    at new ModalSubmitInteraction (\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:82)
    at InteractionCreateAction.handle (\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\client\actions\InteractionCreate.js:94)
    at module.exports [as INTERACTION_CREATE] (\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4)
    at WebSocketManager.handlePacket (\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352)
    at WebSocketManager.<anonymous> (\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:236)
    at WebSocketManager.emit (\node_modules\.pnpm\@vladfrangu+async_event_emitter@2.4.7\node_modules\@vladfrangu\async_event_emitter\src\index.ts:524)
stable sun

Is that after updating?

unreal stone

yes 14.23.1

unique shoal

14.23.1 mmLol

@golden laurel still borked

golden laurel

What did you do haha

@unreal stone^

unreal stone

Heuh, same things as i done in my issue, but I use logger to send me the errors, wait a minute i will use console.error

golden laurel

I cannot reproduce that

unreal stone
TypeError: Cannot read properties of null (reading 'get')
    at ModalSubmitInteraction.transformComponent (N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:185:30)
    at ModalSubmitInteraction.transformComponent (N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:145:25)
    at N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:83:30
    at Array.map (<anonymous>)
    at new ModalSubmitInteraction (N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:82:45)
    at InteractionCreateAction.handle (N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\client\actions\InteractionCreate.js:94:25)
    at module.exports [as INTERACTION_CREATE] (N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketManager.<anonymous> (N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\discord.js@14.23.1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:236:12)
    at WebSocketManager.emit (N:\Documents\Github\dicelette\discord-bot\node_modules\.pnpm\@vladfrangu+async_event_emitter@2.4.7\node_modules\@vladfrangu\async_event_emitter\src\index.ts:524:28)
rose tangle

can you show your exact code

unreal stone

everything is here

golden laurel

Yeah to reiterate, I can't reproduce that with your code identically

Are you doing something else or something different in Discord? Can you reproduce this consistently?

unreal stone

hmmm.… No, it is the exact same code, and I send the modal as before. I tried to add some logs to understand, but it seems to crash at if (interaction.isModalSubmit())

rose tangle

where are you using the command?

unreal stone

What do you mean by "where" ? The modals works outside of this update (old version with old modals). The bot have access to the channel and it is a message. The modals open by a button.

rose tangle

so in a guild?

unreal stone

Yes !

signal shore

Could you create a super minimal repro sample? Same intents, replicas of the modals, etc?

rose tangle
import {
  Client,
  LabelBuilder,
  ModalBuilder,
  UserSelectMenuBuilder,
} from "discord.js";

const client = new Client({ intents: [] });

client.on("interactionCreate", async (interaction) => {
  if (interaction.isChatInputCommand()) {
    const userIdInputs: LabelBuilder = new LabelBuilder()
      .setLabel("common.user")
      .setUserSelectMenuComponent(
        new UserSelectMenuBuilder()
          .setCustomId("userID")
          .setPlaceholder("modals.user.description")
          .setRequired(true)
          .setDefaultUsers([interaction.user.id])
          .setMaxValues(1)
      );

    const modal = new ModalBuilder()
      .setTitle("Foo")
      .setCustomId("bar")
      .setLabelComponents(userIdInputs);
    await interaction.showModal(modal);
  }

  if (interaction.isModalSubmit()) {
    const userFromField = interaction.fields
      .getSelectedUsers("userID", true)
      ?.map((u) => u.id)[0];

    await interaction.reply({
      content: `You selected ${userFromField}`,
      ephemeral: true,
    });
  }
});

client.login(process.env.DISCORD_TOKEN);

this code works completely fine for me

golden laurel

You're doing something differently that we are not thinking of, so it's not simple, unfortunately

unreal stone

Ah, yes I add the modals as a list, as follow:

const modal = new Djs.ModalBuilder()
    .setCustomId("firstPage")
    .setTitle(ul("modals.firstPage", { page: nbOfPages + 1 }));
const charNameInput: Djs.LabelBuilder = new Djs.LabelBuilder()
    .setLabel(ul("common.charName"))
    .setTextInputComponent(
        new Djs.TextInputBuilder()
            .setCustomId("charName")
            .setPlaceholder(ul("modals.charName.description"))
            .setRequired(template.charName || false)
            .setValue("")
            .setStyle(Djs.TextInputStyle.Short)
    );

const userIdInputs: Djs.LabelBuilder = new Djs.LabelBuilder()
    .setLabel(ul("common.user"))
    .setUserSelectMenuComponent(
        new Djs.UserSelectMenuBuilder()
            .setCustomId("userID")
            .setPlaceholder(ul("modals.user.description"))
            .setRequired(true)
            .setDefaultUsers([interaction.user.id])
            .setMaxValues(1)
    );

const avatarInputs: Djs.LabelBuilder = new Djs.LabelBuilder()
    .setLabel(ul("modals.avatar.name"))
    .setTextInputComponent(
        new Djs.TextInputBuilder()
            .setCustomId("avatar")
            .setPlaceholder(ul("modals.avatar.description"))
            .setRequired(false)
            .setValue("")
            .setStyle(Djs.TextInputStyle.Short)
    );

const channelIdInput: Djs.LabelBuilder = new Djs.LabelBuilder()
    .setLabel(ul("modals.channel.name"))
    .setChannelSelectMenuComponent(
        new Djs.ChannelSelectMenuBuilder()
            .setCustomId("channelId")
            .setPlaceholder(ul("modals.channel.description"))
            .setRequired(false)
            .setMaxValues(1)
    );
const components = [charNameInput, avatarInputs];
if (!selfRegister || isModerator) components.push(userIdInputs);
if (!selfRegister?.toString().endsWith("_channel") || isModerator)
    components.push(channelIdInput);

if (havePrivate && isModerator) {
    const privateInput: Djs.LabelBuilder = new Djs.LabelBuilder()
        .setLabel(ul("modals.private.name"))
        .setTextInputComponent(
            new Djs.TextInputBuilder()
                .setCustomId("private")
                .setPlaceholder(ul("modals.private.description"))
                .setRequired(false)
                .setValue("")
                .setStyle(Djs.TextInputStyle.Short)
        );
    components.push(privateInput);
}
modal.setLabelComponents(components);
await interaction.showModal(modal);
rose tangle

just in case have you tried deleting node_modules and installing again

meager meadow
C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:167
        const users = resolveCollection(resolved.users, user => this.client.users._add(user));
                                                                            ^

TypeError: Cannot read properties of undefined (reading 'users')
    at C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:167:77
    at resolveCollection (C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:160:37)
    at ModalSubmitInteraction.transformComponent (C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:167:23)      
    at ModalSubmitInteraction.transformComponent (C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:139:25)      
    at C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:83:30
    at Array.map (<anonymous>)
    at new ModalSubmitInteraction (C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:82:45)
    at InteractionCreateAction.handle (C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\client\actions\InteractionCreate.js:94:25)
    at module.exports [as INTERACTION_CREATE] (C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\unimamq\discord\ts\examples\Privates\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)

Node.js v22.14.0
golden laurel

Update discord.js

unreal stone
burnt quartz

whats the intended way to add TextDisplay components to a modal?

it seems that setComponents is the only way, but it says thats deprecated and to use setLabelComponents, but that doesn't work with TextDisplay components

golden laurel

Modal error

hardy minnow

hey, im trying to use awaitMessageComponent on a reply, and i've included the withResponse option, but awaitMessageComponent still seems to be not a function. any ideas? yes, i am awaiting the message sent as well

robust haven

it’s my birthday 🎉

rose tangle
rose tangle
hardy minnow

so response.message should get me where i need to be?

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/stable/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
burnt quartz
hardy minnow

ah ok, thanks. how things change sighhh

rose tangle

latest builders version is 1.12.1

you have 1.12.0

burnt quartz

thanks

bitter socket

What's wrong with setDefaultValues? I get an error when I use it.

new MentionableSelectMenuBuilder()
    .setCustomId("0782e2252c7c4dad8ed42daf32061f35")
    .setMaxValues(2)
    .setDefaultValues([
      {"id":"835144575894683678","type":"role"},
      {"id":"316860714260234243","type":"user"}
    ])
)
golden laurel

Use SelectMenuDefaultValueType.Role and SelectMenuDefaultValueType.User

bitter socket

thank you

I still get the same error, but it doesn't tell me much
here are the first few lines it's really long

node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2119
      return errors.length === 0 ? Result.ok(finalObject) : Result.err(new CombinedPropertyError(errors, this.validatorOptions));

I wonder if anyone has even tried to set default value on a mentionable select before lol
seems like noone is using this

rose tangle

yeah looks like it's an issue with the validation, we have spotted it just now

if you want it to work now you can disable it

sharp ginkgoBOT
rose tangle

a fix should be coming soon™ though

lime lantern

Does someone know whats happening?

const modal = new Discord.ModalBuilder()
    .setCustomId(`SelecionarCanal_${id}_${tipo}`)
    .setTitle('Selecionar Canal')
    .addLabelComponents(
        new Discord.LabelBuilder()
            .setLabel('Canal')
            .setDescription('Seleciona porra')
            .setChannelSelectMenuComponent(
                new Discord.ChannelSelectMenuBuilder()
                    .setCustomId('canal')
                    .setPlaceholder('Selecione um canal...')
                    .setMinValues(1)
                    .setMaxValues(1)
                    .addChannelTypes(Discord.ChannelType.GuildText)
            )
    )

await interaction.showModal(modal)

// ---------------

if (interaction.customId.split('_')[0] == `SelecionarCanal`) {
    console.log("test")
}
TypeError: Cannot read properties of undefined (reading 'channels')
    at D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:172:34
    at resolveCollection (D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:160:37)
    at ModalSubmitInteraction.transformComponent (D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:170:26)
    at ModalSubmitInteraction.transformComponent (D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:139:25)
    at D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:83:30
    at Array.map (<anonymous>)
    at new ModalSubmitInteraction (D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:82:45)
    at InteractionCreateAction.handle (D:\Bots\node_modules\discord.js\src\client\actions\InteractionCreate.js:94:25)
    at module.exports [as INTERACTION_CREATE] (D:\Bots\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (D:\Bots\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
 Promise {
  <rejected> TypeError: Cannot read properties of undefined (reading 'channels')
      at D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:172:34
      at resolveCollection (D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:160:37)
      at ModalSubmitInteraction.transformComponent (D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:170:26)
      at ModalSubmitInteraction.transformComponent (D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:139:25)
      at D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:83:30
      at Array.map (<anonymous>)
      at new ModalSubmitInteraction (D:\Bots\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:82:45)
      at InteractionCreateAction.handle (D:\Bots\node_modules\discord.js\src\client\actions\InteractionCreate.js:94:25)
      at module.exports [as INTERACTION_CREATE] (D:\Bots\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
      at WebSocketManager.handlePacket (D:\Bots\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
}
rose tangle

there's a current issue with channel selects

modal components are hard it seems

a hotfix should be released soon

lime lantern
bitter socket

noice
I didn't even need that feature lol I was just making a code generator for discord.js
wouldn't be surprised if nobody would have caught that for a while

tacit veldt

encountered the same issue haha

wraith cedar

Some guide for new model components

tardy sable

or is that not with this modal update

bitter socket

You can select multiple

golden laurel
tardy sable
bitter socket
near dove

yoyo, whats the method of adding the new selectmenu in modals

golden laurel

Make a label, and then add a select menu to it. Then shove it in a modal

near dove

so like a normal select menu builder then just .addComponent?

tardy sable

cant find out how to fix this error

TypeError: Cannot convert undefined or null to object
    at Function.entries (<anonymous>)
    at ModalSubmitInteraction.transformComponent (/home/container/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:184:43)
    at ModalSubmitInteraction.transformComponent (/home/container/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:145:25)
    at /home/container/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:83:30
    at Array.map (<anonymous>)
    at new ModalSubmitInteraction (/home/container/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:82:45)
    at InteractionCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/InteractionCreate.js:94:25)
    at module.exports [as INTERACTION_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:352:31)
    at WebSocketManager.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:236:12) Unhandled Rejection
rose tangle

it's been fixed already, pending release

tardy sable

ok thanks

tardy sable
rose tangle

getXSelectValues

X being Role, Channel or whatever you used

tardy sable

oh okay cuz in the docs i only see these 3

golden laurel

14.13.2 has been released @tardy sable @lime lantern @meager meadow @unreal stone
Try updating and come back if you have any issues!

rose tangle
tardy sable

i was at main

golden laurel

Main is the development version yeah, not 14.x

golden laurel

Ez

unreal stone
obsidian saffron

had the same errors, waitin’ for the fix but i got it workin’ after tweak’n some stuff

rose tangle

what? what did you tweak?

the latest release should work just fine

no need to touch the library at all

@obsidian saffron could you elaborate so we can know if there's some pending fix?

rose turret

anyone know how to utilize https://www.npmjs.com/package/discord-rpc ? I made a quick demo and couldn't get anything to show up and most of the stuff online is like tutorials on how to do it for regular people instead of building an actual app and I'm not going to go and reverse engineer all that obviously

and I'm not entirely sure how correct this is, which some people seem to mention sometimes when I've been looking around

Do also note that discord-rpc is "depreciated in favour of Discord's Game SDK", so expect it not to work in the future.

unique shoal

What exactly do you mean by "instead of building an actual app"

The package pretty much still works as -is

obsidian saffron
rose tangle

I see, that patch has been released already

you should prefer that over a modified copy of the library

obsidian saffron

so tmr when i update the bot i'll just use the new patch right away 3D_OKLOL

limpid pecan

I found a bug related to modal interactions, where can I report it?

bleak owl

is it a d.js bug or a discord bug

limpid pecan

discord.js

bleak owl

what’s the bug

limpid pecan
C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:184
        for (const [id, member] of Object.entries(resolved.members)) {
                                          ^

TypeError: Cannot convert undefined or null to object
    at Function.entries (<anonymous>)
    at ModalSubmitInteraction.transformComponent (C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:184:43)
    at ModalSubmitInteraction.transformComponent (C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:145:25)
    at C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:83:30
    at Array.map (<anonymous>)
    at new ModalSubmitInteraction (C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:82:45)
    at InteractionCreateAction.handle (C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\client\actions\InteractionCreate.js:94:25)
    at module.exports [as INTERACTION_CREATE] (C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)        
    at WebSocketManager.<anonymous> (C:\Users\barte\OneDrive\Pulpit\dbm bot ┃ v14\node_modules\discord.js\src\client\websocket\WebSocketManager.js:236:12)

Node.js v22.19.0
bleak owl

what version are you using

limpid pecan

14.23.1

little pebble
limpid pecan
bleak owl

?

limpid pecan
rose turret

I just had to wait a bit, so that was mb 😔

dapper scarab

is calling undocumented apis bannable?

stable sun

I don’t think so

Only "becomes" bannable when you break other rules. Automating with user tokens, overloading Discord api, etc.

dapper scarab

i see, thanks

bitter glade

Hello, are these components v2 only available in dev versions?

snow onyx

everything was released yesterday

bitter glade

I have the latest version, but I still get an error saying that I don't have TextDisplayBuilder in discord.js.

rose tangle

try nuking your lock file and node_modules

make sure you don't have /builders installed separately

oblique seal

What's the current Modal Components limit?

frosty dagger
bitter glade
frosty dagger
bitter glade

14.23.2

frosty dagger
bitter glade

There is an error in this passage: const container = new ContainerBuilder().addComponents(text, new SeparatorBuilder(), ...buttons);

bitter glade

yes

bitter glade
frosty dagger
sharp ginkgoBOT

class ContainerBuilder discord.js@14.23.2
A builder that creates API-compatible JSON data for a container.

dense jackal
sharp ginkgoBOT
frosty dagger

@bitter glade use any of this method based on your components . each one takes another builder of that component

bitter glade

Yes, I checked. This code was generated by GPT because I wanted to test how these new components work. Now it works.

dense jackal
frosty dagger
bitter glade
dense jackal
dense jackal
maiden kraken

hi everyone, I need some confirmation please ( i apologize if this has already been answered before)
My bot sends an ephemeral message after executing a command. This message has a button. When this button is pressed, it triggers a modal. Once this modal is sent, I would like to edit the content of the original ephemeral message.
It seems to me that this is not possible because the original message is ephemeral. in a way, i would have liked to do something like an .update() on the SubmitModalInteraction.
is there a way to workaround this anyway? ty!

frosty dagger
dense jackal

so <ModalSubmitInteraction>.update() fails?

oops forgot to reply to illan’s message

sharp ginkgoBOT

method ModalSubmitInteraction#update() discord.js@14.23.2
Updates the original message of the component on which the interaction was received on.


// Remove the components from the message
interaction.update({
  content: "A component interaction was received",
  components: []
})
  .then(console.log)
  .catch(console.error);

maiden kraken

"The update property does not exist on the type..."
edit : im far from being an expert so please bear with me 🥺

stable sun

You would need to check to make sure the modal came from a message

sharp ginkgoBOT
dense jackal

couldn’t make that up from your message

maiden kraken
oblique seal
dense jackal

@unique shoal (unable to ping mods role from mobile)

cosmic grotto
vocal garnet

Is it possible to set the presence of a bot to this smartphone online icon with discord.js?