#djs-help-v14

78874 messages · Page 49 of 79

unique shoal

That is not supported

vocal garnet

okayy too bad but still tysm

grim oxide

im going to try subcommandgroup, but i wonder what does it look like? is it like /dev ping test?

stable sun

Yea

grim oxide

oh, thanks!

unkempt thistle

is everyone getting the deprecation warning for the new clientReady event, regardless if you changed it or not?

unique shoal

No

dense jackal
unkempt thistle

👍, that's what i thought.

dry star

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

spiral cargo

what does the whole channel's info return in console?

sharp ginkgoBOT

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

dry star
snow onyx

it returns a collection, not a single channel object

dry star

yes it does

snow onyx

because channel is a collection

dry star

oh so what do i use?

snow onyx

you use that but treat it as a collection
if its not a multi select, you can just use .first() on it

dry star

oh i actually never thought of that im gonna try it

it worked ty!

verbal plinth

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

chrome chasm

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

slate hazel

is it possible to align three TextInputComponents in a row in a new ModalBuilder api?

golden laurel

Modals have labels, and labels only have 1 component

slate hazel

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?

rose tangle

showModal and editReply

slate hazel

oh seems followUp just works fine, will look into editReply as well, thanks!

cosmic grotto

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

steel trail

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

rose tangle

can you show all your initial attempt?

you had the initial container builder, were you using a collector or something?

placid kiln

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?

rose tangle

for which component specifically?

though pretty much the only new component is the label

sharp ginkgoBOT
placid kiln

thy

doesnt it say here #announcements message

text display and select menus of all types

or am i missing something ?

rose tangle

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

sharp ginkgoBOT
placid kiln

okay didnt know about the label

last eagle

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

proud arrow

You can't use embeds with components v2.

(or content field)

bleak owl

that’s an embed, not a container

last eagle
proud arrow

Or more likely, that's a container not an embed

last eagle

so how do i make this a "container"

last eagle

thanks!

grand slate

Does anyone have an example of how to use the new question types in Discord modals?

grand slate

guide is not updated?

dense jackal

oh I don’t think it has the updated components

rigid crest

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

rigid crest

ugh the only thing i was looking forward to if it was added

tardy sable

file uploads are next for modals. dont think displaying images are coming any soon in modals

rigid crest

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

tardy sable

yh file uploads are coming soon i think, its already documented

rigid crest

Party

hmm, this could backfire its still limited to 5 modules per modal right? i currently use 7 slash options hmm

proud arrow
rigid crest

oh neat

slate hazel

is there a way to specify an integer/number input in a modal? seems there's only a text input

wary coral
iron needle

Where can you find the limits for rateLimitPerUser (slowmode) and timeouts?

gentle oriole

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

tardy sable
gentle oriole
upper jay

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

rose tangle

the latter

since it's a modal interaction

sharp ginkgoBOT
upper jay

Awesome, thanks

small lotus

just noticed this error today. didnt change anything in the code. what am i supposed to do?
checked intents, code everything

sharp ginkgoBOT

Fetching members can time out on large guilds, as they arrive in chunks through the WebSocket connections.

  • You can specify the time option in FetchMembersOptions to specify how long you want to wait.
  • Make sure you have the required GuildMembers gateway intent enabled
small lotus

thank you!

faint pond

Hey with the new modals changes, is there documentation around this anywhere? Can't seem to figure it out.

rose tangle

the new label component

sharp ginkgoBOT

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

rose tangle

it wraps the select menus

faint pond

Okay, nevermind, can't seem to add anything other than a TextInputComponent still.

rose tangle

yeah you can add labels and text displays now

faint pond
rose tangle

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

faint pond

Hmm okay, what was the reason for creating this new LabelBuilder then? Unsure what the requirement is?

rose tangle

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

faint pond

We still limited to like 5 things per modal?

rose tangle

top level, yes

rare citrus

Are select components supported in modals in discord js yet ?

rose tangle

we're just talking about how to use them right above you

rare citrus

Cheers

tardy sable

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;

rose tangle

fetching many will always fetch, it won't check in cache

rose tangle

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

tardy sable

oh okay. so the cache is not used for this kind of stuff?

rose tangle

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>

tardy sable

yh thats what i did

rose tangle

