#djs-in-dev-version

35223 messages · Page 7 of 36

gloomy kayak

I guess only certain components can be added to a modal

fiery anvil

how did u fix the select menu, i have this ```pl.map((playlist) => {
resultplay.push({
label: ${playlist.name},
value: ${playlist.id},
});
});

const playinput = new ActionRow().addComponents(
new SelectMenuComponent()
.setMinValues(1)
.setMaxValues(1)
.setCustomId("select_playlist_play")
.setPlaceholder("Select a Playlist to play")
.addOptions(resultplay)
);

components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
components[0].components[0].options[0].value[BASE_TYPE_REQUIRED]: This field is required```
stiff pivot

like this

            .addOptions(
                {
                    label: "DPS",
                    value: "dps"
                },
                {
                    label: "Tank",
                    value: "tank"
                },
                {
                    label: "Support",
                    value: "support"
                }
            )

it's not an array

like this ↑

fiery anvil

got it

thx

stiff pivot

np

elfin cape

Is this not a valid intent?

outer bane

you have to use enums / numbers. Read the pinned guide preview

elfin cape

oh

outer bane

iirc you can also use Pascal cased strings here but that's not encouraged to use

elfin cape

ah ok

pain, im guessing this is the slash command options types?

where can i find the new ones, if they are new ones.

BRUH

fiery anvil
stiff pivot like this ↑

i tried it for the past hour, but how the am i gonna add to the options, the things i have in the resultplay array

stiff pivot

...array

              .addOptions(...resultplay)

try this ↑

@fiery anvil

fiery anvil

ok

wow that was easier than i expected, now i know something new

thx a lot

stiff pivot

no problem

elfin cape

im confused

tame gazelle

check pins

elfin cape

thanks

stiff pivot

TypeError: embed.addField is not a function

            const embed = new Embed()
                .setTitle(`\\✨・Nouvelle demande de recrutement`);
            
            embed.addField({
                    name: "Pseudo Zenith",
                    value: pseudoZ,
                    inline: true
                })

why ?

dawn phoenix

removed, use the plural #addFields, same usage

stiff pivot

oh ok thx

elfin cape
copper jetty

or you can use Util.resolveColor method

elfin cape

OH ok

thx

fiery anvil
copper jetty

{ name: "", value: "" }

fiery anvil

Understood thanks

the .setEmoji in the button component is now a object too?

urban belfry

yes

vestal ibex

How to fix it?

forest elm
outer bane

will be fixed in the next dev release

vestal ibex

ok, thx

solemn egret

Sorry I forgot to reply to this but I meant it should be throwing DiscordAPIError

elfin cape

how can i find the colors as numbers
example 0x7289da

or how can i convert them to numbers using djs

outer bane

you can use 0x7289da, that's a hex literal

elfin cape

Ik, but what if i want different colors

forest elm

0x<hex>, you can use a color picker or something

uncut kelp
fiery anvil

so for the .setFooter and .setAuthor field what should be the input, cuz i give it the string but says received undefined

plain roverBOT

Tag suggestion from @copper jetty:
<MessageEmbed>.setFooter() and <MessageEmbed>.setAuthor() now each take an object:

- embed.setAuthor('This is an example text', 'https://exampleicon.com', 'https://websiteofauthor.com')
+ embed.setAuthor({ name: 'This is an example text', url: 'https://websiteofauthor.com', iconURL: 'https://exampleicon.com' })

- embed.setFooter('This is an example text', 'https://exampleicon.com')
+ embed.setFooter({ text: 'This is an example text', iconURL: 'https://exampleicon.com' })
north mulch

Why there are many breaking changes in v14

elfin cape

ohh ok

bruh

outer bane

you can find a reason for the changes in the pins

fiery anvil

does discord.js/voice have breaking changes too?

copper jetty
forest elm
elfin cape
vestal ibex

What?

outer bane

components has to be an array

elfin cape
forest elm

pretty self-explanatory, show the code

elfin cape
  .addOptions([
                        {
                            label: '🎟️Autorole',
                            description: 'Server Config for Auto Role!',
                            value: 'autorole',
                        },                        {
                            label: '🔥Role Keeping',
                            description: 'Server Config for Role Keeping!',
                            value: 'rolekeep',
                        },                        {
                            label: '✅Verification',
                            description: 'Server Config for Verification System!',
                            value: 'verify',
                        },
                        {
                            label: '🥣Logging!',
                            description: 'Server Config For Logging!',
                            value: 'logging',
                        },
                        {
                            label: '🪙Voice Role',
                            description: 'Server Config For Voice role!',
                            value: 'vr',
                        },
                    ]),
fiery anvil

at options: put ...menu

forest elm

remove the [], you have to use rest parameters

elfin cape

oh

thats so weird

vestal ibex
elfin cape

thx

fiery anvil

so with the new gatewayIntents if i put it like this it's the same as the v13 form: intents: [ Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGES, ], or do i have to use flags still?

outer bane

you can either use the enum directly or IntentsBitField.Flags

split fulcrum

What does even this mean?

It fails to send the embed

but i don't know why

outer bane

you tried to send an api request before logging in the client

split fulcrum

ehm

The client is logged in

outer bane

or after destroying it

split fulcrum
outer bane

only possibility of this happening while the client is logged in is a bug where you try to use a wrong token for a webhook which in turn sets your bot token to null

split fulcrum

Hmmm

Like this one?

outer bane

exactly

split fulcrum

But how can i find the error for that one?

outer bane

there's an open pr to fix it, for now you could check for a 401 status and do rest.setToken again

fiery anvil
split fulcrum

For befor i havent had this problem befor with v13 but when i changed to v14 it started happen but okay

dull mulchBOT

pr_open #7508 in discordjs/discord.js by vladfrangu opened <t:1645277692:R> (approved)
fix(RequestHandler): only reset tokens for authenticated 401s
📥 npm i discordjs/discord.js#fix/rest/reset-token-on-401-only-for-authenticated-calls

outer bane

it's a bug with the rest lib

or rather with discord sending the wrong status code

outer bane

you can't really use this install link

forest elm

that command wont work out of the box

outer bane
fiery anvil

oh yeah

forgot that

split fulcrum

should i add the error event?

and listen for the 401 status?

outer bane

you can do that, or wait till the pr gets merged and released

split fulcrum

any release date?

or

outer bane

as always no eta but there's no blocking requested change currently

fiery anvil
forest elm

GuildVoiceStates
GuildMessages

fiery anvil

That makes sense

still wont work tho

Nvm found

Thx for the help

split fulcrum
outer bane

yes, I think you also have to do <Client>.token = ...

Idk if it resets both

split fulcrum

Hmm

fiery anvil

Still learning sry for all the stupid questions

split fulcrum

if am not wrong

copper jetty

you don't have to do it in 1 line

outer bane

setToken is sync, no need to await it. the error event will only be emitted if a listener callback throws btw

split fulcrum

But how can i listen for the 401 event then?

error*

outer bane

catch and handle it everywhere you send something with a webhook

if you want to use the error event await webhook send calls

and check if <DiscordAPIError>.code is RESTJSONErrorCodes.InvalidWebhookToken

elfin cape

how do you set a emoji to a button now

forest elm

{ name: "emoji here" }

elfin cape

oh ok

ty

