#djs-help-v14
78874 messages · Page 48 of 79
tip, you can use subcommands instead of doing "-"
Deprecated.
On August 8, 2023, in change log, Discord announced the new activity state: custom (4). In discord.js, it was merged to main on August 12, 2023
-# References:
-# 1. https://discord.com/developers/docs/change-log#activity-state-for-bot-users
-# 2. https://github.com/discord/discord-api-docs/pull/6345
-# 3. https://github.com/discordjs/discord.js/pull/9743
#djs-help-v14 message they immediately said "nvm" because they missunderstood the question
is v13 discontinued?
yes
d.js has nothing to do with file structure
that's not a d.js feature
How you set your commands up file-wise is completely up to you
Is there a way to setup a TextInputBuilder so that it only accepts numbers? Or something that would accomplish the same effect
no
youll have to add check after submit
I see, thanks
my slash commands got duped, how do i clear the dupe commands
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.
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: [] })
didnt work
you don't add buttonOne to modGriefContainer The object you pass back needs to be modified
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
quick question
i was creating a bot and wondered
is this https://discord.com/developers/docs/components/reference#user-select implemented yet or should i just stick to sendind raw request for now?
did you actually run the script after modifying it
Oooh okay, how can i do that?
you have the GUILD_MESSAGE_POLLS intent? If yes it could be a Discord issue
i ran node deploy-commands
also saved the file before doing that
yes
for regular messages? yes. for modals? not yet
you can send them with a raw api request but d.js cannot handle incoming modals with them yet
i meant for modals
show your code
thanks :))
easiest is to just rebuild the container with the updated button
its the one from the discordjs.guide
try refreshing your client after running it
ctrl + r
if you guys need i can do a pull request somewhere to add it to the official library
alr
there's a pr pending
gotcha
So i'd need to put the entire container code into this block and if i have 9 of these buttons, all of them need it?
can you show how you build the container
Like so
I'm more interested on where you use buttonOne
oh wait
so to update the button you need to update the button in the section in the container
So inside this, i'll need to add this section again and then update the component
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
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
also as an aside recommend using the enum ButtonStyle insted of "Danger" and "Success"
Why so?``
less room for error using ButtonStyle.Danger intend of "Danger"
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
does djs support modal components
not quite yet
any eta?
nope
hi how to get aboutme?
bot are not allowed to
oh and status?
documentation suggestion for @fluid cedar:
GuildMember#presence discord.js@14.22.1
The presence of this guild member
you need to add GUILD_PRESENCES intent to your bot
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
yes, you can
Thank you 
Webhook#deleteMessage() discord.js@14.22.1
Delete a message that was sent by this webhook.
you just need the message Id or message object
I am just rereading your message I am not sure you can use <Message>#delete() but you can delete it with the <Webhook>#deleteMessage function on the webhook
Gotcha thank you yeah, I'll test the first one out I suppose
Are there any modal options that are dropdown menus or selectable similar to select menus? Or must they all be text fields
i mean this
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.
did you add the presence intent?
yes
and in your client?
here?
const { Client, GatewayIntentBits, Collection, ActivityType, Partials } = require('discord.js');
also activity.type you want to check for ActivityType.Custom
so what change
client({
intents:[
GatewayIntentBits.GuildPresences
]
})
type is a number ActivityType is an enum with all of the types. ex ActivityType.Custom is 4
Bump
Not in djs yet
Appreciated is it expected in the future?
yes
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}`)
)
It’d be easier if you factored it out
wdym by "factored it out"?
Put into a variable
As opposed to putting it in a single line "inline"
Sure you would update messages content. `Message#edit({components: [updatedTextDisplay]})
I basically want to send a first message with the TextDisplay I sent above along with some buttons, and when clicking on those buttons, I just want to change the TextDisplay content I sent above with something else based on the button that the user clicked on
But i'm kinda lost on how to do that :/
documentation suggestion for @hasty fern:
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);
The update function is like the edit function but for button interaction.
Yeah but doesnt it mean I would have to create another message component or smth?
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
Had a similar conversation earlier today. Maybe relevant for you.
#djs-help-v14 message
Ok so isn't there a way to avoid that? I just need to modify that single line, nothing more 😔
I'll take a look
When you say single line, are you referring to the content of the text display or just one of the variables used in the text display?
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
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
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
Alright i'll try it, thanks
Well, I tested it and when clicking the buttons it handles the click but it doesn't change the content (bot doesn't crash and there's no errors)
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?
Log out the components to console to validate your index position inside of the container.
Yeah I did that, it's the correct index
You should really be reconstructing it from builders, or retaining references to the original builders
TextDisplayComponent.content is a read only getter
Good to know. Thanks. What is the helper function for recreating builders
They are not raw JSON objects you can work with and repass directly
No helper, just pass to the constructor I think
I thought I recalled a function that would create the correct builder based on the top level component
Oh - if there is I dont know 😄
Tbh the way I'm doing the Components V2 is the one that https://discord.builders uses
but yeah i'll try to modify it
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
Found it
createComponentBuilder discord.js@14.22.1
Factory for creating components from API data.
Does that also work with discord.js components?
No, but close enough
(APIModalComponent | APIMessageComponent) & { type: ComponentType;}
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))
anyone knows how are we using select menus in modals?
i couldn't find any docs about discord.js
Not supported in d.js yet
but we can use it without library right?
Yea
i don't know how but someone told it
If you DIY, the issue isn’t sending from d.js, it’s receiving it in d.js
i need that way do you know how are we doing it
There is no I in we
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
I don’t think main even has it yet
what happens if you try to add a role the user already has?
will the action fail?
No
doesn't seem to make any difference at all.. isn't payload generally doing the same thing, tho?
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?
Do you have the GUILD_MEMBERS intent? Since that is required to receive guildMemberUpdate.
IN djs this would be GatewayIntentBits.GuildMembers
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
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.
Our userUpdate is an artificial one
We emit it out of the guildMemberUpdate if the underlying User changed
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?
user_update only emits for current user change
That gets sent when the current bot user changes.
gotcha
yes
well I had intents and for other member updates that event start but when I change my guild tag it didn't start
iirc it only emits the event for cached members
Unless you enable partials
well I have partials...
Someone help me pls i need help im on ios idk how to add my code to a bot
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]
});
Someone help me pls i need help im on ios idk how to add my code to a bot
- dont spam
- its not DJS Related #1081585952654360687 maybe here to ask
BTW as its a private bot for just one guild fetching all members in client ready event should solve the problem?
It could
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
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
});
}
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
It's read only because this way you modify your cache directly, and it would no longer match the reality
What you guy's think about #1424872782981894365
I got this role has 165 members, but when i use fetch and get role members size, it only caches 20...
you have to fetch members first before getting the role member size
fetch the guild members?
yes
make sure you have the GuildMembers intent
oh, ty, it works now