so the code you're showing is not the updated one?

tardy sable

that was old. just replaced await interaction.guild.members.fetch() with the cache interaction.guild.members.cache

faint pond

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);
tardy sable
rose tangle
faint pond
tardy sable
sharp ginkgoBOT
faint pond

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

rose tangle
tardy sable
faint pond

Ahh ignore me 🤣 I forgot to compile the sub-package.

tardy sable
rose tangle

just in case could you show what your current code looks like?

tardy sable
rose tangle

I meant only the part where you get the position

tardy sable

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

rose tangle

do you have sweepers or limits?

tardy sable

nope

stable sun

People leaving will decrease your join position

tardy sable

but my join position is increasing...

also doesn't it update the cache on member leave?

stable sun

Yea, it removes members from the cache

tardy sable

wait maybe its partial members? could that be affecting it

stable sun

Partial members aren’t cached until you fetch them

tardy sable

can a member become partial during cache?

stable sun

No

That would imply that you deleted data from them

tardy sable

okay so that isnt affecting it

stable sun

You could just filter to see how many ppl joined before btw

Faster than sorting

Unless you keep the sorted array cached and updated

tardy sable

ill see if thats more accurate

stable sun

Could you just check if there’s partial members cached while ur at it?

tardy sable
stable sun

I rly don’t see how you can get different results unless you mess up the cache

tardy sable

me neither. im not modifying the cache or using sweepers or whatever

slow pebble

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)

steel trail
tardy sable

yh but sorting the cache wouldnt affect a join position?

steel trail

It's very inefficient however and you are modifying the cache. Which you really shouldn't. Use toSorted instead

tardy sable

thanks

whats the difference of using client.once and client.on?

steel trail

Once only emits once

tardy sable

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

steel trail

That makes no sense. on definitely works unless you broke it in your code somehow.

fathom sand

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

tardy sable
unreal stone

I have a question, what is the difference between .setLabelComponents and .addLabelComponents ?

red coral

One sets it one adds components

clear garnet

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

unreal stone

Oh, okay ! Thanks

unique shoal
red coral

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

bleak owl

im not too sure what that has to do with the discord.js library

unique shoal

Im just going with suspicious spam account and they can appeal if Im wrong

brittle current

what shoul i use for text input

rose tangle

that

you're just not using it anywhere and your ide is warning you

brittle current

oh srry im dumb

thx

kindred moon

it explains what to do right after the @deprecated tag, use the LabelBuilder to create a label instead

brittle current

thx

dapper cave

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

bleak owl

you can set channel types

dapper cave
bleak owl

what?

dapper cave

same goes for user select I cant give it a list of users unless im insanely blind.

pure ridge

hey guys .. what is the difference between addOptions() and setOptions()

bleak owl

you can't specify specific channels to be shown

dapper cave
bleak owl what?

like pass the channelselectbuilder a list of channel ids so then only those channels show and u can pick from those not ALL channels.

dapper cave
bleak owl

not helpful

dapper cave
pure ridge
bleak owl
bleak owl
dapper cave

discord 🤏 close to cooking they got the components now just give us W options for them fr

tardy sable
bleak owl

in other words, a *string select menu

dapper cave

wait ur onto something how did I not think of that 💀

brittle current

How to set desc for textinput in label builder

dapper cave
      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
brittle current

thx

