#djs-help-v14
78874 messages · Page 49 of 79
okayy too bad but still tysm
im going to try subcommandgroup, but i wonder what does it look like? is it like /dev ping test?
Yea
oh, thanks!
is everyone getting the deprecation warning for the new clientReady event, regardless if you changed it or not?
No
the warning message only comes up when a “ready” event listener is added somewhere in your bot project
👍, that's what i thought.
yo guys how to check what option the user selected in modal components i tried but i still dont know how if someone knows i would appreciate their help
i found out how but im having problem with getting channel id
console.log(channel.id)```
it just gives me undefined and when i do ```console.log(channel)``` it fully works and gives me the whole channel's info
am i doing something wrong
what does the whole channel's info return in console?
show what it logs
guild info and channel id and channel name and the other channel's info
it returns a collection, not a single channel object
yes it does
oh so what do i use?
you use that but treat it as a collection
if its not a multi select, you can just use .first() on it
oh i actually never thought of that im gonna try it
it worked ty!
If individual shards have a very high ping, what factors could this depend on? I have enabled the precentUpdate event, and the bot is also on some servers in the voice channel. .
tried testing polls again by voting on a poll after client start up, and this time it doesn't read the text and vote count
is that intended now?
(I am using all the required partials, including poll and pollAnswer)
Nevermind, I figured it out, just like others we fetch the answers via a poll
is it possible to align three TextInputComponents in a row in a new ModalBuilder api?
Modals have labels, and labels only have 1 component
that's what I thought, thanks
and one more quicky: if I sent a reply with a button, and on this button click I show a modal, how do I edit / remove the button to not be able to click on it again?
showModal and editReply
oh seems followUp just works fine, will look into editReply as well, thanks!
Hello, mentioned this issue couple days ago, 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
});
}
Tried different things, but no luck so back to original start :d
Message#components shouldn't be modified like that, you're modifying cached values there. Also those values aren't meant to be passed back like that to the API. Use ButtonBuilder#from() instead
Or ActionRowBuilder#from or simply .toJSON() on the components
can you show all your initial attempt?
you had the initial container builder, were you using a collector or something?
hey
i dont understand the new modal components i cant seem to get them to work. i also cant find related docs for modal components. am i missing something?
for which component specifically?
though pretty much the only new component is the label
ModalBuilder#addLabelComponents() builders@1.12.1
Adds label components to this modal.
thy
doesnt it say here #announcements message
text display and select menus of all types
or am i missing something ?
yeah, but those aren't new technically
so nothing in them has changed, other than the fact that they can now go inside modals
they need to be wrapped in a label
except for text display which can also go in the modal directly
ModalBuilder#addTextDisplayComponents() builders@1.12.1
Adds text display components to this modal.
okay didnt know about the label
hey, how would i use the new components v2 with my embed so that the buttons are small enough to only match the size of the embed?
const embed = new EmbedBuilder()
.setTitle('📻 Radio Stations Found')
.setDescription('Select a station from the buttons below:')
.setColor(0x00AE86)
.setFooter({ text: `Found ${stations.length} stations • Radio Garden` });
const buttons = stations.slice(0, 5).map((station, index) =>
new ButtonBuilder()
.setCustomId(`station_${index}_${Date.now()}_${station.id}`)
.setLabel(`${index + 1}. ${station.title?.substring(0, 40) || 'Unknown Station'}`)
.setStyle(ButtonStyle.Primary)
);```
this is how it currently is
You can't use embeds with components v2.
(or content field)
that’s an embed, not a container
meaning?
Or more likely, that's a container not an embed
so how do i make this a "container"
thanks!
Does anyone have an example of how to use the new question types in Discord modals?
d.js guide
guide is not updated?
oh I don’t think it has the updated components
are image attachments allowed in modals now? (i havent had time to read all changes) as this could change how i do my suggestion command
no
the only thing i was looking forward to if it was added
file uploads are next for modals. dont think displaying images are coming any soon in modals
pretty much thats what i meant as it would be nice to fully move these over with the other parts of the command when im ready to
ig for now if i wanted to test new part i could call "messageAttachment" or whatever it is currently called
oh okay
yh file uploads are coming soon i think, its already documented

hmm, this could backfire its still limited to 5 modules per modal right? i currently use 7 slash options hmm
Not that it's related to d.js atm but with file upload component, you could allow upto 10 attachments per component
oh neat
is there a way to specify an integer/number input in a modal? seems there's only a text input
No, there is currently no way to validate user input before they click submit
thanks
Where can you find the limits for rateLimitPerUser (slowmode) and timeouts?
I'm trying to figure out from the documentation how the new modal components work, so i’ve managed to understand how to attach components.
However, I’ve seen people creating fields for uploading images.
Does the new modal system have an image upload function? How do you use it?
Like this
file uploads arent supported yet
Aw, ok. Thank you for your reply
How exactly do you fetch / handle string select menus inside modals? Does it work the same way as a normal string select menu, where you handle it using isStringSelectMenu(), or do you need to use isModalSubmit() and fetch them through interaction.fields... (like text inputs)?
the latter
since it's a modal interaction
ModalSubmitFields#getStringSelectValues() discord.js@14.23.2
Gets the values of a string select component given a custom id
Awesome, thanks
just noticed this error today. didnt change anything in the code. what am i supposed to do?
checked intents, code everything
Fetching members can time out on large guilds, as they arrive in chunks through the WebSocket connections.
- You can specify the
timeoption inFetchMembersOptionsto specify how long you want to wait. - Make sure you have the required
GuildMembersgateway intent enabled
thank you!
Hey with the new modals changes, is there documentation around this anywhere? Can't seem to figure it out.
the new label component
ModalBuilder#addLabelComponents() builders@1.12.1
Adds label components to this modal.
LabelBuilder discord.js@14.23.2
A builder that creates API-compatible JSON data for labels.
it wraps the select menus
Ahh okay, so is it just that discord have finally allowed you to put more than just text inputs in the modals now then?
Okay, nevermind, can't seem to add anything other than a TextInputComponent still.
yeah you can add labels and text displays now
Hmmm, got any code examples? An API reference isn't great documentation, would love to see some example code to actually see how it fits together?
if you're familiar with other builders it works pretty much the same
you add a label to the modal, which can have a select menu or text input
and a description and label
Hmm okay, what was the reason for creating this new LabelBuilder then? Unsure what the requirement is?
if you want to add a text display you add it to the modal directly
the label component wraps other component and gives it a label a description
Hmm okay
We still limited to like 5 things per modal?
top level, yes
Are select components supported in modals in discord js yet ?
we're just talking about how to use them right above you
Cheers
i have a user info command and to get the join posistion i used to fetch all guild members per command. thats obviously not efficient so i switched to cache but using the cache now, it always shows a different join position. For example in a server i created it shows correctly im the first member if i keep the fetching, but using cache it shows different numbers each time.
i currently only fetch all guild members on startup to populate the cache. what am i doing wrong?
const position = Array.from((await interaction.guild.members.fetch()).sort((a, b) => a.joinedTimestamp - b.joinedTimestamp).keys()).indexOf(member.id) + 1;
fetching many will always fetch, it won't check in cache
wdym?
if you do any fetch call that is supossed to return many objects (array/collection of unknown length), it'll always call the api
the cache is only used when you fetch a single object
oh okay. so the cache is not used for this kind of stuff?
no, if you want to use the cache for that you'll need to explicitly use it
guild.members.cache
which is a Collection<string (id), GuildMember>
yh thats what i did
so the code you're showing is not the updated one?
that was old. just replaced await interaction.guild.members.fetch() with the cache interaction.guild.members.cache
Hmm tbf, I am struggling to get data from anything other than the input fields.
error: Required field with custom id "colourSelect" not found.
code: "ModalSubmitInteractionFieldNotFound"
When I do:
const dataType = interaction.fields.getField(arg.name);
if its a text input use getTextInputValue
do you have the GuildMembers intent?
It's not, it's a string select
yes. otherwise i wouldnt be able to fetch anyways?
documentation suggestion for @faint pond:
ModalSubmitFields#getStringSelectValues() discord.js@14.23.2
Gets the values of a string select component given a custom id
Sure, but I am getting the field type, so I can see what is what.
Essentially, it's an integration to an existing framework, but with all the different "types" of fields, I don't know what field is what, so I am trying to figure it out fromt he getField
ah right, fetch many won't work without it, sounds like it should work then, what keys show up when you use the cache?
youd just do interaction.fields. atleast that what i used for old components
Ahh ignore me 🤣 I forgot to compile the sub-package.
you mean if i console log the members cache?
just in case could you show what your current code looks like?
rather not its kinda big. it doesnt use any other fetching in it
I meant only the part where you get the position
its exactly this but cache
const position = Array.from((interaction.guild.members.cache).sort((a, b) => a.joinedTimestamp - b.joinedTimestamp).keys()).indexOf(member.id) + 1;
what could possibly else influence my cache? since i now populate the cache upon startup, and when i then do the command it correctly shows the position, but then after some seconds its not accurate anymore
do you have sweepers or limits?
nope
People leaving will decrease your join position
but my join position is increasing...
also doesn't it update the cache on member leave?
Yea, it removes members from the cache
wait maybe its partial members? could that be affecting it
Partial members aren’t cached until you fetch them
can a member become partial during cache?
No
That would imply that you deleted data from them
okay so that isnt affecting it
You could just filter to see how many ppl joined before btw
Faster than sorting
Unless you keep the sorted array cached and updated
hm thats a good one
ill see if thats more accurate
Could you just check if there’s partial members cached while ur at it?
yes was about to check too
I rly don’t see how you can get different results unless you mess up the cache
me neither. im not modifying the cache or using sweepers or whatever
I have some global commands that work in bot dms as well as in guild channels .setContexts([InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel]),, but can I also somehow exclude them from being available if the app is installed on the user and not on the guild but is still invoked in a guild?
(cause user apps dont have access to message resources in guilds)
Yes you are modifying cache. Collection#sort() modifies the collection
yh but sorting the cache wouldnt affect a join position?
It's very inefficient however and you are modifying the cache. Which you really shouldn't. Use toSorted instead
thanks
whats the difference of using client.once and client.on?
Once only emits once
i have a feeling a client.on doesnt emit at all?
i think i found the issue then. switching to client.once ready event actually fetches the members. and client on didnt emit
That makes no sense. on definitely works unless you broke it in your code somehow.
I’m trying to find documentation about the new modals options and how to use them, but when I look in the modal builders wiki it stills vague to me.
Is there a kitchen sink example or specific place I should look at to figure it out?
I’m looking to replace a multi-step chat by a modal form instead