Yeah didn't work with this either
Could you recommend a fix, I've tried to find a solution for days now :d
Make new component builder out of the data
So entire new component (copied into the fnc?)
Yes, as you had to do with some things for years
Embeds, other components
@loud quartz
Can I have questions to you?
To me? No.
If it's about discord.js, just ask it
If not, try #archive-offtopic
Nah , how u did the time in your about me ?
Ok
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
if you're going to do it that way then do a function instead
For the same years you could reuse the received data
but I really think your first attempt should've worked
I'll try to test it locally
for now just make a function
how many slash commands we can register?
https://discord.com/developers/docs/interactions/application-commands#registering-a-command
An app can have the following number of commands:
- 100 global
CHAT_INPUTcommands- 5 global
USERcommands- 5 global
MESSAGEcommands
ty
My command list is 65 but i am gonna to stop making slash commands and make prefix commands
huh
why would you switch from slash commands to prefix commands
use subcommands and subcommand groups
if you have two commands /add-role and /remove-role you should indeed use subcommands with /role as top level command and then “add” and “remove” as subcommands
That what i been doing
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
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
No moderation bot with a few sub commands
How to delete a global commnd
/ban and /kick are built in if you have those, then still you can do /moderation with subcommands kick, ban, timeout etc
Just remove it coe
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: [] })
^ by doing that
Oh that is what my bot does on every restart
So for me just by removing the command from CommandHandler will work
Are you using typescript?
Yup
Delete the folder where your code compiles to
Chances are the removed. Commands are still in JavaScript form
why do you delete your commands on start though
Let me send me command handler code
why is everything any
just use js at that point
and use the enum instead of numbers with comments
Cause i did not make Interfaces for them
I was working on that
also that seems to only fill a slashCommands collection, you're not doing anything with it yet
you should make the interface first and then the code so you don't do double the amount of work
unless you're migrating from js?
fwiw you should not be deploying commands on every bot start-up
Do i just make a command to load the globals then
Instead of loading on startup cause that is how i have it set to
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
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);
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.
You can’t send a message to a channel you can’t see
Even more so with private threads
SendMessages != ViewChannel
discord allows you to do this
your code is only checking for the value below, not the one above
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);
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
Sections can't have separators
Containers can have separators
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
It's just a enum
If you see, the actual value is interactionCreate
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
Ah got it. I just wasn't sure if it was a different type of method or not. Thanks!
Where can I view rate limits applied to interaction endpoints?
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
Would it be safe to assume they are substantially more lenient than the 50/sec global rate limit applied to other endpoints?
I believe that is the only rate limit hold up
you'd be better to ask in ddevs, as that's not anything the library has control over
Nvm they are just not bound to the global rate limit
https://discord.com/developers/docs/topics/rate-limits#global-rate-limit
No, the documentation says they have a different rate limit bucket
But I couldn't find exact numbers anywhere either
each interaction has its own ratelimits
You won't
so it's not something you'll likely reach ever
role.permissions.has('Administrator')
is it valid?
PermissionsBitField#has() discord.js@14.22.1
Checks whether the bitfield has a permission, or multiple permissions.
the docs says it is, so it should ¯_(ツ)_/¯
try it and see
how can I forward a message?
Message#forward() discord.js@14.22.1
Forwards this message
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?
how to forward it to a user DM?
pass the dm channel
should I define it with user.createDM or just user id?
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
that'll only work if you have the user id cached
can you npm ls discord.js
also this isn't how you check whether the event was a role create
that if will always be true
LOL i missed that
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
discord.js@14.22.1 -> .\node_modules\.pnpm\discord.js@14.22.1\node_modules\discord.js
then what should I do?
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
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);
}
it says doesn't work with (partial) group dm channels
i looked in auditLog.d.ts and seems like only color is there not colors
My bad. Missed "Exclude"
looks correct but try it and see
okay and two other questions
- what intents and partials do I need?
- in which cases user.createDM() will get an error?
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
How does fetching entitlements work? Can you fetch the ones from a specific user?
client.application.entitlements.fetch()
okay tnx <3 and what about second question?
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
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
its context menu cmd
for the latter, I'm not sure whether that method errors when the user doesn't receive dms
you can test it
so member.user.createDM() will always works even if member blocked bot or closed their DM?
^^
well if I could I wouldn't ask but I don't know which cases should I check XD
you could just block the bot and use the command on yourself
Always works
well fair enough
tnx @stable sun
ah, there you go
You get an error once you send a message
you can see the code to see how it works, but in essence it just uses the entitlement(s) endpoint
Entitlements Resource - List Entitlements
read more
and how can I fetch all members in a role?
and yes, you can fetch one
EntitlementManager#fetch() discord.js@14.22.1
Fetches entitlements for this application
see the 2nd overload's options
So I'd have to fetch it, and then sort them afterwards?
you can't, you need to fetch all members
sort them for what?
for only one specific userId
then you meant filter?
yeah sorry
and also I said you can fetch a single one
or well, from a single member
I think I worded that poorly
ok tnx
Oh okay, I'll take a look at that one. Thanks
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;
}
}```
You have to use a mix, like SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder | SlashCommandSubcommandGroupBuilder;
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
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
And btw if i changed my type to that do i still use SlashCommandBuilder or SlashCommandOptionsOnlyBuilder when making a new cmd with my class
RESTPostAPIChatInputApplicationCommandsJSONBody
u use the main one still, slash command builder
Okay
Something lke this
Ah okay thanks for showing me that way too. I'll stick with the builder though for my cmds
You can still use the builder, you just call .toJSON at the end, but depends if you don’t mind doing builder | other builder | …
I don't think SlashCommandSubcommandGroupBuilder should be there
Tbh I made it ages ago lol
SlashCommandOptionsOnlyBuilder is not an actual class, it's just a type
<@&839912195994812420> ty
Can I followUp to an interaction that hasn't been replied to yet?
no, because there's no interaction to followUp from
if you defer and then followUp it'll behave as editReply but that behavior is deprecated
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
if you just want the commands to appear in all servers, deploy globally
i have some commands that are based on unique variables
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?
yeah, its being extremely inconsistent about deploying commands successfully
can you show your deploy code
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;
}```
does it show the success message for that server, with the data you expect?
it legit just stalls forever, no success log
no error either
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
absolutely
rest.on('rateLimited', console.log(chalk.redBright(`Rate Limited on Guild Command Deployment for ${server.serverName || serverId}`) ))
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))
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
that sounds really weird
are you 100% sure it's saved?
can you place a log right before put just in case
ill redo it rn after spamming cmd s a million times lol
and added the logs
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.
halp
still sitting, even now lol
hmm that sounds really weird
what about in the catch?
you can only get it from the user
User#primaryGuild discord.js@14.22.1
The primary guild of the user
can a private bot have dm commands?
what do you mean by "private bot" specifically?
figuring out how to make dm commands work and i guess i have to enable it in the installation page? but having this error
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
that's a question better fit for ddevs (#useful-servers)
this is for support specifically with djs
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?
please wait for someone to answer your thread, https://discord.com/channels/222078108977594368/1425276531370098748, instead of posting in multiple channels