dapper cave
modal.addLabelComponents(
    paragraphLabel,
);```
red coral

You can also do like setTextInputComponent((label) => label.) right?

rose tangle

modal.addLabelComponents((label) => label...) yeah

outer plume

Just to confirm, using action rows in modals will be deprecated right?

unique shoal

It is deprecated

outer plume

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

pure ridge

i'm a little confused now .. is label builder new for modals or how is this working now

warm scroll

Hi, is there any way to get user from UserSelect in modal? I'm getting undefined when processing modal

sharp ginkgoBOT
brittle current

They still work but idk if it will work after sometime

wicked rampart

is there a way to create a URL that when clicked auto populates a slash command in chat for someone?

unique shoal

Breaking changes will not be introduced in any v14 version

unique shoal
unique shoal
sharp ginkgoBOT

Message formatting (mentions, timestamps, emoji, etc.): learn more

outer plume
unique shoal

No?

outer plume

oh?

unique shoal

As in the action rows that exist in containers?

No

Why would they be

pure ridge

can a container be ephemeral?

unique shoal

In the sense that they can be in an ephemeral message, yes

pure ridge

so .. it is possible to use multiple flags in CommandInteraction reply() ?

unique shoal

Yes, join them with |

outer plume
unique shoal

MessageFlags.Ephemeral | MessageFlags.IsComponentsV2

outer plume

so addComponents will be deprecated in the future to be specific for what action row it's getting

unique shoal

I have no idea

I have no context for that discussion

outer plume

oh wait see @unique shoal

unique shoal

okay

outer plume

but yeah no context so np. thanks Pray

unique shoal

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

outer plume

hm yes ok. action rows aren't going anywhere. But actionrow being generic might change in the future

wicked jungle
 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 ?

rose tangle

because you can't have a section without an accessory

wicked jungle

been on this for hours lol thanks

a better error message would be useful lol

astral pine

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
bleak owl

use the intents you actually need, not sure why you are using all of them

other than that, what's the issue?

astral pine

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?

clear garnet

I don't see where you're logging in

astral pine

omited when sending on discord, it logs in correctly, it just wont print anything when i DM it

sharp ginkgoBOT

To receive direct message events on "messageCreate" with your bot, you will need:

astral pine

the older versions were so easy in comparison
but it works now, thank you

bleak owl

i disagree, but glad it works for you now

astral pine

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

grizzled notch

where in docs is per server profile stuff?

stable sun
grizzled notch
grizzled notch
stable sun
grizzled notch

im on old docs..

-.-

stable sun

guild.members.editMe(…)

sharp ginkgoBOT
grizzled notch

oh

stable sun

Thought you were trying to grab the avatar

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

brittle current
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;
        }```
wary coral

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

sharp ginkgoBOT

documentation suggestion for @brittle current:
method 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);

wooden carbon
solar furnace
solar furnace
solar furnace

ah

wary coral

You are looking for the metadata from other applications correct? Not your own?

sharp ginkgoBOT
wary coral

The above documentation link is for getting your own applications. Role connection metadata

brittle current

thx

stable olive

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?

crimson gale

no

wooden carbon

if i can get the bot's role, then i can surely get the linked role.

thin pagoda

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

wary coral
thin pagoda

so i need to pass a sized photo into media gallery right

wary coral
sharp ginkgoBOT
wary coral
wooden carbon

But i have no idea how do i get the keys of those linked role.

wary coral

Why do you need the keys?

brittle current
// --- 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
wooden carbon

Idk how to explain

wary coral

Are you trying to check for only your application or other applications as well?

wooden carbon
wary coral

You could get the metadata with a raw request as long as you have the applications ID

wooden carbon
wary coral

IDK wym. You don't need the key to submit a rest request for the application role connection metadata

wary coral

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

wary coral
wooden carbon

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.

wary coral

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

wooden carbon

also, i have those info stored in the db so, no need for fetch

wooden carbon
wary coral

Glad I could help in some way best of luck with your project

wooden carbon

can you test it out please

wary coral

IDK

I cant I am running out the door for work right now

wooden carbon

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.

wary coral
wooden carbon

No bot id, and nothing else.

Maybe <guild>.fetchIntegrations() has something

let me try

ember summit

Rq how do you get the stringselectmenuvalue from a modal once its submitted?

ember summit

Im looking through it but its always been confusing for me

sharp ginkgoBOT
ember summit

coool tty

wary coral
wooden carbon
wary coral

Probably needs manage integrations

wooden carbon

I can't seem to get it with normal member perms.....

I don't want the bot to have manage integrations perms :/

proud arrow
wooden carbon
proud arrow

Yeah you can't get that

wooden carbon

;-;

proud arrow

Discord doesn't expose that information

wooden carbon

:/

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.

proud arrow

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

dense crown

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

wary coral
dense crown

Property 'options' does not exist on type 'ChatInputCommandInteraction<CacheType> | MessageContextMenuCommandInteraction<CacheType> | UserContextMenuCommandInteraction<...> | PrimaryEntryPointCommandInteraction<...>'.
Property 'options' does not exist on type 'PrimaryEntryPointCommandInteraction<CacheType>'.

wary coral