Im not using the toJSON function

urban belfry
elfin cape
   const allButtons = [startButton.setDisabled(true), backButton.setDisabled(true), forwardButton.setDisabled(false), endButton.setDisabled(false)]
      
      let group2 = new ActionRow().addComponents(allButtons)
      
      let helpMessage = await interaction.followUp({
        content: `Click on the buttons to change page`,
        embeds: [em1],
        components: [group2],
      })
``` code
plain roverBOT

_ Spread syntax (...)
Spread syntax (...) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.

urban belfry

spread the array and pass that addComponents(...allButtons)

elfin cape

oh

elfin cape

ehm

uncut kelp

Looks to be working as intended

velvet jasper

Should be validated by zod once the PR is merged but yeah labels on select menu options are required

viral zinc

?

velvet jasper
viral zinc

Ok thanks

fiery anvil

guys in the Modals PR example there is a type ModalActionRowComponent import, how do i require it in js?

copper jetty

You don't need it in js

fiery anvil
velvet jasper
fiery anvil
velvet jasper

Can you show me your entire code

fiery anvil

All 250 lines?

velvet jasper

The code for the modal

fiery anvil

wait that error could be due to the fact that im using messagecollector?

or it doesnt matter?

copper jetty

It doesn't matter

fiery anvil

This is all the modal

nothin else

copper jetty

Add TextInput to ActionRow and the ActionRow to Modal

fiery anvil
            const modal = new Modal()
            .setTitle('Add songs to the playlist')
            .setCustomId('add_modal');
            const ModalTextInput = new TextInputComponent()
            .setCustomId('add_modal_text_input')
            .setLabel('Insert URLs to add')
            .setStyle(TextInputStyle.Short);
            modal.addComponents(ModalTextInput)
            await i.showModal(modal);
          }``` u lost me what do u mean
knotty plover

You need to put the TextInput in an ActionRow

Same as you do buttons etc

fiery anvil

oh thats why

copper jetty
fiery anvil
const rows = [tvShowInputComponent, haikuInputComponent].map(
  (component) =>
    new ActionRow<ModalActionRowComponent>().addComponents(component)
);```

this part right>

it gives me an error like this

im gonna try again

knotty plover

you dont need the generics unless youre using TS

fiery anvil
knotty plover

You dont use ...rows if its not an array

its only one row

fiery anvil

It worked, thx for the patience

im noob for now 🙂

fiery anvil

is there a way of checking if the interaction is already replied?

plain roverBOT
jovial inlet

i need help

i went by everything in discord.js

and im getting errors

copper jetty

send the error

jovial inlet

ill send them later

i just wanted to let u know cuz im eating my dinner rn

ok i can send them now

let me find it first

knotty plover

lmao what

jovial inlet

whenever i try to add in a new slash command, this pops up

copper jetty

One of your command files don't have data property exported

jovial inlet

ive gone by the whole discord.js guide so far

ok

what do i do then

copper jetty

export data property in every command file

jovial inlet

how do i do that

this is ping.js

pallid ice

follow the guide again, you likely missed a data: property in one of your command files

jovial inlet

thats echo, i copy pasted from discord.js

pallid ice

yeah, you messed up echo

jovial inlet

what was i supposed to do

pallid ice

well, compare it to ping.js and you'll work it out

jovial inlet

ok thank you

what does module.exports do

is that how i use my slashcommands, and register them

from deploy-commands.js and slash-register.js

i know it exports it from another fiel

pallid ice

I suggest you take some time to learn some basic JS before you start messing with development versions of d.js

jovial inlet

where do i start

copper jetty
jovial inlet

and how long does it take to learn

copper jetty

few hours

jovial inlet

deadass

where do i start

like which one should i click on

@copper jetty

@pallid ice

pallid ice
jovial inlet

lmao what?

ik its not v14

and ill ping people if i want to, i was talking to them

secondly, im new here, so i was looking whre to find help

scarlet tangle

hi

a question Djs dev needs djs builders dev?

knotty plover

generally yes

scarlet tangle

npm i @discordjs/builders@dev

?

copper jetty

yes

scarlet tangle

.setColor(Discord.Util.resolveColor('Green'))

its correct?

velvet jasper

You can use just ‘Green’ now in the latest version

scarlet tangle
TypeError: Cannot read properties of undefined (reading 'resolveColor')                                                                 at Embed.setColor (/home/liyue/bot/node_modules/discord.js/src/structures/Embed.js:24:32)

wtf?

okay

scarlet tangle

gonna open pr

scarlet tangle
scarlet tangle
scarlet tangle has solution?

replace src/structures/Embed.js with

- const { Util } = require('../util/Util');
+ const Util = require('../util/Util');
hardy bone

welp did modals release?

autumn forum

v14 it's merged, 13 it's still a pr(?)

Question: If canceling a modal isn't indicated against the api, how would I handle a user cancelling a modal and reopening another? Is there a way/example of how to do this with the promises instead of collector?

cerulean bay

When i use deferReply on a <ModalSubmitInteraction>, interaction.replied says undefined

await interaction.deferReply({ephemeral: true})

if (interaction.isRepliable()) {
  console.log(interaction.replied) //false
}

And trying to reply to it returns 'INTERACTION_ALREADY_REPLIED'

scarlet tangle

Modals in v14??

scarlet tangle
scarlet tangle
cerulean bay

Not Undefined

scarlet tangle
cerulean bay

The reason why i use isRepliable() is for typings only.

slow storm
cerulean bay

True, i can use deffered instead. Thanks.

crude valley

Whenever I try editing a ephemeral reply, I get this error. This happens when I click a button, it sends a reply and try to edit it

why?

split fulcrum

Do you have fetchReply?

crude valley
split fulcrum

Try use that

Like this message.reply({content: "your message", fetchReply: true})

copper jetty

You can't fetch ephemeral reply, use editReply method

split fulcrum

Ahh yea forgot that

crude valley
split fulcrum

Hmm

Have you tried use deferReply?

If you haven't try use it before you editReply

cerulean bay

Use collected.update()

split fulcrum

Or do that ^^^

cerulean bay

That how i do it. @crude valley

copper jetty

You can't reply twice, update is a reply

split fulcrum

Update updates the reply

copper jetty

no

crude valley

Im gonna test

crude valley
split fulcrum

Try defer the reply and use editReply

cerulean bay

You are right. On my side, i'm able to do it as my first reply has a button in it so i'm updating the message from the interaction inside the ephemeral message. Otherwhise, i think you can't edit an ephemeral message.

I would suggest you to simply defer the reply instead of saying please wait. Discord will already show a loading thing

copper jetty
split fulcrum

Ahh yea

True

crude valley
cerulean bay
crude valley

eyesss

cerulean bay

When deffering

urban belfry

what are you even trying to do?

crude valley

@cerulean bay@urban belfry

urban belfry

okay but what are you trying to do?
edit the message, like what? what's the process?

cerulean bay

Also, why are you using a collector?

crude valley

on collector#collect

crude valley
cerulean bay

A simple interaction. With interaction.isButton() and comparing the customId if the interaction matching the one you've set for the button

Like this, you will not be waiting for someone to click the button

crude valley

no I want the buttons to expire

that's why I'm using a collector

cerulean bay

Then, simply disable it after your timeout instead

Disabled button is better than a not working one

crude valley

And what's the difference between a collector and interaction create event?

cerulean bay

If your bot crashes or reboots, the button will still be working if not a collector.

crude valley
slow storm

I think this issue isn't related to @dev so u can ask in #djs-help-v14

cerulean bay

True

crude valley

ah but the error doesn't show up in older versions, that's why I'm asking here

cold root

d

scarlet tangle

is there any docs for djs v14?

copper jetty

Read pins

hardy wind

Hi, Is there any reason why Discord.Util.resolveColor() isn't working anymore?

urban belfry
hardy wind
hardy wind
urban belfry not working as in...? show your usage as well

It seems you can't use .setColor(Discord.Util.resolveColor('Blue')) now when building an embed, and after looking at the code and realising that it should now accept a string again as it did with v13, I tried that and it still doesn't work.

I worked around it for now by removing the new colour setter method from the structure.

velvet jasper
hardy wind

I must say I am always happy with the help and support offered here.

split fulcrum

Did anything change in displayAvatarURL for when i try to get the Bots Avatar URL in png format it still gives it has a webp

and it even shows the formats that i can put

brazen knoll

how do you use Custom Emojis in SelectMenu Options setEmoji(APIMessageComponentEmoji)
The Guide does not mention anything related to that
nor do the Docs explain what an APIMessageComponentEmoji is

hardy wind
split fulcrum

ahh okay

brazen knoll

neh, had to look at code to figure it out

![disableNoSwitch](https://cdn.discordapp.com/emojis/831557873070637066.webp?size=128 "disableNoSwitch")

has to be converted to

{
"name": "disableNoSwitch",
"id": "831557873070637066",
"animated": false
}

kinda shitty how they removed the resolvers

urban belfry

they exist on djs, the package, on the util class, not on builders, moving it out to builders means they wouldn't have access to that

velvet jasper

probably can be added back to djs builders

compact hull

How can I collect a modal text input after user submit?

copper jetty

Construct new InteractionCollector or listen to interactionCreate event

vast jasper

Over the interaction event. Check with isModalSubmit() i guess.

tame gazelle

isModalSubmit()

vast jasper

Thx ❤️

slate kelp

Can I get an example function for Sweepers.guildMembers.filter?

compact hull

Hey its me again, So I've been working on the modal submit collector and this works:


    let string: string = '';

    const modal_collector = new InteractionCollector(client, { interactionType: InteractionType.ModalSubmit, max: 1})
    modal_collector.on('collect', async (modal_interaction: ModalSubmitInteraction) => {
      string = modal_interaction.fields.getTextInputValue('textinput')
      await modal_interaction.reply({content: `Entered ${string}`})

    })```