theres no guide for it yet but someone made a interactive site for it https://modal.builders
I have a question, what is the difference between .setLabelComponents and .addLabelComponents ?
One sets it one adds components
Add -> Add another label component alongside any existing ones on the builder
Set -> Replace any and all existing ones on the builder with the ones provided
Oh, okay ! Thanks
Its a good site but theres something hilarious to me about using a GUI builder to design the code builders instead of just using JSON
Ig you can see it quicker without having to do the json, running it. Imagine using rust and having to compile everything every time lol
im not too sure what that has to do with the discord.js library
Im just going with suspicious spam account and they can appeal if Im wrong
what shoul i use for text input
that
you're just not using it anywhere and your ide is warning you
oh srry im dumb
thx
it explains what to do right after the @deprecated tag, use the LabelBuilder to create a label instead
thx
can you give like the new ChannelSelectMenuBuilder for modals a list of channels u can select from no right? cuz if no thats so lame fr discord ALMOST cooked
you can set channel types
yeah I saw but not a list of channels right?
what?
same goes for user select I cant give it a list of users unless im insanely blind.
hey guys .. what is the difference between addOptions() and setOptions()
you can't specify specific channels to be shown
like pass the channelselectbuilder a list of channel ids so then only those channels show and u can pick from those not ALL channels.
one adds options the other sets options.
not helpful
addOptions() adds more options to what is already there and setOptions() replaces all existing options with the ones you provide.
ya but what does set mean .. are they selected?
addOptions constantly adds options one after another while setOptions overwrites any options previously added
@dapper cave