You want to use ischatinputcommand

dense crown

oh it started working after i changed if (!interaction.isChatInputcommand())
yea i did it thxx

wary coral

Np

short mulch

How do I get the select menu value from a select menu in a modal?

cloud nacelle

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)
cloud nacelle
proud arrow
cloud nacelle
proud arrow

Yeah, so we can't do anything here. This is an issue with your ide

cloud nacelle

oh okay i'll try on VSCode

in VSCode it work well thanks

wooden carbon
wary coral
short mulch
wary coral

This is for the old textInput but the principal is the same

dapper cave

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

short mulch
dapper cave

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);
sharp ginkgoBOT
wary coral
short mulch

Kk,Thanks.

wary coral
toxic latch

Hi, how can I embed/make a clickable bot command like this?

fathom warren

by inserting command mention in order </command_name:command_id>

toxic latch
fathom warren

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

fervent osprey

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?

fathom warren
fervent osprey

ah I think I got it thanks!

fathom warren

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

hushed furnace

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?

dapper cave
grim oxide

since ModalBuilder.addComponents() is deprecated, what other function can i use though?

hushed furnace
grim oxide
dapper cave

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 stare (ChatInputCommandInteraction)

true notch

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 | }
dapper cave

copy 50035 🗣️

dapper cave
true notch
dapper cave
dapper cave
true notch

yes same, I really don't understand the meaning of this error

dapper cave

might actually be discord's fault praysob

halcyon bison
halcyon bison
true notch

ah true, I might be missing UPDATE_MESSAGE...

sharp ginkgoBOT

tag suggestion for @dapper cave:
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.

golden laurel

I'm guessing that link is what actually gave you the error?

halcyon bison

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

dapper cave

alr one sec pls

I might've fixed it

thank u all for the help happy

bitter pivot

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

Specifically like the SlashCommandBuilder.setDescription I mean - so that commands are translated

rose tangle

there's no best way, there's only one

you set the description_localizations, either via the builder or the raw data

sharp ginkgoBOT
toxic moat

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

stable sun

It has to be a direct link to the image

hushed furnace

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.

rose tangle

can you show your code?

hushed furnace
rose tangle 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"
                }
            ])
    );
versed current

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.

rose tangle
hushed furnace

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.

rose tangle
versed current
hushed furnace

Oh I guess modals just keep the same data that was previously entered when being opened again.

rose tangle

you'll need a setMinValues(0) if you want to allow nothing to be selected, which would show the placeholder

versed current
hushed furnace

pepeOk Thanks

rose tangle

alternatively you could add a description to your label which will always be shown regardless of selection

tardy sable

question, if a channel id invalid for a ChannelSelectMenuBuilder in setDefaultChannels. does it throw error?

also just any select menu that accepts default values

versed current

it can only be invalid if the channel is deleted between the submission and your processing. The chance is minimal.

hushed furnace
rose tangle

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)

tardy sable

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?

rose tangle

djs won't

the api, probably

tardy sable

alright will ask there

okay it will just filter it out nice

dim estuary

Does discord.js support per guild bot profile?
I can't seem to find a method to edit the avatar banner etc.

crimson gale

guild > members > editMe

dim estuary
grim oxide

huh..? i imported ButtonBuilder but not ThumbnailBuilder, and now this comes out

stable sun

Show code

It’s saying you didn’t provide a button nor thumbnail. Importing it is only half the battle

grim oxide

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

glacial quail

requestContainer is just an array?

grim oxide

nope

glacial quail

oh never worked with ContainerBuilder so i'm sorry that i can't help

grim oxide

it's alright

glacial quail

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],
    })

grim oxide

hmm ill try that

rose tangle

it's unrelated to that part of your code

grim oxide

oh

rose tangle
grim oxide

i see, but how can i fix that?

rose tangle

add an accessory to the section

or if you just want text, don't use a section

just add the text

grim oxide

i see

sharp ginkgoBOT
grim oxide

ill check what i was doing with that component, thanks for the help

glacial quail

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?

grim oxide
stable sun
rose tangle

containers and action rows are different things, a container looks like an embed

it can also have an action row inside

glacial quail

Ohhh, didn't saw that. Thanks for clarifying!

stable sun

Also see the guide for a visual reference of the other components