However, I'm wondering if this is the right way to go. Does it work the same as https://discord.js.org/#/docs/discord.js/main/class/Message?scrollTo=createMessageComponentCollector ?
compact hull
brazen knoll
components[2].components[0].emoji:
{ id: '946108238737338388', name: 'News', animated: false }
components[2].components[1].emoji:
{ id: '946108238817030174', name: 'Category', animated: false }

DiscordAPIError[50035]: Invalid Form Body
components[2].components[0].emoji[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
components[2].components[1].emoji[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType

whats the issue here

both emojis are valid
News
Category

    new Discord.SelectMenuOption()
      .setLabel(<channel>.name)
      .setValue(<channel>.id)
      .setEmoji(<client>.objectEmotes.channelTypes[<channel>.type]);

<client>.objectEmotes.channelTypes:

    "4": { "name": "Category", "id": "946108238817030174", "animated": false },
    "5": { "name": "News", "id": "946108238737338388", "animated": false },```

this the code for it
uncut kelp

What is c? It's obviously not getting the object, so there is where you begin debugging

brazen knoll

missed the edit

FacePalm was looking at the wrong class to fix

uncut kelp

:

hardy wind

Hi guys, is there an example for the modal builder available?
Thanks

copper jetty
hardy wind
scarlet tangle

Hello how can i install 13.7.0 dev version

copper jetty

you can't

Read guide from pins

It's Embed in v14

latent lion

Is <Client>.user.setActivity() removed in v14?

new Discord.Embed()

latent lion

Don't know why but if I do client.user.setActivity('.help') It doesn't work

scarlet tangle

guys

can you send an example to create a modal

copper jetty
scarlet tangle

thanks

would that work?

i dont feel like using the modal constructor

hushed wind
tame gazelle

.addChoice() got removed too? ._.

knotty plover

in the sense I dont think it ever existed, probably

tame gazelle

in the SlashCommandBuilder

knotty plover

But yeah I think we're shifting to use the plural methods only

tame gazelle

I see, thanks

how does .addChannelTypes() work?

outer bane

takes rest parameters similar to all other plural methods

tame gazelle

thanks

scarlet tangle

how i can get label or min max values of a input text

tame gazelle

how does <Embed>#setColor() work now?

copper jetty
tame gazelle

I did

copper jetty

👍

tame gazelle

.setColor(member.displayColor)

TypeError: Cannot read properties of undefined (reading 'resolveColor')
    at Embed.setColor (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\Embed.js:24:32)
    at Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\utility\userinfo.js:67:18)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\events\interactionCreate.js:55:17)
    at async Client.<anonymous> (H:\IdrisGaming\Discord Bot\ObitoInteractions\Structure\Client.js:48:25)
uncut kelp

That's a bug that has a current pull request

tame gazelle

any alternative?

uncut kelp

No

tame gazelle

rip

scarlet tangle

only type value and customid

knotty plover

Yeah the ModalSubmit doesnt receive those values

scarlet tangle

so they copy paste in the src of djs builders lmfao

knotty plover

...what

scarlet tangle
knotty plover

and its null for a ModalSubmitInteraction

Not seeing the issue

The label needs to exist in builders

velvet jasper
brisk glen

is there a way to check to avoid Interaction has already been acknowledged errors?

scarlet tangle

bruh

how do I get guild id in modal submit interaction

ok its extending Interaction so guild.id

brazen knoll

can i collect modal replies through MessageComponentCollectors on Messages or Channels

it seems like i cannot, are there plans to add this?

knotty plover

Use the InteractionCollector

They interactions, not message components

opal saffron

(quick dumb question) does .addField got removed? if yes then what is the alternative? [I got error when adding an Embed with .addField]

dawn phoenix

plural, same usage
.addFields(...fields), also works with one

hardy bone

did modals release 😐

vague coyote

its available on the dev branch

honest current

Is there a way to put the menus inside the modals?

dawn phoenix

not yet, more types coming, so far only text input

split fulcrum

From no where the setColor on the Embed Not work anymore and its a DecimalColor

So idk what changed

copper jetty

It's a bug

split fulcrum

Okay should i do?

use 0x?

or

balmy ember

setColor now takes a number iirc, so 0x would work ig

split fulcrum

For i have it like this

copper jetty
uncut kelp No

Jiralite said theres no alternative so i think you have to downgrade

split fulcrum

Have anything changed in setEmoji? to for

copper jetty

{ name: "emoji" }

split fulcrum

Ahh ok

split fulcrum
balmy ember
split fulcrum

ahh okay

stiff pivot

Hi guys

when try to add emoji to selector i've this error

Only dictionaries may be used in a ModelType
{
                                label: "HTC Vive",
                                value: "vive",
                                emoji: "950797639237128252"
                            },

This is an option ↑

can u help me pls

urban belfry

you want to pass an object to emojis

pass that as emoji:{id: id}

stiff pivot

oh
thx bro

scarlet tangle

Hi , when im trying to get user avatar url
Iw always give me webp format in v14

user.displayAvatarURL({ format: "jpg" })

tame gazelle

it's extension now

scarlet tangle

How ?

scarlet tangle

Didnt work

outer bane

did you read the linked documentation?

scarlet tangle

Yes

outer bane

where did you find format in it?

tame gazelle
urban belfry

there's no format, there is extension

scarlet tangle

Ohhh

Thx

scarlet tangle

Also messagecreate event not working

velvet jasper
grave brook

Hey, where is the MessageComponentsOptions type ?

velvet jasper
grave brook

No, MessageComponentsOptions

copper jetty
grave brook
copper jetty

because it doesn't exist

grave brook

That's what I said

KaPOP

velvet jasper

What are you trying to do?

grave brook

It seems that the components are broken

grave brook
velvet jasper

What?

grave brook

I develop in Typescript

velvet jasper

What code is not working?

grave brook

The types that correspond to the components are not present in the dev version

velvet jasper

{ name: “emojiName” }

knotty plover

They come from discord-api-types

grave brook

Oh okay ! Thanks !

dim gulch

I have a problem with my node_modules

i get an error that he can't find discord.js

vague coyote

Then I suggest installing it

dim gulch

no i have it installed

vague coyote

npm ls discord.js

dim gulch

i know i know

vague coyote

show it

show the output when using that command

safe gate

how to make a discord bot

hmmmm

interesting

copper jetty
safe gate

ight

ty m8

dim gulch

i get something like this?!

vague coyote

again

npm ls discord.js

show the output

dim gulch

k

copper jetty

npm install discord.js@dev

dim gulch
vague coyote

alright, now you move to #djs-help-v14 since thats obviously not dev related LUL

dim gulch

k xd

cerulean bay

I've just noticed that my bot doesn't receive directMessages since i upgraded to djs14. Anyone having this issue?

Yes

Ho, actually, i've disables partials. Let me try that.

I see.

That was the issue. Thanks xD

crude valley
/Users/nikan/Nikan-Utilities/node_modules/discord.js/src/structures/Embed.js:24
    return super.setColor(Util.resolveColor(color));
                               ^
TypeError: Cannot read properties of undefined (reading 'resolveColor')
    at Embed.setColor (/Users/nikan/Nikan-Utilities/node_modules/discord.js/src/structures/Embed.js:24:32)
    at nikansUtil.<instance_members_initializer> (/Users/nikan/Nikan-Utilities/src/structures/Client.ts:35:110)
    at new nikansUtil (/Users/nikan/Nikan-Utilities/src/structures/Client.ts:55:5)
    at Object.<anonymous> (/Users/nikan/Nikan-Utilities/src/index.ts:4:23)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module.m._compile (/Users/nikan/Nikan-Utilities/node_modules/ts-node/src/index.ts:1455:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/nikan/Nikan-Utilities/node_modules/ts-node/src/index.ts:1458:12)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

why do I get this error on Util import?

knotty plover

known bug at the moment

vague coyote

Will use 10 iirc

long narwhal

so i'm not really sure if this goes here or in #archive-builders since it's builders @ dev (sorry whoever i pinged), but
do UnsafeModals need to go through @discordjs/rest (like Slash Commands or Context Menus) or can you use them like Buttons or Select Menus?

vague coyote

Neither, you use them with interaction.showModal()

long narwhal

huh

vague coyote

Thqnkqng

Not sure what else your question wants

long narwhal

no that was it lmao; ig the way i was thinking was like: oh somebody joined a server, lemme throw a modal up in their face Wheeze

vague coyote

Nope, its a type of reply :(

long narwhal

interesting, thanks

scarlet tangle

How do I make interaction.fields.getTextInputValue not throw an error if the field doesn’t exist? (TypeScript)

vague coyote

✨ try catch ✨

Why do you try to get a non existing field tho?

scarlet tangle

This field will exist if a user selects something in the slash command and will not exist if not

scarlet tangle

could also make it required (if it should be always present)

vague coyote

if the field is empty it returns an empty string, not error

scarlet tangle
vague coyote

Yes, was talking to mega

scarlet tangle

Ok

scarlet tangle

Hello when using the guildMemberAdd Event
Can I get the Inviter ?

woeful pollen

no

small mica
.addField({name: "Kick", value: `${message.guild.me.permissions.has("KickMembers")? "Yes": "No"}`})```
It shows yes even if it doesn't have the permissions. Any idea why?
split fulcrum

Did the <member>.presence.activities change? for everytime i try to eval it i just get null

split fulcrum

and one more question did message.args get removed?

urban belfry
split fulcrum

Well it was

or not

nvm it was nothing

supple geode

I have an engineering question (not sure if this is the right channel). If I'm trying to make my bot configurable for different servers, I should just store the settings in my database mapped to the server ID, right? Or is there a clearly better solution?

gritty citrus
copper jetty

Right but this channel is for dev version of discord.js

supple geode

ah okay

thanks

scarlet tangle

Hello the messageReactionAdd event Not Working in v14

tame gazelle

look changes for partials

scarlet tangle
copper jetty

show full error

scarlet tangle

How do you add the AttachmentOption type with the discordjs/builders

tame gazelle

.addAttachmentOption()

latent lion

How about normal slash commands?

velvet jasper

The same

latent lion
const command = {
  ...,
  type: 4,
};
scarlet tangle
latent lion
tame gazelle
latent lion

Thanks

velvet jasper

ApplicationCommandOptionType.Attachment

latent lion
plain roverBOT
velvet jasper
tame gazelle

they were using them so I gave that too ._.

velvet jasper

Oh I missed that ignore me

scarlet tangle
tame gazelle `.addAttachmentOption()`

I am getting this issue: TypeError: (intermediate value).setName(...).setDescription(...).addAttachmentOption is not a function The current version of discordjs/builders I am using is ^0.12.0 should I be using a different version to have the addAttachmentOption()?

tame gazelle

use builders dev version

copper jetty

npm i @discordjs/builders@dev

scarlet tangle

Thanks!

I had a feeling that was the cause

how does it work

tame gazelle

try by writing it in PascalCase

or enums

scarlet tangle

Ok

still doesnt work

uncut kelp

How about you show us what you're doing

This isn't a mind reading game

icy dew

channels aren't bitfields so they should be using enums right?

scarlet tangle
uncut kelp

Please don't send pictures

scarlet tangle
if(type === "threads" && !interaction.guild?.features.includes("PrivateThreads")) return await interaction.reply({ content: `:Failure: This server does not have access to private threads.`, ephemeral: true })
uncut kelp

You use the GuildFeature enumerable

scarlet tangle

GuildFeature.PrivateThreads?

uncut kelp

Try it and see

scarlet tangle

O K

uncut kelp

Your IDE should autocomplete it

scarlet tangle

im using pterodactyl

velvet jasper
scarlet tangle

its a panel used by a lot of hostings

scarlet tangle
latent lion

Why doesn't streaming activity type work?

keen bobcat

needs to be a valid twitch stream url

latent lion
keen bobcat

unsure of the rest of the syntax but that's not optional

keen bobcat

pretty sure the type is wrong as well

latent lion

Oh

copper jetty
latent lion
latent lion

It works fine

velvet jasper

Yeah basically you can only fake streaming with a bot or a bot user and/or client mods

scarlet tangle

I am receiving this error, and I am confused to what could be causing it.

^ it repeats itself multiple times

The .setname command's code is ```js
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
data: new SlashCommandBuilder()
.setName('setname')
.setDescription('change the name of a channel')
.addChannelOption(option => option.setName('channel').setDescription('the channel you want to rename').addChannelTypes('GuildText').setRequired(true))
.addStringOption(option => option.setName('name').setDescription('The new name of the channel').setRequired(true))
.addStringOption(option => option.setName('reason').setDescription('The reason for the change').setRequired(false)),

async execute(interaction) {

    const Channel = interaction.options.getChannel('channel');
    const Name = interaction.options.getString('name');
    const Reason = interaction.options.getString('reason') || 'No Reason Provided';

    Channel.setName(Name, [Reason]);

    await interaction.reply({ content: `I have changed ${Channel.name} name to ${Name} successfully.`, ephemeral: true });
    
},

};```

outer bane

use the enum values for addChannelTypes

scarlet tangle

Okay

Where can I find the enum values for addChannelTypes?

copper jetty

ChannelType.GuildText

scarlet tangle
scarlet tangle
copper jetty

or you can find it in the source code if you want

scarlet tangle

Thank You!

hasty gorge

I cant find message button in v14 docs for some reason

tame gazelle

check the guide

pins

copper jetty

ButtonComponent

scarlet tangle
finite fog

No, only those two will work.

prisma kiln

What is this mean

tame gazelle

{ name: 'string' }

prisma kiln
obtuse crater

Why are UnsafeModal and UnsafeTextInputComponent not re-exported in discord.js?

prisma kiln

what's the problem, I cant set color for embed

copper jetty
prisma kiln

yeah

is there already issue for this in github ?

dull mulchBOT
hollow agate

I was testing the new Attachment option but the error says it's not a function

prisma kiln

oh cool

hollow agate
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
	data: new SlashCommandBuilder()
		.setName('attachment')
		.setDescription('Attach files.')
    .addAttachmentOption(option => option.setName('file')
      .setDescription('the file to attach.')),
  permissions: 'Administrator',
	async execute(interaction) {
    console.log(interaction.options.getAttachment('file'));
		await interaction.reply('Pong!');
	},
};```
obtuse crater
forest elm

most likely an oversight yeah, will pr

copper jetty
hollow agate
copper jetty

and your error?

pulsar citrus

could someone show me how to add a string option for choices? since the documentation isnt complete its very confusing

got it working - for the future if you want to add a single choice you'd do stringoption.addChoices({ name: '', value: '' })

gritty citrus

pretty self explanatory, and that is explained in the guide

pulsar citrus

not self explanatory when you've been using d.js for years and so many drastic changes have been made that break the predictability of the library

also colours in embeds appear to be broken i am unable to set numerical RGB colours or resolvable colours <embed>.setColor('Blurple') / <embed>.setColor('0xFFFFFF')

TypeError: Cannot read properties of undefined (reading 'resolveColor')

outer bane

known bug

pulsar citrus

sound

any temp fixes? otherwise I can quickly hook up a temp solution for myself by manually adding back the resolveColor method into the code

outer bane

you can import the embed from builders directly if you don't use camelCased constructor input or you edit the local file with the fix which is to remove the {} from the util import

otherwise wait for the pr to get merged and released

pulsar citrus

yeah fixed the import for now

ripe scaffold

hi, so i ran into a problem whilst updating to the newest dev version

        const jumpButton: ButtonComponentData = {
            label: "Jump to your DMs",
            url: startMessage.url,
            style: ButtonStyle.Link
        };

        const jumpRow = new ActionRow({
            components: [jumpButton]
        });

        interaction.reply({embeds: [successEmbed("Started the application process in your DMs")], components: [jumpRow]});

used this code and ran into the error Error: Cannot serialize component type: undefined, which I found someone asked earlier and components doesn't take an array anymore... so I changed that

        const jumpButton: ButtonComponentData = {
            label: "Jump to your DMs",
            url: startMessage.url,
            style: ButtonStyle.Link
        };

        const jumpRow = new ActionRow({
            components: jumpButton
        });

       interaction.reply({embeds: [successEmbed("Started the application process in your DMs")], components: [jumpRow]});

then i ran into this error TypeError: components?.map is not a function, which wants me to change it back to an array

im a bit stuck, any help?

copper jetty

ComponentType.Button

lofty grail
ripe scaffold

ty

one more question, curious why this throws a type error

        const jumpButton = new ButtonComponent({
            label: "Jump to your DMs",
            url: startMessage.url,
            style: ButtonStyle.Link,
        });

        const jumpRow = new ActionRow({
            components: [jumpButton] // ERROR HERE
        });
Type 'ButtonComponent' is not assignable to type 'APIMessageActionRowComponent | APITextInputComponent'.
  Type 'ButtonComponent' is not assignable to type 'APIButtonComponentWithURL'.
    Types of property 'url' are incompatible.
      Type 'string | undefined' is not assignable to type 'string'.
        Type 'undefined' is not assignable to type 'string'.

it works fine with my method above using a ButtonComponentData object, but not a ButtonComponent

velvet jasper

It needs to be in an action row

Oh wait nvm

ripe scaffold

yeah thats why i did the mistake of forgetting ComponentType earlier, I switched from ButtonComponent to ButtonComponentData and forgot to add the type back

but i prefer ButtonComponent because of the camelCase customId so just wondering why this throws that error, i can use ButtonComponentData object but its not ideal

midnight stirrup

hi, for addChannelTypes, i see that it should be taking rest params (but docs doesn't show it properly), any example for this?

nvm got it to work, missed out on a bit in my code

scarlet tangle

how is the "manage permissions" permission called?

copper jetty

I dont think theres manage permissions permission

scarlet tangle
copper jetty

ManageChannels

scarlet tangle

nope that doesnt work

vague coyote

thats ManageRoles

scarlet tangle

Ok

copper jetty

It says channels permissions

scarlet tangle

but discord

vague coyote

ManageChannels is just the channel name and stuff

scarlet tangle

why

scarlet tangle

No perm to create the channel*

west fjord

probably a good idea to check your bot's actual permissions, that tick screen is just an invite url generator...

fiery anvil

i used to set the presence like this, client.manager.init(client.user.id); client.user.setPresence(client.config.presence); client.log("Successfully Logged in as " + client.user.tag); but now it gives me this error TypeError: Cannot read properties of undefined (reading 'presence')

split fulcrum

Do you need the webhook intent to make webhooks works or??

split fulcrum
fiery anvil

yeah

west fjord
fiery anvil

oh ok

fiery anvil

someone know what is this ? (node:18624) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time (Use `node --trace-warnings ...` to show where the warning was created)

vague coyote

you can ignore it

hallow violet

does ChatInputCommandInteraction was the new BaseCommandInteraction?

scarlet tangle
split fulcrum

Did the <member>.presence.activities change? for everytime i try to eval it i just get null

vague coyote

If the member is offline, its null

Or if the presence isnt cached

tame gazelle

<Embed>#setColor() now takes a ColorResolvable?
not just a number?

velvet jasper

Yes

scarlet tangle
interaction.channel.send({embeds: [new Discord.Embed().setTitle('hi').setColor(Discord.Util.resolveColor('AE6800'))]})

whats wrong

mint kraken

i need help

mint kraken

how do i make this

copper jetty
scarlet tangle
fiery anvil
    status: "online", 
    activities: [
      {
        name: "Music on a few guilds",
        type: "LISTENING", 
      },
    ],
  });``` this code doesn't give me errors but dont show up on discord either
copper jetty

Use enums instead of strings ActivityType.Listening

fiery anvil

have to import it?

copper jetty

yes

You can't use something that isn't defined

fiery anvil

Thank you

scarlet tangle

guys, i used to use this way in V13

const client = new Discord.Client({
    intents: Object.keys(Discord.Intents.FLAGS)
})

how can i do it in V14?

woeful pollen

GateawayIntentBits

copper jetty
scarlet tangle

i don't want to type them all

scarlet tangle
scarlet tangle
tame gazelle
scarlet tangle
scarlet tangle

Code: ```js
const TextInput = new Discord.ActionRow().setComponents(
new Discord.TextInputComponent()
.setLabel('Label')
.setCustomId('customId-example')
.setPlaceholder('type:')
.setStyle(1)
)

            await i.reply({ ephemeral: true, embeds: [Embed], components: [TextInput]})