discord 🤏 close to cooking they got the components now just give us W options for them fr
well you can do a select menu then and populate it with the channels you want. limited to 25 tho
in other words, a *string select menu
wait ur onto something how did I not think of that 💀
How to set desc for textinput in label builder
const paragraphLabel = new LabelBuilder()
.setLabel("Detailed Feedback")
.setDescription("Provide detailed feedback or comments")
.setTextInputComponent(
new TextInputBuilder()
.setCustomId("paragraph_input")
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder("Enter a longer message...")
.setRequired(false)
.setMaxLength(1000)
);```
code example
thx
modal.addLabelComponents(
paragraphLabel,
);```
You can also do like setTextInputComponent((label) => label.) right?
modal.addLabelComponents((label) => label...) yeah
Just to confirm, using action rows in modals will be deprecated right?
It is deprecated
sorry, I meant other action rows*
action rows for buttons, and select menus
since it doesn't follow the builder pattern correctly and shouldn't be generic
i'm a little confused now .. is label builder new for modals or how is this working now
Hi, is there any way to get user from UserSelect in modal? I'm getting undefined when processing modal
documentation suggestion for @warm scroll:
ModalSubmitFields#getSelectedUsers() discord.js@14.23.2
Gets users component
So i have to change all modals in my code
They still work but idk if it will work after sometime
is there a way to create a URL that when clicked auto populates a slash command in chat for someone?
You will need to before upgrade to v15, whenever that releases
Breaking changes will not be introduced in any v14 version
Not following sorry, action rows are still used outside modals
You can mention commands, but it wont autopopulate options
Message formatting (mentions, timestamps, emoji, etc.): learn more
as in, are they going to be deprecated in the future (based on other convos about them in the past). Since they're generic
No?
oh?
As in the action rows that exist in containers?
No
Why would they be
can a container be ephemeral?
In the sense that they can be in an ephemeral message, yes
so .. it is possible to use multiple flags in CommandInteraction reply() ?
Yes, join them with |
ah. I was confused because of this
#djs-help-v14 message
MessageFlags.Ephemeral | MessageFlags.IsComponentsV2
so addComponents will be deprecated in the future to be specific for what action row it's getting
I have no idea
I have no context for that discussion
oh wait see @unique shoal
okay
but yeah no context so np. thanks 
That sounds like the ActionRow type (previously defined by generic) will be determined by which component you add to it
Which is why you must be explicit in the add method
Rather than a generic addComponents
The ActionRow itself is not deprecated
hm yes ok. action rows aren't going anywhere. But actionrow being generic might change in the future
const textDisplay = new TextDisplayBuilder().setContent('just some text');
const buttonPrimary = new ButtonBuilder()
.setCustomId('test_button')
.setLabel('Test')
.setStyle(ButtonStyle.Primary)
const buttonLink = new ButtonBuilder()
.setURL('https://test.com')
.setLabel('Test')
.setStyle(ButtonStyle.Link);
const Thumbnail = new ThumbnailBuilder({
media: {
url: 'https://i.imgur.com/example.png'
}
})
const sectionBuilder = new SectionBuilder()
.addTextDisplayComponents(textDisplay, textDisplay)
// .setThumbnailAccessory(Thumbnail); doesnt work if i remove this
const separator = new SeparatorBuilder()
.setSpacing(SeparatorSpacingSize.Large);
const buttonTextDisplay = new TextDisplayBuilder()
.setContent('just a test text');
const section = new SectionBuilder()
.addTextDisplayComponents(buttonTextDisplay)
.setButtonAccessory(buttonPrimary);
const section2 = new SectionBuilder()
.addTextDisplayComponents(buttonTextDisplay)
.setButtonAccessory(buttonLink);
const mediaGallery = new MediaGalleryBuilder().addItems([
{
media: {
url: 'https://i.imgur.com/example.png'
}
}
]);
const containerBuilder = new ContainerBuilder()
.addSectionComponents(sectionBuilder)
.addSeparatorComponents(separator)
.addMediaGalleryComponents(mediaGallery)
.addSectionComponents(section)
.addSeparatorComponents(separator)
.addSectionComponents(section2);
await message.channel.send({
flags: MessageFlags.IsComponentsV2,
components: [containerBuilder]
});
can someone tell me why this only works if i add a thumbnail ?
because you can't have a section without an accessory
been on this for hours lol thanks
a better error message would be useful lol
i havent used discordjs in a few years, what am i missing here?
const Discord = require("discord.js");
const { Client, Events, GatewayIntentBits } = Discord;
const client = new Client({
intents: Object.keys(GatewayIntentBits).map((intent) => {
return GatewayIntentBits[intent];
}),
});
client.once("clientReady", (readyClient) => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
client.on("messageCreate", (message) => {
console.log(message);
});
```it wont log anything, and ik my bot isnt in 100 servers
use the intents you actually need, not sure why you are using all of them
other than that, what's the issue?
originally i was only using message, but i just threw all of them because nothing was working
would requesting more intents than needed break it?
I don't see where you're logging in
omited when sending on discord, it logs in correctly, it just wont print anything when i DM it
To receive direct message events on "messageCreate" with your bot, you will need:
- The
DirectMessagesgateway intent - The
Channelpartial setting
the older versions were so easy in comparison
but it works now, thank you
i disagree, but glad it works for you now
wdym disagree?
const Discord = require("discord.js");
const { Client, Partials, GatewayIntentBits } = Discord;
const fs = require('fs');
const client = new Client({
partials: [
Partials.Channel
],
intents: [
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages
]
});
i only spammed all of the intents because i was frustrated
where in docs is per server profile stuff?
Under the GuildMember class
ty
i mean for the bot, as in like editing the bot's display avatar
Still the same class
what method is it ? I can't seem to find it 😭
im on old docs..
-.-
guild.members.editMe(…)
GuildMemberManager#editMe() discord.js@14.23.2
Edits the current application's guild member in a guild.
oh
Thought you were trying to grab the avatar
Sorry about that wasn't very clear in my original message
oh you can edit bio too cool
name: Events.GuildMemberUpdate
async run(client: Client, oldState: GuildMember, newState: GuildMember)
I want to get the user’s latest roles, including their linked roles. The information I need is:
- The linked role’s key
- All role IDs the user has
How do i achieve this?
import {
ContextMenuCommandBuilder,
ApplicationCommandType,
PermissionFlagsBits,
ModalBuilder,
TextInputBuilder,
TextInputStyle,
LabelBuilder,
StringSelectMenuBuilder,
StringSelectMenuOptionBuilder
} from 'discord.js';
export default {
data: new ContextMenuCommandBuilder()
.setName('Mute')
.setType(ApplicationCommandType.User)
.setDefaultMemberPermissions(PermissionFlagsBits.MuteMembers),
async execute(interaction) {
const member = await interaction.guild.members.fetch(interaction.targetUser.id).catch(() => null);
if (!member) return interaction.reply({ content: ":x: Nelze najít člena.", flags: 64 });
if (member.communicationDisabledUntil && member.communicationDisabledUntil > new Date())
return interaction.reply({ content: ":x: Uživatel už má mute.", flags: 64 });
// Zobraz modal pro zadání důvodu
const modal = new ModalBuilder()
.setCustomId(`mute_reason_modal_${member.id}`)
.setTitle('Mute')
const label = new LabelBuilder()
.setLabel("Důvod")
.setTextInputComponent(
new TextInputBuilder()
.setCustomId('reason')
.setStyle(TextInputStyle.Short)
.setPlaceholder('Např. spam, toxicita...')
.setRequired(true)
)
const selectMenu = new LabelBuilder()
.setLabel("Výběr doby mute")
.setStringSelectMenuComponent(
new StringSelectMenuBuilder()
.setCustomId("time")
.setPlaceholder("Vyber dobu pro mute uživatele")
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel("10min")
.setValue(String(10 * 60 * 1000))
.setEmoji({id:"1424625488168615936"}),
new StringSelectMenuOptionBuilder()
.setLabel("30 minut")
.setValue(String(30 * 60 * 1000))
.setEmoji({id:"1424625488168615936"}),
new StringSelectMenuOptionBuilder()
.setLabel("1 hodina")
.setValue(String(60 * 60 * 1000))
.setEmoji({id:"1424625488168615936"}),
new StringSelectMenuOptionBuilder()
.setLabel("6 hodin")
.setValue(String(6 * 60 * 60 * 1000))
.setEmoji({id:"1424625488168615936"}),
new StringSelectMenuOptionBuilder()
.setLabel("1 den")
.setValue(String(24 * 60 * 60 * 1000))
.setEmoji({id:"1424625488168615936"}),
new StringSelectMenuOptionBuilder()
.setLabel("7 dní")
.setValue(String(7 * 24 * 60 * 60 * 1000))
.setEmoji({id:"1424625488168615936"})
)
);
modal.addLabelComponents(label,selectMenu)
await interaction.showModal(modal);
}
};
it will not mute them
node:events:497 throw er; // Unhandled 'error' event ^ RangeError: Invalid time value at Date.toISOString (<anonymous>) at GuildMemberManager.edit (/home/node/node_modules/discord.js/src/managers/GuildMemberManager.js:370:58) at GuildMember.edit (/home/node/node_modules/discord.js/src/structures/GuildMember.js:395:31) at GuildMember.disableCommunicationUntil (/home/node/node_modules/discord.js/src/structures/GuildMember.js:488:17) at GuildMember.timeout (/home/node/node_modules/discord.js/src/structures/GuildMember.js:504:17) at file:///home/node/events/client/interactionCreate.js:1290:26 at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async withUserLock (file:///home/node/events/client/interactionCreate.js:65:5) at async Object.execute (file:///home/node/events/client/interactionCreate.js:109:7) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:402:10) at process.processTicksAndRejections (node:internal/process/task_queues:92:21) Node.js v22.20.0
// --- Modal submit pro mute_reason_modal ---
if (interaction.isModalSubmit() && interaction.customId.startsWith('mute_reason_modal_')) {
const memberId = interaction.customId.replace('mute_reason_modal_', '');
const reason = interaction.fields.getTextInputValue('reason') || `Mute přes context menu od ${interaction.member.displayName || interaction.user.username }`;
const time = interaction.fields.getStringSelectValues("time");
const member = await interaction.guild.members.fetch(memberId).catch(() => null);
if (!member) {
await interaction.reply({ content: "❌ Nelze najít člena.", flags: 64 });
} else {
await member.timeout(time, reason + `\nMute přes context menu od ${interaction.member.displayName || interaction.user.username }`);
await interaction.reply({ content: `✅ :member: Uživatel ${member} byl ztlumen na 1 hodinu.\n:moderation: Důvod: ${reason}`, flags: 64 });
}
return;
}```
Something's wrong with the time value that you provide the function.
Looking at the documentation for the time out function it needs to be a number, not a string
documentation suggestion for @brittle current:
GuildMember#timeout() discord.js@14.23.2
Times this guild member out.
// Time a guild member out for 5 minutes
guildMember.timeout(5 * 60 * 1000, 'They deserved it')
.then(console.log)
.catch(console.error);
can someone look into it too?
wdym by linked role's key
as for role IDs, discord.js provides a collection of the member's roles (GuildMember.roles.cache) which you can easily work through. you can easily then turn that into an array of the role IDs through map() iirc
const mapped = newState.roles.cache.map((role) => role.id);
this should map the role IDs into a new array
ah
welp, amgelo
Strictly speaking, Discord JS doesn't support this because it's part of oauth
Assuming you have the application ID, you can request the metadata using rest
You are looking for the metadata from other applications correct? Not your own?
documentation suggestion for @wooden carbon:
ClientApplication#fetchRoleConnectionMetadataRecords() discord.js@14.23.2
Gets this application's role connection metadata records
The above documentation link is for getting your own applications. Role connection metadata
thx
is the discord modal form capable of dynamic changes? Say when I selected a value from a userselect, the other inputs can be updated too based on the selected value?
no
That sounds really odd, as linked role is a part of a normal role and, with behavior of integrations(bot) role.
if i can get the bot's role, then i can surely get the linked role.
Hi can i know that how i can make the size of an image in media in cv2? or is that i need to give the sized image to make the image like that
I mean i need to make the image smaller
You can't control the display of an image in media gallery
ohh
so i need to pass a sized photo into media gallery right
You could check if the role's managed flag is true. But I can't test that myself right now.
Role#managed discord.js@14.23.2
Whether or not the role is managed by an external service
Maybe, I have not worked with media galleries. All I know is that you can't tell the media gallery how you want the image displayed
hmm ok got it
const linkedRole = [];
const NormalRole = [];
for (const [roleId, role] of newState.roles.cache) {
if (role.tags && role.tags.guildConnections) {
linkedRole.push(roleId);
} else if (!role.tags) {
NormalRole.push(role);
}
}
I did manage to seprate normal role from linked role.
But i have no idea how do i get the keys of those linked role.
Why do you need the keys?
// --- Modal submit pro mute_reason_modal ---
if (interaction.isModalSubmit() && interaction.customId.startsWith('mute_reason_modal_')) {
const memberId = interaction.customId.replace('mute_reason_modal_', '');
const reason = interaction.fields.getTextInputValue('reason') || `Mute přes context menu od ${interaction.member.displayName || interaction.user.username }`;
const time = interaction.fields.getStringSelectValues("time");
const member = await interaction.guild.members.fetch(memberId).catch(() => null);
let text;
let duration;
switch (time) {
case "10min":
duration = 10 * 60 * 1000;
text = time;
break;
case "30min":
duration = 30 * 60 * 1000;
text = time;
break;
case "1h":
duration = 60 * 60 * 1000;
text = time;
break;
case "6h":
duration = 6 * 60 * 60 * 1000;
text = time;
break;
case "1d":
duration = 24 * 60 * 60 * 1000;
text = time;
break;
case "7d":
duration = 7 * 24 * 60 * 60 * 1000;
text = time;
break;
default:
duration = 60 * 60 * 1000;
text = "1h";
}
if (!member) {
await interaction.reply({ content: "❌ Nelze najít člena.", flags: 64 });
} else {
await member.timeout(duration, reason + `\nMute přes context menu od ${interaction.member.displayName || interaction.user.username }`); // 1 hodina
await interaction.reply({ content: `✅ :member: Uživatel ${member} byl ztlumen na ${text}.\n:moderation: Důvod: ${reason}`, flags: 64 });
}
return;
}```why it falls to default
to validate it against database.
Idk how to explain
Are you trying to check for only your application or other applications as well?
for others, but i do have their token, and all required credentials for the patch request stuff.
You could get the metadata with a raw request as long as you have the applications ID
yeah, but i do need to know keys first.
IDK wym. You don't need the key to submit a rest request for the application role connection metadata
got it
This is what i want
I don't think that's possible. I am trying to look through the docs for a way to get from the role ID to the metadata key
in the roleTagData is the botId field populated on the linked roles?
idk
but not sure, maybe
The bot ID will work too. I can query the credentials using the bot ID, and the key I'm generating, while creating linked role is created by hashing the credentials. That way, I can retrieve the key and update the key’s field as well as can have required credentials.
I was going to say with the id you could get the meta data /applications/{botId}/role-connections/metadata
nv that still does not link the role to a key
that is useless for me, as a bot can have multiple linked role fields.
also, i have those info stored in the db so, no need for fetch
Each keys are generated based off credentials using sha hasher so, as long as i have bot id, i can generate the key.
Also, a key is linked to a role ID (not exactly, but it’s a bit complex to explain). Just think of it this way: I can’t query it directly, but if I have the key, I can retrieve the corresponding role ID from my database.
Glad I could help in some way best of luck with your project
but is it populated ?
can you test it out please
IDK
I cant I am running out the door for work right now
In case of linked role, is the botId field populated in role's tag?
welp ig i will just wait for someone reply well, doing some test myself in parallel.
the Discord doc is inconclusive its says "the id of the bot this role belongs to"
https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure
Unfortunately, role tag only has guildConnections: true
No bot id, and nothing else.
Maybe <guild>.fetchIntegrations() has something
let me try
Rq how do you get the stringselectmenuvalue from a modal once its submitted?
did you read the doc?
Im looking through it but its always been confusing for me
ModalSubmitInteraction discord.js@14.23.2
Represents a modal interaction
ModalSubmitInteraction discord.js@14.23.2
Represents a modal interaction
coool tty
That is unfortunate
what perms level does fetchIntegrations() needs?
Probably needs manage integrations
I can't seem to get it with normal member perms.....
I don't want the bot to have manage integrations perms :/
The only way to get a users linked role metadata is by using users outh2 token with appropriate scopes, and you can only get metadata for your application. You can't get which role is linked with your application, only that a role is a linked role
I was wrong. It's manage guild
https://discord.com/developers/docs/resources/guild#get-guild-integrations
I only need which linked role belongs to which bot
Yeah you can't get that
;-;
Discord doesn't expose that information
:/
i am gonna go cry bye
I somehow found a workaround, but it has to do at max 25 rest call request per member update. 🥹
actually might be up to 400.
And that would be? That may very well get you rate limited if you make that many req per member update
Actually anything that requires you doing that is not right and pretty much api abuse
Property 'options' does not exist on type 'ChatInputCommandInteraction<CacheType>
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === "servercheck") {
const serverid:any = interaction.options.get('id');
console.log(serverid);
const guild:Guild = client.guilds.cache.get(serverid.value)!
...
why am i getting this error?
i thought "interaction.options.get()" was the right way to get the value of the interaction's options
Could you share your full error message
Property 'options' does not exist on type 'ChatInputCommandInteraction<CacheType> | MessageContextMenuCommandInteraction<CacheType> | UserContextMenuCommandInteraction<...> | PrimaryEntryPointCommandInteraction<...>'.
Property 'options' does not exist on type 'PrimaryEntryPointCommandInteraction<CacheType>'.
Your issue is with type guard.
You want to use ischatinputcommand
oh it started working after i changed if (!interaction.isChatInputcommand())
yea i did it thxx
Np
How do I get the select menu value from a select menu in a modal?
Im starting with DiscordJS and i don't i can't use GatewayIntentBits like the current docs tells it.
require('dotenv').config()
const { Client, Events, GatewayIntentBits } = require("discord.js")
const client = new Client({
intents: [
GatewayIntentBits.Guilds
]
})
client.once(Events.ClientReady, (c) => {
console.log(`Logged in as ${c.user.tag}!`)
})
client.login(process.env.BOT_TOKEN)
Okay is work now but like in the picture the Guilds is not recognize by the IDE and i don't have completion
Are you using webstorm? That has known to have this type of issues
Yes i use Webstorm
Yeah, so we can't do anything here. This is an issue with your ide
oh okay i'll try on VSCode
in VSCode it work well thanks
Yeah, I know. I’ve just changed the entire logic, and now I can resolve the bot ID in a single network trip to the database, and no need for data fetch from discord.
Use the field property on the interaction
Would you mind giving an example?
interaction.fields.getTextInputValue('hobbiesInput');
This is for the old textInput but the principal is the same
apologies for the long ahh code
const CATEGORY_INFO: Record<
SkillCategory,
{ label: string; emoji: string; value: string }
> = {
[SkillCategory.BUILDER]: {
label: "Builder",
emoji: "🧱",
value: SkillCategory.BUILDER,
},
[SkillCategory.SCRIPTER]: {
label: "Luau Scripter",
emoji: "💻",
value: SkillCategory.SCRIPTER,
},
[SkillCategory.GRAPHICS_ARTIST]: {
label: "Graphics Artist",
emoji: "🎨",
value: SkillCategory.GRAPHICS_ARTIST,
},
[SkillCategory.MODELER_3D]: {
label: "3D Modeler",
emoji: "🧩",
value: SkillCategory.MODELER_3D,
},
[SkillCategory.INTERFACE_DESIGNER]: {
label: "Interface Designer",
emoji: "🖼️",
value: SkillCategory.INTERFACE_DESIGNER,
},
[SkillCategory.CLOTHING_DESIGNER]: {
label: "Clothing Designer",
emoji: "👕",
value: SkillCategory.CLOTHING_DESIGNER,
},
[SkillCategory.VIDEO_EDITOR]: {
label: "Video Editor",
emoji: "🎬",
value: SkillCategory.VIDEO_EDITOR,
},
[SkillCategory.ANIMATOR]: {
label: "Animator",
emoji: "🕺",
value: SkillCategory.ANIMATOR,
},
[SkillCategory.MUSIC_COMPOSER]: {
label: "Music Composer",
emoji: "🎵",
value: SkillCategory.MUSIC_COMPOSER,
},
[SkillCategory.VISUAL_EFFECTS]: {
label: "Visual Effects Artist",
emoji: "💥",
value: SkillCategory.VISUAL_EFFECTS,
},
[SkillCategory.SOUND_EFFECTS]: {
label: "Sound Effects Creator",
emoji: "🔊",
value: SkillCategory.SOUND_EFFECTS,
},
[SkillCategory.TERRAIN_EDITOR]: {
label: "Terrain Editor",
emoji: "🌄",
value: SkillCategory.TERRAIN_EDITOR,
},
[SkillCategory.TEXTURE_ARTIST]: {
label: "Texture Artist",
emoji: "🧵",
value: SkillCategory.TEXTURE_ARTIST,
},
[SkillCategory.VOICE_ACTOR]: {
label: "Voice Actor",
emoji: ":microphone2:",
value: SkillCategory.VOICE_ACTOR,
},
[SkillCategory.JAVASCRIPT_PROGRAMMER]: {
label: "JavaScript Programmer",
emoji: ":computer:",
value: SkillCategory.JAVASCRIPT_PROGRAMMER,
},
[SkillCategory.TYPESCRIPT_PROGRAMMER]: {
label: "TypeScript Programmer",
emoji: ":computer:",
value: SkillCategory.TYPESCRIPT_PROGRAMMER,
},
[SkillCategory.PYTHON_PROGRAMMER]: {
label: "Python Programmer",
emoji: ":snake:",
value: SkillCategory.PYTHON_PROGRAMMER,
},
[SkillCategory.CSHARP_PROGRAMMER]: {
label: "C# Programmer",
emoji: ":computer:",
value: SkillCategory.CSHARP_PROGRAMMER,
},
[SkillCategory.CPP_PROGRAMMER]: {
label: "C++ Programmer",
emoji: ":computer:",
value: SkillCategory.CPP_PROGRAMMER,
},
[SkillCategory.PHP_PROGRAMMER]: {
label: "PHP Programmer",
emoji: ":elephant:",
value: SkillCategory.PHP_PROGRAMMER,
},
[SkillCategory.JAVA_PROGRAMMER]: {
label: "Java Programmer",
emoji: ":coffee:",
value: SkillCategory.JAVA_PROGRAMMER,
},
[SkillCategory.RUST_PROGRAMMER]: {
label: "Rust Programmer",
emoji: ":crab:",
value: SkillCategory.RUST_PROGRAMMER,
},
[SkillCategory.HTML_CSS_PROGRAMMER]: {
label: "HTML/CSS Developer",
emoji: ":globe_with_meridians:",
value: SkillCategory.HTML_CSS_PROGRAMMER,
},
[SkillCategory.YOUTUBER]: {
label: "YouTuber",
emoji: ":tv:",
value: SkillCategory.YOUTUBER,
},
};
const modal = new ModalBuilder()
.setCustomId("skill_role_select_modal")
.setTitle("Apply for Skill Role");
const categorySelectLabel = new LabelBuilder()
.setLabel("Choose a Skill Role")
.setDescription("Select the skill role you want to apply for")
.setStringSelectMenuComponent(
new StringSelectMenuBuilder()
.setCustomId("skill_role_category")
.setPlaceholder("Select a skill role...")
.setRequired(true)
.addOptions(
availableCategories.map((category) => ({
label: CATEGORY_INFO[category].label,
value: CATEGORY_INFO[category].value,
description: `Apply for ${CATEGORY_INFO[category].label} role`,
emoji: { name: CATEGORY_INFO[category].emoji },
}))
)
);
modal.addLabelComponents(categorySelectLabel);
await interaction.showModal(modal);
7:24:47.873 ERROR [ApplyCommand] Unexpected error in apply command [BOT-63C75] User:1045011641940574208 Guild:1410388318457430216
Error: Invalid Form Body
data.components[0][TAG_FIELD_MISSING]: Field "type" is required to determine the model type.
at new DiscordAPIError (C:\Users\aaaaaaa\Documents\Development\basementdevs-unified\node_modules\@discordjs\rest\dist\index.js:618:5)
at handleErrors (C:\Users\aaaaaaa\Documents\Development\basementdevs-unified\node_modules\@discordjs\rest\dist\index.js:762:17)
at processTicksAndRejections (native:7:39)
17:24:48.008 ERROR [InteractionHandler] Invalid Form Body
data.components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,). [BOT-LR04O] User:1045011641940574208 Guild:1410388318457430216
what the hellies is wrong with this to cause that error?!?!?!
Yeah i knew that for the old one. But it's the same for the modal components?
am I silly cuz this works
const modal = new ModalBuilder()
.setCustomId("example_modal")
.setTitle("Example Modal");
const stringSelectLabel = new LabelBuilder()
.setLabel("Favorite Option")
.setDescription("Choose your preferred option from the list")
.setStringSelectMenuComponent(
new StringSelectMenuBuilder()
.setCustomId("string_select")
.setPlaceholder("Select an option...")
.setRequired(true)
.addOptions([
{
label: "Option A",
value: "option_a",
description: "First choice",
emoji: { name: "🅰️" },
},
{
label: "Option B",
value: "option_b",
description: "Second choice",
emoji: { name: "🅱️" },
}
])
);
modal.addLabelComponents(
stringSelectLabel,
);
await interaction.showModal(modal);
documentation suggestion for @short mulch:
ModalSubmitFields discord.js@14.23.2
Represents the serialized fields from a modal submit interaction
Basically see the above documentation
Kk,Thanks.
Do you still have an issue or is it solved?
Hi, how can I embed/make a clickable bot command like this?
by inserting command mention in order </command_name:command_id>
Does it also work with subcommands?
you can obtain command_id thru autocompleting any command and right clicking bar where it shows with description
Does it also work with subcommands?
yes, it does, even with subcommand groups @toxic latch
Hi I'm facing an issue about PermissionFlagsBits
I couldn't set the permission "SetVoiceChannelStatus" because couldn't find from that
Is there I'm missing?
Perfect, thank you!
it's merged with ManageChannels as it's deriving from Channel type, if im correct
ah I think I got it thanks!
no problem :>
i have a question by myself, because we have documented nitro subs through API doc in djs, yet we cannot obtain user premium type anyway, so why in the name of God is it documented if it's unusable at all?
would be far better to better handle user premium type in order to (at very least) return proper emoji for user's nitro badge ( dependable whether he has boost or just classic )
as well as nitro badge for users that have been subbed for a while
and to check for damn banners -.-
-# like i know there is a prop in user object, but still there might be workarounds that might bug out apps
With the new modal string selects, can you programmatically add options to it? When I try to .addOptions to a StringSelectMenuBuilder with an array of objects containing a label and value or with an array of StringSelectMenuOptionBuilder I get TypeError: Cannot destructure property 'emoji' of 'selectMenuOption' as it is undefined.. I am not trying to add and do not want any emojis.
When I stop trying to programmatically add the options and just manually add an option so that it works, and I stringify the resulting LabelBuilder object, the options array just contains objects with label and value keys.. Not sure what I am doing wrong?
I still have the issue
since ModalBuilder.addComponents() is deprecated, what other function can i use though?
anyone?
You use LabelBuilders and .addLabelComponents()
hmm, okay i guess
18:40:21.699 ERROR [ApplyCommand] Unexpected error in apply command [BOT-H3O9B] User:1045011641940574208 Guild:1410388318457430216
Error: Invalid Form Body
data.components[0][TAG_FIELD_MISSING]: Field "type" is required to determine the model type.
at new DiscordAPIError (C:\Users\aaaaa\Documents\Development\basementdevs-unified\node_modules@discordjs\rest\dist\index.js:618:5)
at handleErrors (C:\Users\aaaaa\Documents\Development\basementdevs-unified\node_modules@discordjs\rest\dist\index.js:762:17)
at processTicksAndRejections (native:7:39)
const modal = new ModalBuilder()
.setCustomId("skill_role_select_modal")
.setTitle("Apply for Skill Role");
const stringSelectLabel = new LabelBuilder()
.setLabel("Favorite Option")
.setDescription("Choose your preferred option from the list")
.setStringSelectMenuComponent(
new StringSelectMenuBuilder()
.setCustomId("string_select")
.setPlaceholder("Select an option...")
.setRequired(true)
.addOptions([
{
label: "Option A",
value: "option_a",
description: "First choice",
emoji: { name: "🅰️" },
},
{
label: "Option B",
value: "option_b",
description: "Second choice",
emoji: { name: "🅱️" },
},
{
label: "Option C",
value: "option_c",
description: "Third choice",
emoji: { name: "🔤" },
},
])
);
modal.addLabelComponents(stringSelectLabel);
await interaction.showModal(modal);```
why is it erroring
(ChatInputCommandInteraction)
Ahah, I'm getting this exact same error @dapper cave
I'm calling the discord rest API without discord.js however
0[TAG_FIELD_MISSING]: Field "type" is required to determine the model type.
jobs:dev | at handleErrors (/Users/poca/Documents/Github/sublyna-monorepo/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:762:13)
jobs:dev | at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
jobs:dev | at async BurstHandler.runRequest (/Users/poca/Documents/Github/sublyna-monorepo/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:866:23)
jobs:dev | at async _REST.request (/Users/poca/Documents/Github/sublyna-monorepo/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:1307:22)
jobs:dev | at async doRun (file:///Users/poca/Documents/Github/sublyna-monorepo/node_modules/.pnpm/@restatedev+restate-sdk@1.7.3/node_modules/@restatedev/restate-sdk/dist/esm/src/context_impl.js:194:23) {
jobs:dev | requestBody: { files: undefined, json: { embeds: [Array], components: [Array] } },
jobs:dev | rawError: {
jobs:dev | message: 'Invalid Form Body',
jobs:dev | code: 50035,
jobs:dev | errors: { _errors: [Array] }
jobs:dev | },
jobs:dev | code: 50035,
jobs:dev | status: 400,
jobs:dev | method: 'POST',
jobs:dev | url: 'https://discord.com/api/v10/interactions/1426247521956528220/XXXXX/callback'
jobs:dev | }
copy 50035 🗣️
so discord is noobing not me? 
I don't think so unfortunately 😭 I think we both made the same mistake at the exact same time?
shut we always gotta blame discord 🤫
this code worked yesterday tho so im confused
yes same, I really don't understand the meaning of this error
might actually be discord's fault 
requestBody: { files: undefined, json: { embeds: [Array], components: [Array] } }
this doesn't seem like a proper interaction callback payload
thanks for the example btw
for you, this code appears to be fine
could you confirm that the error originates from here specifically and not some other part of the same command?
what version of discord.js are you using?
ah true, I might be missing UPDATE_MESSAGE...
^14.23.2
I copied and pasted this and it worked btw
I'm guessing that link is what actually gave you the error?
even that code appears to be fine, so I'd still like confirmation the error originates from there
it'd be easier with a longer stack trace
alr one sec pls
I might've fixed it
thank u all for the help 
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?
Specifically like the SlashCommandBuilder.setDescription I mean - so that commands are translated
there's no best way, there's only one
you set the description_localizations, either via the builder or the raw data
SlashCommandBuilder#setDescriptionLocalizations() discord.js@14.23.2
Sets the description localizations for this command.
can like https://tenor.com/view/george-bush-bush-bush-meme-george-bush-meme-bush-eyebrow-gif-13760874066974063104 be in setImage of an embed? cuz when I do it, it just never loads
It has to be a direct link to the image
Does placeholder text not work in string selects on modals? Have a modal with a string select and placeholder text but when opening the modal it always just defaults to the first option in the list instead of showing the placeholder text. I've tried adding default: false to all of the option but that isn't changing anything. On the discord docs it says Placeholder text if nothing is selected or default; max 150 characters.
can you show your code?
const state = new LabelBuilder()
.setLabel("State")
.setStringSelectMenuComponent(
new StringSelectMenuBuilder()
.setCustomId('state')
.setPlaceholder('State to set the node to')
.addOptions([
{
label: "Unstarted",
value: "unstarted"
},
{
label: "Partial",
value: "partial"
},
{
label: "In Progress",
value: "in_progress"
},
{
label: "Done",
value: "done"
}
])
);
Guys is there already a guide on how to use the new modal component builders? Because I don't know if discordjs.guide ist still the correct thing as it's marked as "legacy".
Update: I just saw the message above.
is your modal customid constant?
Yes. But I guess it may have just been a bug on my discord client.. I tried refreshing my client and now it shows as expected.
it's legacy because there's plans to eventually make a new one, I'm not sure which message above you're referring to since there isn't any recent talk about the guide lol
-# This one: #djs-help-v14 message
Oh I guess modals just keep the same data that was previously entered when being opened again.
since it was constant, your client had cached the last option you selected, which was the first one (from what you asked in your question)
you'll need a setMinValues(0) if you want to allow nothing to be selected, which would show the placeholder
if the custom ID is the same, the previous values get assigned again if the form wasn't submitted
Thanks
alternatively you could add a description to your label which will always be shown regardless of selection
question, if a channel id invalid for a ChannelSelectMenuBuilder in setDefaultChannels. does it throw error?
also just any select menu that accepts default values
it can only be invalid if the channel is deleted between the submission and your processing. The chance is minimal.
Don't think that'll be necessary. This modal opens from a button attached to an embed to edit parts of the embed. The select picks a certain part of it and I didn't want it to be prefilled. That was more of the concern rather than the placeholder actually showing.
djs also just sends the data and makes sure it matches the schema, it doesn't validate whether it's a valid id (apart from validating that it's a string snowflake)
no i mean something like this
new ChannelSelectMenuBuilder()
.setCustomId("channel")
.setChannelTypes([ChannelType.GuildText])
.setDefaultChannels(['824411059443204127'])
if the default channel doesnt exist anymore it will throw error?
alright will ask there
okay it will just filter it out nice
Does discord.js support per guild bot profile?
I can't seem to find a method to edit the avatar banner etc.
guild > members > editMe
ups, went guild.members.me....., thank you
huh..? i imported ButtonBuilder but not ThumbnailBuilder, and now this comes out
Show code
It’s saying you didn’t provide a button nor thumbnail. Importing it is only half the battle
oh
const approveButton = new Discord.ButtonBuilder()
.setCustomId(`approve_word_${suggestionId}`)
.setLabel("okay")
.setStyle(Discord.ButtonStyle.Success);
const declineButton = new Discord.ButtonBuilder()
.setCustomId(`decline_word_${suggestionId}`)
.setLabel("nope")
.setStyle(Discord.ButtonStyle.Danger);
requestContainer.addActionRowComponents((row) =>
row.addComponents(approveButton, declineButton)
);
const dmSent = await dev
.send({
components: [requestContainer],
flags: [MessageFlags.IsComponentsV2],
})
.catch((err) => {
client.logError(err);
});
this is where im importing ButtonBuilder
requestContainer is just an array?
nope
oh never worked with ContainerBuilder so i'm sorry that i can't help
it's alright
maybe trying making something like this
const approveButton = new Discord.ButtonBuilder()
.setCustomId(`approve_word_${suggestionId}`)
.setLabel("okay")
.setStyle(Discord.ButtonStyle.Success);
const declineButton = new Discord.ButtonBuilder()
.setCustomId(`decline_word_${suggestionId}`)
.setLabel("nope")
.setStyle(Discord.ButtonStyle.Danger);
requestContainer.addActionRowComponents((row) =>
row.addComponents(new Discord.ActionRowBuilder().setComponents(approveButton, declineButton))
);
const dmSent = await dev
.send({
components: [requestContainer],
flags: [MessageFlags.IsComponentsV2],
})
hmm ill try that
your container has a section which doesn't have an accessory
it's unrelated to that part of your code
oh
it says that error because like it says, it expected a ButtonBuilder or a ThumbnailBuilder, but it's undefined (not set)
i see, but how can i fix that?
add an accessory to the section
or if you just want text, don't use a section
just add the text
i see
ContainerBuilder#addTextDisplayComponents() discord.js@14.23.2
Adds text display components to this container.
ill check what i was doing with that component, thanks for the help
i belive this is a new thing, but what exactly is the use for ContainerBuilder instead using the ActionRowBuilder and put inside the components field the action row?
yep i got it fixed. thank you
Containers have a visual separation
containers and action rows are different things, a container looks like an embed
#announcements message this is a container
it can also have an action row inside
Ohhh, didn't saw that. Thanks for clarifying!
Also see the guide for a visual reference of the other components
What kind of error is this?
Fairly certain that's a you're not supposed to go there 403
What is the code you ran
await message.react(personReaction)
```Seems like this 😂
No idea, discord could've taken a hit or something because first time seeing this
I'm pretty sure that's not supposed to look like that
what is personReaction?
honestly bro idek, i tried finding the msg but i couldn't see myself 💀
I can search the db for that
Is there a way to get every filled in option in a command if theyre all not required?
Seems like this < a:996149968614207509:1327295751935754322> however this is actually from the bot itself?
I think it somehow bugged out and couldn't acccess its own emojis?
looks like it was that but without the <>
so it wasn't parsed as an emoji string
It works perfectly fine now though that's very odd lol
Interesting, can I test/parse it properly before sending?
if you're saving it on a db just save it with the <>
I am yes
This is why I am confused lol, its always saved properly
oh yeah bro it's not some reaction thing lol
same thing happened on another project
around 20m after that initial one lol
what does the url look like
very normal
Also had the same error in my 3rd project like 20m prior to these 2 and twice there
This some new thing I've seen
Maybe my IP got ratelimitted or something idek
are all those projects different applications?
All those projects run on the same machine but yeah are different bot applications, each one
Even my main bot was affected
I think cf ratelimits look different but it could be that
given it's a 403 anyways
All of them are like in that hour span and all projects though I thought discord.js would show something better
no description is the fallback
since there's no code = no description 
does discord.js return 429s ?
or does it go under the ratelimit event
depends on your client options
i haven't changed anything with ratelimit
RESTOptions#rejectOnRateLimit discord.js@14.23.2
Determines how rate limiting and pre-emptive throttling should be handled. When an array of strings, each element is treated as a prefix for the request route (e.g. /channels to match any route starting with /channels such as /channels/:id/messages) for which to throw RateLimitErrors. All other request routes will be queued normally
Default value: null
should be the event then
hmm i suppose it's just 429's hitting or a cf temp ban or smth
usually thought its an hour ban but that was a 1 time error in an hour span with different times for each project lol
is there a way to get all the filled in options of a command or do I have to get each one of my options seperately, check if theyre filled in and then use those?
the latter is what you're supposed to do, yeah
what else do you want to do?
dunno
can i set empty string in setvalue for textinputbuilder?
thought there might have been some sort of built in function inside of DJS, who knows
I meant to ask what is your use case that you need that
or how would that be used in the first place
sure
prob would be a better way to do it
though that's the default anyways, modals are shown without any input
ty
for (const levelNum of [0, 1, ...]) {
const name = options.getString(level_{levelNum})
}
?
yeah I know that part, just was wondering if there was a built in function in DJS like getOptions or something around that
I think you can access the raw values, but it's not good DX
also shouldnt you just do a for loop that repeats 7 times, and use the i value subtracted by one?
that's another way of doing it, yeah
could also use a while loop if you want
just trying to make an example of what you can do to get the point across
is there any particular reason why Permissions havent been added to discord api types
guys I'm getting the error Expected the value to be a string or number and I could narrow it down to the cause - the LabelBuilder.
Any idea what's wrong here?
new LabelBuilder()
.setLabel("Ticket Channel Naming")
.setDescription(
"The naming template for ticket channels. Variables: {username}, {index}, {category}",
)
.setTextInputComponent(
new TextInputBuilder()
.setRequired(true)
.setCustomId("naming")
.setPlaceholder("Enter ticket channel naming template")
.setValue("ticket-{index}")
.setMinLength(3)
.setMaxLength(64),
)
Update: Discord wants me to set the style which is not supplied by default; I just forgot that,
Also your value for the naming field will not put the index number like you want. You need to add $ before {index} and use ` instead of " there
it's not to display a value
like the description says, it's a placeholder to be replaced elsewhere in the code, just pre-filled into the value
That is correct :)
I've got another little issue. My bot created a non-private private thread.
As you can see below, the thread is visible to everyone - even though I specified that it should be private. How can this be?
Code:
await channel.threads.create({
name: `Discussion - ${channel.name}`,
type: ChannelType.PrivateThread,
autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek,
startMessage: messageId,
invitable: false,
});
You cannot create a private thread out of a message
ah
makes sense (or not)
Not our rules
yeah; It works now. Thanks so much!
that is what I meant but did not word the best
"ticket-{index}" =/= "`ticket-${index}`"
wait I am relising that I am stupid and that is probably intended
Yeah, it's not meant to be a template literal
It's meant to be a template for a human
And then just .replace('{ticket}', ticketId) elsewhere
I guess I would have just put it in the placeholder instead of value, but that is personal preference
Welllll.. while valid, value is selectable
And editable
But yeah
exactly
Since I'm sending a message I have written something which can replace nested values pretty fast and this is what I'm using.
I find it easier to have the readable format without the $.
how to resolveColor using a #hex
you just pass it
I assume you're talking about how to use the resolveColor function
yay cause i get this
Argument of type 'string' is not assignable to parameter of type 'ColorResolvable'.ts(2345)
.setColor(resolveColor(panel.embed.color?.replace(/#/g, ""));
you need to type assert it as ColorResolvable
Why are you removing the #?
or `#{string}` more specifically
i was debuing why it keep on getting it
Yea, don't remove it, resolveColor() handles that internally already
resolveColor discord.js@14.23.2
Resolves a ColorResolvable into a color number.
Per the types, it supports passing #${string} string types to it
.setColor(resolveColor(panel.embed.color || "#0099FF"));
As for the types though, assuming panel.embed.color is typed as just string, yea, you'll need to do what Amgelo suggested
i still get same error is doing this and yes its a string
Then you'd want to do this
it's not typed to accept any string, only ColorResolvables
you already know your value is one so you'll need to tell ts that
Also, if you're using this on an EmbedBuilder, you don't need to do resolveColor() anyways, as that's also called internally
DiscordAPIError[50035]: Invalid Form Body
guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
at handleErrors (C:\Users[]\OneDrive\Desktop\NovaEagle Bot\node_modules@discordjs\rest\dist\index.js:762:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async SequentialHandler.runRequest (C:\Users[]\OneDrive\Desktop\NovaEagle Bot\node_modules@discordjs\rest\dist\index.js:1163:23) at async SequentialHandler.queueRequest (C:\Users[]\OneDrive\Desktop\NovaEagle Bot\node_modules@discordjs\rest\dist\index.js:994:14)
at async _REST.request (C:\Users[]\OneDrive\Desktop\NovaEagle Bot\node_modules@discordjs\rest\dist\index.js:1307:22)
at async C:\Users[]\OneDrive\Desktop\NovaEagle Bot\deploy-commands.js:36:16 {
requestBody: { files: undefined, json: [ [Object] ] },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { guild_id: [Object] }
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1408167025490133023/guilds/undefined/commands'
when i try to deploy commands, it receive an error for no reason
add a console.log(clientId, guildId, token) and make sure none of those values are returning as undefined...cuz at least one of them are
ok
but where?
anywhere?
the deploy-commands.js
yes...anywhere under line 2
i deployed them again and it shows the same error
i put under line 2
Your guildId is undefined
yeah, i just put the server id inside of guildId in config.json
Okay, well whatever it is you're doing, it's resulting in guildId having a value of undefined, hence the error
guildId is corrected
solved already ✅
how can i create a thread
GuildTextThreadManager#create() discord.js@14.23.2
Creates a new thread in the channel.
// Create a new public thread
channel.threads
.create({
name: 'food-talk',
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
reason: 'Needed a separate thread for food',
})
.then(threadChannel => console.log(threadChannel))
.catch(console.error);
module.exports = {
data: new SlashCommandBuilder()
.setName('hello')
.setDescription('Responds to hello'),
async execute(interaction) {
await interaction.reply('Hello!')
},
};```
how to add ephemeral here
Ephemeral responses
You may not always want everyone who has access to the channel to see a slash command's response. Previously, you would have had to DM the user to achieve this, potentially encountering the high rate limits associated with DM messages, or simply being unable to do so, if the user's DMs were a way...
read more
What do you recommend more for discord.js, ESM, or commonjs?
that’s ultimately up to you
await interaction.reply({ content: 'Hello!', flags: MessageFlags.Ephemeral }); and import MessageFlags from discord.js
ok
What do you recommend more? Actually, the only thing that convinces me in ESM is top-level await.
ESM has been the standard for JavaScript for a while now
how can i remove this
remove what
Frost Secure started a thread
not possible
After i put my ephemeral message in my slash command code, the application did not respond.
module.exports = {
data: new SlashCommandBuilder()
.setName('hello')
.setDescription('Responds to hello'),
async execute(interaction) {
await interaction.reply({ content: 'Hello!', flags: MessageFlags.Ephemeral });
},
};```
hello.js code here
that’s not your index.js
your interactionCreate event handles interaction responses
It's just a message so just delete it
make sure to finish the whole guide...as you need all parts of the "your app" section to get slash commands working
ok
ThreadManager discord.js@14.23.2
Manages API methods for thread-based channels and stores their cache.
@silent mirage please use the hide option or #app-commands for personal docs usage
Sorry but how do i add it so a member can send messages in thread i did thread.member.add and i still can not send messages
it should inherit from the parent channel
threads dont have their own permissions
oh so if person can not send a message in channel it wont allow for them to send messages in thread
you can set the type to PrivateThread to prohibit who can be added but i dont remember exactly how private threads work
Yay cause its set to private thread but my alt still cannot send messages
What I'm defining wrong 😭
well you're not showing the code that errors
but if I were to guess, you're then using confesionescanal.send()
and confesionescanal is undefined
Yes that's what I'm using, wait I'll send it
btw you don't need to do that .find()
caches are Collections (Maps)
they're keyed by the id
just use cache.get(id)
The channel wasn’t found
is that line 65?
Yes
then what Chewinky said
fetchReply doesn’t exist on channel.send btw
Only interaction.reply
Oks, I'll erase that then
Usually caused by invalid id, id is the incorrect type, or bot isn’t a member of the guild that contains the channel
Log the confesionsid and type before the send call
Oks, I'll try to write the ids in the command and not on config.json, and how do I log the id? 😅
storing ids in config files is better, don't change that
I mean console.log
just log your confesionsid variable since it's what's causing the issue
see if it's the value you expect
compare it against the actual channel id you can copy from discord
Could also be that the channel is in a different guild
Okay, thanks I'll try that
Okay I found the error, one id wasn't on config.json sorry
Well it was, but with another name
DiscordAPIError[50035]: Invalid Form Body
data.flags[MESSAGE_CANNOT_REMOVE_COMPONENTS_V2_FLAG]: The MessageFlags.IS_COMPONENTS_V2 flag cannot be removed from a message once it has been set.
how do you actually bypass this limitation?
you can't
i think int.deleteReply + int.followUp
well that'd be a new message
depending on your use case that could work, or not
for instance with user app commands you have a limited amount of followUps
plus since it'd be a new message it'd notify people
damm
as it is the only way, i will try
hi, is there a feature in discord.js to set a voice channel status?
couldnt find it anywhere in the docs, do i have to manually do it by contacting Discord API, because that was the only solution I found on the internet.
It is not documented by Discord yet, so d.js thus does not support it at this time
oh
well then ill use the code sent by someone @ @bold elm to do it manually thanks
For buttons, it gives me the error when i try to use
.setEmoji('❌️') by saying it's not an emoji. Any solutions?
how do i make my discord bot status like this
hi, how to set status voice channel?, i couldn find anything about this in the documentation
you have to manually contact discord api and do it
its not an emoji. your supposed to get the emoji id
❌️
Ohh
its not very hard
async function updateStatus(channel, musicInfo) {
try {
const response = await fetch(`https://discord.com/api/v9/channels/${channel.id}/voice-status`, {
method: 'PUT',
headers: {
Authorization: `Bot ${process.env.BOT_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
'status': musicInfo
})
});
if (response.ok) {
console.log('Status updated successfully!');
} else {
console.error('Failed to update Status:', response.statusText);
const responseBody = await response.text();
console.error('Response body:', responseBody);
}
} catch (error) {
console.error('Error updating Status:', error);
}
}```
Yeah, its just weird that this isn't in the library yet, but oh well, thanks for the answer
its not documented by discord yet, even though its been here for 2 years
Thanks
and discord.js doesnt add undocumted features
np
ok, I understand, anyway, thanks
can you not use client.rest instead of a full blown fetch request
Hey, Is the latest update of modal hasn't be released in builder yet?
is it possible to add another option after an autocomplete?
for example /command [autocomplete] [integerOption]
they have, if you're talking about labels and select menus
yeah, but not like that the integer option only shows up when a specific autocomplete option has been selected
for that you'd need to use subcommands instead of autocomplete
so like the autocomplete will return the same integer option no matter the selected autocomplete?
I am talking the modal components. Can we use the existing select menus in modals?
Thank you. I am so sorry to bug you in.
I have start more reading
you predefine all options of a command on registering and not on executing
so if I register a command with an autocomplete option and an integer option, the integer option will always be existing no matter the given input of the autocomplete option
like Qjuh said you would need subcommands instead but that has a limit of 25
if thats enough you should use indeed slashcommands (or slash command groups if needed)
Hi, I'm currently getting an issue where my bot needs to authenticate via MFA to create channels etc.
Please help.
I see yea
the user who initiated the command the owner of the bot/application does not have enabled 2FA on their account
It's not a selfbot, it's being triggered through a modal & a bot token.
@dense jackal
enable 2fa on your account
It's not that, I've had 2FA enabled for a long time.
DiscordAPIError: Two factor is required for this operation
Elevated permissions are required to execute this action. You need to activate 2FA on your developer account in order to do this with the bot.
- Elevated permissions: learn more
- Setting up 2FA: learn more
wait i think ik the issue 😭
if the bot is part of a development team I guess all members with managing perms must have 2fa enabled, but not too sure about that
the bot is owned on an alt account that doesnt have 2fa i just remembered lol
lol
curious killing the moth; is "age verified" documented (but not announced documented? if its not publically announced) i wanna start filtering accounts by if they verified there age (if thats a flag bots can read) to better help filter out scam accounts
whoops wrong server for this message
const container = new ContainerBuilder();
const text3 = new TextDisplayBuilder().setContent(
[
'### Send Items',
`-# You are about to send item ID: ${selectedItemIds.join(', ')} to buyer: ${cfxName}`,
'-# Please confirm your action by clicking the button below or cancel if you made a mistake.',
].join('\n'),
);
const changelogButton2 = new ButtonBuilder()
.setLabel('Confirm Send')
.setCustomId(`confirm_send_${selectedItemIds.join('_')}_${cfxName}`)
.setStyle(ButtonStyle.Primary);
const cancelButton = new ButtonBuilder()
.setLabel('Cancel')
.setCustomId('cancel_send')
.setStyle(ButtonStyle.Secondary);
const section3 = new SectionBuilder().addTextDisplayComponents(text3)
container.addSectionComponents(section3);
const row1 = new ActionRowBuilder<ButtonBuilder>().addComponents(changelogButton2);
const row2 = new ActionRowBuilder<ButtonBuilder>().addComponents(cancelButton);
container.addActionRowComponents(row1);
container.addActionRowComponents(row2);
await interaction.update({ content: '', components: [container], flags: MessageFlags.IsComponentsV2, ephemeral: true, });
how to add action row components two?
What does this do?
Click it it’ll tell you
Is StringSelectMenuBuilder() isn't supported in ModalBuilder latest 14.23.2?
Why do you say that
As mentioned in the announcement #announcements message select menus are supporting now.
const modal = new ModalBuilder()
.setCustomId('xyz_modal')
.setTitle('Advanced Configuration');
const applyToSelect = new StringSelectMenuBuilder()
.setCustomId('apply_xyz')
.setPlaceholder('Who gets this role?')
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel('lama')
.setDescription('lama')
.setValue('lama')
.setDefault(true),
new StringSelectMenuOptionBuilder()
.setLabel('gemini')
.setDescription('gemini')
.setValue('gemini')
);
modal.addComponents(
new ActionRowBuilder().addComponents(applyToSelect)
);
await interaction.showModal(modal);```
I may be dumb. If you can help me out what am I doing wrong here?
Don't use action rows any more. They are deprecated in modals. Use labels
Modal -> Label -> Component
Oooo. My bad can you elaborate a little more or if there is docs?
You just need to replace ActionRowBuilder there with LabelBuilder then use a method from the second link
how
send pls 🙏
client.rest.put(/channels/${channel.id}/voice-status, { body: { status: status } });```
Thank you so much. Sorry to add you in much trouble.
No need to apologise :o
You'll also need a label on the label builder to make sure the API is happy, just test it out
const applyToLabel = new LabelBuilder({ label: 'Who gets this role?', component: applyToSelect });```
It worked. Thanks for the help!
how to do this
status without playing/watching etc
thx
whats the char limit on a label im hoping im in the limit for the modal one
i was over by 50 characters
how would i get the user here? i want to find it in a messageReactionAdd event but cant find it inside reaction.message.interaction
i know normally you would use interaction.targetMessage but this isnt inside a command
message.reference? Try that?
thanks
I believe that info is in the interactionMetadata
const trigger = messageReaction.message.interactionMetadata?.triggeringInteractionMetadata?.user
const target = messageReaction.message.interactionMetadata?.user
Message#interactionMetadata discord.js@14.23.2
Partial data of the interaction that this message is a result of
doing
let guild = client.guilds.cache.get(guildId);
is the same result in terms of data as doing
let guild = interaction.member.guild;
?
Depending what the guildId you use as the input in the first one, then yes.
But if you're trying to see where a command was used, then ya use interaction.guild
can a bot dm a bot?
That's a good question, probably not but you should test it
i did, i thought it would be funny, but ig not
Expected the value to be an object, but received string instead
Received:
| 'This is an example embed!'
at _ObjectValidator.handle (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2070:9)
at _ObjectValidator.parse (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at EmbedBuilder.setFooter (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\node_modules\@discordjs\builders\dist\index.js:341:26)
at Object.execute (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\commands\general\embed.js:12:8)
at Object.execute (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\events\interactionCreate.js:16:18)
at Client.<anonymous> (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\index.js:43:44)
at Client.emit (node:events:518:28)
at InteractionCreateAction.handle (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\timpu\OneDrive\Desktop\NovaEagle Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
i tried to enter embed command it didn't work
could you share your code?
here
footer is an object
To add text to the footer
.setFooter({text:'Your text here'})
ok
yes it includes the user who did the command but not on who it was done on
Then I would say that Discord does not exspose that Information to bots
i was able to get it through message reference
whats the issue here
for BakeWithMe? #djs-help-v14 message

why my guildId, cilentId and token appearing when i run "node deploy-commands.js"?
-# Note: i blurred my token for privacy reasons
Just help me My back hurts after coding for 3 Hours
Cuz I told you to add a console.log yesterday for debugging. You should remove that now that you don't need that log
ok
XD
solved ✅ XD
Hi,
Does this mean that a PartialMessage includes content and author, or that it excludes content and author ?
I'm trying to determine what a message has on the messageDelete event.
Thanks
you can check Partialize's docs
I did, but it's not any more readable to me
first is the partialized type (Message), then the nulled keys (they're always null) and then the nullables (could be null)
A partial message has only the ids guaranteed (message, channel, guild)
Okay, thanks.
It may include them but does not guarantee their presence
why giveaway bot doesnt have status?
and @sharp ginkgo too
Hi again,
Why everything at discordjs.guide is under /legacy now ?
All search results are broken because of this
Broken how?
We are gonna need more information
For example, I search the following : discord js enable partials
And got the following link : https://discordjs.guide/popular-topics/partials
Which leads to a 404 error.
The working link is the following : https://www.discordjs.guide/legacy/popular-topics/partials#enabling-partials
Why /legacy ? It's anti-SEO.
Oh you mean google search. Naturally that may take some time to update as google updates its index. For now you can use the search bar in the website
And that's how I finally found it yes, but it's a breaking change.
A non-breaking change would have been to at least make a redirection.
But, still, why moving the entire thing under this /legacy route with almost nothing left ?
tag suggestion for @robust flame:
HTTP-only applications receive interactions through HTTP webhooks instead of the Discord Gateway. Bots that are not connected to the Gateway, but use HTTP interactions appear as online without a status. Discord.js does not support HTTP interactions. Use discord-interactions instead.
We eventually plan to update to update the guide, so current content is under legacy because changing it later will present the same issue
they have HTTP interactions endpoint set, making them appear online without status
Hey guys 🙂
How can I set the bot avatar for a specific guild? Unfortunately, I couldn't find it in the docs. Maybe I'm just blind 😄
We've also added support for setting your application's bio and avatar per guild, as well as some poll cleanups!
documentation suggestion for @strange star:
GuildMemberManager#editMe() discord.js@14.23.2
Edits the current application's guild member in a guild.
Then please make a redirection until then
I have raised this internally
How can you access the description of a Label that was in the modal on a ModalSubmitInteraction? I tried looping through interaction.components and checking the component.description but they are all undefined
By knowing what you wrote in there. It's your code. The customId should be enough to know what the label was
The interaction doesn't contain the label
Ah okay thank you, I was just trying to get some information that's different in the label depending on the user through to my handler in a simpler way
const disabledComponents = interaction.message.components.map(
(container) => {
if (container.type === ComponentType.Container) {
const containerActionRow =
new ActionRowBuilder<MessageActionRowComponentBuilder>();
container.components.forEach((component) => {
if (component.type === ComponentType.ActionRow) {
component.components.forEach((innerComponent) => {
if (innerComponent.type === ComponentType.Button) {
const button = ButtonBuilder.from(innerComponent);
button.setDisabled(true);
containerActionRow.addComponents(button);
} else if (
innerComponent.type === ComponentType.StringSelect
) {
const select =
StringSelectMenuBuilder.from(innerComponent);
select.setDisabled(true);
containerActionRow.addComponents(select);
}
});
}
});
return containerActionRow;
}
return container;
}
);
if (disabledComponents.length > 0) {
await interaction.message.edit({
components: disabledComponents,
});
}```
any idea on how i'd clone a container and replace buttons/select menus with disabled now this works but it removes all other parts of the container like text displays etc and there is no ContainerBuilder.from 
documentation suggestion for @dapper cave:
createComponentBuilder discord.js@14.23.2
Factory for creating components from API data.
You can use this function
oh thank you
anyone know the doc page where all the interaction options are like targetMessage, reply etc
It depends which type interaction you would like?
there was a page that covered everything
but i keep losing it
Each of the interactions is different. They have overlap but they aren't the same. For example, Target message only exists on message context menu interactions
yh ik, but theres a page that got all options regardless if context menu or not. like isModalSubmit() targetMessage etc
everything you can do with interaction basically
Both of those exist. On message context menu interactions.
can you link me to one
documentation suggestion for @tardy sable:
MessageContextMenuCommandInteraction discord.js@14.23.2
Represents a message context menu interaction.
ah yes its that
thank you
What are all the new components in the modals?\
The discord API docs will naturally have that
message_reference[MESSAGE_REFERENCE_UNKNOWN_MESSAGE]: Unknown message
what does this mean
Hi, do you recommend using the InteractionCreate event with interaction.isModalSubmit() instead of interaction.awaitModalSubmit of ChatInputCommandInteraction?
When using an event, you don't need to specify a time to complete the form, right?
you are trying to reference a message that doesn't exist (anymore) within the scope your app has access to
the app needs to have a bot user in the server that can view the channel the message was sent in to reference it (forward/reply)
in this case, probably reference it not probably
it really depends on your use case...both are good but for different reasons
if you start an interaction and use the modal for additional input, then awaitModalSubmit is probably better...but interactionCreate is better for standalone event flows as well as if you can't predict when the user will submit the response modal
Modal data is no longer retrieved using interaction.fields.getTextInputValue('myCustomId')?
it is?
but if you need any data outside of the modal submit, then you can either store that data in a "pending" queue somehow, or you can use a collector (awaitModalSubmit) to gather additional info
I have this code:
const reasonTxt = new TextInputBuilder()
.setCustomId('inputReason')
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);
const reasonLabel = new LabelBuilder()
.setLabel("Report Reason")
.setTextInputComponent(reasonTxt);
modal.setLabelComponents(reasonLabel);
interaction.showModal(modal);
interaction.awaitModalSubmit({time: 300_000 }).then(interaction => {
const reason = interaction.fields.getTextInputValue('inputReason');
And when i click on "send", console shows:
TypeError: Cannot read properties of undefined (reading 'forEach')
at /home/ivanmbo/DB/BotDS/node_modules/discord.js/src/structures/ModalSubmitFields.js:23:23
Im using this to update from ActionRows: https://github.com/discordjs/guide/pull/1631/files?short_path=b2290ee#diff-b2290eeb2a4f13f335eb82edcb5c6db372baf0dcb40c4a92ebd5c2554fc2ffe7
what's your DJS version? and how are you building your modal?
all of it...how are you adding the labels?
modal.setLabelComponents(reasonLabel);
interaction.showModal(modal);
discord.js includes builders. i’m not sure why you have core installed if you are using d.js alone
if you use discord.js rather than the subpackages, then installing the subpackages can cause data mismatches
That's very true, now it works, thanks
is this in miliseconds or seconds?
seconds
thanks
is there a way to fetch a users discord badges?
No, the closest there is to that is fetching their flags, however not all flags are associated to a badge and not all badges have an associated flag
like fetching hypesquads
isnt hypesquad going away? why bother?
yeah the hypesquad program closed
if you want to view the badges of a user, simply click on their profile
there is no reason a bot needs to see user badges other than to just display already visible user information
O
like the badges are going away?
that we dont know but it's at least not accessible...i wouldnt be suprised if it gets removed entirely
Is it normal for some bots, that they are fetching the users' badges? In the embed, it fetches that I have the Active Developer & Hypesquad Balance badge.
they are using some undocumented route or some oauth based system
and again, this is all visible by clicking on a user's profile
not trying to discourage what you want to do, but there is a reason why discord does not want bots to do this, since there is no reason to
Has anyone else had issues with components v2 not displaying correctly on mobile?
did you update your mobile app?
why does this return error on modals. the setDefaultValues part, and yes the id is a user
new MentionableSelectMenuBuilder()
.setCustomId("mentionables")
.setMaxValues(25)
.setDefaultValues([{ id: "427193512522416180", type: SelectMenuDefaultValueType.User }])
error:
CombinedPropertyError (1)
Received one or more errors
input.component
at _ObjectValidator.handleIgnoreStrategy (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2136:70)
Yes it’s on the most recent version
I mean I've noticed some slight offsets, but that's mainly on android and it's more of a nitpick tbh
@golden laurel dont want to bother you but
worked for me no issue
let me check if im on latest version
As an aside you know with MentionableSelectMenu user can select user, channel or role
channel too?
#djs-help-v14
yes...since i mentioned it...its mentionable
are you sure? because no channel is showing up for me on the mentionable menu
I assumed that I cant seem to get that to happen
i see someone had same error as me
oh nevermind i guess not...i remember it being that way...but the docs show that it's only roles and users
Select menu for mentionables (users and roles)
same
@wary coral is that a modal youre working with? cuz im on latest version and still have the error
yes,
const menu = new MentionableSelectMenuBuilder()
.setCustomId("mentionable")
.setMaxValues(25)
.setDefaultValues([
{ id: "427193512522416180", type: SelectMenuDefaultValueType.User },
]);
const menuLabel = new LabelBuilder()
.setLabel("mention")
.setMentionableSelectMenuComponent(menu);
hm weird
wait use it inside a label too
you need to put it in a label
oh nvm overlooked that bruh
try this, this is my exact code
const modal = new ModalBuilder().setTitle("mentions").setCustomId('modal')
return await interaction.showModal(
modal.addLabelComponents(
new LabelBuilder()
.setLabel("mentions")
.setDescription("select")
.setMentionableSelectMenuComponent(
new MentionableSelectMenuBuilder()
.setCustomId("mentions")
.setMaxValues(25)
.setDefaultValues([{ id: "427193512522416180", type: SelectMenuDefaultValueType.User }])
)
)
)
no problems
very weird
this is the full error log
CombinedPropertyError (1)
Received one or more errors
input.component
| CombinedError (6)
| Received one or more errors
|
| 1 CombinedPropertyError (2)
| | Received one or more errors
| |
| | input.type
| | | [ExpectedValidationError: s.literal(V)]
| |
| | input.style
| | | [MissingPropertyError: style]
|
| 2 CombinedPropertyError (1)
| | Received one or more errors
| |
| | input.type
| | | [ExpectedValidationError: s.literal(V)]
|
| 3 CombinedPropertyError (2)
| | Received one or more errors
| |
| | input.type
| | | [ExpectedValidationError: s.literal(V)]
| |
| | input.default_values
| | | [CombinedError]
|
| 4 CombinedPropertyError (1)
| | Received one or more errors
| |
| | input.default_values
| | | [CombinedError]
|
| 5 CombinedPropertyError (2)
| | Received one or more errors
| |
| | input.type
| | | [ExpectedValidationError: s.literal(V)]
| |
| | input.default_values
| | | [CombinedError]
|
| 6 CombinedPropertyError (2)
| | Received one or more errors
| |
| | input.type
| | | [ExpectedValidationError: s.literal(V)]
| |
| | input.options
| | | [MissingPropertyError: options]
at _ObjectValidator.handleIgnoreStrategy (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2136:70)
at _ObjectValidator.handleStrategy (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1983:47)
at _ObjectValidator.handle (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2089:17)
at _ObjectValidator.parse (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at LabelBuilder.toJSON (/home/container/node_modules/@discordjs/builders/dist/index.js:1638:20)
at /home/container/node_modules/@discordjs/builders/dist/index.js:2734:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (/home/container/node_modules/@discordjs/builders/dist/index.js:2734:35)
at StringSelectMenuInteraction.showModal (/home/container/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:402:46)
what does you project dependencies look like?
latest djs version is 14.23.2?
anything else?
do you want me to send all dependencies?
run npm ls
what does that do
it list out all of your project dependencies
https://docs.npmjs.com/cli/v11/commands/npm-ls
tag suggestion for @tardy sable:
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
[0;31mnpm [0;0muninstall discord-api-types @discordjs/rest @discordjs/builders
[0;34myarn [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
[0;33mpnpm [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
just a disclaimer, because you are using distube with youtube and ytdl plugins, we won't really help you further since those violate the TOS
^
i dont use those anymore just havent uninstalled yet
error still persists after doing this
I’ve noticed entire text displays not rendering correctly (or at all) in containers
this is not something that we can solve as being in the discord.js server. you might want to bring it up in ddevs #useful-servers and see if they have any information about it since this would be a client issue
Yea I will once I can gather a little more information, just figured I’d run it by here first
we only handle discord.js issues
Why can't I use channel.send?
If by "use" you mean with TypeScript/autocomplete, because you haven't ensured that the channel you're receiving is actually a channel type you can send messages to
Good...
TypeScript doesn't know that though by default
I'm using node.js/JavaScript
How do I do it?
Okay, so what are you referring to when you say you "can't" use channel.send?
Ahhh, wait, I just realized... As the method name suggests - Channels - it returns multiple channels, not just one
console log + error returned
A Collection of channels to be specific
Yea, exactly. Your channel variable is not actually a single channel, it's a Collection containing any number of channels
Collection#first() discord.js@14.23.2
Obtains the first value(s) in this collection.
.setContexts(['Guild'])
``` is this good?
.setContexts(InteractionContextType.Guild),
got it
Does anyone know how to achieve an effect similar to inline fields in embeds in components v2?
with spaces
which breaks on mobile but, that's the only way pretty much
I'd recommend just looking for an alternative way to represent your fields in cv2
Manually, yes, but here we're talking about doing it automatically, because previously I used the function in the value field, set inline to true, and it worked fine, but now I can't do that because there is only one text.
there shouldn't be a problem with adding spaces automatically
but like I said, it'd break on mobile, plus it's not actual good UX
it's the same answer as before, look for an alternative
Alternatively, I can put everything vertically, but then there is a large empty space on the right.
Then continue to use embeds. As Components can't have inline fields and I don't believe they intend to change that ever
Now that I've started using these v2 components, the embeds seem outdated. Besides, looking at the v2 components, these embeds are terribly small.
so how exactly do we add select menus to modals? i'm trying to do something like this but it doenst work
const personInput = new StringSelectMenuBuilder()
.setCustomId('select')
.setPlaceholder('Select the person')
.setMinValues(1)
.addOptions(personList)
const actionRow =
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(personInput);
modal.addComponents(actionRow);
They go inside a Label, not an ActionRow
LabelBuilder discord.js@14.23.2
A builder that creates API-compatible JSON data for labels.
ModalBuilder#addLabelComponents() builders@1.12.1
Adds label components to this modal.
Ah okay, now I have a list of things i want users to be able to select, but yet I get this error when I set a setMinValues on the StringSelectMenuBuilder?
DiscordAPIError[50035]: Invalid Form Body
data.components[3].component.min_values[NUMBER_TYPE_MAX]: Int value should be less than or equal to 1.
Specifically, I want people to be able to select more than just one option, how would I do that?
Currently I have it like this:
const peopleInput = new StringSelectMenuBuilder()
.setCustomId('people')
.setPlaceholder('Select people')
.setOptions(peopleList)
.setMinValues(1);
const peopleLabel = new LabelBuilder()
.setLabel('People')
.setDescription('Please add relevant people')
.setStringSelectMenuComponent(peopleInput);
actually what do i do if i have more than 25 things that i want to display?
I was wondering is it possible for a discord bot to have guild specific profile as in different avatar , bio , banner for different guilds and no im not talking about webhooks or using different bot instances
are there code examples on github or something for the new modal components ?
someone sent this a while back u can use it as a example
https://pastebin.com/FMthQcp4
Or use this
https://modal.builders/
is kiss your heart guys
I was wondering is it possible for a discord bot to have guild specific profile as in different avatar , bio , banner for different guilds and no im not talking about webhooks or using different bot instances'
you can do different avatars and bio
ohh
And banner too
is there a way to make my bot status like this
this bot doesn't have a status
so invisible?
HTTP-only applications receive interactions through HTTP webhooks instead of the Discord Gateway. Bots that are not connected to the Gateway, but use HTTP interactions appear as online without a status. Discord.js does not support HTTP interactions. Use discord-interactions instead.
yeah that
if the bot only has HTTP interactions, no status will be displayed as it has no gateway connection.
is there a way to make discord.js work with http interactions without a gateway connection
_ _
_ _
Question, what's the way to go if I want to clone a message's components to edit the message to edit the message with adjusted components?
For example, I want to edit a message but with all buttons disabled. Or I want to edit a message and use the the components from the message and just append another component.
What's the best way to do this?
interactions.js does this. But it hasn't been maintained very well.
where
is that the only way bruh
no ****
is there a way to do it with discord.js without changing my code
Your questions were literally answered in the tag I sent
oh, mb
new WhateverBuilder(message.components[0].toJSON()) and then edit what you want to edit
but I'd have to make a very long switch-statement in a function to account for every component builder. Right?
I'd assume you know what your top-level component is in the place where you want to edit it (since you'd need to know where the thing you want to edit is anyway)
If you just want to append to it you can just use the toJSON() result and won't need new builders
well, currently I only have two points where I'd need to do that.
- The message has a single container with an action row somewhere. All buttons in it should be disabled.
- The message has a single container with a section of which the button accessory should be disabled.
ah, that's good to know. Thanks!
Both cases would be covered by new ContainerBuilder(message.components[0].toJSON()) then, no switch needed at all
yeah but I had the idea to make a universal function for that so I could simply reuse that 😅
I did this now, I don't know if it will work but I'll try and see.
Can you use GIFs in mediagallery? I tried checking discord docs and discord.js docs but can't find and if I try it doesn't work so imma just assume no but can't hurt to ask here fr
yes
olá
do you know if this error has been fixed? i still have error with the setdefaultvalues on the mentionable menu
It has been fixed. What /builders version do you have installed? Maybe need a fresh install to have the correct fixed version
version 1.12.1
@discordjs/builders@1.12.2 has the fix
ill update and see then
thank you that fixed it
can you set defaultvalues for a stringselectmenu or is that only for channels, roles etc?
wanted to know from when should I start sharding ? when my bot is in over 100+ or 1000+ servers ?