guildAuditLogEntryCreate event does not emit when audit logs stack?
whats a good way to handle this edge case?
you have to listen to the event and get the audit log after
yeah, it's create, not update
is there another event for update then?
Sadly no
Would’ve been better if update was never a thing at all tbh. Just handle combining logs on the client side
how do you fetch a GuildPreview for a guild the client is not in?
As far as I'm aware that is not possible for bots
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?
fetch checks cache first
But if you have the Guilds intent theyll all be cached
when does the app cache the guilds - on startup ?
yes
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)
why there is no status of this app? Also how to remove that online idle and dnd thing
Because it is an app, not a bot
Slash commands only
no
Modals require an interaction to respond to
makes sense... damn it
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
// 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
I'm setting the role into string or not?
And this is the doc when I hover fetch()
public RoleManager.fetch(id: Snowflake, options?: BaseFetchOptions): Promise<Role | null>
I'm using "discord.js": "14.22.1"
It's also null here https://discord.js.org/docs/packages/discord.js/14.22.1/RoleManager:Class#fetch
Ids should never be represented as a number at any point in js runtime
JS numbers only supports up to 53 bits. Snowflakes require 64 bits
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.
you aren’t applying any numeric operations with it, so then it is better to use a string type instead
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?
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
Why doesn’t it seem to work?
Hey I wanted to ask if there is someone here who has made a commercial discord game bot? I had some questions for them
How feasible it is to make a game discord bot for commercial purposes? Like I wanted to earn some money from a side project I was working on it's a game based on a novel so can I monetize it and earn decent amount of money?
Because djs internals throw errors since the modal data is different iirc, so it's accessing undefined property etc
So you understand that the issue is internally. You ignoring in the interactionCreate listener will do nothing. D.js doesn't yet support receiving modal components. You can either keep ignoring the error. Or wait for modal components support in d.js
(I'm not the person with the issue, I was just replying for them, I already solved it for myself)
Oh, mb. Got confused
Np
How easy it is to monetise depends entirely on how much people want to pay to use it
If it's not your novel though, profiting off someone else's work without permission is not a good start
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)
);```
it's setURL
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");
OH SHIT, thank you
it's just a different version of the same package
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
oh okay
ill just wait for modal update then 
but does it mean then next release is v15?
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
How to add options in the </command:commandID> command link?
it's not possible
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?
we're still working on the release for modal components
aaahhh thought its my problem
i mean that IS an api error, so your API payload is wrong
but discord.js does not have that feature set
since im using discord.js i will wait any estimate date?
SoonTM
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: .
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
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...
there isn't a supported way
I cry.
one would be to clone the repo, build it and link it locally but obviously that's not user-friendly
yeah and I don't really wanna do that in prod :p
the official advice is to wait for a release
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)
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
You I will allow to ping me, but whats up
oh
yeah wait like 30 min or smth
Basically the github has a fix that I need
smh vlad no leeks!
Woooo ty \o/
I'll take a break in the meantime haha
LETS GOOOOOOOOOO
please keep the excitement to #archive-offtopic
Just curious, does this also support the upcoming file upload component? (I assume no)
no
that'll come after the docs pr for it is merged
Alright, thanks!
you probs can send it raw, who knows
im assuming in a 14.23.x
.24 but yes
It is now right :p
yes
Well done djs maintainers. ❤️❤️❤️ stops the constant requests for this release 😆😆😆😆
finally
So why is this happening?
can you show the code snippet too? looks like author is null
The author property of the message is null
yeah that'd be a partial message
you enabled partials and are not handling the partial case
anyone wondering about this, the answer is you cannot
still not public, presumably docs pr will merge when it is
Yeah thanks
how it works bio and avatar per guild?
Could you explain it to me with an example code?
if i update package, it will break the current modals i made in code?
I don't believe that was actually backported before the latest release, so I don't believe djs supports that yet
Some things are deprecated yeah
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
it shouldn't
but if it does, open an issue
It should not. However, you may receive a warning to indicate that some code is deprecated. And should be updated. breaking change only occurs on major versions(note for TS breaking type changes may occur as they are not considered breaking)
okay thanks
documentation suggestion for @rustic lantern:
ModalBuilder#addLabelComponents() builders@1.12.0
Adds label components to this modal.
I've been told it did make it in
it seems you'd use <Guild>.members.editMe(), not sure if <GuildMember>.edit() would also work, but the typings at least don't seem to believe so
i was looking exactly into that, so the text is inside the description?
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
ah ok, now I'll try it on my test bot
.edit() won't work for editing your banner/bio/avatar yeah
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)
Now I can add Channel selectmenus in modals???
which other partials do you have? I believe you also need the message and user partials
yes
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);
Oh I see let me try
labels are intended to be labels for other components
you'd want a text display which apparently didn't make it to the builder
you'd need to send it with raw json
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,).
...
}
you don't add the select menu directly
you need to add a label which will have the select menu
yes!!! im not alone with it!!
ah, nvm I missread it, you need the action row
So first i need to add the label then add the channel select into thhe label?
So the text display hasn’t been implemented yet, huh?
same with messages, select menus need to be wrapped in an action row
That is not the builders
it does support sending and receiving
there just isn't a method on the builder
oh, i see ty
If u got it to work, please help me lol
ModalBuilder#addActionRowComponents() builders@1.12.0
[DEPRECATED] Use addLabelComponents instead
so they should be wrapped then, weird
well both methods should work then, but prefer the label
plus you can give it a description
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
Fyi Select menu will not work in action rows for modal. It needs to be in label component
text inputs aren't wrapped in action rows
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
the poll partial can't end polls right?
let me see ...
It turned out really nice.
umm in new modal
how many labels we can add and in label how many components we can add ?
the limit is still 5 top level components in modals, that hasn't changed
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)
so 5 lebel but inside label we can add more
well each label can only have 1 component, so no
Label only holds 1 component
nto really
Yes really. Notice it is setX and not addX
some how its working
That is three separate label component
Not one
😩 ig I am bugging
your code doesn't have more than one component per label
yeah
that's what we're saying
sorry
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);```
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
add components dispatched ig
You can just do addLabelComponents(label => label.setLabel("Canal")) instead of doing new Discord.LabelBuilder() btw
Can someone give me docs link for new modal menus?
what about raw json ?
JSON should work. Try it! That's what builders resolve to in the end
ig guide is not updated yet
Ah okay
ModalBuilder discord.js@14.23.0
Represents a modal builder.
the docs are updated
the guide isn't
It's still impossible to defer a modal right ? Thus making it populated with data a bit tricky
correct
It should be there now. We released a new version of @discordjs/builders for it. Update your lockfile or stuff to see it
That's what I thought. Thank you
so inside a modal how to handle those select menu does anyone did that ?
Can y'all drop a code for the new update
It's kind of no different to sending components in a message, you just make a builder
documentation suggestion for @frosty dagger:
ModalSubmitFields#getStringSelectValues() discord.js@14.23.0
Gets the values of a string select component given a custom id
You recieve it like how you would a text input
Same for other types of selects. You can check the docs for their methods
just noob question can we use discordjs/builder along side with discordjs in same bot same project
What about getting the value of the field? Same as regular strings?
djs comes with builders
@last mango
/tag query:✅ subpackages nice
Okay ty
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.
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?
to distinguish it from the gateway READY event
should work, yeah
you can't end partial polls in any way right? (Just wanted to confirm)
i see that yes but i always though a ready was just telling a response a 200 ok hmm
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
So passing in null will just remove the server profile stuff?
try it and see
oh so like telling a server to wait for the correct boot sequence
https://pastebin.com/jcgNXxWb
is it correct usage ?
does it work?
the structure being partial is unrelated to whether you can end the poll
you're always free to call <Poll>.end() on the assumption you have the permissions and the poll hasn't already ended
that happens way earlier, the ready event sends all the data the client would require to be fully ready
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
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
Tbh, just use the Events enum
every usage
at the very least, every usage that makes its way to <Client>.on() or <Client>.once()
alright
I'm not sure why you have that first client.on though, if you have an event routing system
are you sure? Because I created a poll before starting the client and voted on it after starting it the bot crashes with this error
if you read the error, this is unrelated to the structure being partial
oh wait I see what you mean hold on
well uh ig i just got used to having one i call heartbeat and the other that controls status
to me it makes sense but i havnt actually tried having both together
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
how come guild ban add cant display the length of the ban?
bans aren't temporary, not sure what you mean
ok so it shouldn't be affected by the structure being partial, but this line seems to gloss over that possibility
feel free to open an issue on github
theban duration
that's not a thing
alright sure
it is you can select when there unbanned
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
no when i press ban on someone it says for like 6 hours example
that's to select how old of messages to delete
where do you see that?
oh okay my bad.,
any chance someone can direct me to djs' docs for setting bios/avatars per guild?
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;
documentation suggestion for @crisp roost:
GuildMemberManager#editMe() discord.js@14.23.0
Edits the current application's guild member in a guild.
ty
you get that manager via Guild#members
@rose tangle we still can not show another modal in response of a modal interaction?
correct
they only added more components to modals
nothing else on how they function, or their limits
You can use MessageManager#endPoll() and pass the message id to end the poll in the meantime. That doesn't do any fancy checks
im trying to find the modal changes but i cant see them on the link provided unless they are nested deeper
alright I shall try
yeah okay this one works thanks
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!
ModalBuilder#addLabelComponents() builders@1.12.0
Adds label components to this modal.
LabelBuilder discord.js@14.23.0
A builder that creates API-compatible JSON data for labels.
it has methods for adding select menus
Is there a way to get my bot bio/editied guild bot bio? I dont see anything.
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?
There isn't, it's set and forget
rip
On DDevs someone said you can send an empty payload to receive the data back but I can't confirm this
That should work yeah if you edit nothing
But I don't think discord.js will show you bio
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
}```
That's not an error
oh huh? what then
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
Setting a label still works. The preferred method now is modal -> label -> component
'(label: string): TextInputBuilder' is deprecated.
You can see what methods are available in a modal and a label
That doesn't disprove what I said. Are you trying to say something different?
i have for my commenting on suggestions: idm removing label if it no longer works this way as placeholder is pretty much the same thing right?
const commentText = new TextInputBuilder()
.setCustomId('comment-text')
.setLabel('Your comment')
.setPlaceholder('Enter your comment here...')
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);
i feel stupid, thank you xD
and for the other part i use addActionRowComponents instead addComponents now?
But labels on text inputs still work so I'm not sure what you're trying to say
my ide is saying its been depreceated tho on TextInputBuilder
It just means in the future it will be removed, not that it no longer works
hmm, so i should be fine for the next 6 or 8 months or however long before v15 is out when ig its removed?
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
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)
im also confused for this it says to use that or another way but it gives depreciated
ModalBuilder' of 'modal.addComponents' is deprecated.
but isnt addActionRowComponents what its changing to?
ModalBuilder' of 'modal.addActionRowComponents' is deprecated.
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
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)
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.
documentation suggestion for @eternal moth:
GuildMemberManager#editMe() discord.js@14.23.0
Edits the current application's guild member in a guild.
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)
can you show your code
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
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
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?
o,o
yeah, the plan is to eventually make a new one
glad, its been ig now years waiting for v15 i was over excited
can someone tell me whats new with the modals and if theres a preview available. thanks for the help in advance.
ddocs probably has some previews
in case you mean usages with djs, check the ModalBuilder docs
in the modals section?
so do i repalce
const textGiven = new ActionRowBuilder().addComponents(commentText);
modal.addTextDisplayComponents(textGiven);
with just this then?
modal.addTextDisplayComponents(commentText);
wait is it like a update to the new display components or v2 comps ig?
yes
v15 sir? 💀
no
Why would that need a v15
yeah that should work
i am asking when v15. like i am 20 now
when it's needed
Why would there be a v15
We dont need v15
whats the purpose of updating to v15 if theres no reason to? that's just breaking people's code for nothing
crazy how it was hyped. well thanks for the help
Nobody who actually knows anything about developing the library has hyped a v15 lol
at least unironically...some of us joke about it
same error as before and the only change is what i mentioned form the original link
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
its not like that. the way everything was changing in the docs hyped me of it. well isnt rly required ovb but it looked cleaner to me
Its just a new guide theme really
@rigid crest
oh right
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
pretty much the code is exactly the same
Because nobody has written them yet
the "biggest" change is probably the action row generic
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)
so for label id use const labelText = new LabelBuilder()?
djs docs currently are more like information about everything and the best readable docs for new comers. well lets not chat casually here
on hover theres a example what is "component" reffering to?
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)
its broken
That... does look internally broken
hmm, will try to rebuild my node_modules before creating an issue
i have this frm looking at example, do i need to change what component is to where i want it to go?
const labelText = new LabelBuilder({
label: "label",
component,
}).setLabel('Label');
Either resolved or this.client appears to be undefined, let me check
Yeah this.client is undefined
oh kek
Oh right because its a static method
Of course
Error handling interaction: ReferenceError: component is not defined so ig i was right it needs to be pointed?
Should I open an issue ?
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)
You're adding a text input to a text display
so i change TextInputBuilder -> TextDisplayBuilder? does textinputstyle stay the same?
Displays have no style
You need to be using the right components and methods
i dont see anything to add text input when i do modal.addtext 
Is there a way to fetch the bot's guild member bio (user bio if no guild member bio ofc)?
You add a text input component to a label builder
so modal.addLabelComponents(labelText,, commentText);?
We might need to fix our guide
Why are you just making up random stuff....
im not im over-processing and nothing makes sense anymore
There are two ways right now
And Im still wrapping my head around which is which, one sec
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');
no it does not
actually yes it might
Try that
ok it worked
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?
can you show your client constructor
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
Looks like it is pinging you. What part are you expecting to happen that doesn't?
hsla(189, calc(var(--saturation-factor, 1) * 100%), 50.8%, 1)
this actually works?
it feels suppressed, I expect a red 1
Let me show you what the expected result is when I take off the allowedMentions from my commandlogger so it pings me
I see no difference
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)
I see no red 1
click the image
good afternoon!! The limit for Modal is still 5 elements?
5 top level components, yes
Ah, you sent a second screenshot which shows completely black in preview... 🤦♂️
Is this version have code breaking changes by the way since modals are affected?
No
It just adds features w/o breaking existing js code
Thanks
That doesn't look like the original discord app though 
^^^^
We don't support TOS violations
Okay man
Minor changes will never break existing js code
No I mean like new component for modal has been added so I thought the whole modal input system has been changed too
Hm, I see the difference with my command logger and my tag-render command. I assume interaction.reply does not support non suppressed pings?
it's the same answer, minor changes doesn't break existing js code
that's only for major versions (v14 > v15)
they can break ts code though
Gotta work on new branch
Adding methods and properties isn’t considered breaking
It’s also why I don’t recommend extending classes from d.js or any that you didn’t declare in general
There is a doc a doc for modals update?
honestly this has to be a bug with interaction.reply, cause why would it suppress mentions by default inside components
not yet
even giving the mention highlight but not sending any notifications
i mean there's the docs
https://discord.js.org/docs/packages/builders/1.12.0/ModalBuilder:Class
just no guide
have you tried with an unmodded client? because containers ping by default
that's a known "issue" most people encounter and ask here, because they're used to embeds which don't ping
yes of course
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
can i add select menu inside embed?
no, but a container you can
ContainerBuilder
Features
builders: Modal select menus in builders v1 (#11138) (ac683b9)
That is putting them in modals
Not embeds
it says v1
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
ohh
nvm my 2kb brain cant process that
All good
v1 is the version djs v14 uses so
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
Just released discord.js 14.23.1. Update and try again!
You can't create a thread in the UI and apply labels at the same time
got it thanks
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
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
check 0:13
Thanks, realised my issue was with deferring
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)
Is that after updating?
yes 14.23.1
14.23.1 
@golden laurel still borked
What did you do haha
@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
I cannot reproduce that
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)
can you show your exact code
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?
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())
where are you using the command?
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.
so in a guild?
Yes !
Could you create a super minimal repro sample? Same intents, replicas of the modals, etc?
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
You're doing something differently that we are not thinking of, so it's not simple, unfortunately
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);
just in case have you tried deleting node_modules and installing again
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
Update discord.js
pnpm i --force, yes, but I could try with deletion
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
Modal error
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
it’s my birthday 🎉
ModalBuilder has addTextDisplayComponents, make sure your @discordjs/builders version is up to date
response isn't a message, it's a response
so response.message should get me where i need to be?
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
its not on the docs from what i can see
ah ok, thanks. how things change sighhh
it was hotfixed, looks like the docs haven't refreshed yet
latest builders version is 1.12.1
you have 1.12.0
thanks
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"}
])
)
What error?
Use SelectMenuDefaultValueType.Role and SelectMenuDefaultValueType.User
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
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
disableValidators discord.js@14.23.0
Disables validators.
a fix should be coming soon™ though
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)
}
there's a current issue with channel selects
modal components are hard it seems
a hotfix should be released soon
nice.
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
encountered the same issue haha
Some guide for new model components
try this: https://modal.builders/?generate=djs
crazy
does it have support for selecting multiple values in select menu?
or is that not with this modal update
You can select multiple
Should be fixed now in 1.12.2 (nuke your lockfile/node_modules and reinstall basically)
oh i see there yh thanks
nice
Make sure to increase max values though as the default is one
yoyo, whats the method of adding the new selectmenu in modals
Make a label, and then add a select menu to it. Then shove it in a modal
so like a normal select menu builder then just .addComponent?
bets ty
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
it's been fixed already, pending release
ok thanks
to get a channel select or role select etc do i use getField() or getStringSelectValues()?
getXSelectValues
X being Role, Channel or whatever you used
oh okay cuz in the docs i only see these 3
14.13.2 has been released @tardy sable @lime lantern @meager meadow @unreal stone
Try updating and come back if you have any issues!
I'm not sure which version of the docs you're seeing, https://discord.js.org/docs/packages/discord.js/14.23.1/ModalSubmitFields:Class has everything
i was at main
Main is the development version yeah, not 14.x
yes fixed
Ez
Thank you! Will try tomorrow (it's around 3am in my country)
I'll update
had the same errors, waitin’ for the fix but i got it workin’ after tweak’n some stuff
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?
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.
What exactly do you mean by "instead of building an actual app"
The package pretty much still works as -is
The linked example from the page is for an electron app https://github.com/discordjs/RPC/blob/master/example/main.js
i had the same errors but fixed ‘em manually. i edited files like ModalSubmitInteraction.js and User.js etc.. on the exact lines the error pointed out. the new patch’s gonna fix it anyway, but i wanted to test it on my bot right away so i did it manually.
I see, that patch has been released already
you should prefer that over a modified copy of the library
so tmr when i update the bot i'll just use the new patch right away 
I found a bug related to modal interactions, where can I report it?
is it a d.js bug or a discord bug
discord.js
what’s the bug
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
what version are you using
14.23.1
Update to 14.23.2
?
okay thanks
yeah I was working in an electron project, if you check my account now you'll see it; I think I was just expecting the assets to register faster so I assumed it was a me error
I just had to wait a bit, so that was mb 😔
is calling undocumented apis bannable?
I don’t think so
Only "becomes" bannable when you break other rules. Automating with user tokens, overloading Discord api, etc.
i see, thanks
Hello, are these components v2 only available in dev versions?
everything was released yesterday
I have the latest version, but I still get an error saying that I don't have TextDisplayBuilder in discord.js.
try nuking your lock file and node_modules
make sure you don't have /builders installed separately
What's the current Modal Components limit?
Same as before 5
It didn't work. I have something like this: (intermediate value).addComponents is not a function.
In your package.json what version is there ?
14.23.2
Reload your ide or delete nodes module and reinstall. Ig something cached
There is an error in this passage: const container = new ContainerBuilder().addComponents(text, new SeparatorBuilder(), ...buttons);
Your code ?
yes
I did it, and nothing happened.
If i am not wrong containerBuilder doesn’t have addcomponent method
ContainerBuilder discord.js@14.23.2
A builder that creates API-compatible JSON data for a container.
correct, you have to specify what kind of component you’re about to add
ContainerBuilder#addTextDisplayComponents() discord.js@14.23.2
Adds text display components to this container.
@bitter glade use any of this method based on your components . each one takes another builder of that component
Yes, I checked. This code was generated by GPT because I wanted to test how these new components work. Now it works.
@bitter glade you should not use AI for writing Discord bot related code as AI data is too outdated—use the official guides instead:
https://www.discordjs.guide/legacy/popular-topics/display-components
give exact link of doc then maybe it can make
I used extended thinking and told him to check the latest documentation.
if you do that then I don’t see any point in using AI—just read the guide yourself
you see that even then it cannot check the latest documentation/guides, as it failed in writing valid code for the latest d.js version
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!
thats true but now days jr dev fully addicted to ai , they feel docs boring . but docs are everything
That's exactly what you do
so <ModalSubmitInteraction>.update() fails?
oops forgot to reply to illan’s message
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);
"The update property does not exist on the type..."
edit : im far from being an expert so please bear with me 🥺
You would need to check to make sure the modal came from a message
ModalSubmitInteraction#isFromMessage() discord.js@14.23.2
Whether this is from a MessageComponentInteraction.
ah yeah if you use typescript you need to use the typeguard thats given above
couldn’t make that up from your message
that is indeed the solution! ty for your help. ty b3ssel too
Oh okay too bad, thanks
@unique shoal (unable to ping mods role from mobile)
Did it work for you? Or how could I make it a function?
Is it possible to set the presence of a bot to this smartphone online icon with discord.js?