```console
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0][COMPONENT_TYPE_INVALID]: The specified component type is invalid in this context

what is the problem?

copper jetty

You need to add that ActionRow to Modal

scarlet tangle
copper jetty

and then i.showModal()

scarlet tangle
velvet jasper

Btw setColor should be fixed now

ripe scaffold
latent lion

why is there a error?

oh, figured it out, I did { name: ... } instead of { text: ... }

proven forge
worthy fog

It’s iconURL

velvet jasper

it doesn't matter both work

worthy fog

icon doesn’t I’m 99% sure

It’s iconURL not icon

uncut kelp

Yea meant icon_url and iconURL will work

worthy fog

Oh

Oh this is the dev version

pallid ice
scarlet tangle

and dynamic is now forceStatic

scarlet tangle

@willow garnet can u help me

just a lil help

west fjord

#rules 6 dont ping people for help

wanton path

May i know the reason why Embed#addField is removed?

sterile hemlock

Because we have addFields() which does the exact same thing, but can do multiple

west fjord

the same change will be happening across all builders as well, so addComponent will be removed etc

west fjord

you had to pass objects to addField anyway even if it wasn't removed?

wanton path
west fjord

that was for v13, in @dev it was changed to use an object

wanton path

Thats my issue

west fjord

its been discussed many times and this is the change that came out of it, it's easier to have a single method that can do one or multiple

wanton path

My problem is now i have to construct an object for each fields

sterile hemlock
west fjord

i find it easier to use addFields, can just create an array of fields and spread them into the method, saves having loads of addField... i feel it actually declutters rather than creates more

wanton path

But anyways, i can define Embed#addField by my own, i don't want to talk about it anymore

slim bough

Where can we now find APIErrors that lived under Constants?

outer bane
dusty dirge

i would suggest to add addField back as it's useful

tame gazelle

you can just use multiple addFields?

dusty dirge
tame gazelle

why you can't?

dusty dirge

i thought we can use only one lmao

dusty dirge
tame gazelle

yep

forest elm

it has been removed yes

pine sentinel

What's the new way of initializing a MessageActionRow? Apparently it isn't a constructor anymore: js new Discord.MessageActionRow()

pine sentinel
velvet jasper
pine sentinel

It worked

pine sentinel

why is custom ids now required for URL buttons?

pallid ice
scarlet tangle

v14 is out?

uncut kelp

Pins

pine sentinel
knotty plover

That's a bug if that's the case, but you might not have correctly changed the button style to the new input?

velvet jasper

can u share ur code?

ripe scaffold

yeah i think theres a problem with button typings, for example:

        const jumpButton = new ButtonComponent({
            label: "Jump to your DMs",
            url: startMessage.url,
            style: ButtonStyle.Link,
        });

        const jumpRow = new ActionRow({
            components: [jumpButton] // ERROR HERE
        });
Type 'ButtonComponent' is not assignable to type 'APIMessageActionRowComponent | APITextInputComponent'.
  Type 'ButtonComponent' is not assignable to type 'APIButtonComponentWithURL'.
    Types of property 'url' are incompatible.
      Type 'string | undefined' is not assignable to type 'string'.
        Type 'undefined' is not assignable to type 'string'.

correct me if im wrong, its just no one has given me a solution so im assuming there is probably none

hollow agate
ripe scaffold

startMessage is just a message url

it’s not a problem with that, i’ve even used a ButtonComponentData object with the same info it’s just the ButtonComponent which is messing it up

hollow agate

Hmmm

Maybe try use the beta builder

velvet jasper
ripe scaffold
uncut kelp

Np

hollow agate
velvet jasper

oh you mean responding to a modal with another modal

velvet jasper

yeah discord api limitation

hollow agate

So we can make a big form

hollow agate
dire rover
C:\Hydro\node_modules\discord.js\src\structures\Modal.js:6
class Modal extends BuildersModal {
                    ^

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (C:\Hydro\node_modules\discord.js\src\structures\Modal.js:6:21)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Hydro\node_modules\discord.js\src\index.js:127:17)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)

Node.js v17.5.0```