sharp ginkgoBOT
shut musk

What kind of error is this?

wary coral

What is the code you ran

shut musk
 await message.react(personReaction)
```Seems like this 😂

No idea, discord could've taken a hit or something because first time seeing this

rose tangle

I'm pretty sure that's not supposed to look like that

what is personReaction?

shut musk

honestly bro idek, i tried finding the msg but i couldn't see myself 💀

I can search the db for that

coral river

Is there a way to get every filled in option in a command if theyre all not required?

shut musk
rose tangle

looks like it was that but without the <>

so it wasn't parsed as an emoji string

shut musk

It works perfectly fine now though that's very odd lol

shut musk
rose tangle

if you're saving it on a db just save it with the <>

shut musk

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

rose tangle

what does the url look like

shut musk

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

rose tangle

are all those projects different applications?

shut musk

All those projects run on the same machine but yeah are different bot applications, each one

Even my main bot was affected

rose tangle

I think cf ratelimits look different but it could be that

given it's a 403 anyways

shut musk

All of them are like in that hour span and all projects though I thought discord.js would show something better

rose tangle

no description is the fallback

since there's no code = no description kek

shut musk

does discord.js return 429s ?

or does it go under the ratelimit event

rose tangle

depends on your client options

shut musk

i haven't changed anything with ratelimit

sharp ginkgoBOT

propertysignature 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

rose tangle

should be the event then

shut musk

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

coral river

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?

rose tangle

the latter is what you're supposed to do, yeah

what else do you want to do?

coral river

dunno

tardy sable

can i set empty string in setvalue for textinputbuilder?

coral river

thought there might have been some sort of built in function inside of DJS, who knows

rose tangle

I meant to ask what is your use case that you need that

or how would that be used in the first place

coral river

prob would be a better way to do it

rose tangle

though that's the default anyways, modals are shown without any input

tardy sable
rose tangle
coral river
rose tangle

I think you can access the raw values, but it's not good DX

coral river
rose tangle

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

bitter nova

is there any particular reason why Permissions havent been added to discord api types

versed current

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,

wary coral

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

loud quartz

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

versed current

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,
});
loud quartz

You cannot create a private thread out of a message

versed current

ah

makes sense (or not)

loud quartz

Not our rules

versed current

yeah; It works now. Thanks so much!

wary coral
loud quartz

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

wary coral

I guess I would have just put it in the placeholder instead of value, but that is personal preference

loud quartz

Welllll.. while valid, value is selectable

And editable

But yeah

versed current

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

silent mirage

how to resolveColor using a #hex

rose tangle

you just pass it

I assume you're talking about how to use the resolveColor function

silent mirage

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

you need to type assert it as ColorResolvable

clear garnet

Why are you removing the #?

rose tangle
silent mirage
clear garnet

Yea, don't remove it, resolveColor() handles that internally already

sharp ginkgoBOT
clear garnet

Per the types, it supports passing #${string} string types to it

silent mirage
      .setColor(resolveColor(panel.embed.color || "#0099FF"));


clear garnet

As for the types though, assuming panel.embed.color is typed as just string, yea, you'll need to do what Amgelo suggested

silent mirage

i still get same error is doing this and yes its a string

clear garnet
rose tangle

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

clear garnet

Also, if you're using this on an EmbedBuilder, you don't need to do resolveColor() anyways, as that's also called internally

cosmic burrow

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

topaz bluff

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

cosmic burrow

ok

but where?

topaz bluff

anywhere?

cosmic burrow
topaz bluff

yes...anywhere under line 2

cosmic burrow

i deployed them again and it shows the same error

i put under line 2

clear garnet

Your guildId is undefined

cosmic burrow

yeah, i just put the server id inside of guildId in config.json

clear garnet

Okay, well whatever it is you're doing, it's resulting in guildId having a value of undefined, hence the error

cosmic burrow

guildId is corrected

solved already ✅

silent mirage

how can i create a thread

sharp ginkgoBOT

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

cosmic burrow

module.exports = {
  data: new SlashCommandBuilder()
  .setName('hello')
  .setDescription('Responds to hello'),
  async execute(interaction) {
    await interaction.reply('Hello!')
  },
};```

how to add ephemeral here
sharp ginkgoBOT

guide 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

bitter glade

