#djs-help-v14

78874 messages · Page 2 of 79

halcyon bison
dense jackal

the docs isn't updated yet, they forgot to update those pages (I already made a PR for it but its not reviewed yet)

dense jackal
somber berry

Hello! I want to get the user's response from a Modal. Their answers from TextInputBuilder.

Tho, I am unsure how to retrieve that. Could anyone help me?

handleAllApplicationTypes.js:

const modal = new ModalBuilder()
    .setTitle("Staff Applications")
    .setCustomId("staffApplicationsModal");

const actionRows = [];

for (let i = 0; i < applicationGuildData.staffQuestions.length && i < 5; i++) {
    const question = applicationGuildData.staffQuestions[i];

    const input = new TextInputBuilder()
        .setCustomId(question.customId || `question_${i}`)
        .setLabel(question.label?.slice(0, 45) || `Question ${i + 1}`)
        .setStyle(TextInputStyle.Paragraph)
        .setPlaceholder(question.label?.slice(0, 45) || `Question ${i + 1}`)
        .setRequired(true);

    const actionRow = new ActionRowBuilder().addComponents(input);
    actionRows.push(actionRow);
}

modal.addComponents(...actionRows);

return await interaction.showModal(modal);

This is where i want to get their answers:

const { 
    ChannelType, 
    EmbedBuilder, 
    ChatInputCommandInteraction, 
    Client, 
    MessageFlags, 
    ModalBuilder, 
    TextInputBuilder, 
    TextInputStyle, 
    ActionRowBuilder 
} = require("discord.js");

const applicationGuildSchema = require("../schemas/applicationGuildData");
const applicationSchema = require("../schemas/applicationData");
const getEmbedColorForGuild = require("../functions/getEmbedColorForGuild");

module.exports = {
    customId: "staffApplicationsModal",
    userPermissions: [],
    botPermissions: [],
    
    /**
     * @param {Client} client
     * @param {ChatInputCommandInteraction} interaction
     */
    run: async (client, interaction) => {
        const applicationGuildData = await applicationGuildSchema.findOne({ guildId });

        if (!applicationGuildData) {
            const embed = new EmbedBuilder()
                .setDescription("No guild data found. Report this to an admin.")
                .setColor(embedColor);

            return await interaction.reply({ 
                embeds: [embed], 
                flags: MessageFlags.Ephemeral 
            });
        }

        // ...
    }
};
trail pasture
const { SlashCommandBuilder, ContainerBuilder, TextDisplayBuilder, SeparatorBuilder, SeparatorSpacingSize, MessageFlags, FileBuilder, AttachmentBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
    .setName('test')
    .setDescription('random test cmd'),

    async execute(interaction) {
        const attachment = new AttachmentBuilder('./src/roblox/Quiz-Center.rbxl', { name: 'Quiz-Center.rbxl' });
        
        const youtubeButton = new ButtonBuilder()
            .setLabel('YouTube')
            .setStyle(ButtonStyle.Link)
            .setURL('https://youtube.com');

        const row = new ActionRowBuilder().addComponents(youtubeButton)

        const container = new ContainerBuilder()
        .addTextDisplayComponents(
            new TextDisplayBuilder({
                content: `hello.`
            })
        )
        .addSeparatorComponents(
            new SeparatorBuilder({
                spacing: SeparatorSpacingSize.Large
            })
        )
        .addTextDisplayComponents(
            new TextDisplayBuilder({
                content: `goodbye.`
            })
        )
        .addFileComponents(
            new FileBuilder({
                file: {
                    url: `attachment://${attachment.name}`,
                },
            })
        )
        .addActionRowComponents(row);
        
        interaction.reply({ 
            flags: MessageFlags.IsComponentsV2, 
            components: [container],
            files: [attachment]
        });
    }
}``` 
i figured out how to use these can u give me an example on how the section will look like if i have to use that?
sharp ginkgoBOT

guide suggestion for @somber berry:
guide Other Interactions: Modals - Extracting data from modal submissions
read more

steel trail

No, it can only be added on the first editReply after a deferReply

Once there is content of any way you can’t change the componentsV2 flag

halcyon bison
trail pasture
somber berry
halcyon bison
heady tapir

so what about deferring with the flag?

dense jackal

it should be possible to use the MessageFlags.IsComponentsV2 when editing the reply after defer, but seems like they made a mistake in d.js

halcyon bison
steel trail
viral hinge

how to use ThumbnailBuilder?

trail pasture

clearly doing smth wrong here

halcyon bison

I think first, do you actually want to use the builders, or do you just want to do raw objects?

halcyon bison

then you should use the builders' methods rather than passing the data to the constructor

this applies to all of the builders you're using

if you just wanted to use the objects you're passing to each constructor, you could just skip the builder all together

somber berry

Hi all, if I want to apply a tag to a thread via my bot, how can I do this? Would I need to save the tag in my database? (the tags get created by the bot).

halcyon bison

you can access a forum's tags from <ForumChannel>.availableTags
then, either when creating the thread with the appliedTags option or after the fact with <ThreadChannel>.setAppliedTags(), you can use <GuildForumTag>.id

somber berry
halcyon bison

you don't need to save the id since you can always access it from <ForumChannel>.availableTags
and it's an array that you can use <Array>.find() on and check <GuildForumTag>.name

you can save it if you want to

frosty epoch

has anybody already done this new message embed 'builder' to play around? 😄

rose eagle

I think I was able to erase the background of the embedded background when I wrote the component V2.
What should I do?

somber berry
steel trail
trail pasture
sharp ginkgoBOT
steel trail
frosty epoch
halcyon bison
halcyon bison
rose eagle
halcyon bison

you can just use the components inside your container outside of a container

shadow pier

is there a djs guide to using components?

dense jackal
spark nacelle

Hello, what do i need to add to send the V2 components? when i try to add the flag it gives me an type error.

With the current code i get this error:

iscordAPIError[50035]: Invalid Form Body
components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
dense jackal
halcyon bison
spark nacelle

Ah, so just ts expect error for now on that flag?

dense jackal
spark nacelle

but it exists

dense jackal

yeah well maybe you're referring to the ?with_components=true query param

spark nacelle

seems like it

dense jackal

but I think its not needed when using interaction#editReply(), flags: MessageFlags.IsComponentsV2 is

drifting crag

does the new componentv2 work with webhook

shut musk

What's the difference between media gallery and file component?
Is media gallery the one where it shows images together in 2x2?

halcyon bison
halcyon bison
opaque trellis
        const Container = new ContainerBuilder()

        Container.addTextDisplayComponents(
            new TextDisplayBuilder().setContent([
                `# ${Client.Methods.Emojis.Red} [Roblox Release]・Windows ${Client.Methods.Emojis.Windows}`,
                `## <t:${Math.floor(Date.now() / 1000)}:F>`,
            ].join('\n'))
        )

        Container.addSectionComponents(
            new SectionBuilder()
                .addTextDisplayComponents(
                    new TextDisplayBuilder().setContent([
                        `- All Windows-based cheats have been neutralized.`
                    ].join('\n'))
                )
        )


        Container.addSeparatorComponents(separator => separator.setSpacing(SeparatorSpacingSize.Small))

        Container.addSectionComponents(
            new SectionBuilder()
                .addTextDisplayComponents(
                    new TextDisplayBuilder().setContent(`\`\`\`version-a9a5d0b275a34ffb\`\`\``)
                )
                .setButtonAccessory(
                    new ButtonBuilder()
                        .setLabel('Install')
                        .setStyle(ButtonStyle.Link)
                        .setURL('https://rdd.latte.to/?channel=LIVE&binaryType=WindowsPlayer&version=version-a9a5d0b275a34ffb')
                )
        );

        await Interaction.reply({ components: [Container], flags: MessageFlags.IsComponentsV2 })

any1 know why?

halcyon bison