I get this error when I update to the latest version of discord.js@dev

true yoke

Show the code for BuildersModal (where you import it)

dire rover
true yoke

Oh that's from discord.js

dire rover

Yes

true yoke

Are you using a modal anywhere?

dire rover

Nope

So is this a bug ?

true yoke

I think so I haven't seen that b4

dire rover

I uninstalled discord.js@dev

and reinstalled it

Also, How do I show modal to a specific channel ?

true yoke

Look at the guide, link is in pins

dire rover

what bout message ?

Also was .addField changed again ?

TypeError: (intermediate value).setTitle(...).setThumbnail(...).setDescription(...).addField is not a function```
.addField({name:"About Me:", value:"I am Gamecord. A Bot Made To Display Game Stats Directly in-to your servers.\n I Do This With The Help Of Official And Unofficial API's.",inline: false})```

This is where the error is coming from

idle galleon
dire rover
gamecord@1.1.0 C:\Hydro
└── (empty)```
idle galleon

Can you run it anyways?

idle galleon

Use npm why instead of npm ls

dire rover
dire rover
idle galleon Use `npm why` instead of `npm ls`
C:\Hydro>npm why @discordjs/builders
@discordjs/builders@0.13.0-dev.1646913825.dcd4797
node_modules/@discordjs/builders
  @discordjs/builders@"^0.13.0-dev" from discord.js@14.0.0-dev.1646914074.dcd4797
  node_modules/discord.js
    discord.js@"^14.0.0-dev.1646914074.dcd4797" from the root project```