What do you recommend more for discord.js, ESM, or commonjs?

bleak owl

that’s ultimately up to you

little pebble
cosmic burrow

ok

bitter glade
little pebble

ESM has been the standard for JavaScript for a while now

silent mirage

how can i remove this

bleak owl

remove what

silent mirage

Frost Secure started a thread

bleak owl

not possible

cosmic burrow

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
bleak owl

that’s not your index.js

your interactionCreate event handles interaction responses

little pebble
topaz bluff
cosmic burrow

ok

sharp ginkgoBOT
rose tangle

@silent mirage please use the hide option or #app-commands for personal docs usage

silent mirage

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

topaz bluff

it should inherit from the parent channel

threads dont have their own permissions

silent mirage

oh so if person can not send a message in channel it wont allow for them to send messages in thread

topaz bluff

you can set the type to PrivateThread to prohibit who can be added but i dont remember exactly how private threads work

silent mirage

Yay cause its set to private thread but my alt still cannot send messages

broken lake

What I'm defining wrong 😭

rose tangle

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

broken lake
rose tangle

btw you don't need to do that .find()

caches are Collections (Maps)

they're keyed by the id

just use cache.get(id)

stable sun

The channel wasn’t found

rose tangle

is that line 65?

broken lake
rose tangle

then what Chewinky said

stable sun

fetchReply doesn’t exist on channel.send btw

Only interaction.reply

broken lake
stable sun

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

broken lake
rose tangle

storing ids in config files is better, don't change that

stable sun

I mean console.log

rose tangle

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

stable sun

Could also be that the channel is in a different guild

broken lake
broken lake

Well it was, but with another name

zealous bison

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?

rose tangle

you can't

zealous bison

i think int.deleteReply + int.followUp

rose tangle

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

zealous bison

damm

as it is the only way, i will try

last eagle

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.

clear garnet

It is not documented by Discord yet, so d.js thus does not support it at this time

last eagle

oh

well then ill use the code sent by someone @ @bold elm to do it manually thanks

short mulch

For buttons, it gives me the error when i try to use
.setEmoji('❌️') by saying it's not an emoji. Any solutions?

last eagle

how do i make my discord bot status like this

mortal plover

hi, how to set status voice channel?, i couldn find anything about this in the documentation

last eagle
last eagle

❌️

last eagle
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);
    }
}```
mortal plover
last eagle
last eagle

and discord.js doesnt add undocumted features

last eagle
mortal plover
spring frost
native marten

Hey, Is the latest update of modal hasn't be released in builder yet?

halcyon solstice

is it possible to add another option after an autocomplete?
for example /command [autocomplete] [integerOption]

steel trail
dense jackal
steel trail

for that you'd need to use subcommands instead of autocomplete

halcyon solstice
native marten
native marten

I have start more reading

dense jackal

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)

toxic moat

Hi, I'm currently getting an issue where my bot needs to authenticate via MFA to create channels etc.

Please help.

dense jackal
toxic moat

@dense jackal

dense jackal
toxic moat
sharp ginkgoBOT

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.

toxic moat

wait i think ik the issue 😭

dense jackal

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

toxic moat
dense jackal

lol

rigid crest

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

short granite
                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?

chrome chasm

What does this do?

red coral

Click it it’ll tell you

native marten

Is StringSelectMenuBuilder() isn't supported in ModalBuilder latest 14.23.2?

native marten
golden laurel 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?
golden laurel

Don't use action rows any more. They are deprecated in modals. Use labels

Modal -> Label -> Component

native marten
golden laurel

You just need to replace ActionRowBuilder there with LabelBuilder then use a method from the second link

last eagle

send pls 🙏

client.rest.put(/channels/${channel.id}/voice-status, { body: { status: status } });```
native marten
golden laurel

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

native marten
pine dagger

how to do this
status without playing/watching etc

rigid crest

whats the char limit on a label im hoping im in the limit for the modal one

i was over by 50 characters

tardy sable

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

topaz bluff

message.reference? Try that?

tardy sable
wary coral
sharp ginkgoBOT
lunar quiver

doing

let guild = client.guilds.cache.get(guildId);

is the same result in terms of data as doing

let guild = interaction.member.guild;

?

topaz bluff

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

astral pine