your first section doesn't have an accessory
if you didn't want to add an accessory, but rather just a text display, you'll want to skip the section all together (like you're doing with your first text display)

opaque trellis

ah thanks

trail pasture

why does this not work?

const container = new ContainerBuilder()
      .addMediaGalleryComponents(
        new MediaGalleryBuilder()
        .addItems(
          new MediaGalleryItemBuilder()
          .setURL('attachment://error.png')
        )
      )```

it gives Error sending webhook message: HTTPError: Internal Server Error

```js
await webhook.send({
          components: [container],
          flags: MessageFlags.IsComponentsV2,
          files: [attachment],
      });```
halcyon bison

that sounds like an issue on their end

runic wren

can ThumbnailBuilder accept an image attachment?

trail pasture
opaque trellis

are buttons the only supported accessory? or can i put menus

halcyon bison
halcyon bison
halcyon bison

which is to say, you cannot put a select menu

opaque trellis

how did this guy do it though

halcyon bison

that's not an accessory, it's just in an action row in the container

opaque trellis

whats the max amount of cction rows i can put

halcyon bison
tame eagle

Cant figure out where error came from

const container = new ContainerBuilder()
  .setAccentColor(hex2rgb(member.displayHexColor))
  .addSectionComponents([
    new SectionBuilder()
      .addTextDisplayComponents(new TextDisplayBuilder().setContent([
          `test`,
          `test`
      ].join("\n")))
  ])
return interaction.reply({ components: [container], flags })
Error: Received one or more errors
expected = class extends
given = undefined
validator = 's.instance(V)'
halcyon bison

in future, please share the whole error
but in this case, section components require accessories
if you just wanted the text display without adding a button/thumbnail, use that directly and skip the section

tame eagle

got you, thanks

livid plover

hi guys, do you know which URL is the latest one for adding a user to a guild having their access token after completing the OAuth2 flow?

i found a v8 api url but is v8 the latest one?

livid plover

thank you!!!

dense jackal
livid plover

i posted here because i read You can use ⁠djs-help-v14 for questions you expect can be quickly solved.

loud quartz

Yes, about d.js

Your question does not involve d.js at all

livid plover

you're right, i'll ask in the discord developers server next time

wise flower

How to set thumbnail in new components

dense jackal
wise flower

any guide on it ?

crisp finch

quick q. how are components structured? obviously embeds have author, title, description, images, footer, etc. but what about components? where is this documented in djs?

dense jackal
wise flower
fe4c22b7] Error in stats: CombinedError (2)
  Received one or more errors

  1 ExpectedValidationError > s.instance(V)
  |   Expected
  | 
  |   Expected:
  |   | [Function: ButtonBuilder]
  | 
  |   Received:
  |   | undefined

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  | 
  |   Expected:
  |   | [Function: ThumbnailBuilder]
  | 
  |   Received:
  |   | undefined

    at _UnionValidator.handle (/workspaces/Zyren_V2/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1965:23)
    at _UnionValidator.parse (/workspaces/Zyren_V2/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
    at SectionBuilder.toJSON (/workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:2170:37)
    at /workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:1871:64
    at Array.map (<anonymous>)
    at ContainerBuilder.toJSON (/workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:1871:35)
    at /workspaces/Zyren_V2/node_modules/discord.js/src/structures/MessagePayload.js:151:46
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (/workspaces/Zyren_V2/node_modules/discord.js/src/structures/MessagePayload.js:150:49)
    at GuildMessageManager.edit (/workspaces/Zyren_V2/node_modules/discord.js/src/managers/MessageManager.js:186:8)

crisp finch

Why won't this work for instance

import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import {
    AttachmentBuilder,
    ButtonBuilder,
    ButtonStyle,
    ContainerBuilder,
    FileBuilder,
    MessageFlags,
    SectionBuilder,
    SeparatorSpacingSize,
    TextDisplayBuilder, WebhookClient,
} from 'discord.js';

const self = await readFile(fileURLToPath(import.meta.url), 'utf8');

const container = new ContainerBuilder();

const text = new TextDisplayBuilder().setContent("Hello, this is the text display builder!")

container.addTextDisplayComponents(text)

const webhook = new WebhookClient({ url: 'webhook_url_here' });

await webhook.send({
    components: [container],
    withComponents: true,
});
proud arrow
runic wren
wise flower How to set thumbnail in new components

this worked for me

const thumbnail = new ThumbnailBuilder().setURL(url)
const container = new ContainerBuilder()
.addSectionComponents(
    new SectionBuilder()
    .setThumbnailAccessory(thumbnail)
    .addTextDisplayComponents(
    new TextDisplayBuilder({content: `Text`})
    )
  )
)
crisp finch
spark hare

how do I add color to the embed in components v2 again CAUGHT

proud arrow

To the flags option

steel trail

flags: MessageFlags.IsComponentsV2

crisp finch
proud arrow
steel trail
spark hare

alright let me try it

proud arrow

What does your code looks like now?

crisp finch
import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import {
    AttachmentBuilder,
    ButtonBuilder,
    ButtonStyle,
    ContainerBuilder,
    FileBuilder,
    MessageFlags,
    SectionBuilder,
    SeparatorSpacingSize,
    TextDisplayBuilder, WebhookClient,
} from 'discord.js';

const self = await readFile(fileURLToPath(import.meta.url), 'utf8');

const container = new ContainerBuilder();

const text = new TextDisplayBuilder().setContent("Hello, this is the text display builder!")

container.addTextDisplayComponents(text)

const webhook = new WebhookClient({ url: 'url' });

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

You removed the withComponents option

crisp finch

oh

yeah it works now
ty

steel bronze

Idk why the new TextDisplay does not work I have updated to the news discord.js also

spark hare
proud arrow
novel mauve

is there going to be a page on the djs guide for new components or should i go off the docs only

proud arrow

Currently docs only.

steel bronze
proud arrow

That's inside a container. Yours is just plain text component

steel bronze

how would I do it then?

proud arrow

The message you sent has a file with the code used to send that message. You can look at it to know how it works for now

sharp ginkgoBOT
proud arrow

If you want to use json, then you can follow this docs

ivory sable

Is there a way to get a message with a .then attached? I can't seem to get it to work

steel trail

return it from the .then() callback

currently you return the result of console.log, which is void

wise flower

how to set buttons in the bottom

steel trail

put them in an actionrow like before

wise flower
ivory sable
wise flower

like this

proud arrow

You put it where you want in the order you want. That's the whole point of components v2
#discord-dev-news

jolly bay

do I need to specify the componentv2 flag when sending to webhook

proud arrow

Yes. If it contains v2 components

jolly bay

with the withComponents thingy?

proud arrow

It's for non-bot owned webhooks, so that you can still use non-interactive components

jolly bay

ah

so only the flag is needed if my bot owns the webhook im tryna send to

proud arrow

Yes

dense jackal

its weird tho that for webhooks you need both withComponents: true AND the flags: MessageFlags.IsComponentsV2 flag

or did withComponents: true exist before components v2 when sending a webhook message through your bots webhook

novel mauve

for link buttons yes

proud arrow

This was the case before v2 components. For link buttons

dense jackal

ah alr

dapper cave

erm its an mts file?? thats not source code

steel trail

Yea it is

unborn ridge

Is this valid to create a discord client instance like that?
intents: new IntentsBitField(32767)
I basically want all the intents

dapper cave
sharp ginkgoBOT

tag suggestion for @unborn ridge:
We highly recommend only specifying the intents you actually need.

  • Note, that 98303, 32767 or whatever other magic number you read that represents "all intents", gets outdated as soon as new intents are introduced.
  • The number will always represent the same set of intents, and will not include new ones. There is no magic "all intents" bit.
steel trail
dapper cave

lol if I open with cursor I get code nvm chat

yeah my bad sorry qjuh

unborn ridge
zenith violet

No you dont

Only use the ones you need

Intents increase memory usage

wise flower

how to add multiple buttons in a section ?

unborn ridge
steel trail

You can’t. Multiple buttons next to each other go in an ActionRow. Only one can be next to a section as accessory

steel trail

And you should know what events you need and add intents when you need them

steel trail

That’s an ActionRow

wise flower

oh how can i add that to the container ?

unborn ridge
steel trail

Else your bot gets spammed with lots of data from discord it doesn’t need

Putting unnecessary strain on your connection, host and discord’s servers

ivory sable
ivory sable

Ah, that was deceptively simple. Much appreciated!

wise flower

https://sourceb.in/NvCZXfyOkH
Help me with this

[d554aba1] Error in stats: CombinedError (2)
  Received one or more errors

  1 ExpectedValidationError > s.instance(V)
  |   Expected
  | 
  |   Expected:
  |   | [Function: ButtonBuilder]
  | 
  |   Received:
  |   | undefined

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  | 
  |   Expected:
  |   | [Function: ThumbnailBuilder]
  | 
  |   Received:
  |   | undefined

    at _UnionValidator.handle (/workspaces/Zyren_V2/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1965:23)
    at _UnionValidator.parse (/workspaces/Zyren_V2/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
    at SectionBuilder.toJSON (/workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:2170:37)
    at /workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:1871:64
    at Array.map (<anonymous>)
    at ContainerBuilder.toJSON (/workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:1871:35)
    at /workspaces/Zyren_V2/node_modules/discord.js/src/structures/MessagePayload.js:151:46
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (/workspaces/Zyren_V2/node_modules/discord.js/src/structures/MessagePayload.js:150:49)
    at GuildMessageManager.edit (/workspaces/Zyren_V2/node_modules/discord.js/src/managers/MessageManager.js:186:8)
thin cosmos

How do I make messages ephemeral with flags on deferReply?

loud quartz
loud quartz
wise flower
wary coral
spiral hemlock

is ContainerBuilder not being exported from @discordjs/builders normal? MediaGalleryBuilder, SectionBuilder and etc is being exported, just ContainerBuilder is not being exported (i am using it in a cf worker, so i can't use the main discord.js package or it throws errors due to node builtin packages missing)

shut musk

For FileBuilder in setURL(), how would i go about using a buffer?

sharp ginkgoBOT

Files in embeds should be attached via the message option object and referenced in the embed:

const attachment = new AttachmentBuilder('./image.png', { name: 'image1.png' });
const embed = new EmbedBuilder()
  .setTitle('Attachments')
  .setImage(`attachment://${attachment.name}`);

channel.send({
  embeds: [embed],
  files: [attachment]
});
zenith violet

same approach

shut musk

but we're using components so

zenith violet

same approach

shut musk

right

Wait question, a file can be a single image to display right or does that also need to be inside media gallery

spark hare

how do i add thumbnail to components v2 Thonk

proud arrow

Thumbnail can only be added as an accessory to section component

shut musk
const image = new AttachmentBuilder('./hive_leaderboard.png', { name: 'lb.png' })

    const container = new ContainerBuilder()
    container.addFileComponents(
        new FileBuilder().setURL(`attachment://${image.name}`)
    )
    await channel.send({
        components: [container],
        files: [image],
        flags: MessageFlags.IsComponentsV2,

    })
```Is this not meant to render the image?
versed jackal

Is it intended that soundboard sounds are only cached after being fetched even though they are sent with the guild create event?

crimson thistle
shut musk ```js const image = new AttachmentBuilder('./hive_leaderboard.png', { name: 'lb....

are you trying to render an image?
if so, i would use a MediaGalleryComponent

here's a little snippet code

const image = new MediaGalleryItemBuilder()
  .setURL("https://purepng.com/public/uploads/large/purepng.com-sliced-wheat-breadfood-wheat-bread-wholemeal-bread-bread-sliced-bread-941524637683ilg8q.png") // this is an image of a bread
  .setDescription("bread")

const mediaGallery = new MediaGalleryBuilder()
  .setId(1)
  .addItems([
    image
  ])

const container = new ContainerBuilder()
  // rest of your container thingies
  .addMediaGalleryComponents([
      mediaGallery
  ])

then you just send the container like you did with channel.send

shut musk

Yeah, figured so

crimson thistle

oh, my bad

shut musk

No noo thank you very much, I thought i could use file builder for simgle image but i assumed its media gallery

ty for snippet, helps a ton bro 💙

crimson thistle

you're welcome 👍

wary coral

I assume the setId is used for ordering the sections is that right?

crimson thistle

honestly, i don't know
maybe it is, but the thing that the documentation says is not very helpful

give me a second

yeah honestly idk what it does

crimson thistle

mb i read the wrong thing

wary coral

np, makes sense to use if your are looking to update one component in a container

feral thunder

Anybody knows why it throws this error below in console when trying to delete/edit a soundboard sound? The docs display a valid method for directly deleting/editing a SoundboardSound and VSC also recognizes it as valid method, but it doesn't seem to work when executing?

[ERROR] TypeError: sound.delete(...).then is not a function
feral thunder
little pebble
sharp ginkgoBOT
feral thunder
little pebble
feral thunder

Yeah, I forgot to provide str inside fetch()

torn sparrow

can't i use that as like that?
mainContainer.addActionRowComponents(<StringSelectMenuBuilder()>);

shut musk
wary coral
crimson thistle

hey everyone,
i'm currently experiencing with components v2 and i'm having a little trouble experimenting with Sections

this is the code:

const section = new SectionBuilder()
  .addTextDisplayComponents([
    textDisplay
  ])
  .setId(1)
        
const container = new ContainerBuilder()
  /*.addTextDisplayComponents([
    textDisplay
  ])*/
  .addSectionComponents([
    section
  ])
  .setAccentColor(Colors.Red)

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

and this is the error i get: https://pastebin.com/zSQ9Qqwa

shut musk
const attachment = new AttachmentBuilder('./lb.png', { name: 'lb.png' })

    const image = new MediaGalleryItemBuilder()
        .setURL(`attachment://${attachment.name}`) 

        const mediaGallery = new MediaGalleryBuilder()
        .setId(1)
        .addItems([
            image
        ])

    const container = new ContainerBuilder()
        .addMediaGalleryComponents([
            mediaGallery
        ])

    await channel.send({
        components: [container],
        flags: MessageFlags.IsComponentsV2,
    })
```This is what i have
crimson thistle
shut musk

Hmm. How would I go about adding an image then?

steel trail

But it is a string. That’s fine

shut musk

components[0].components[0].items[0].media.url[UNFURLED_MEDIA_ITEM_REFERENCED_ATTACHMENT_NOT_FOUND]: The referenced attachment ("attachment://lb.png") was not found

that's what I get

crimson thistle

oh, well i'm not experienced

steel trail

You need to actually attach the attachment to the message though. Pass it in files:

wise flower
shut musk

Facepalm I had it before and got an error so i removed it, now i added it back and no error

programming at its finest 😔 where did that error go

rigid crest

why is the file in the announcement a video file? is it on docs instead?

steel trail

Which is funny in itself considering said OS and coding language are made by the same company

rigid crest

o

wise flower

Small And Soft

wary coral
wise flower that's the code of my stats command and the error is given below

I think this is part of your issue. you are not using ActionRowBuilder<ButtonBuilder> when adding the buttons. your are trying to add the buttons directly

        const createContainer = (activeTab) => {
            return new ContainerBuilder()
                .addSectionComponents(embeds[activeTab])
                .addSeparatorComponents(separator => separator.setSpacing(SeparatorSpacingSize.Large))
                .addActionRowComponents(
                    new ButtonBuilder()
                        .setCustomId('general')
                        .setLabel('General')
                        .setStyle(activeTab === 'general' ? ButtonStyle.Primary : ButtonStyle.Secondary)
                        .setDisabled(activeTab === 'general'),
                    new ButtonBuilder()
                        .setCustomId('system')
                        .setLabel('System')
                        .setStyle(activeTab === 'system' ? ButtonStyle.Primary : ButtonStyle.Secondary)
                        .setDisabled(activeTab === 'system'),
                    new ButtonBuilder()
                        .setCustomId('team')
                        .setLabel('Team')
                        .setStyle(activeTab === 'team' ? ButtonStyle.Primary : ButtonStyle.Secondary)
                        .setDisabled(activeTab === 'team')
                );
        };
unique quest

How can I trace what is causing the “Socket Error” problem?

wary coral
wise flower oh thanks i will try

to add some calcification
you are doing this

new ContainerBuilder().addActionRowComponents(new ButtonBuilder())

when you need this

new ContainerBuilder().addActionRowComponents(new ActionRowBuilder<ButtonBuilder>().addComponents(new ButtonBuilder()))
steel trail

A section needs an accessory next to it. If you don‘t want one you don’t need a section and can put the textdisplay(s) directly instead

zenith violet
wise flower
[474a714b] Error in stats: CombinedError (2)
  Received one or more errors

  1 ExpectedValidationError > s.instance(V)
  |   Expected
  | 
  |   Expected:
  |   | [Function: ButtonBuilder]
  | 
  |   Received:
  |   | undefined

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  | 
  |   Expected:
  |   | [Function: ThumbnailBuilder]
  | 
  |   Received:
  |   | undefined

    at _UnionValidator.handle (/workspaces/Zyren_V2/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1965:23)
    at _UnionValidator.parse (/workspaces/Zyren_V2/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
    at SectionBuilder.toJSON (/workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:2170:37)
    at /workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:1871:64
    at Array.map (<anonymous>)
    at ContainerBuilder.toJSON (/workspaces/Zyren_V2/node_modules/@discordjs/builders/dist/index.js:1871:35)
    at /workspaces/Zyren_V2/node_modules/discord.js/src/structures/MessagePayload.js:151:46
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (/workspaces/Zyren_V2/node_modules/discord.js/src/structures/MessagePayload.js:150:49)
    at GuildMessageManager.edit (/workspaces/Zyren_V2/node_modules/discord.js/src/managers/MessageManager.js:186:8)
steel trail

You don‘t add any accessory to your sections you create

wise flower

oh ok

shut musk

What value does Container.setAccentColor() take? It says number but what does that mean

steel trail

RGB Color code

shut musk

only rgb?

wary coral

yes

shut musk
steel trail
steel trail
shut musk

oh hex value

sharp ginkgoBOT
shut musk

perfect, ty

steel trail

Can also use that for convenience

crimson thistle

yo btw i've heard a little bit about deno and bun
what are those?

shut musk

different software, not djs related

steel trail

Other runtimes than NodeJS. Can’t really recommend them for discord.js if you don’t have a good reason

crimson thistle
shut musk

dw lol

wise flower
cobalt solstice

Hello, im not sure why this is happening

ExpectedConstraintError > s.array(T).lengthGreaterThanOrEqual()
  Invalid Array length

  Expected: expected.length >= 1

Code:

const container = new ContainerBuilder()
            .setId(1).setAccentColor(0x0099ff)
            .addTextDisplayComponents(component => component.setContent('Staff Management Panel').setId(2))
            .addSeparatorComponents(component => component.setDivider(true).setId(3))
            .addTextDisplayComponents(component => component.setContent('Select an action from the following:\n- Change Slowmode\n- Lock Channel\n- Unlock Channel\n- Ban Member\n- Quarantine Member').setId(4))
            .addActionRowComponents(component => component.setId(5).addComponents(row));
await interaction.channel.send({ components: [container], flags: MessageFlags.IsComponentsV2 });
jolly bay

can I send content and the new embed together?

wise flower
wary coral
wise flower
shadow pier

ContainerBuilder#setAccentColor() doesn't accept hex strings?

wary coral
feral thunder

Fetching a sound by id always seems to result in undefined, but when using fetching options it works. Is it supposed to behave like this? The docs display SoundboardSoundResolvable can be specified as single option Thonkang

Returns always undefined:

ctx.guild.soundboardSounds.fetch(id).catch(ctx.noop)

Returns the sound object:

ctx.guild.soundboardSounds.fetch({ soundboardSound: id }).catch(ctx.noop)

The id is a valid sound ID of the current guild

steel trail
sharp ginkgoBOT
wise flower
steel trail

Well, you mention a user in there, so the parse user makes it ping

wise flower
wary coral

what qjiuh said. replied user is for you are replying to a message. not went they are mentioned in the message

steel trail
steel trail

Because it’s edited, so what was it before edit?

wary coral
shadow pier

ty

little pebble
tender spade

Hi, I was wondering if there is an easy way to detect when a server was joined. I want to update my servercount on top.gg when the bot gets added to a new server. I was looking through the Event enum but I cant seem to find one which clearly indicates it gets triggered when a server is joined. I could of course do it on any random event but that seems kind of inefficient

umbral whale

In <GuildChannel>.permissionOverwrites.cache what does <overwrite>.allow/deny.toArray() return? My editor can't infer the type for some reason and I can't seem to find it in the docs. Does it return a PermissionsString or something else?

feral thunder
sharp ginkgoBOT
sharp ginkgoBOT
tender spade
wise flower
shadow pier

Do containers have footers like embeds?

steel trail

No, but you can use any kind of markdown you want
-# including these or timestamps

rigid crest
dense jackal
shadow pier

Oh that - #?

dense jackal

yes

proud arrow
rigid crest

so something like this? .setThumbnailAccessory(${interaction.client.user.dsiplayAvatarURL()})

steel trail

More like .setThumbnailAccessory(thumbnail => thumbnail.setURL(…))

wary coral
shadow pier

What is a section?

crimson thistle

can i not add multiple buttons in a SectionBuilder?

wary coral
rigid crest

hmm, ok i miss-judged where it was going to go do i have to attach it to the first text box?

crimson thistle
crimson thistle

🥀

proud arrow

Use action rows if you need multiple buttons

rigid crest
sinful rover

Is it a must to add an accessory to a section?

new SectionBuilder()
        .addTextDisplayComponents(components)
        .setThumbnailAccessory(
          new ThumbnailBuilder().setURL(
            "image_link",
          ),
        )
proud arrow
proud arrow

Otherwise use text component simply not section if you just want text

sinful rover
wary coral yes

well they should document it, I had to dig into the source code to figure it out, I have no idea what the error message whats to say

fyr this is the error message

error: Received one or more errors
 errors: [
  1161 | var CombinedPropertyError = _CombinedPropertyError;
1162 |
1163 | // src/lib/errors/ValidationError.ts
1164 | var _ValidationError = class _ValidationError extends BaseError {
1165 |   constructor(validator, message, given) {
1166 |     super(message);
                             ^
error: Expected
 validator: "s.instance(V)",
     given: undefined,
  expected: [class (anonymous)],

      at new BaseError (1:23)
      at new ValidationError (/home/harrow/shits/projects/discord-assistant/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1166:5)
      at new ExpectedValidationError (/home/harrow/shits/projects/discord-assistant/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1487:5)
      at handle (/home/harrow/shits/projects/discord-assistant/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1531:75)
      at run (/home/harrow/shits/projects/discord-assistant/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:958:23)
      at handle (/home/harrow/shits/projects/discord-assistant/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1960:32)
      at parse (/home/harrow/shits/projects/discord-assistant/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
      at toJSON (/home/harrow/shits/projects/discord-assistant/node_modules/@discordjs/builders/dist/index.js:2170:37)
      at map (1:11)
      at <anonymous> (/home/harrow/shits/projects/discord-assistant/src/core/handle.ts:75:16)
wary coral
crimson thistle

good things require good time

unique quest
zenith violet

its nothing djs can do about though

sharp ginkgoBOT

Errors such as ECONNRESET, ConnectTimeoutError, SocketError: other side closed indicate a network issue

  • Free or shared hosting providers often come with significant limitations
  • Another indication of these issues are 'Unknown Interaction' errors.
rigid crest

what am i doing wrong?

ExpectedConstraintError > s.array(T).lengthGreaterThanOrEqual()
  Invalid Array length
  Expected: expected.length >= 1
  Received:
  | []
        const topImage = new SectionBuilder().setThumbnailAccessory(thumbnail => thumbnail.setURL(`${interaction.client.user.displayAvatarURL()}`));
       const titleText = new TextDisplayBuilder().setContent(
            [
                '# Application Information',
            ].join('\n'),
       );
        container.addSectionComponents(topImage).addTextDisplayComponents(titleText);
ebon belfry

Is it possible to send a message that doesn't get manipulated by discord as such? I have an in-game chat to discord link and don't want people's messages to be affected by markdown or other discord things like channel tags and pings if possible

cobalt solstice

can an embed be added in the container of componentsv2? also is it possible to add author and footer to it?

proud arrow
snow onyx
proud arrow
wary coral
fading girder

Do we have a guide on how to use components v2 in djs latest version?

light sapphire
fading girder

got it, ty

light sapphire

np

shadow pier
terse crown

Hello, how to defer a reply and then add components v2? can we edit the flags of a message? because we can't put IsComponentV2 in the flags of a deferred message.

shadow pier
gaunt yarrow

Can anyone tell how to use component V2 is there any guide or something.

terse crown

yes, but when editing, I get the DiscordAPIError[50035]: Invalid Form Body components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).

cobalt solstice

I'm trying to use .addFileComponents of ComponentsV2 but after setting the URL with .setURL it says that it wants an attachment instead of the link. I'm not sure how to solve this

fading girder

is it possible to add normal buttons other than links using the sections? (in component v2)

gaunt yarrow

Hm

wary coral
rigid crest

im curious is this a carousel? or is it a single image like embed?

crimson thistle
wary coral
rigid crest

a

shadow pier

can link buttons have custom emojis?

agile nest

can i use select menus in new embeds?

cobalt solstice

yes

agile nest
snow onyx

slap it in an action row as usual and add it to the components

wary coral
shadow pier

ty

cobalt solstice

I'm trying to use .addFileComponents of ComponentsV2 but after setting the URL with .setURL it says that it wants an attachment instead of the link. I'm not sure how to solve this

 MultiplePossibilitiesConstraintError > s.string().url()
  |   Invalid protocol for file URL. Must be attachment:
  | 
  |   Expected any of the following:
  |   | - attachment:
proud arrow

Show the code

cobalt solstice

isnt the link to an image itself considered an attachment

proud arrow

And also full error, not just half

cobalt solstice

addFileComponents, the last

agile nest

i assume they also removed color from new embed?

snow onyx

you can still set accent color

wary coral
agile nest its only rgb?

Yes in Tuple form or hex value forms

ContainerBuilder.setAccentColor(color?: RGBTuple | number): ContainerBuilder
snow onyx

0xHEX
like 0x00ffff

without quotes

agile nest

kk

wary coral
fading girder

is it possible to somehow create different columns in components v2? like how we have fields inline in embed builder?

shadow pier

Argument of type 'ApplicationEmoji' is not assignable to parameter of type 'APIMessageComponentEmoji'.

Im trying to use ButtonBuilder#setEmoji()

dense jackal
signal jewel

how would one go about editing a container section button? Say I would like to edit a single button on the container, would I have to repass the entire container with the change i made or can i target said button?

cobalt solstice
dense jackal

but this is all very new so there isn't a lot of research being done what fits the best

wary coral
tardy sable

i cant add a button and thumbnail at the same time in a section?

                const section = new SectionBuilder()
                    .addTextDisplayComponents(text)
                    .setButtonAccessory(button)
                    .setThumbnailAccessory(thumbnail);
signal jewel
dense jackal
wary coral
dense jackal
crimson thistle

so i'm making an Application Command and i'm trying to get a member's avatar URL
the member is got by doing interaction.options.getMember("user")
and the URL is attempted by doing member.avatarURL()

however, it keeps printing out null for some reason
does anyone know why?

shadow pier

How many containers can a message have

dense jackal

I think just 1

sick gust

Is there a way to make an ephemeral component v2?

dense jackal

yes, just pass in both flags

sick gust

I try to use array with 2 flags but dont working

After i show a error log

wary coral
sick gust

Ahh

Tkx bro

little pebble
sharp ginkgoBOT
little pebble

Maybe you want this instead

crimson thistle

does the default discord profile count

little pebble
crimson thistle

coolio
thanks

wary coral

cc @dense jackal

dense jackal

ah thanks

rigid crest

how do i turn reply off (the ping) editReply never used to do the orange ping colour (?)

sharp ginkgoBOT
dense jackal

@rigid crest ^

rose tangle

fyi allowedMentions are currently broken when sending components v2 messages

broken as, ignored

the team is working in a fix

shadow pier

I was like why isn't it working 😭

rigid crest

my IDE says its AllowedMentionsTypes: [AllowedMentionsTypes.User],

dense jackal

your IDE is wrong

rose tangle

the property is still called allowedMentions, what you can pass to parse is those values

or just their string mappings

users, roles, etc

rigid crest

so this would be what would work to stop the ping allowedMentions: { parse: ["repliedUser"] }?

agile nest

is there a way to make only certain users selectable in select menus or still no

sharp ginkgoBOT

discord Messages Resource - Allowed Mentions Object
read more

rose tangle

and not other users/roles/etc inside the message

dense jackal
rigid crest
rose tangle
dense jackal
rose tangle

oh /docs, thought you meant /discorddocs

dense stirrup
rose tangle

no idea, it should be automatic

dense jackal

hm alr

terse crown
rose tangle
dense stirrup

that doesnt seem to work

terse crown

yeah, add the flag in the editReply, not the deferReply

rose tangle

could you show your code?

dense jackal
dense stirrup

I'm on TS yeah; I assume this is an error or?

rose tangle
terse crown

this type is incorrect, add a // @ts-expect-error

dense stirrup
shadow pier

wait, should an array be passed for flags or union

rose tangle

oh yeah that should include the cv2 flags as well

dense jackal

union

rose tangle

seems like a types bug, but it should work in runtime

dense jackal

but its known by the d.js dudes

dense stirrup

👍 i'll ignore it for now

shadow pier
terse crown

like i said, add a // @ts-expect-error before the line with the error

dense jackal
terse crown

because flags can be an array

shadow pier

oh so both work?

terse crown

yeah

shadow pier

ApplicationEmoji#name can be null?

rose tangle

looks like it can

agile nest
Error: Expected a string primitive
    at _StringValidator.handle (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2615:70)
    at _StringValidator.parse (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
    at validateRequiredSelectMenuParameters (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\builders\dist\index.js:545:21)
    at StringSelectMenuBuilder.toJSON (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\builders\dist\index.js:1180:5)
    at C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\builders\dist\index.js:2302:64
    at Array.map (<anonymous>)
    at ActionRowBuilder.toJSON (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\builders\dist\index.js:2302:35)
    at C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\builders\dist\index.js:1871:64
    at Array.map (<anonymous>)
    at ContainerBuilder.toJSON (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\builders\dist\index.js:1871:35) {validator: 's.string()', given: undefined, stack: 'Error: Expected a string primitive
    at _St…@discordjs\\builders\\dist\\index.js:1871:35)', message: 'Expected a string primitive'}
``` whats this error about?
shadow pier

thats so weird

agile nest
rigid crest

so ig it doesnt support more than one image? or if it does what did i do wrong

const mediaAttachment = new MediaGalleryBuilder({
            items: [
                {
                    description: "A Desktop Wallpaper",
                    media: {
                        url: 'https://t3.ftcdn.net/jpg/05/69/72/02/240_F_569720237_58rhoQoMjxyB0QCeXQK0OVUA0qNogTmq.jpg',
                    },
                    description: "A Desktop Wallpaper",
                    media: {
                        url: 'https://t3.ftcdn.net/jpg/05/69/72/02/240_F_569720237_58rhoQoMjxyB0QCeXQK0OVUA0qNogTmq.jpg',
                    },
                    description: "A Desktop Wallpaper",
                    media: {
                        url: 'https://t3.ftcdn.net/jpg/05/69/72/02/240_F_569720237_58rhoQoMjxyB0QCeXQK0OVUA0qNogTmq.jpg',
                    },
                },
            ],
        });
rose tangle
agile nest

oops

rose tangle
shadow pier

so how do i get around this?

agile nest

i still cannot actually understand, what does separator divide, sections? components?

dense jackal

components

rose tangle

inside a container ^^

dense jackal

its just a horizontal line you can put inside your container

rigid crest
rose tangle could you try with different urls just in case?

i changed the second and third links and the image got set to the third link

        const mediaAttachment = new MediaGalleryBuilder({
            items: [
                {
                    description: "A Desktop Wallpaper",
                    media: {
                        url: 'https://t3.ftcdn.net/jpg/05/69/72/02/240_F_569720237_58rhoQoMjxyB0QCeXQK0OVUA0qNogTmq.jpg',
                    },
                    description: "A Desktop Wallpaper",
                    media: {
                        url: 'https://t4.ftcdn.net/jpg/04/86/85/75/240_F_486857516_mq31R22FNaMxE3DTkWO73bAdaDxllmj8.jpg',
                    },
                    description: "A Desktop Wallpaper",
                    media: {
                        url: 'https://t4.ftcdn.net/jpg/04/19/10/29/240_F_419102935_z4wjydPrlF2a8glzyLg5F7Qve6y6IDm7.jpg',
                    },
                },
            ],
        });
container.addMediaGalleryComponents(mediaAttachment)
wary coral
agile nest i still cannot actually understand, what does separator divide, sections? compon...

https://discord.com/developers/docs/change-log#whats-new

New Layout Components

  • Section - Combine text with an accessory component for contextually linked elements
  • Container - Create visually distinct groupings with a customizable accent color
  • Separator - Add visual spacing and dividers between components

New Content Components

  • Text Display - Add rich markdown-formatted text anywhere in your messages
  • Thumbnail - An image used in a section
  • Media Gallery - Present collections of images and videos in an organized grid
  • File - Embed file attachments as part of your message layout
delicate needle

It is possible to build components v2 in object ?

rose tangle

wdym?

shadow pier
tardy sable

why cant i add file, keep getting error:

const text = new TextDisplayBuilder().setContent(`Here is the transcript of the ticket`);

const mediaGallery = new MediaGalleryBuilder()
    .setId(1)
    .addItems([new MediaGalleryItemBuilder().setURL(image.url)]);

const file = new FileBuilder().setURL(htmlFile.url);

container.addTextDisplayComponents(text).addMediaGalleryComponents(mediaGallery).addFileComponents(file);

return await interaction.followUp({ components: [container], flags: MessageFlags.IsComponentsV2 });
zenith violet

which error

delicate needle
dense jackal
delicate needle
agile nest
wary coral

all of the above

dense jackal

it divides component-component

rose tangle
tardy sable
zenith violet which error

input.url
| MultiplePossibilitiesConstraintError > s.string().url()
| Invalid protocol for file URL. Must be attachment:
|
| Expected any of the following:
| | - attachment:

the file cant be a link i assume?

terse crown
delicate needle
dense jackal
delicate needle
wary coral
rigid crest
shadow pier
oblique seal

Hey, is it possible to add multiple buttons to a section with .setButtonAccessory()?

rose tangle
shadow pier
terse crown
dense jackal
oblique seal
wary coral
rose tangle

I doubt you can remember all the component types

including the cv2 ones

just use the enum, you don't require to lookup what number is which

dense jackal

and text showing the name of the component is in no way harder than a number

delicate needle

Everyone does what they want ^^

terse crown
rose tangle

yeah, that's why we're recommending you, not forcing it

you're free to do things harder for yourself if you'd like, but the point of this channel is to give help

tardy sable
rose tangle

just show how it begins

tardy sable
steel trail
tardy sable

ok thanks

agile nest

how do i get emoji from specific guild

radiant bough
rigid crest
fading girder

are there limits to how many sections can be added in components v2?

snow onyx
dense jackal

(and a section is a top-level component)

steel trail

it can be, it can also be in a container

dense jackal

discord api docs needs another check to be more clear, that's fs

shadow pier
zinc wyvern

Hello, I'm on v14.13.0 and I have an old bot I haven't really worked on in like a year. When I try to build it im getting this:

src/commands/Moderation/purge.ts:129:51 - error TS2339: Property 'send' does not exist on type 'DMChannel | PartialDMChannel | PartialGroupDMChannel | NewsChannel | StageChannel | TextChannel | PublicThreadChannel<...> | PrivateThreadChannel | VoiceChannel'.
  Property 'send' does not exist on type 'PartialGroupDMChannel'.

129                 const msg = await message.channel.send(toSend)

I'm aware of what it means, but why would I not be able to reply to a text message I got? message is of type Message. If there is a message there in the first place, then it's a channel where one can write no? Is there any "good" solution to check whether I can send a message or not?

sharp ginkgoBOT
delicate needle

There is something to transform builder into raw object ?

wary coral
steel trail

.toJSON()

zinc wyvern
delicate needle
rose tangle

user installed apps can receive interactions from group dms, and you can't send messages to them

steel trail
shadow pier
delicate needle
wary coral
steel trail
shadow pier
rose tangle
wary coral
radiant bough

can someone link components v2 docs? I think im blind lol

shadow pier
delicate needle
steel trail
shadow pier
radiant bough

Ahh thanks! i was looking in djs, but presume that will be launched at a later stage?

steel trail
steel trail
shadow pier

and how can animated be null as well, either its animated or its not 😭

rose tangle

yeah we were suspecting that, applicationemoji probably shouldn't be typed as null as well

someone was probably thinking about reactions when they were implemented to djs

rose tangle

yes

shadow pier
rose tangle

that's what the docs suggest, yes, but then it'll be a ReactionEmoji

not an ApplicationEmoji

stable sun

May be null

agile nest

in SlashCommandBuilder().addUserOption() i can only use x => x... or object too?

shadow pier

so basically ApplicationEmoji is incorrectly typed?

rose tangle
rose tangle
rigid crest

a question i asked a while go but wasnt fully answered, can the thumbnail be flexible (left to right)

steel trail

no

rose tangle

that's just an image?

steel trail

thumbnail is always fixed size to the right

shadow pier
rose tangle

just type assert

radiant bough

Can we add videos to embeds now? I cant find any info on restrictions of filetypes in the docs

rose tangle

as string

or !

radiant bough

goated, now to figure out how

shadow pier
agile nest
bitter pivot

What is Components v2 in v14?

Is it something to do with the way components are handled/will I need to change the way my bot sends messages/components or what does it introduce?

rose tangle

due to the allowedMentions bug

and the editReply flags bug

shadow pier

so this could be fixed in that as well?

rose tangle

maybe this fix can also be added there

shadow pier

does it need a github issue?

bitter pivot
terse crown
dense jackal
bitter pivot
rigid crest

is there a image limit? (like discords upload limit being 10?)

zenith violet

its the same for bots as it is for users

so 10 by default

bitter pivot
zenith violet

yes

radiant bough

is there an overview of the djs functions/enums added to support components v2? And maybe how theyre used lol

bitter pivot
terse crown

you have an example of almost everything in the file in #announcements

radiant bough
bitter pivot
radiant bough
hasty osprey

are there any d.js ts tutorials

terse crown

just open it in vscode bruh

radiant bough
terse crown

why would you open a text file in a media player

agile nest
Uncaught _ExpectedValidationError Error: Expected
    at handle (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1531:75)
    at parse (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
    at assertReturnOfBuilder (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@discordjs/builders/dist/index.js:2461:53)
    at _sharedAddOptionMethod (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@discordjs/builders/dist/index.js:3263:5)
    at addUserOption (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@discordjs/builders/dist/index.js:3194:17)
    at <anonymous> (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/commands/ban.js:7:10)
    at <anonymous> (node:internal/modules/cjs/loader:1562:14)
    at <anonymous> (node:internal/modules/cjs/loader:1699:10)
    at <anonymous> (node:internal/modules/cjs/loader:1313:32)
    at <anonymous> (node:internal/modules/cjs/loader:1123:12)
    at traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at <anonymous> (node:internal/modules/cjs/loader:1335:12)
    at require (node:internal/modules/helpers:136:16)
    at <anonymous> (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/index.js:52:21)
    at <anonymous> (node:internal/modules/cjs/loader:1562:14)
    at <anonymous> (node:internal/modules/cjs/loader:1699:10)
    at <anonymous> (node:internal/modules/cjs/loader:1313:32)
    at <anonymous> (node:internal/modules/cjs/loader:1123:12)
    at traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at executeUserEntryPoint (node:internal/modules/run_main:170:5)
    at <anonymous> (node:internal/main/run_main_module:36:49)

https://pastebin.com/dzjni8JK

rose tangle
radiant bough
zinc wyvern

This used to give back something of type Message, but now it seems to give back something that pretty much only has client? It gives InteractionCallbackResponse.

repliedMessage = await interaction.channel?.send(content);
rose tangle
hasty osprey
sharp ginkgoBOT

guide Home: Introduction - Before you begin...
read more

terse crown
zenith violet

.reply will return that

radiant bough
hasty osprey

i love this new forward feature

rigid crest

on addattachmentoption can i add a description? like the user clicks the file of choice then they can add a description for the alt text? i have been wondering about this for a while but never asked about it

zinc wyvern
agile nest
terse crown
zenith violet

pass in withResponse: true

zinc wyvern

oh sorry, I sent the wrong thing then (originally).
Thank you

sharp ginkgoBOT
zenith violet

access its .message propertry

fallen trellis

yo is it mandatory to set an accessory button in a section of a container ?

zenith violet

a button or thumbnail yes

fallen trellis

damn

thank you

terse crown

i think you can just put just some text

rose tangle

if you're doing a section it is mandatory

fallen trellis
rose tangle

because otherwise the section would be useless

just use a text component directly

terse crown

ah yes thats right my bad

radiant bough

Just to confirm, we cant set a color like we can with embeds? cv2 a whole new thing?

rose tangle

you can set an accent color, yes

fallen trellis
rose tangle

in a container

zenith violet

or thumbnail

rose tangle

the section requires an accessory

fallen trellis
rose tangle

a thumbnail or a button

if you just use the text display directly you don't need to

fallen trellis

thanks, wolvinny and amgelo

fallen trellis
agile nest

i dont understand the error

Uncaught _ExpectedValidationError Error: Expected
    at handle (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1531:75)
    at parse (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
    at assertReturnOfBuilder (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@discordjs/builders/dist/index.js:2461:53)
    at _sharedAddOptionMethod (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@discordjs/builders/dist/index.js:3263:5)
    at addUserOption (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/node_modules/@discordjs/builders/dist/index.js:3194:17)
    at <anonymous> (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/commands/ban.js:7:10)
    at <anonymous> (node:internal/modules/cjs/loader:1562:14)
    at <anonymous> (node:internal/modules/cjs/loader:1699:10)
    at <anonymous> (node:internal/modules/cjs/loader:1313:32)
    at <anonymous> (node:internal/modules/cjs/loader:1123:12)
    at traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at <anonymous> (node:internal/modules/cjs/loader:1335:12)
    at require (node:internal/modules/helpers:136:16)
    at <anonymous> (file:///C:/Users/bs115/Desktop/truq%20djs%20rewrite/index.js:52:21)
    at <anonymous> (node:internal/modules/cjs/loader:1562:14)
    at <anonymous> (node:internal/modules/cjs/loader:1699:10)
    at <anonymous> (node:internal/modules/cjs/loader:1313:32)
    at <anonymous> (node:internal/modules/cjs/loader:1123:12)
    at traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at executeUserEntryPoint (node:internal/modules/run_main:170:5)
    at <anonymous> (node:internal/main/run_main_module:36:49)```
radiant bough
zenith violet

you just passed a void

sharp ginkgoBOT
agile nest
zenith violet
agile nest

how do i fix it

zenith violet

by passing in a user option

agile nest

this?

addUserOption({
            name: "member",
            description: "Member to ban",
            required: true,
        })
hushed mirage

How to make such a message?

zenith violet
mellow galleon

why are action rows not allowed to be in containers when the discord docs state that they are allowed to be?

zenith violet
agile nest

i cant understand what you mean, this code worked before but when i updated it stopped working

zenith violet

not too sure why you are using builders in the first place if you just pass in raw json

hushed mirage
zenith violet

literLLY

its in the message

terse crown
wary coral
mellow galleon

its in the docs but when i tried adding an ActionRowBuilder it errored

hushed mirage

this?

terse crown
hushed mirage

XD

zenith violet
wary coral
signal jewel
mellow galleon no
container.addActionRowComponents((row) => row.addComponents(
        new ButtonBuilder()...
    ))

should work

mellow galleon

but now im getting

DiscordAPIError[50035]: Invalid Form Body
data.components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
data.components[1][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
data.components[2][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
await i.reply({
  components: [
    new TextDisplayBuilder({ content: "Hello to <@" + (i.options.get("mention")?.value ?? i.user.id) + ">!" }),
    new SeparatorBuilder(),
    new ContainerBuilder()
      .addActionRowComponents(p => p.addComponents(
        new ButtonBuilder()
          .setCustomId(`test-${i.options.get("mention")?.value ?? i.user.id}`)
          .setLabel("Mention me")
          .setStyle(ButtonStyle.Primary)
       ))
  ]
});
terse crown

well well well

radiant epoch

kinda looks messy

mellow galleon

oh yea the flag

terse crown

you need the IsComponentsV2

agile nest
mellow galleon

didnt notice lol

zenith violet

also, you shoud use getString or whatever option type you have

zenith violet
tardy sable

do i use multiple buttons like this

.setButtonAccessory(button1, button2)

or
.setButtonAccessory(button1)
.setButtonAccessory(button2)

terse crown

you can only have one button in an accessory

wary coral
rose tangle

(which would go in a separate component, not as an accessory)

rose tangle
wary coral

sorry, IDk why I thought an action row could be an accessory

steel trail

alternatively two sections each with one button, if you want them below each other

rose tangle
rose tangle

yes

agile nest

ah thats sad

tardy sable
rose tangle
near siren

is it possible to adjust the size of an image inside an image gallery in containers?
I'm switching from an embed to a container and the image when used in the old embeds is smaller than it is when used as an image gallery in a container and its way too big for my liking

rose tangle
steel trail
tardy sable

thanks

umbral whale

Channels are always cached when the Guilds intent is specified, correct?

agile nest
steel trail
umbral whale

Got it. Thanks

near siren
rose tangle

attachment builder doesn't let you modify the size

and I don't think a smaller image would show as being smaller, pretty sure it'll still be big

just guessing though

tardy sable
rose tangle

nothing inside that section

you're done in that section

add another component, an action row, to the container

tardy sable

like this?

container.addSectionComponents(actionrow);

zinc wyvern

I haven't used discord.js and typescript in a while. I have a bot with many lines of code and I don't want to edit in the .isSendable call to each and every interaction.channel use. I have an "interaction manager", where I would like to just ignore any interaction that has a channel that's not sendable. Does anyone know how I can then make a type that specifies that?

For Message, I found this:

OmitPartialGroupDMChannel<Message>

though I don't know how to get it (probably will just check and then manually do as).

Is there something similar for interactions?

rose tangle
fading girder

discord invite links are not previewed when sent via components v2? (ie, outside the container)

rose tangle

try it and see

covert vine

im actually fucking dumb, what does DiscordAPIError[10002]: Unknown Application mean?

steel trail
zinc wyvern
fading girder
rose tangle try it and see

doesn't preview but I am so confused on why though... aren't content outside container work as a normal message? sad

sharp ginkgoBOT
tardy sable
rose tangle

we don't have control over that

steel trail

that should do the trick then (and use the <"cached"> generic on the parameters of your command files)

rose tangle

since they're action row components

tardy sable

ok thanks

steel trail
rose tangle
tardy sable ok thanks

please first read the docs if you're wondering what methods every object has, instead of guessing

sharp ginkgoBOT

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

steel trail

and no, there can't be any content outside of components. text outside of a container is still a component, just no boxed background

steel trail
covert vine ^

applicationId wrong usually. show the full error for more insight

weary swallow
fading girder

it does

weary swallow

Oh thanks, not really had a chance to test it out (should defo remove slowmode for donors ;) )

sharp ginkgoBOT

tag suggestion for @weary swallow:
You can control which entities receive notifications via the allowedMentions option. You can:

{ ..., allowedMentions: { parse: ["users", "roles"] } }
covert vine
steel trail applicationId wrong usually. show the full error for more insight
DiscordAPIError[10002]: Unknown Application
    at handleErrors (C:\Users\Uzivatel\Desktop\Langs\js\discord.js\node_modules\@discordjs\rest\dist\index.js:727:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async SequentialHandler.runRequest (C:\Users\Uzivatel\Desktop\Langs\js\discord.js\node_modules\@discordjs\rest\dist\index.js:1128:23) 
    at async SequentialHandler.queueRequest (C:\Users\Uzivatel\Desktop\Langs\js\discord.js\node_modules\@discordjs\rest\dist\index.js:959:14)
    at async _REST.request (C:\Users\Uzivatel\Desktop\Langs\js\discord.js\node_modules\@discordjs\rest\dist\index.js:1272:22)
    at async C:\Users\Uzivatel\Desktop\Langs\js\discord.js\main.cjs:71:9 {
  requestBody: { files: undefined, json: [ [Object], [Object] ] },
  rawError: { message: 'Unknown Application', code: 10002 },
  code: 10002,
  status: 404,
  method: 'PUT',
  url: 'https://discord.com/api/v10/applications/1364333179397341294/guilds/1206958734958399488/commands'
}
rose tangle

in case you want to not mention, it's currently broken but it'll be fixed

wary coral
covert vine

it has been used before and it has all scopes and im using all intentions just to not have to cope with ts

crimson gale

meanwhile i think that 1206958734958399488 is the bot and 1364333179397341294 is the guild
-# i lied, i KNOW that that's the case AE_WorriedFrogSip

fading girder
crimson gale

no

weary swallow
crimson gale

components v2 means no content and no embeds

fading girder

got it, all of this is kinda confusing at first. ty

zinc wyvern
steel trail
rigid crest

im struggling to keep the message component and disable button after click without removing the entire message component or do i need to add the button inside the suggestion component to start the thread? (or will it still erase all of the info)

if (interaction.customId === 'comment_button') {
    try {
      const disabledButton = new ActionRowBuilder().addComponents(
        new ButtonBuilder()
          .setStyle(ButtonStyle.Danger)
          .setLabel('Use thread to continue comments')
          .setCustomId('comment_button')
          .setEmoji('📒')
          .setDisabled(true)
      );


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

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

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

      await interaction.showModal(modal);
      const message = interaction.message;
      setTimeout(async () => {
        const suggestionContainer = message.components[0]; //without this being here and in the edit below it just disables the button and removes the suggestionContainer
        await message.edit({ components: [suggestionContainer, disabledButton] });
      }, 2000);

//rest is just thread creating
with the added message.components, i get this error 
    return { ...this.data, media: this.media.toJSON() };
                                             ^

TypeError: this.media.toJSON is not a function
    at ThumbnailComponent.toJSON, at SectionComponent.toJSON,at Array.map (<anonymous>), at ContainerComponent.toJSON,Array.map (<anonymous>), at MessagePayload.resolveBody, at GuildMessageManager.edit,at Message.edit, 
crimson gale
covert vine
radiant epoch

Guys, what is image class is used for container?
Okay found it: APIMediaGalleryComponent

zenith violet
crimson gale

-# tfw ignored 2 days in a row AE_WorriedFrogSip

rose tangle

and with a "I have no idea" kekw

covert vine

works lol

sorry guys for being the biggest retarded piece of shit in this server

rose tangle

switching them is an understandable mistake, but please just don't ignore the one trying to help you

steel trail
atomic comet

Does anyone know why im getting

{bot path}\node_modules\@sapphire\shapeshift\src\validators\UnionValidator.ts:9
export class UnionValidator<T> extends BaseValidator<T> {
                                                        ^


CombinedError: Received one or more errors```
with
`[class ThumbnailBuilder extends ComponentBuilder]` and `[class ButtonBuilder extends ComponentBuilder]`
steel trail
atomic comet
shadow pier

I thought ChatInputCommandInteraction<undefined> indicated ChatInputCommandInteraction for DMs?

radiant epoch

For educational and learning purpose, is this correct for Media Gallery on ComponentsV2:

const mediaGallery = new MediaGalleryBuilder();
const image = new MediaGalleryItemBuilder().setURL(some_url);

mediaGallery.addItems(image);
rigid crest
atomic comet
covert vine
        this.interactionMap[name](interaction);
                                 ^

TypeError: this.interactionMap[name] is not a function
``` i think its getting to the point where im bad at js
shadow pier
agile nest

how do i check if specific choice was selected

steel trail
steel trail
fading girder
zenith violet
steel trail
agile nest
fading girder

got it thanks for help guys, yall are awesome

zenith violet
sick gust

i try to make this and return error

rose tangle

the flag goes in the editReply, not the defer

because you don't use components in the defer

agile nest
zenith violet

its just like you would get a regular option

steel trail

getString(...) and compare it against the choices

rose tangle
steel trail

(or getNumber/getInteger)

agile nest
zenith violet

yes

hard ridge

I'm trying to run npm but it's giving this error

sick gust
zenith violet
rose tangle
hallow mesa

Is withComponents only for webhooks? And other messages and interaction responses just need to include Flags.IsComponentsV2?

steel trail

webhooks need both (for components v2), but yes

hallow mesa

Gotcha. Thanks!

sick gust

(sorry my english

rose tangle

hmm my bad then, no idea why it's like that

hard ridge
zenith violet
rigid crest
shadow pier
steel trail
zinc wyvern

Does anyone by any chance know why I'm getting this?

src/buttons/tickets/createticket.ts:69:45 - error TS2769: No overload matches this call.
  Overload 1 of 3, '(modal: APIModalInteractionResponseCallbackData | ModalComponentData | JSONEncodable<APIModalInteractionResponseCallbackData>, options?: ShowModalOptions | undefined): Promise<...>', gave the following error.
    Argument of type 'ModalBuilder' is not assignable to parameter of type 'APIModalInteractionResponseCallbackData | ModalComponentData | JSONEncodable<APIModalInteractionResponseCallbackData>'.
  Overload 2 of 3, '(modal: APIModalInteractionResponseCallbackData | ModalComponentData | JSONEncodable<APIModalInteractionResponseCallbackData>, options?: ShowModalOptions | undefined): Promise<...>', gave the following error.
    Argument of type 'ModalBuilder' is not assignable to parameter of type 'APIModalInteractionResponseCallbackData | ModalComponentData | JSONEncodable<APIModalInteractionResponseCallbackData>'.

69                 await interaction.showModal(modal)

modal is of type ModalBuilder:

const modal = new ModalBuilder()

modal.setCustomId("ticketpanel"+input)
modal.setTitle(panelData.questionsTitle || "Ticket Questions")

/** create `rows` component */

modal.addComponents(rows)

try {
  await interaction.showModal(modal)
} catch (e) {
  /** handle error */
}
shadow pier
floral blaze

for the slash command character limit, are only the lengths of the values of the names, descriptions, options(names, descriptions, choices), subcommand groups(names, descriptions), and subcommands(names, descriptions, options(names, descriptions, choices)) counted towards the character limit? or do the lengths of the keys also count towards the limit? Do the lengths of other parts of slash commands like contexts, defaultMemberPermissions, etc count against the character limit too? I'm confused what it means by "combined name, description, and value properties" in the documentation

rigid crest

so...
.setThumbnailAccessory(thumbnail => thumbnail.setURL(${interaction.user.displayAvatarURL()})); -> thumbnail breaks if you try to start a thread with the component data using the application it throws TypeError: this.media.toJSON is not a function

let mediaAttachment;
        if (mediaItems.length > 0) {
            mediaAttachment = new MediaGalleryBuilder({
            items: mediaItems,
            });
            suggestionContainer.addMediaGalleryComponents(mediaAttachment);
        }
```->  MediaGalleryBuilder breaks if you try to start a thread with the component data using the application it throws `TypeError: this.media.toJSON is not a function`

how can i start a thread if both forms of image media will crash the application? (when without any image media im able to start a thread via button and modal perfectly fine)
steel trail
rose tangle
floral blaze

glad I'm not the only one confused by its wording lol. I'll take a look there. Thanks

halcyon bison

(also it isn't specific to creating threads, but rather any reuse of existing component data for those components)

rigid crest

so like embed building "x.setImage"?

halcyon bison

all of the builders use methods like that, not just embeds
if you've been passing objects to each builders' constructor for everything, I'm unsure why you're even using the builders at all

rigid crest

this is what i had for the thumbnail when it was constantly throwing the error with the tread after commenting it out it was fine

const topImage = new SectionBuilder()
            .addTextDisplayComponents(titleText)
            .setThumbnailAccessory(thumbnail => thumbnail.setURL(`${interaction.user.displayAvatarURL()}`));
            suggestionContainer.addSectionComponents(topImage)
agile nest

ive got a new error:

DiscordAPIError[50035]: Invalid Form Body
data.components[0][BASE_TYPE_REQUIRED]: This field is required
    at handleErrors (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\rest\dist\index.js:748:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async BurstHandler.runRequest (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\rest\dist\index.js:852:23)
    at async _REST.request (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\@discordjs\rest\dist\index.js:1293:22)
    at async ChatInputCommandInteraction.reply (C:\Users\bs115\Desktop\truq djs rewrite\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:194:22)
    at async Object.execute (C:\Users\bs115\Desktop\truq djs rewrite\commands\modules.js:64:3)
    at async Client.<anonymous> (C:\Users\bs115\Desktop\truq djs rewrite\index.js:73:3) {requestBody: {…}, rawError: {…}, code: 50035, status: 400, method: 'POST', …}

code:
https://pastebin.com/EgCnzPt9

halcyon bison
rigid crest

im doing it this way they go on the post correctly but crashes when a thread is attempted to be made with the button

const mediaItems = [];

        if (image1Attachment) {
            mediaItems.push({
            description: `File uploaded by: ${interaction.user.username ?? interaction.user.displayName}`,
            media: {
                url: image1Attachment.url,
            },
            });
        }

        if (image2Attachment) {
            mediaItems.push({
            description: `File uploaded by: ${interaction.user.username ?? interaction.user.displayName}`,
            media: {
                url: image2Attachment.url,
            },
            });
        }

        if (image3Attachment) {
            mediaItems.push({
            description: `File uploaded by: ${interaction.user.username ?? interaction.user.displayName}`,
            media: {
                url: image3Attachment.url,
            },
            });
        }

        if (image4Attachment) {
            mediaItems.push({
            description: `File uploaded by: ${interaction.user.username ?? interaction.user.displayName}`,
            media: {
                url: image4Attachment.url,
            },
            });
        }

        let mediaAttachment;
        if (mediaItems.length > 0) {
            mediaAttachment = new MediaGalleryBuilder({
            items: mediaItems,
            });
            suggestionContainer.addMediaGalleryComponents(mediaAttachment);
        }
halcyon bison
rigid crest im doing it this way they go on the post correctly but crashes when a thread is ...

oh I had assumed you were doing a different silly thing, since frankly, this is also a little silly
again, at this point, I'm not sure why you're using the builder at all
but returning to the issue at hand
again, the issue stems from reusing the component data
in your original message, it'd be this line await message.edit({ components: [suggestionContainer, disabledButton] });
you'll need to recreate the component manually

reef flame

Are there any guides or examples for the recent update on components v2?

upper kelp

can I not use client.rest to register my slash commands?
im getting Expected token to be set for this request, but none was present

halcyon bison
upper kelp

im getting the error after login...

steel trail

and the whole reason for using rest for it is to have a separate script, not run it every time your bot starts

steel trail

but if you really insist on doing it with your client you can just use client.application.commands.set() instead of raw rest

upper kelp

here's logs, code will be available in a minute

Loading all commands
Command loaded: counter
Command loaded: ping
Logged in as deniz.blue#1664 !
Command loaded: counter
Error while publishing commands Error: Expected token to be set for this request, but none was present
    at _REST.resolveRequest (C:\Users\dennis\source\Repos\TheAlan404\seawork\node_modules\.pnpm\@discordjs+rest@2.5.0\node_modules\@discordjs\rest\src\lib\REST.ts:313:11)
steel trail

that's missing most of the error stacktrace. especially the interesting part

upper kelp
zenith violet

exporting your client is a bad idea

upper kelp

rest of stacktrace

    at _REST.queueRequest (C:\Users\dennis\source\Repos\TheAlan404\seawork\node_modules\.pnpm\@discordjs+rest@2.5.0\node_modules\@discordjs\rest\src\lib\REST.ts:255:44)
    at _REST.request (C:\Users\dennis\source\Repos\TheAlan404\seawork\node_modules\.pnpm\@discordjs+rest@2.5.0\node_modules\@discordjs\rest\src\lib\REST.ts:210:31)
    at _REST.put (C:\Users\dennis\source\Repos\TheAlan404\seawork\node_modules\.pnpm\@discordjs+rest@2.5.0\node_modules\@discordjs\rest\src\lib\REST.ts:191:15)
    at publishCommands (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\publish\publish.ts:17:27)
    at devPublishCommands (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\publish\dev.ts:30:15)
    at Store.<anonymous> (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\publish\dev.ts:9:5)
    at Store.emit (node:events:519:35)
    at addCommand (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\store\store.ts:26:18)
b\REST.ts:191:15)
    at publishCommands (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\publish\publish.ts:17:27)
    at devPublishCommands (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\publish\dev.ts:30:15)
    at Store.<anonymous> (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\publish\dev.ts:9:5)
    at Store.emit (node:events:519:35)
    at addCommand (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\store\store.ts:26:18)
    at Store.emit (node:events:519:35)
    at addCommand (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\store\store.ts:26:18)
    at <anonymous> (C:\Users\dennis\source\Repos\TheAlan404\seawork\framework\commands\store\load.ts:27:19)
sick gust

had to be something similar to the embeds author in the container :(

zenith violet

and as qjuh said, the whole reason REST is used is because its meant to be a separate file

upper kelp
zenith violet
zenith violet
upper kelp

hmm okay

upper kelp
halcyon bison
lavish surge

Hi! For some reason my bot emojis don't work with components v2, was that support removed and do I need to use app emojis now? Or did I make a mistake somewhere

zenith violet

wdym by dont work

lavish surge

like they don't display

halcyon bison

then please take it elsewhere
this channel is for if you need help

sick gust

unfortunately

lavish surge
sick gust
steel trail

so it should definitely not be done that way but as a separate thing you do once when things changed

shadow pier
covert vine
(async () => await commands.syncCommands())();
^

TypeError: client.on(...) is not a function
``` whar
radiant epoch

Code:

new ContainerBuilder()
  .addSectionComponents([
    new TextDisplayBuilder().setContent(
      [
        `### ${emojis.globe} Original Message`,
         message.content,
      ].join("\n")
    ),
   new ThumbnailBuilder().setURL(emojiURL),
  ])

Error:

ExpectedConstraintError > s.array(T).lengthGreaterThanOrEqual()
  Invalid Array length

  Expected: expected.length >= 1

  Received:
  | []

Isn't this how we use section component?

halcyon bison
steel trail

but having Non-Guild-Interactions and CachedGuildInteractions on the same type without RawGuild still doesn't seem like a useful idea to me. you'd still have to discern them, which is when you'd call inCachedGuild() typeguard. and thus excluding the raw guild was useless

covert vine

ffs, why is it so random to wherever i should put my semi colons

halcyon bison
radiant epoch
steel trail
halcyon bison
upper kelp
rose eagle

When Using Component V2, How Can I Make the Embed Behind It Transparent?

radiant epoch

What is the max character that a container/message(4000+) can have?

All containers have different limit of chars like embeds or it is still applied as "message"

rose eagle
halcyon bison

so what's the issue?

radiant epoch
steel trail
rose eagle
radiant epoch
steel trail

yes

radiant epoch

f

can we bypass that with embeds?

tame eagle

How I can disable buttons in container?

interaction.message.components.forEach(row => row.components.forEach(component => {
    if (component.data.type === ComponentType.Section && component.accessory.type === ComponentType.Button) {
        component.accessory.data.disabled = true
    }
    if (component.data.type === ComponentType.ActionRow) {
        component.components.forEach(component => {
            component.data.disabled = true
        })
    }
}))
await interaction.update({ components: interaction.message.components })
TypeError: this.media.toJSON is not a function
radiant epoch
rose eagle
radiant epoch

you wrote each of them in components: [...] ?

oh so it is all inside a section

rose eagle

Components: [Section1, Section2]

radiant epoch

thanks

halcyon bison
agile nest

how can i create a handler for interaction commands?

sharp ginkgoBOT

guide suggestion for @agile nest:
guide Creating Your Bot: Command handling
read more

agile nest

this is for buttons too?

halcyon bison

I mean not if you just copy paste it, but you can use similar logic for components, yes
all interactions are received by the same event, and therefore you can delegate work to command/component handling from there

sharp ginkgoBOT

guide suggestion for @agile nest:
guide Message Components: Component interactions - The Client#interactionCreate event
read more

agile nest

oh i see isButton(), but im supposed to put this code in every single file i create?

ohhh its isChatInputCommand

halcyon bison

not if you only have one interactionCreate listener
which you only should have one

agile nest

OH i finally get it

interactionCreate just executes the button code

agile nest

like in slash command

halcyon bison

again, you can use similar logic, but components don't have names
and it really depends on how you've implemented the button interaction handler

agile nest

thats what im trying to do right now and i dont know how

halcyon bison

if you're having trouble

  • reading files in a directory
  • storing those in some data structure (likely a Collection)
  • and calling the appropriate function upon receiving an interaction with a matching <ButtonInteraction>.customId
    that sounds like you should share what you have so far in #1081585952654360687
dense saffron

Did they remove timestamps (the one from embeds) with components v2?

halcyon bison

the new components aren't actually embeds, so I wouldn't say they removed timestamps

dense saffron

ok, rephrase: they didn't implement timestamps into this new stuff they want you to use?

agile nest
halcyon bison
slate light
else if (commandName === 'shop') {
            const embed = new EmbedBuilder()
                .setTitle('🛍️ Hogwarts Shop')
                .setColor('Purple')
                .setFooter({ text: '⚡ Buttons expire in 2 minutes.' })
                .setDescription('Select a category below to browse magical items!');
        
            const row = new ActionRowBuilder().addComponents(
                new ButtonBuilder()
                    .setCustomId('wands')
                    .setLabel('Wands')
                    .setStyle(ButtonStyle.Primary),
                new ButtonBuilder()
                    .setCustomId('animals')
                    .setLabel('Animals')
                    .setStyle(ButtonStyle.Primary),
                new ButtonBuilder()
                    .setCustomId('artifacts')
                    .setLabel('Artifacts')
                    .setStyle(ButtonStyle.Primary)
            );
        
            await interaction.deferReply({ ephemeral: false });
        
            await interaction.editReply({
                embeds: [embed],
                components: [row]
            });
        
            const shopMessage = await interaction.fetchReply(); // <== here define shopMessage only once
        
            setTimeout(async () => {
                try {
                    const disabledRow = new ActionRowBuilder().addComponents(
                        row.components.map(button =>
                            ButtonBuilder.from(button).setDisabled(true)
                        )
                    );
        
                    await shopMessage.edit({
                        embeds: [embed],
                        components: [disabledRow]
                    });
                    console.log('Buttons disabled after 2 minutes.');
                } catch (error) {
                    console.error('Failed to disable buttons:', error);
                }
            }, 120_000);
        }
halcyon bison
slate light

why are the buttons not disabled after 2 minutes ( i have used gpt in between for correcting it)

agile nest
halcyon bison

that's why you should scroll up to the Responding to component interactions section

azure spire

If a user doesn't have read permission for a channel, could he still stand Component Interactions? Like: Do I have to double check for permissions, or can component interactions only be send if the message with the components is visible for the user. Sorry for that horrible phrasing lol.

sharp ginkgoBOT

tag suggestion for @slate light:
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops.

  • Once you do, log relevant values and if-conditions
  • More sophisticated debugging methods are breakpoints and runtime inspections: learn more
halcyon bison

though of course further actions such as <Interaction>.channel.send() will rely on permissions

agile nest
halcyon bison

have you tried it?

azure spire
halcyon bison
rose tangle

users can get access to customIds on messages they can see though, so don't store secrets there

slate light
long parcel

in new components builder i can put 2 texts next to each other? similar to embedFields (inline)?

agile nest
rose tangle

they tried to tell you to first try it

azure spire
rose tangle

nope

long parcel

:/

rose tangle

also we don't have control over what components discord has

sharp ginkgoBOT

We are not Discord, just some nerds who develop Discord bots!

rigid crest
vapid crypt

Anyone know what this error means and where it could be coming from?
DiscordAPIError[50035]: Invalid Form Body components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).

rose tangle

if you're trying to use components v2 you need to send IsComponentsV2 message flag as well

vapid crypt

Ohh

halcyon bison

at least until the fix goes through

slate light
crimson thistle

is there a way i can use editReply and put a content value while using the IsComponentV2 MessageFlag?

rose tangle

no, you can't use content and v2 components

crimson thistle

shucks

steel trail

just put a TextDisplay as top level component. Behaves the same

zenith violet

place console logs to see where it stops

rustic heron

just a question, shouldnt this be already assumed?

or is it to prevent problems with embeds or older code?

agile nest
steel trail
covert vine
rustic heron

in next updates

steel trail

you should do it

rigid crest
steel trail
rustic heron

soontm

covert vine
rose tangle

and you might not always want to use components v2

if it were a full replacement then it could make sense to eventually assume it

but it isn't