idle galleon

You can safely change it to addFields (plural)

dire rover

ooof

slow storm
dire rover

A Person Made This

And this is a command, so it will obviously use message.

tame gazelle

a button is an interaction

dire rover
tame gazelle

<ButtonInteraction>#showModal ig

dire rover
scarlet tangle

did anything change for button emoji it keeps returning me a cracked error

var _this = _super.call(this) || this;
                           ^

ZodError: [
  {
    "code": "invalid_type",
    "expected": "object",
    "received": "string",
    "path": [],
    "message": "Expected object, received string"
  }
]
    at new ZodError (F:\Hurricane\node_modules\zod\lib\ZodError.js:81:28)
    at handleResult (F:\Hurricane\node_modules\zod\lib\types.js:115:21)
    at ZodObject.ZodType.safeParse (F:\Hurricane\node_modules\zod\lib\types.js:192:16)
    at ZodObject.ZodType.parse (F:\Hurricane\node_modules\zod\lib\types.js:173:27)
    at ButtonComponent.setEmoji (F:\Hurricane\node_modules\@discordjs\builders\dist\index.js:3:4858)
    at Base.run (F:\Hurricane\Src\Interface\Commands\Base\Security\antinuke-wl.js:151:79)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  issues: [
    {
      code: 'invalid_type',
      expected: 'object',
      received: 'string',
      path: [],
      message: 'Expected object, received string'
    }
  ],
  format: [Function (anonymous)],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)]
}