can a bot dm a bot?

topaz bluff

That's a good question, probably not but you should test it

astral pine

i did, i thought it would be funny, but ig not

cosmic burrow
  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

cosmic burrow
wary coral

footer is an object

sharp ginkgoBOT
wary coral

To add text to the footer
.setFooter({text:'Your text here'})

cosmic burrow

ok

tardy sable
wary coral

Then I would say that Discord does not exspose that Information to bots

tardy sable

i was able to get it through message reference

zealous marten

whats the issue hereThonk

zealous marten

notLikeMonbrey

cosmic burrow

why my guildId, cilentId and token appearing when i run "node deploy-commands.js"?

-# Note: i blurred my token for privacy reasons

glossy sorrel

Just help me My back hurts after coding for 3 Hours

topaz bluff
cosmic burrow

ok

zealous marten

XD

cosmic burrow

solved ✅ XD

steel yacht

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

rose tangle

you can check Partialize's docs

sharp ginkgoBOT
steel yacht

I did, but it's not any more readable to me

rose tangle

first is the partialized type (Message), then the nulled keys (they're always null) and then the nullables (could be null)

steel trail
steel yacht

Okay, thanks.

zealous marten
robust flame

why giveaway bot doesnt have status?

and @sharp ginkgo too

steel yacht

Hi again,
Why everything at discordjs.guide is under /legacy now ?
All search results are broken because of this

proud arrow

We are gonna need more information

steel yacht
proud arrow

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

steel yacht

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 ?

sharp ginkgoBOT

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.

proud arrow
bitter nova
strange star

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!

sharp ginkgoBOT
steel yacht
proud arrow

I have raised this internally

halcyon zephyr

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

steel trail

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

halcyon zephyr

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

dapper cave
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 ![imsad](https://cdn.discordapp.com/emojis/1404949289318486026.webp?size=128 "imsad")
sharp ginkgoBOT

documentation suggestion for @dapper cave:
function createComponentBuilder discord.js@14.23.2
Factory for creating components from API data.

proud arrow

You can use this function

dapper cave

oh thank you

tardy sable

anyone know the doc page where all the interaction options are like targetMessage, reply etc

wary coral
tardy sable

there was a page that covered everything

but i keep losing it

wary coral

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

tardy sable

everything you can do with interaction basically

wary coral

Both of those exist. On message context menu interactions.

tardy sable

can you link me to one

sharp ginkgoBOT
tardy sable

ah yes its that

thank you

coarse storm

What are all the new components in the modals?\

loud quartz

The discord API docs will naturally have that

jagged rock

message_reference[MESSAGE_REFERENCE_UNKNOWN_MESSAGE]: Unknown message

what does this mean

normal delta

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?

crimson gale

in this case, probably reference it not probably

topaz bluff
normal delta
topaz bluff

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

normal delta
topaz bluff it is?

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

topaz bluff

what's your DJS version? and how are you building your modal?

all of it...how are you adding the labels?

normal delta
modal.setLabelComponents(reasonLabel);
interaction.showModal(modal);
bleak owl

discord.js includes builders. i’m not sure why you have core installed if you are using d.js alone

topaz bluff

if you use discord.js rather than the subpackages, then installing the subpackages can cause data mismatches

normal delta

That's very true, now it works, thanks

tardy sable

is this in miliseconds or seconds?

normal delta
tardy sable

thanks

torn orchid

is there a way to fetch a users discord badges?

clear garnet

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

topaz bluff

isnt hypesquad going away? why bother?

bleak owl

yeah the hypesquad program closed

if you want to view the badges of a user, simply click on their profile

topaz bluff

there is no reason a bot needs to see user badges other than to just display already visible user information

cursive grove

O

torn orchid
topaz bluff

that we dont know but it's at least not accessible...i wouldnt be suprised if it gets removed entirely

torn orchid
topaz bluff

they are using some undocumented route or some oauth based system

bleak owl

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

minor solstice

Has anyone else had issues with components v2 not displaying correctly on mobile?

loud quartz

did you update your mobile app?

tardy sable

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)
minor solstice

Yes it’s on the most recent version

pliant root
tardy sable
tardy sable

let me check if im on latest version

wary coral

As an aside you know with MentionableSelectMenu user can select user, channel or role

tardy sable

channel too?

topaz bluff
tardy sable

are you sure? because no channel is showing up for me on the mentionable menu

wary coral

I assumed that I cant seem to get that to happen

tardy sable

i see someone had same error as me

topaz bluff

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)