any idea? how can i fix it?

woeful pollen

provide an object

scarlet tangle
woeful pollen

id, name and/or animated

scarlet tangle

i see but if its a inbuilt discord asset cuz they don't have ids

woeful pollen

I think you do { name: '🍴' }

scarlet tangle

ok i'll try thanks for helping me out

woeful pollen

theres a pr to accept emoji strings

dull mulchBOT

pr_open #7616 in discordjs/discord.js by suneettipirneni opened <t:1646667379:R> (changes requested)
refactor: allow button builders to accept emoji strings
📥 npm i suneettipirneni/discord.js#discord.js/refactor/allow-emoji-strings

narrow totem

Do autocomplete responses not accept an array of objects or something?

plain roverBOT
slow storm

Same as v13

dawn phoenix

firT actually, why are they not using var args

slow storm

Same thinking xD I'll make a pr today

Ig this is the only method left which accepts array

small mica
scarlet tangle

error

Bot is online!
C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:9
      const exampleEmbed = new MessageEmbed()
                           ^

ReferenceError: MessageEmbed is not defined
    at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:9:28)
    at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)   
    at Client.emit (node:events:520:28)
    at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:520:28)

Code

const { Embed } = require('discord.js')

module.exports = {
  data: {
    name: 'help',
     description: "help how to use this bot",
    },
    execute(message, args){
      const exampleEmbed = new MessageEmbed()
        .setColor('#ff2436')
        .setTitle('Help')
        .setDescription('This command is a help command')
        .addFields(
            { name: 'Commands', value: '-about\n-help\n\nAdmin commands\n-ban\n-kick' },
            { name: 'Roles', value: 'Owner = Owner of the roblox server\nDiscord Owner = Owner of the discord server and me the bot\nHigh Mod = High Mod in discord and ingame\nMod =  Mod in discord and ingame\nAdmin = Admin ingame\nVerifyed = Players\nBots = Bots in discord\n' },
        )
        .setTimestamp()

channel.send({ embeds: [exampleEmbed] });
  }   
}
small mica

thats common sense

scarlet tangle
small mica

Yes it is. How can you use MessageEmbed() when you import Embed

scarlet tangle

error'

Bot is online!
C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\types.js:175
        throw result.error;
        ^

ZodError: [
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "string",
    "path": [],
    "message": "Expected number, received string"
  }
]
    at new ZodError (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\ZodError.js:80:28)
    at handleResult (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\types.js:115:21)
    at ZodNullable.ZodType.safeParse (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\types.js:191:16)
    at ZodNullable.ZodType.parse (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\types.js:172:27)
    at Embed.setColor (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\@discordjs\builders\dist\index.js:1:5975)
    at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:10:7) 
    at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)    
    at Client.emit (node:events:520:28)
    at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) {
  issues: [
    {
      code: 'invalid_type',
      expected: 'number',
      received: 'string',
      path: [],
      message: 'Expected number, received string'
    }
  ],
  format: [Function (anonymous)],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)],
  flatten: [Function (anonymous)]
}
small mica
small mica

anyone knows this?

const { ApplicationCommandType, ApplicationCommandOptionType, Embed, Util, Modal, TextInputComponent, TextInputStyle} = require('discord.js');


module.exports = {
  name: 'modal',
  description: 'Bakaa',
  type: ApplicationCommandType.ChatInput,
    /**
     *
     * @param {Client} client
     * @param {CommandInteraction} interaction
     * @param {String[]} args
     */
     run: async (client, interaction, args) => {
try{

    const modal = new Modal()
    .setCustomId('myModal')
    .setTitle('My Modal');

// Add components to modal

// Let's create our text inputs
const favoriteColorInput = new TextInputComponent()
    .setCustomId('favoriteColorInput')
    // The label is the prompt the user sees for this input
    .setLabel("What's your favorite color?")
    // Short means only a single line of text
    .setStyle(TextInputStyle.Short);

const hobbiesInput = new TextInputComponent()
    .setCustomId('hobbiesInput')
    .setLabel("What's your favorites hobbies?")
    // Paragraph means multiple lines of text.
    .setStyle(TextInputStyle.Paragraph);

// An action row only holds one text input,
// so we need one action row per text input.
const firstActionRow = new ActionRow().addComponents(favoriteColorInput);
const secondActionRow = new ActionRow().addComponents(hobbiesInput);

// Now we need to add our inputs into the modal
modal.addComponents(firstActionRow, secondActionRow);

// Show our modal
await interaction.showModal(modal);
} catch(e) {
return interaction.followUp(`\`\`\`js\n${e}\`\`\``)
}
}
}```
Code of modals^
scarlet tangle
small mica

How are you even coding without reading docs -_-

scarlet tangle

BRINGS ME BACK TO START

// at the top of your file
const { MessageEmbed } = require('discord.js');

// inside a command, event listener, etc.
const exampleEmbed = new MessageEmbed()
    .setColor('#0099ff')
    .setTitle('Some title')
    .setURL('https://discord.js.org/')
    .setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
    .setDescription('Some description here')
    .setThumbnail('https://i.imgur.com/AfFp7pu.png')
    .addFields(
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )
    .addField('Inline field title', 'Some value here', true)
    .setImage('https://i.imgur.com/AfFp7pu.png')
    .setTimestamp()
    .setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });

channel.send({ embeds: [exampleEmbed] });

code on the website

tame gazelle

this is for the stable version
not main (dev)

small mica

Yeah.

small mica
scarlet tangle
tame gazelle

try to understand what you're doing then

small mica

Also ping me when helping with modals

uncut kelp

There's a tutorial on YouTube for dev? O_o

tame gazelle

probably when passing v12 to v13 ._.

scarlet tangle
dawn phoenix
small mica

Shouldn't it be

if (!interaction.isChatInputCommand()) return;

instead of

if (!interaction.isCommand()) return;
small mica
small mica

Also the latest discord.js dev version is showing this error whenever i start my bot

umbral slate
small mica

ah ok ill try it

small mica
umbral slate
small mica

ohok

velvet jasper
small mica
uncut kelp

Your error is a dot? ;o

What's your dev version?

umbral slate
uncut kelp What's your dev version?

the issue is that they're on the latest djs dev but the builders dev is outdated because the repo uses workspace versions, which don't update and require a clean install

small mica
const { Client, ActionRow, CommandInteraction, ApplicationCommandType, ApplicationCommandOptionType, Modal, TextInputComponent, TextInputStyle } = require("discord.js");

module.exports = {
    name: "modal",
    description: "returns websocket ping",
    type: ApplicationCommandType.ChatInput,
    /**
     *
     * @param {Client} client
     * @param {CommandInteraction} interaction
     * @param {String[]} args
     */
    run: async (client, interaction, args) => {
        const modal = new Modal()
            .setCustomId('myModal')
            .setTitle('My Modal');

        // Add components to modal

        // Let's create our text inputs
        const favoriteColorInput = new TextInputComponent()
            .setCustomId('favoriteColorInput')
            // The label is the prompt the user sees for this input
            .setLabel("What's your favorite color?")
            // Short means only a single line of text
            .setStyle(TextInputStyle.Short);

        const hobbiesInput = new TextInputComponent()
            .setCustomId('hobbiesInput')
            .setLabel("What's your favorites hobbies?")
            // Paragraph means multiple lines of text.
            .setStyle(TextInputStyle.Paragraph);

        // An action row only holds one text input,
        // so we need one action row per text input.
        const firstActionRow = new ActionRow().addComponents(favoriteColorInput);
        const secondActionRow = new ActionRow().addComponents(hobbiesInput);

        // Now we need to add our inputs into the modal
        modal.addComponents(firstActionRow, secondActionRow);

        // Show our modal
        await interaction.showModal(modal);
    },
};

code^

copper jetty

You can't reply twice

small mica

how am I replying twice?

copper jetty

showModal is a reply

small mica

what shud I do then? In docs that is only given

?

velvet jasper

does your command handler always defer the interaction?

the only way that could be happening is if it's being deffered or replied somewhere else in your handler

shadow socket

What is the maxiumium length of customId of a BTN?

velvet jasper

100 characters

shadow socket

okay

pallid gulch

am I missing something?

copper jetty

awaitModalSubmit isn't a thing

pallid gulch

Oh I thought it was based on doing some searching

how do I retrieve the modal responses?

velvet jasper
copper jetty
pallid gulch
copper jetty

yes

pallid gulch

how come it doesn't collect the response?

uncut kelp

Magic numbers oh no

copper jetty

You passed wrong componentType or wrong interactionType in collector options

You can use <Interaction>.isModalSubmit()

pallid gulch

Got it, I removed the componentType. Which componentType would it come under anyway?

It's probably like ActionRow or something

copper jetty

Modals aren't components

pallid gulch

oh gotcha, explains why it's optional

narrow totem

Responding to an autocomplete interaction with

interaction.respond([
 {
   name: 'Option 1',
   value: 'option1',
 },
])

returns

DiscordAPIError[50035]: Invalid Form Body
data.choices[0][MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
data.choices[1][MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType

I was told that it's still the same as v13 but...?

copper jetty
narrow totem
interaction.respond({
   name: 'Option 1',
   value: 'option1',
 })
``` returns the same error though
shadow nacelle

How now i know the channel type (String)
If i do channel.type it returns a number

narrow totem
plain roverBOT
tame gazelle

the example ^

narrow totem
copper jetty
tame gazelle
narrow totem

yeah but going with the docs brings up the same error and that guy was replying to me

prisma kiln

does modals has opportunity to check if provided data match some regex pattern

narrow totem

no but you can do it client side

prisma kiln

wdym

like send error message ?

narrow totem

you internally check if the data they provide matches your regex pattern, discord doesnt do it

stuck solstice
narrow totem
stuck solstice

Array of objects

narrow totem

yes?

forest elm

you're contradicting yourself 10 PES2_Shrug

stuck solstice

Strange, don't recall if it was changed or not. Read the source?

stuck solstice

Nah they're referring to me

urban belfry

it is planned to be a rest parameter, i'm not sure if it already changed

forest elm

it wasnt changed, it takes an array

narrow totem

why the sudden change to rest params instead of arrays?

forest elm

it wasnt changed

narrow totem

no, i meant for other stuff

velvet jasper

Heads up everyone, in the next dev release components will be renamed. Instead of having a “Component” suffix they’ll have a “Builder” suffix. For example ButtonComponent -> ButtonBuilder

I’ll try to update the guide later tonight when I get home

dull mulchBOT
true yoke

Yeah

copper jetty

Embed

Read pins

forest elm

broadcastEval takes a function instead of a string since v13

that wasnt changed

novel notch

Help Plis

Code

let test = new Discord.ActionRow()
            .addComponents(
            new Discord.SelectMenuComponent()
            .setCustomId("test")
            .setPlaceholder('Test')
            .setMinValues(1)
            .setMaxValues(1)
            .addOptions({
                label: "test",
                description: "test2",
                value: "test"
            })
            )

Error

TypeError: Cannot destructure property 'components' of 'undefined' as it is undefined.
scarlet tangle

v14 dev

did they make a change?

dark light

because it's coming from the discord.js source

cc @velvet jasper

uncut kelp

Oh dear lol... I think the import should be from builders now and not discord.js

uncut kelp

Don't worry it's not relevant to you

scarlet tangle

but someone explain to me what that is

uncut kelp

It's an error x_x

It's because of a bug

scarlet tangle

uh

from?

uncut kelp

Not from you, from discord.js

scarlet tangle

alr

ok

thanks ig

shadow socket
scarlet tangle

@uncut kelp srry for ping but whats SelectMenuBuilder etc...

ButtonComponent => ButtonBuilder?

uncut kelp

Ya

novel notch
scarlet tangle

same

shadow nacelle

Modals only support TextInputs right?

deep jetty

Yes

tiny obsidian
hardy bone

why do i get this error while running the code

ig thats an error from the package's side

small mica
velvet jasper does your command handler always defer the interaction?
const client = require("../index");

client.on("interactionCreate", async (interaction) => {
    // Slash Command Handling
    if (interaction.isChatInputCommand()) {
        await interaction.deferReply({ ephemeral: false }).catch(() => {});

        const cmd = client.slashCommands.get(interaction.commandName);
        if (!cmd)
            return interaction.followUp({ content: "An error has occured " });

        const args = [];

        for (let option of interaction.options.data) {
            if (option.type === "SUB_COMMAND") {
                if (option.name) args.push(option.name);
                option.options?.forEach((x) => {
                    if (x.value) args.push(x.value);
                });
            } else if (option.value) args.push(option.value);
        }
        interaction.member = interaction.guild.members.cache.get(interaction.user.id);

        cmd.run(client, interaction, args);
    }

    // Context Menu Handling
    if (interaction.isContextMenuCommand()) {
        await interaction.deferReply({ ephemeral: false });
        const command = client.slashCommands.get(interaction.commandName);
        try{
            if (command) command.run(client, interaction);
        } catch(e) {
            interaction.followUp({content: `\`\`\`js\n${e}\`\`\``})
        }
    }
});

My interaction create event