wary coral

same

tardy sable

@wary coral is that a modal youre working with? cuz im on latest version and still have the error

wary coral

yes,

const menu = new MentionableSelectMenuBuilder()
  .setCustomId("mentionable")
  .setMaxValues(25)
  .setDefaultValues([
    { id: "427193512522416180", type: SelectMenuDefaultValueType.User },
]);

const menuLabel = new LabelBuilder()
  .setLabel("mention")
  .setMentionableSelectMenuComponent(menu);
tardy sable

hm weird

tardy sable
wary coral

you need to put it in a label

tardy sable

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 }])
        )
    )
)
wary coral

no problems

tardy sable

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

what does you project dependencies look like?

tardy sable

latest djs version is 14.23.2?

wary coral

anything else?

tardy sable

do you want me to send all dependencies?

wary coral

run npm ls

tardy sable

what does that do

wary coral
sharp ginkgoBOT

tag suggestion for @tardy sable:
discord.js includes multiple sub-packages, installing these separately can mess with internal code:

npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
bleak owl

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

wary coral

^

tardy sable

i dont use those anymore just havent uninstalled yet

tardy sable
minor solstice
bleak owl
minor solstice

Yea I will once I can gather a little more information, just figured I’d run it by here first

bleak owl

we only handle discord.js issues

burnt sail

Why can't I use channel.send?

clear garnet

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

clear garnet

TypeScript doesn't know that though by default

burnt sail

I'm using node.js/JavaScript

How do I do it?

clear garnet

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

clear garnet

A Collection of channels to be specific

clear garnet
sharp ginkgoBOT
brittle current
.setContexts(['Guild'])
``` is this good?
.setContexts(InteractionContextType.Guild),

got it

bitter glade

Does anyone know how to achieve an effect similar to inline fields in embeds in components v2?

rose tangle

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

bitter glade

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.

rose tangle

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

bitter glade

Alternatively, I can put everything vertically, but then there is a large empty space on the right.

topaz bluff

Then continue to use embeds. As Components can't have inline fields and I don't believe they intend to change that ever

bitter glade

Now that I've started using these v2 components, the embeds seem outdated. Besides, looking at the v2 components, these embeds are terribly small.

crisp finch

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);
steel trail

They go inside a Label, not an ActionRow

sharp ginkgoBOT

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

crisp finch
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);
crisp finch

actually what do i do if i have more than 25 things that i want to display?

jovial citrus

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

warped ore

are there code examples on github or something for the new modal components ?

trail pasture
upper jay
warped ore

is kiss your heart guys

jovial citrus

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'

kindred moon
jovial citrus
steel trail

And banner too

last eagle

is there a way to make my bot status like this

versed current

this bot doesn't have a status

last eagle

so invisible?

sharp ginkgoBOT

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.

versed current

yeah that

if the bot only has HTTP interactions, no status will be displayed as it has no gateway connection.

last eagle

is there a way to make discord.js work with http interactions without a gateway connection

versed current

_ _

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

versed current
last eagle

where

versed current
last eagle

is that the only way bruh

versed current

no ****

last eagle

is there a way to do it with discord.js without changing my code

steel trail
versed current

oh, mb

steel trail
versed current

but I'd have to make a very long switch-statement in a function to account for every component builder. Right?

steel trail

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

versed current

well, currently I only have two points where I'd need to do that.

  1. The message has a single container with an action row somewhere. All buttons in it should be disabled.
  2. The message has a single container with a section of which the button accessory should be disabled.
versed current
steel trail
versed current

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.

dapper cave

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

nimble copper

olá

tardy sable

do you know if this error has been fixed? i still have error with the setdefaultvalues on the mentionable menu

steel trail
steel trail

@discordjs/builders@1.12.2 has the fix

tardy sable

ill update and see then

tardy sable
tardy sable

can you set defaultvalues for a stringselectmenu or is that only for channels, roles etc?

frosty dagger

wanted to know from when should I start sharding ? when my bot is in over 100+ or 1000+ servers ?