#djs-in-dev-version

1 messages Β· Page 21 of 1

devout narwhal
#

Can select menus be within modals?

outer bane
#

no

devout narwhal
#

Oh well

outer bane
#

discord planned other components afaik but currently it's only textinput

devout narwhal
#

Alright, thanks

scarlet tangle
#
const SelectMenu = new SelectMenuBuilder().setCustomId('setup-menu').setMinValues(1).setMaxValues(data.length).setOptions({ label: "test", value: "test", emoji: "πŸ€–" })

why is this not working?

Error: ```console
Error: Received one or more errors
at ObjectValidator.handleStrictStrategy (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@sapphire\shapeshift\dist\index.js:998:70)
at ObjectValidator.handleStrategy (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@sapphire\shapeshift\dist\index.js:910:47)
at ObjectValidator.handle (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@sapphire\shapeshift\dist\index.js:951:17)
at ObjectValidator.parse (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@sapphire\shapeshift\dist\index.js:114:88)
at SelectMenuOptionBuilder.setEmoji (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@discordjs\builders\dist\index.js:867:42)
at SelectMenuOptionBuilder.setEmoji (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules\discord.js\src\structures\SelectMenuOptionBuilder.js:17:20)
at Client.<anonymous> (c:\Users\mmgam\OneDrive\Desktop\Tickets\ismm.js:472:97)

brave dagger
#

that's not the full error
I think

scarlet tangle
tame gazelle
scarlet tangle
tame gazelle
scarlet tangle
#

Tried uninstalling and reinstalling and works now,thanks

brave dagger
#

how can I send a modal?

tame gazelle
#

Interaction#showModal()

devout narwhal
#

embed.fields now returns undefined, what would the alternative be?

tame gazelle
#

try embed.data.fields

devout narwhal
#

That worked, thanks!

brave dagger
vague coyote
scarlet tangle
blissful depot
#

i saw a bot like this that doesn't have presence, its possible with this version?

dawn phoenix
#

nothing to do with versions, it's websocketless bots

#

our docs bot doesn't have one either

brave dagger
#

what's the difference between builders and "unsafe" builders?

dawn phoenix
#

builders validate input fields (for stuff like length)

#

unsafe do not have any validation

blissful depot
scarlet tangle
blissful depot
dawn phoenix
#

nothing discord.js helps with

#

discord.js is based on websocket connections

blissful depot
#

ok, thanks

tender quest
#

Is this the correct way to use typedefs?

const { StickerType, StickerFormatType } = require('discord.js');
let sticker = await currentSticker.fetch(); // A random sticker
console.log(StickerFormatType[sticker.format]);
console.log(StickerType[sticker.type]);

I want to convert the number to a string so that the user can easily understand it.

(I ask about this because in v13 it was returning a string instead of a number)

marsh matrix
# tender quest Yup

This works for me

const { StickerFormatType, StickerType } = require("discord.js");
console.log(StickerFormatType["1"], StickerType["1"]); // PNG Standard
tender quest
#

Okoko, tysm blobguns

devout narwhal
#

Is the limit of 5 action rows the same in modals?

woeful pollen
#

I'm pretty sure yeah

brave dagger
#

What is the max amount of components in a modal?

brave dagger
knotty plover
#

5 rows with 1 text input each

undone yew
#

where is error? Interaction failed

knotty plover
#

This isn't even an interaction

#

It's a message event

undone yew
#

yes

knotty plover
#

On the buttons?

#

Because you don't respond to the interaction

undone yew
#

ok

brave dagger
#

Like data.reply

woeful pollen
#

also data.customId

normal sandal
#

what are the big changes in v14?

woeful pollen
#

read channel pins

undone yew
wicked tusk
#
        client.on('modalSubmit', (modal) => {
        
        const header = modal.components[1].value
        const welcomeChannel = member.guild.channels.cache.find(ch => ch.id === '937470079896002590');
        welcomeChannel.send(`${header}`);
        })

whats wrong with the modal.components ?

knotty plover
#

modalSubmit is not a discord.js event

#

No idea what you're using

wicked tusk
#

could you pls tell me i am still new at d.js

knotty plover
#

What npm module?

#

We don't have a separate module for modals

wicked tusk
#

discord.js

#

ah you mean where i copied it from?

knotty plover
#

You couldn't possibly have copied that from discord.js lol

wicked tusk
#

discord-modals

knotty plover
#

Yeah that's not ours

wicked tusk
#

yea now ik

knotty plover
#

Modals fire interactionCreate

wicked tusk
knotty plover
#

interaction.isModalSubmit() to check if it is one

#

interaction.fields.getTextInputValue(customId)

#

interaction.reply

wicked tusk
#

so if i do message.channel.send(interaction.fields.getTextInputValue(customId))

knotty plover
#

No, use interaction.reply

#

There's no message here

wicked tusk
#

so i have to send it in the same channel ?

knotty plover
#

You have to respond to the interaction somehow yes

wicked tusk
#

but what if i want it in a different channel ?

knotty plover
#

That would be pretty terrible UX

#

You can respond to the submit AND send something to another channel

#

But you still need to respond so the user knows you got the input

wicked tusk
#

yea i could do like interaction.reply("sent") or something like that but what i want to do is like a bug report form and in one channel the users should see the modal and in the other channel i should see the reported bugs

#

so i need to send it to another channel

knotty plover
#

That's fine as long as you also reply

wicked tusk
#

ah so i can do message.channel.send tho?

knotty plover
#

Well I mean that's still going to be the same channel

wicked tusk
#

yea if i define it just an example

knotty plover
#

And I'm still confused as to where a message came from, Modals can only be sent in response to interactions

wicked tusk
#

so if a user clicks on a the button in the channel #bugreport and comes to the modal and i want the incoming bugs to be in channel #reports this possible?

#

if i respond to the interaction

knotty plover
#

Yes

wicked tusk
#

ok my last question for today is if i sent the message, then how do i get the input of the modal ?

wicked tusk
#

thanks

#

wow, you're verified bot dev nice

chilly zephyr
#

On the node of receiving modal input, I got an issue on my own. I'll grab the code real quick

wicked tusk
chilly zephyr
#

To my own problem? Yeah sure Hehe

wicked tusk
#

idk maybe it's useful

#
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
module.exports = async (client) => {

const bugChannel = "955208454774063214";

client.on('interactionCreate', async (interaction, message) => {
    if(!interaction?.isButton()) return;
    const { member, channel } = interaction;
    if(channel.id == bugChannel && interaction?.customId == "bugModal") {
        // Create our modal
        const modal = new ModalBuilder()
            .setCustomId('myModal')
            .setTitle('My Modal');

        // Add components to modal

        // Let's create our text inputs
        const favoriteColorInput = new TextInputBuilder()
            .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 TextInputBuilder()
            .setCustomId('hobbiesInput')
            .setLabel("What's some of your favorite 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 ActionRowBuilder().addComponents(favoriteColorInput);
        const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);

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


        await interaction.showModal(modal);
        if (!interaction.isModalSubmit()) return;
            // Get data entered by user
    const favoriteColor = interaction.fields.getTextInputValue('favoriteColorInput');
    const hobbies = interaction.fields.getTextInputValue('hobbiesInput');

    console.log({ favoriteColor, hobbies });

    }
});
}

this is also not working did i do anything wrong?

chilly zephyr
#

Which part isn't working though, like what isn't working? Does it log favoriteColor and hobbies?

wicked tusk
#

no it doesn't

#

this is all i get

#

no logging

chilly zephyr
#
    const { member, channel } = interaction;
    if(channel.id == bugChannel && interaction?.customId == "bugModal") {
        // Create our modal
        const modal = new ModalBuilder()```
#

Put some console logs in there, see if they run

#

Nvm it shows the modal

wicked tusk
#

yes

#

the problem is that if i submit nothing happens eventhough it should log favoriteColor & hobbies

chilly zephyr
#

You have your modal submit if statement inside your isButton statement

wicked tusk
#

so remove it or what to do idk?

chilly zephyr
#

Don't put it inside that if statement

#
if (itsabutton) {
    // do something
} else if (itsamodalsubmission) {
    // do something else
}```
wicked tusk
#

so for } else if (itsamodalsubmission) {
i do
const favoriteColor = interaction.fields.getTextInputValue('favoriteColorInput');
const hobbies = interaction.fields.getTextInputValue('hobbiesInput');

console.log({ favoriteColor, hobbies });

this right?

chilly zephyr
#

Yes but you should also check the ID and whatnot

#

It'll never be a button, it'll always be modal submission

wicked tusk
#

what do you mean why else if (itsamodalsubmission)

#

that aint a real thing tho?

chilly zephyr
#

No it's pseudo code

wicked tusk
#

so just else without the () right?

#
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
module.exports = async (client) => {

const bugChannel = "955208454774063214";

client.on('interactionCreate', async (interaction, message) => {
    if(!interaction?.isButton()) return;
    if (interaction.isButton) {

    
    const { member, channel } = interaction;
    if(channel.id == bugChannel && interaction?.customId == "bugModal") {
        // Create our modal
        const modal = new ModalBuilder()
            .setCustomId('myModal')
            .setTitle('My Modal');

        // Let's create our text inputs
        const favoriteColorInput = new TextInputBuilder()
            .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 TextInputBuilder()
            .setCustomId('hobbiesInput')
            .setLabel("What's some of your favorite hobbies?")
            // Paragraph means multiple lines of text.
            .setStyle(TextInputStyle.Paragraph);

        const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
        const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);

        modal.addComponents(firstActionRow, secondActionRow);

        await interaction.showModal(modal);
        if (!interaction.isModalSubmit()) return;
    }else {
    const favoriteColor = interaction.fields.getTextInputValue('favoriteColorInput');
    const hobbies = interaction.fields.getTextInputValue('hobbiesInput');

    console.log({ favoriteColor, hobbies });
}
    }
});
}

#

like this?

chilly zephyr
#

Read your code

#

Tell me what this does js if(!interaction?.isButton()) return; if (interaction.isButton) {

wicked tusk
#

oh forgot to remove itr

gloomy kayak
#

Yeah, it's a normal interaction, you need to reply to it

wicked tusk
#

ok thanks great

uncut kelp
steel haven
#

Hi, now how to compare oldChannel to newChannel ?

wicked tusk
chilly zephyr
steel haven
wicked tusk
#

do i have to do ephemeral: true } in reply if only the user can see it?

chilly zephyr
#

Yes

wicked tusk
#

thank you so much for helping i learned a lot today πŸ™‚

#

where can i see all TextInputBuilder options? like .short or paragraph ?

chilly zephyr
wicked tusk
#

lamo sry

#

if required is a boolean it can be true or false but how do i do it?
like .setRequired (false) or wat

woeful pollen
#

huh? .setRequired() takes true or false

wicked tusk
#

yea so it was correct or not?
.setRequired (false)

woeful pollen
#

yes

uncut kelp
#

I don't think anything changed

steel haven
#

It is no longer a DM | GuildChannel

forest elm
#

ok? and why does that metter

uncut kelp
#

It's like that in version 13 too

steel haven
#

Mmh thinkMan Okey

velvet needle
#

Is there a change somewhere in V14 list? I didn't find any in the guide

white nebula
#

It's in the pinned messages

velvet needle
#

Oh Thx

#

With the Modal Code from the Guide i get this Error

tame gazelle
velvet needle
tame gazelle
velvet needle
#

Problem solved, reinstalling djs fixed the problem

chilly zephyr
#
// on command interaction, create this modal:
const modal = new ModalBuilder().setCustomId("profileEditor").setTitle("Profile Editor - Description");
const descriptionInput = new TextInputBuilder().setCustomId("descriptionInput").setLabel("Your new profile description").setStyle(TextInputStyle.Paragraph).setMaxLength(800).setRequired(true);

const actionRow = new ActionRowBuilder().addComponents(descriptionInput);
modal.addComponents(actionRow);

// show it
await interaction.showModal(modal);

// filter looks nice
const filter = (modalInteraction) => modalInteraction.customId === "profileEditor" && modalInteraction.user.id === member.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 180000 });

// but it never gets collected
collector.on('collect', i => {
    const desc = i.fields.getTextInputValue("descriptionInput");
    eb.setDescription("Input: " + desc);
    interaction.channel.send({ content: member.toString(), embeds: [eb] });
});```
#

Not sure what I'm doing wrong here. I also tried listening to it through the interactionCreate event but have had no success so far. Am I overlooking something?

summer sable
#

Why .getAttachment() returns an ephemeral attachment?

knotty plover
#

Because it is ephemeral

knotty plover
#

So they'll never be collected by a message component collector

chilly zephyr
#

Man that makes sense

#

I found InteractionCollector, is that what I'm supposed to be for/into?

knotty plover
#

yeah, or I think theres an interaction.awaitModalSubmit

#

Not sure if merged

chilly zephyr
#

I don't think that was merged

summer sable
knotty plover
#

You can

#

Its ephemeral because it was sent to you

#

and only to the bot

chilly zephyr
#
const filter = (modalInteraction) => modalInteraction.customId === "profileEditor" && modalInteraction.user.id === member.id;
const collector = new InteractionCollector(client, { filter, time: 180000, guild: interaction.guild, maxUsers: 1, max: 1, componentType: ComponentType.TextInput, interactionType: InteractionResponseType.Modal });```
Is this not a valid use case? Doesn't seem to trigger the collect event
knotty plover
#

Dont set component type

#

It cant be both a component and a modal

chilly zephyr
#

Ah okay

knotty plover
#

Otherwise looks okay

chilly zephyr
#

Thank you, will give it a try without the component type

#

shakeshead Still doesn't fire the collect event

#

I'll log the filter actually and see if it's false for some reason

#

I think it went through but logs an empty line in here: js collector.on('collect', i => { const desc = i.fields.getTextInputValue("descriptionInput"); console.log(desc);
Despite of it having the same id: js const descriptionInput = new TextInputBuilder().setCustomId("descriptionInput").setLabel("Your new profile description").setStyle(TextInputStyle.Paragraph).setMaxLength(800).setRequired(true);

knotty plover
#

and you did put something it it? I have to ask lol

chilly zephyr
#

Yes KEK
I'm expecting "Test desc"

knotty plover
#

Could you log i.fields.fields

chilly zephyr
#

In collected or end? Or both?

knotty plover
#

collected

#

though it should be essentially the same thing

chilly zephyr
#

Yeah it's also empty

#

There's a way to put prefilled text in the text boxes right? Placeholder or the other one, I'd have to check Value, that's the one

#

Maybe I could add that to it and submit it without modifying it and see if it changes anything

#

Empty log after submitting

#

Wow I'm griefing both of us. I forgot I wrote an unfinished log line there KEK

#

So the collect event doesn't trigger at all

knotty plover
#

huh

#

I'd debug your filter then

summer sable
knotty plover
#

uhh... no? thats the only way to get interaction options

#

Whats the issue?

chilly zephyr
dapper forum
#

hey @uncut kelp, can you confirm what you mean?
think we've got a misunderstanding here!

summer sable
inner breach
#

umm hello, how can i fix this error? NGS_umm

nocturne kayak
#

temp fix is to pass an empty object to ButtonBuilder constructor

jade mural
#
/home/runner/vtt/node_modules/discord.js/src/rest/RequestHandler.js:350
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Unknown interaction
    at RequestHandler.execute (/home/runner/vtt/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/runner/vtt/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async ModalSubmitInteraction.deferReply (/home/runner/vtt/node_modules/discord-modals/src/structures/interfaces/InteractionResponses.js:12:5) {
  method: 'post',
  path: '/interactions/964036933992992800/aW50ZXJhY3Rpb246OTY0MDM2OTMzOTkyOTkyODAwOnpXa1ZHWWoyeGZHUTh6aTdjUnRwV2l1OVd4b29SYUNTRmYxNlNlZVJQWFROMTY5QnRSTnN0RDh0NXNNRWYyeGI5enJ4YXBhUXhYOXVMMElmNGp1dFExZWVQVzBJSE1DdWM0MngxSVVDaXQyY29lbmIyWnRTT2ZOYjRJeWZxbUZq/callback',
  code: 10062,
  httpStatus: 404,
  requestData: { json: { type: 5, data: { flags: 64 } }, files: [] }
}
tame gazelle
tame gazelle
#

why would you need to fetch an emoji for get his id?

inner breach
slow storm
inner breach
#

oh okay, thx for the information NGS_SadOkeyy

#

I will wait until @dev is updated again _NC_wiggle1

brave dagger
#

what is the "message" property of a modal interaction?

knotty plover
#

The message it launched from, if it was from a button/select menu

vast mirage
#
{
    type: 1,
    components: [
      {
        type: 3,
        custom_id: 'gender',
        minValues:1,
        maxValues:1,
        label: 'gender',
        placeholder: 'select',
        options:[
          {label:"XY",value:"male",description:"XY"},
          {label:"XX",value:"female",description:"X"},
        ],
        required: true
      },
    ],
  },
- data.components[1].components[0]: The specified component type is invalid in this context
#

where exactly am i going wrong and how can i fix it?

tame gazelle
#

shouldn't be min_values and max_values ?

vast mirage
#

but i have to do it accordingly

idle galleon
#

Then you should be using customId

vast mirage
#

I checked is correct

idle galleon
#

What did you use the select menu in?

vast mirage
#

Modal

idle galleon
#

It's just weird to mix camel case w/ pascal

#

You can't use select menu in modal

#

Only text fields

vast mirage
#

but it appears in the documentation

tame gazelle
#

modals only support text inputs for now

idle galleon
#

Pretty sure Discord docs doesn't say you can use other types in modals

vast mirage
#

ok thank you very much
πŸ™πŸ»

acoustic temple
#
  constructor({ emoji, ...data }) {
                ^

TypeError: Cannot destructure property 'emoji' of 'undefined' as it is undefined.

I'm getting this error when creating ActionRow with Buttons

acoustic temple
#
const row = new ActionRowBuilder()
                .addComponents(
                    new ButtonBuilder()
                    .setCustomId('excluir')
                    .setLabel('Deletar')
                    .setStyle(ButtonStyle.Success),

                    new ButtonBuilder()
                    .setCustomId('cancelar')
                    .setLabel('Cancelar')
                    .setStyle(ButtonStyle.Danger)
                );

Code

acoustic temple
#

thanks

velvet needle
forest elm
#

new ButtonBuilder({})

velvet needle
#

Oh Thank You

uncut kelp
#

Guild directory support, guild ban pagination and the modal builder from discord.js should be in the next dev release (43 mins from now)

tame gazelle
uncut kelp
#

What's wrong with that code

tame gazelle
tame gazelle
uncut kelp
#

Man, should have said that first lol

tame gazelle
#

so not in the next dev release?

uncut kelp
#

Dev releases don't publish other people's branches

#

It publishes the main branch

spare fiber
#

in v13 if we disable GuildMember cache, Message#member and Interaction#member will return null. but shouldnt it return partial member instead? (discord sends raw member payload in messageCreate and interactionCreate gateway events) will this fixed in v14?

about interaction, it return partial guild member

uncut kelp
#

Those resolve from the cache. I don't view it as an issue. I don't think it'd be a good idea to store those values on the class itself as it wouldn't be updated if edited by other means

spare fiber
#

well user may want to check member permissions only. but dont want to cache the member itself. with partial GuildMember you still able to check member permissions

urban belfry
spare fiber
#

did you mean like user created their message class?

#

Message class is private already, user cant even using it (especially on ts, in js still can use it 🀷 )

urban belfry
#

not at all, other message related events, and messages accessed by other stuff, like reactions

devout narwhal
#

Does anyone happen to know why this isn't working?

 Cannot destructure property 'options' of 'undefined' as it is undefined```
#

The error shows the first line in the image

#

Found a solution

gloomy kayak
devout narwhal
spare fiber
urban belfry
tropic karma
#

Hey any body have an idea how it works? Cant set the property by myself on PermissionsBitField.

#

i write in typescript, thats my error Property 'has' does not exist on type 'string | Readonly<PermissionsBitField>'. Property 'has' does not exist on type 'string'.ts(2339)

#

thats my code if (slashCommand.userPerms || slashCommand.botPerms) { if ( !interaction.member.permissions.has( PermissionsBitField.Flags[slashCommand.userPerms] || [] ) ) { const userPerms = new EmbedBuilder() .setDescription( `🚫 ${interaction.user}, You don't have \`${slashCommand.userPerms}\` permissions to use this command!` ) .setColor('Red') interaction.reply({ embeds: [userPerms] }) }

urban belfry
spare fiber
urban belfry
#

we're getting derailed, the point was that no, there's no point in duplicating data and storing it in multiple places, if you disabled the cache, it's gone, done

trail zinc
urban belfry
spare fiber
#

if you say that, isnt APIMember in interaction is also duplicating data?

urban belfry
nocturne kayak
#

why does this error still appear even with type guard?

urban belfry
urban belfry
#

yes i already answered you 🀨
use the inCachedGuild type guard
it'll make sure interaction.member is a GuildMember

nocturne kayak
urban belfry
#

could you send your entire listener up to that point then?

trail zinc
urban belfry
trail zinc
#

you can just put a type check

#

if(typeof (interaction.member.permissions) === "object") { /*do whatever*/ }

#

also

#

how do you use TextInputBuilder in a slash command ?

#

i mean what is it used for

hoary fox
trail zinc
#

oh

urban belfry
chilly zephyr
urban belfry
chilly zephyr
#

Yes

urban belfry
#

and you don't see what's wrong with that?
they're two separate distinct things

chilly zephyr
#

Ah I must've overlooked that, thank you. However;

// collector looks like this:
const collector = new InteractionCollector(client, { filter, time: 10000 /*180000*/, guild: interaction.guild, maxUsers: 1, max: 1, interactionType: InteractionResponseType.Modal });

// I listen like so
collector.on('end', i => {
    console.log("Ended. Custom ID:" + i.customId + ", user ID: " + i.user);
// Ended. Custom ID:undefined, user ID: undefined```
#

I'm trying to figure out why it's not triggering my collect event properly so I'm trying to get details from the end event but it's not exactly helping

plain roverBOT
urban belfry
#

look at the type, is i an interaction.. or a collection? or is it specifically a collection of interactions?

chilly zephyr
#

Ah, a collection of collected elements

foggy rover
#

modals included at v14?

novel ginkgo
#

When is discord.js v14 coming out?

tropic karma
#

@urban belfry I'm just getting started with typescript. I like it very much. Sometimes I don't understand the explanations though. English is also not my main language. I think I understand what inCacheGuild does, but I don't understand where to put it in my code. https://sourceb.in/eNUcYYxax0

urban belfry
tropic karma
urban belfry
#

brb hold on
during which you should change to using isChatInputCommand instead of isCommand for slashies specifically

urban belfry
#

@tropic karma so isCommand means the interaction is a Command interaction, as of right now there can be two types of command interactions, slash commands(referred to as chat input commands) and context menu commands
and if you want specifically slashies, isChatInputCommand, and there is one for context menus too

so that's why i recommend that
as for your issue, hover around the part where you access to .reply, the part of the error and see if the type is a ChatInputCommandInteraction<"cached"> or anything close because idr
if not you did something wrong and show me the code

#

and before all this, make sure you have the latest dev version of course and try restarting the ts server

haughty lava
#

please make this readable, received more errors

outer bane
#

shapeshift overides util.inspect, if you catch the error and log it it should tell you the wrong input

haughty lava
#

the difference between setFields and addFields??

outer bane
#

set replaces, add pushs

haughty lava
#

so which is best to use?

outer bane
#

depends on if you want to keep existing fields

haughty lava
#

hmmm

#

oh wait, i misread that 😳

#

this is correct then right?

outer bane
#

seeing as you got an error from validators it's probably not correct

haughty lava
#

what is wrong?

#

i don't get it, i checked the docs too

#

it sounds correct

outer bane
#

console.log the error, it's probably name or value being null which is not allowed

haughty lava
#

should it be undefined then>

outer bane
#

no, it has to be a string

haughty lava
#

i mean for no value

outer bane
#

fields always have both a name and a value

haughty lava
#

so it is a must to have a name?

#

then i found my error!

wicked tusk
uneven urchin
#

(or use the empty object solution ofc)

outer bane
uneven urchin
#

πŸ˜΅β€πŸ’«

wicked tusk
#

anyone in here knows how i can get the titel from a modal from interactionCreate into messageReationAdd?

outer bane
#

why don't you add all the information you need to the modal's customId? you have up to 100 chars which should be enough

gentle bane
#
let joiner = joinVoiceChannel({
                channelId: voiceChannel.id,
                guildId: voiceChannel.guild.id,
                adapterCreator: voiceChannel.guild.voiceAdapterCreator,
            });
```Type 'InternalDiscordGatewayAdapterCreator' is not assignable to type 'DiscordGatewayAdapterCreator'
#

??

#

isn't that fixed

regal mason
#

Is there a way to listen to a button interaction ? other than listening to interactionCreate and check the customId etc. I want a collector like messages and reactions collerctors etc.

plain roverBOT
regal mason
#

thx

scarlet tangle
#

when interactionCreate Modal Submit
can i read the modal name ?

regal mason
#

@velvet jasper The problem is that there's no way to create the collector on the reply of an command interaction

velvet jasper
#

In the future you won’t have to use fetchReply but for now that’s required

regal mason
#

In the reply options of the interaction ?

velvet jasper
#

Yes

regal mason
#

When I defer it ?

velvet jasper
#

When you follow up

regal mason
#

My use case is for editReply, that's the same ?

velvet jasper
#

I don’t think you need to fetchReply on edits

regal mason
#

Then, how I can listen to button interaction from edits ?

velvet jasper
#

Refer to the guide on interaction collectors

scarlet tangle
woeful pollen
#

you can get the customId

compact plover
#

Current version giving me TypeError:
Cannot destructure property 'components' of 'undefined' as it is undefined. at new ModalBuilder (/home/bots/QABot/node_modules/discord.js/src/structures/ModalBuilder.js:11:17)

Reverting to older version and works flawlessly again

compact plover
#

One second

compact plover
wicked tusk
#

why isn't this working anymore?

var CronJob = require('cron').CronJob;

 module.exports = async (client) => {


    client.on("ready", () => {
      
        const stringlength = 69;
        console.log("\n")
        console.log(`     ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.yellow)
        console.log(`     ┃ `.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.yellow)
        console.log(`     ┃ `.bold.yellow + `Discord Bot is online!`.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length-`Discord Bot is online!`.length)+ "┃".bold.yellow)
        console.log(`     ┃ `.bold.yellow + ` /--/ ${client.user.tag} /--/ `.bold.yellow+ " ".repeat(-1+stringlength-` ┃ `.length-` /--/ ${client.user.tag} /--/ `.length)+ "┃".bold.yellow)
        console.log(`     ┃ `.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.yellow)
        console.log(`     ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.yellow)
        console.log(` [ONLINE] `.yellow + `Logged in as: `.green + `${client.user.tag}`.yellow);
        let counter = 0;
        var job = new CronJob('0 * * * * *', function () {
            console.log(" [Status Update] :: ".bgCyan.red + String(counter).bgCyan.brightRed)
            switch(counter){
                case 0: {
                    try{client.user.setActivity(`www.kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 1: {
                    try{client.user.setActivity(`Best Bots | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 2: {
                    try{client.user.setActivity(`botlist.kooje.me - SOON`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 3: {
                    try{client.user.setActivity(`Best Bots of 2022`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 4: {
                    try{client.user.setActivity(`Over ${client.guilds.cache.reduce((a, b) => a + b?.memberCount, 0)} Members!`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 5: {
                    try{client.user.setActivity(`Best Bots on Discord | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 6: {
                    try{client.user.setActivity(`Order Today! | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter=0;
                }break;
                default: {
                    try{client.user.setActivity(`Free Bots | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter = 0;
                    counter++;
                }break;
            }
        }, null, true, 'Europe/Berlin');
        job.start();
    });

}
velvet jasper
scarlet tangle
#

when tf will v14 be out 😭

compact plover
idle galleon
#

It’s most likely not gonna be any time soon

knotty plover
#

Why does it need to be "out" if its usable now anyway

ripe scaffold
#
                        const otherText = new TextInputBuilder({
                            label: "IGN of punishing staff member",
                            customId: "other",
                            minLength: 3,
                            maxLength: 16,
                            required: true,
                            style: TextInputStyle.Short,
                        });

                        const otherRow = new ActionRowBuilder<TextInputBuilder>({components: [otherText]});

                        const otherModal = new ModalBuilder({
                            title: "Other Option",
                            customId: "ticketStaffOtherModal",
                            components: [otherRow] // error here
                        });
Type 'ActionRowBuilder<TextInputBuilder>' is not assignable to type 'ActionRow<TextInputComponent> | ActionRowData<TextInputComponentData>'.
  Type 'ActionRowBuilder<TextInputBuilder>' is missing the following properties from type 'ActionRow<TextInputComponent>': type, equals
#

ts error, works fine if i ignore it

#

internal issue?

knotty plover
#

Thats fair, but if we rush one that will compromise it's stability

knotty plover
cerulean bay
#

How would i do this with the new embeds from the latest version? message.embeds[0].setDescription()

#

As it's now an Embed() and don't have any function in it

velvet jasper
knotty plover
#

which one does

cerulean bay
knotty plover
#

the modal?

balmy sky
#

how do i use the new embeds

#
import { EmbedBuilder } from "discord.js";

export class JoewyEmbed extends EmbedBuilder {
  public constructor(timestamp?: boolean) {
    super();
    this.setColor("White");

    if (timestamp !== false) {
      this.setTimestamp();
    }
  }
}
velvet jasper
#

I’ll need to look at it later the code is pretty non-legible on mobile

balmy sky
#

ive got this class but but it is erroring

velvet jasper
#

Why are you extending the builder?

balmy sky
#

because i want it to set the color automatically

velvet jasper
#

Your constructor needs to be compatible with the constructor from the superclass

balmy sky
#

and uh

#

how would i go about doing that

velvet jasper
#

But in all honesty a factory function is simpler than extending the class

balmy sky
#

okk

balmy sky
velvet jasper
#

It’s the same as builder process as the old one

balmy sky
#

well no

#

the only method i see is the set color

velvet jasper
#

Try installing the latest builder dev

copper jetty
balmy sky
#

so how do i use text input?

woeful pollen
#

check channel pins

copper jetty
cerulean bay
#

Why can't i use [new ActionRowBuilder()] in <messageOption>.components ?

nocturne kayak
civic topaz
#

How to make the client status -> mobile phone if djs version is v14

spare fiber
#

same as you do in v13, nothing changed

main basin
#

Whats changed with intents in V14? its not allowing me to use the flags without throwing error, but then if i dont have the intents.flags its not define

main basin
wicked tusk
#
var CronJob = require('cron').CronJob;

 module.exports = async (client) => {


    client.on("ready", () => {
      
        const stringlength = 69;
        console.log("\n")
        console.log(`     ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.yellow)
        console.log(`     ┃ `.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.yellow)
        console.log(`     ┃ `.bold.yellow + `Discord Bot is online!`.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length-`Discord Bot is online!`.length)+ "┃".bold.yellow)
        console.log(`     ┃ `.bold.yellow + ` /--/ ${client.user.tag} /--/ `.bold.yellow+ " ".repeat(-1+stringlength-` ┃ `.length-` /--/ ${client.user.tag} /--/ `.length)+ "┃".bold.yellow)
        console.log(`     ┃ `.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.yellow)
        console.log(`     ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.yellow)
        console.log(` [ONLINE] `.yellow + `Logged in as: `.green + `${client.user.tag}`.yellow);
        let counter = 0;
        var job = new CronJob('0 * * * * *', function () {
            console.log(" [Status Update] :: ".bgCyan.red + String(counter).bgCyan.brightRed)
            switch(counter){
                case 0: {
                    try{client.user.setActivity(`www.kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 1: {
                    try{client.user.setActivity(`Best Bots | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 2: {
                    try{client.user.setActivity(`botlist.kooje.me - SOON`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 3: {
                    try{client.user.setActivity(`Best Bots of 2022`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 4: {
                    try{client.user.setActivity(`Over ${client.guilds.cache.reduce((a, b) => a + b?.memberCount, 0)} Members!`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 5: {
                    try{client.user.setActivity(`Best Bots on Discord | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter++;
                }break;
                case 6: {
                    try{client.user.setActivity(`Order Today! | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter=0;
                }break;
                default: {
                    try{client.user.setActivity(`Free Bots | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
                    counter = 0;
                    counter++;
                }break;
            }
        }, null, true, 'Europe/Berlin');
        job.start();
    });

}

why isn't this working anymore inv14??

wicked tusk
#

no error

#

just not working that's the problem

plain roverBOT
#

To help you we need more information:
β€’ What are you trying to do?
β€’ What is your code?
β€’ What errors and debug logs do you have?

scarlet tangle
#

does it log the other stuff btw

wicked tusk
#

i already have aka console.log(" [Status Update] :: ".bgCyan.red + String(counter).bgCyan.brightRed)
and it's logging but no status

#

client.user.setActivity(hi, {type: "PLAYING"})
anything wrong with that?

wicked tusk
#

what

brittle robin
#

client.user?.setActivity({name: 'hi', type: 'PLAYING'})

client.user?.setPresence({status: 'online', activities: [{name: 'asd', type: 'PLAYING'}]})

wicked tusk
#

why user? what's that supposed to mean?

brittle robin
scarlet tangle
#

how many max choices can a slash command have?

spare fiber
#

25 iirc

scarlet tangle
#

what?

tame gazelle
copper jetty
#

slash command can have 625 choices

lethal dagger
#

i had a zod error something along the lines of only 25 in array so i thought only 25 choices

tame gazelle
copper jetty
lethal dagger
#

wait

urban belfry
#

we know, there;s no need to confuse users, just say 25 per options that support it

lethal dagger
#

me are confusion

#

lemme process this

urban belfry
#

options like string options and the number options can support up to 25 choices

lethal dagger
#

choices are a choice in option only for strings and numbers

#

options are options in slash commadns

#

ohh

#

so slash commands can have 25 options and those options can have 25 choices so 625 choices for 1 slash command

#

am i right?

copper jetty
#

yes 25*25 is 625

lethal dagger
#

ah

tame gazelle
#

pins

#

didn't get

copper jetty
#

just;

undone yew
#

how to remove role from the member?

copper jetty
#

<GuildMember>.roles.remove()

undone yew
#

I'm using

const user = client.users.cache.get(message.author.id)
user.roles.remove(role)

but giving error

woeful pollen
#

roles are on members, not users

plain roverBOT
#

Despite sounding similar there is a distinct difference between users and members in Discord:
β€’ User: global discord user data (global avatar, username, tag, id)
β€’ GuildMember: user data associated to a guild (guild, nickname, roles, voice, guild avatar, etc.)
β€’ Conversion: User ➞ GuildMember | GuildMember ➞ User

woeful pollen
#

if you have the message already, why not use message.member directly?

woeful pollen
#

pass an empty object to the button builder constructor, it's a known issue

fresh geyser
#

can someone give me docs of v10 discord api

tame gazelle
#

isn't the only one that is documented?

fresh geyser
velvet jasper
woeful pollen
#

nothing really changed in v10 except message content intent is enforced to read message content

fresh geyser
velvet jasper
#

we didn't do anything special, bc v9 is almost identical to v10

fresh geyser
#

ok

fiery widget
#
            .addComponents(
                new SelectMenuBuilder()
                    .setCustomId('select')
                    .setPlaceholder('Nothing selected')
                    .setOptions([
                        {
                            label: 'Select me',
                            description: 'This is a description',
                            value: 'first_option',
                        },
                        {
                            label: 'You can select me too',
                            description: 'This is also a description',
                            value: 'second_option',
                        },
                    ]),
            )```
what's wrong?
scarlet tangle
fiery widget
#

they are different methods, addOptions doesnt work too

fiery widget
# tame gazelle <@489434117369364490> ^

it didn't work, that worked:const row = new ActionRowBuilder() .addComponents( new SelectMenuBuilder({ options: [ { label: 'Select me', description: 'This is a description', value: 'first_option', }, { label: 'You can select me too', description: 'This is also a description', value: 'second_option', } ] }) .setCustomId('select') .setPlaceholder('Nothing selected') ) but i dont really like this solution

fiery widget
# tame gazelle <@489434117369364490> ^

tried that before:

            .addComponents(
                new SelectMenuBuilder({})
                .setCustomId('select')
                .setPlaceholder('Nothing selected')
.setOptions([
                        {
                            label: 'Select me',
                            description: 'This is a description',
                            value: 'first_option',
                        },
                        {
                            label: 'You can select me too',
                            description: 'This is also a description',
                            value: 'second_option',
                        },
                    ]),
            )```
#

may i need to use addOptions instead?

tame gazelle
#

new SelectMenuBuilder({})
.setOptions(…)

#

ah wait

fiery widget
#

typeError: Cannot read properties of undefined (reading 'map')

tame gazelle
#

I dunno how to solve that sorry

woeful pollen
#

setOptions takes a rest parameter

fiery widget
#

wdym?

woeful pollen
#

.setOptions({ ... }, { ... })

fiery widget
#

oh i see, thanks!

split fulcrum
#

What's the latest dev version??

tame gazelle
#

check the npm page

nocturne kayak
#

seem like the rateLimit or informational event in general isnt there anymore?
what was it replaced with in v14?

woeful pollen
split fulcrum
#

Any bugs in that version??? Or is it fine

tame gazelle
#

dev version = has bugs

scarlet tangle
split fulcrum
#

Ik ik

#

But like any big bugs??

woeful pollen
#

yeah there is currently a known bug, and its always gonna have bugs, its not any near to ready

scarlet tangle
split fulcrum
#

Ok

fiery widget
#

what should i pass here?

                            label: 'You can select me too',
                            description: 'This is also a description',
                            value: 'second_option',
                            emoji: 'πŸš—'
                        }```
#

instead of the emoji string

#

got this error: ValidationError: Expected a string primitive

#

emoji: { name: ':red_car:' } doesnt work too

acoustic temple
#

What is this error?

TypeError: makeURLSearchParams is not a function
fluid summit
#

I'm trying to updated channel creation for djs v14. I've updated permissionOverwrites from Permissions.FLAGS.VIEW_CHANNEL to ViewChannel, but it looks like I still need to update the type. Are we only allowed to use the API integers now? I believe this int should be 0 based on the API docs.

const newChannelId = (await guild.channels.create('new-channel', {
        reason: 'new channel',
        type: 'GUILD_TEXT',
        position: 0,
        permissionOverwrites: [
          { type: 'role', id: guild.roles.everyone, deny: ['ViewChannel'] },
        ],
      }).catch(console.error)).id;
uncut kelp
woeful pollen
acoustic temple
uncut kelp
#

Re-read the message you replied to

acoustic temple
#

I didn't understand

#

hum, I"ll check

#

@uncut kelp Version ^14.0.0-dev.1649808570-01a423d

#

Can I update this by npm i discord.js@dev?

uncut kelp
#

You need to install @discordjs/rest's development version

#

It has the @dev tag like discord.js

acoustic temple
#

So I use npm i discordjs/rest@dev?

fluid summit
woeful pollen
#

ChannelType.GuildText, it's an enum from discord-api-types

fluid summit
#

Thank you. I appreciate the guidance

frigid sleet
#

How can I check if the user executing a slash command has a specific permission, like the ManegeMessage Permsission

tame gazelle
frigid sleet
#

Thank you

brisk path
#

Are there any advantages of using the EnumResolvers rather than just importing them from discord-api-types

outer bane
#

no, it's meant as a way to resolve strings while transitioning, enums should be the preferred method

#

all enums are re-exported from d.js btw, no need to import from dapi-types

fluid summit
#

What am I doing wrong with the footer attachment here? My thumbnail embed works out fine.

 const thumbnail = new MessageAttachment('./assets/gn.png', 'gn.png');
 const footerImage = new MessageAttachment('./assets/gm.png', 'gm.png');
 const helpEmbed = new EmbedBuilder()
      .setThumbnail(`attachment://${thumbnail.name}`)
      .setFooter({ text: 'gm', iconURL: `attachment://${footerImage.name}` });
 return interaction.reply({
      embeds: [helpEmbed],
      files: [footerImage, thumbnail],
 });
tame gazelle
#

try footerImage.url

fluid summit
# tame gazelle try `footerImage.url`

Thanks! Can you suggest how I could look this up on my own? I feel like I’m asking dumb questions that I should be able to discover on my own. πŸ™πŸΌ

outer bane
#

that is from a 3rd party lib, not d.js

bright rampart
#

how do I check if a message was sent in a server by anyone, anywhere

fluid summit
#

So footers no longer accept attachments? footerImage.url returns undefined

tame gazelle
outer bane
#

use <Message>.guildId

outer bane
fluid summit
bright rampart
tame gazelle
fiery widget
#

Hey, trying to create a channel with permissions, trying to do that gives me an error: permissionOverwrites: [ { allow: 'VIEW_CHANNEL', id: interaction.user.id }, ]
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: VIEW_CHANNEL.

fiery widget
#

thanks!

median junco
#

How do I get the customid from a ButtonBuilder

tame gazelle
fluid summit
median junco
frigid sleet
#
    client.user.setPresence({ activities: [{ name: '/help',type: 'WATCHING' }], status: 'online' }); 

Can someone tell me why this no longer works in v14? Or am I doing something wrong?

woeful pollen
#

use the ActivityType enum instead of WATCHING

frigid sleet
#

ah thanks

wicked tusk
#

https://srcb.in/G2NMujPXOp

node:events:368
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of undefined (reading 'filter')
    at Client.<anonymous> (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\others\status_role_system.js:38:39)Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:251:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21)
#

it's not working anymore in v14

outer bane
wicked tusk
outer bane
#

log the error, find out why it fails

wicked tusk
#

so console.log(aM)

outer bane
#

aM is undefined

#

no need to log it

wicked tusk
#

then log what

outer bane
#

the error you get in line 36. currently you do catch(() => {}) which just ignores the error and returns undefined

wicked tusk
#

yes so i do console.log() and log what?

outer bane
#

catch gets called with the error as the first argument

wicked tusk
#

i don't understand anything you are saying me sir, so log what? like it has to be an error with fetching but am i suppose to log? the guild?

plain roverBOT
#

<:_:957801942573256854> Promise.prototype.catch()
The catch() method returns a Promise and deals with rejected cases only. It behaves the same as calling Promise.prototype.then(undefined, onRejected) (in fact, calling obj.catch(onRejected) internally calls obj.then(undefined, onRejected)). This means that you have to provide an onRejected function even if you want to fall back to an undefined result value - for example obj.catch(() => {}).

wicked tusk
#

ah so i catch it and do
console.log(error)

outer bane
#

yes

wicked tusk
#

like this?

outer bane
#

that would work, yes

wicked tusk
# outer bane that would work, yes

Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
at Timeout._onTimeout (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\managers\GuildMemberManager.js:462:16)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
[Symbol(code)]: 'GUILD_MEMBERS_TIMEOUT'
}

outer bane
#

do you have the GuildMembers intent?

wicked tusk
#

nope i i think it's fixxed now

plain roverBOT
#

<:_:957801942573256854> Promise.prototype.catch()
The catch() method returns a Promise and deals with rejected cases only. It behaves the same as calling Promise.prototype.then(undefined, onRejected) (in fact, calling obj.catch(onRejected) internally calls obj.then(undefined, onRejected)). This means that you have to provide an onRejected function even if you want to fall back to an undefined result value - for example obj.catch(() => {}).

fiery widget
woeful pollen
#

you need the MessageContent intent

fiery widget
#

and btw, for some reason after changing the version to v14, the bot status doesnt work anymore, is there a new syntax?

bright rampart
#

Yea

woeful pollen
fiery widget
#

client.user.setPresence({ activities: [{ name: 'with discord.js' }] });

#

(from v13)

bright rampart
#

Type not set?

fiery widget
#
``` doesnt work too
woeful pollen
#

use the ActivityType enum

fiery widget
#

still xD client.user.setPresence({ activities: [{ name: 'with discord.js', type: ActivityType.Watching }] });

fiery widget
urban belfry
#

guild presences

#

but not for setting, for receiving

fiery widget
#

oh i see

#

well setActivity works but setPresence doesnt

urban belfry
#

show your code, are you using both at the same time?

fiery widget
#
//client.user.setActivity(`sdgsdf`,ActivityType.Watching )```
urban belfry
#

how'd activities turn into activity?

fiery widget
#

mb

urban belfry
#

which one do you have?

fiery widget
#

activities

#

tried to change the status with the same setPresence method too and it didnt work

tame gazelle
#

works fine for me

fiery widget
#

is it possible to use this with a bot?

#

The custom status, and the buttons.

woeful pollen
#

bots cant have a custom status

wicked tusk
cerulean bay
#

But fetching a user informations could return a Custom ActivityType

scarlet tangle
#

Can someone help me with this error?

Code:

const Option1 = new Discord.SelectMenuOptionBuilder().setLabel('s0').setValue('s0').setEmoji("πŸ€–")
            const SelectMenu = new SelectMenuBuilder().setCustomId('setup-menu').setMinValues(1).setMaxValues(data.length).setOptions(Option1);

Error:

Error: Received one or more errors
    at ObjectValidator.handleStrictStrategy (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@sapphire\shapeshift\dist\index.js:998:70)
    at ObjectValidator.handleStrategy (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@sapphire\shapeshift\dist\index.js:910:47)
    at ObjectValidator.handle (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@sapphire\shapeshift\dist\index.js:951:17)
    at ObjectValidator.parse (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@sapphire\shapeshift\dist\index.js:114:88)
    at SelectMenuOptionBuilder.setEmoji (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@discordjs\builders\dist\index.js:867:42)
    at SelectMenuOptionBuilder.setEmoji (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\SelectMenuOptionBuilder.js:18:20)
    at Client.<anonymous> (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\ismm.js:478:97)
copper jetty
#

setEmoji takes an object

scarlet tangle
copper jetty
#

{ name: "" }

scarlet tangle
#

oh

scarlet tangle
civic topaz
#

why discord.js need to make many not useful changes?

copper jetty
knotty plover
woeful pollen
regal mason
#

What this error means ?

knotty plover
#

you have not provided an error

proven forge
spare fiber
#

pass {} to constructor for temporary fix

proven forge
spare fiber
#

show how you do it

proven forge
spare fiber
#

ButtonBuilder({})

knotty plover
#

Different error

proven forge
#

a

knotty plover
#

Do what KagChi showed

proven forge
#

It worked

#

thanks

empty tapir
#

What are these errors?

knotty plover
#

What's your TS version?

urban belfry
#

@empty tapir what mon asked
and show us the versions of discord-api-types adn djs

empty tapir
urban belfry
#

yea

urban belfry
empty tapir
#

I'm not at the computer now, then I'll throw it off.

woeful pollen
#

English

shy birch
#

Good morning, will there be a "collector" for modals without using events?

#

Sorry I still haven't slept just taking RedBull

woeful pollen
#

probably there will be

shy birch
#

Do you have any idea how it will work?

#

.createModalCollector?

#

Something like that?

plain roverBOT
shy birch
#

Ok

#

Thank you very much, it really helped a lot

shy birch
#

how do i do it now?

woeful pollen
#

use the ChannelType enum from discord-api-types

fiery widget
#

Hey, is it possible to force the user to stay on a modal and complete the inputs?
and is it possible to close the modal if the awaitModalSubmit event finished without any interaction?
code:

            interaction.awaitModalSubmit({ filter, time: 15000 })
                .then(interaction => console.log(interaction))
                .catch(console.error)```
shy birch
#

don't have it on discord.js? Do I have to install discord-api-types?

#

@woeful pollen

woeful pollen
#

discord-api-types is already installed with discord.js

woeful pollen
fiery widget
woeful pollen
#

catch the error and respond with time exceeded or something

fiery widget
#

oh sounds good, a new modal will replace the current?

shy birch
#

When I created the category the permissions were not placed

woeful pollen
fiery widget
woeful pollen
#

just catch the error and send a message in the channel that the time exceeded

fiery widget
#

oh oke thanks!

#

and is it possible to make showModal works after a reply already sent? like editReply works?

woeful pollen
#

nope, showModal is an initial response

shy birch
woeful pollen
shy birch
#

Ok

fiery widget
#

hey, is it possible to check if an interaction already replied? or catch the "already replied" error?

#

and is it possible to receive the modal inputs fields as an array or convert the map to an array instead of using the getTextInputValue func?

plain roverBOT
fiery widget
#

yeah mb just did what i wanted, didnt notice the replied bool before.
thanks!

plain roverBOT
nocturne kayak
#

it'll be a collection @fiery widget ^

shy birch
#

πŸ˜„

fiery widget
nocturne kayak
#

interaction.fields.toJSON()
or Array.from(interaction.fields.values())

tame gazelle
#

it's interaction.fields.fields

#

ModalSubmitInteraction.fields => ModalSubmitFieldsResolver
ModalSubmitFieldsResolver.fields => Collection

nocturne kayak
#

well i just fixed what he tried to convert coll to arr

fiery widget
#

interaction.fields.fields.toJSON() worked, thanks!

empty tapir
urban belfry
#

that's all, you didn't install discord-api-types?

empty tapir
#

no

spare fiber
#

try install it then

urban belfry
#

nah, reinstall djs

shy birch
#

@woeful pollen

woeful pollen
#

pass an empty object to the constructor of ButtonBuilder, it's a current known bug

#

so new ButtonBuilder({})

empty tapir
#

the same

shy birch
#

ok, this occurs with all?

#

@woeful pollen

woeful pollen
#

most of the builders, yes

shy birch
#

got it, thanks, I'm enjoying playing with this version, I was very excited

chilly zephyr
#

The collect event never gets triggered

const modal = new ModalBuilder().setCustomId("profileEditor").setTitle("Profile Editor");
// add some components here, then show the modal with await interaction.showModal(modal)

const filter = (modalInteraction) => modalInteraction.customId === "profileEditor";
const collector = new InteractionCollector(client, { filter, time: 3000, guild: interaction.guild, maxUsers: 1, interactionType: InteractionResponseType.Modal });

// this never gets triggered
collector.on('collect', i => {
    console.log(i.fields.fields);
});```
nocturne kayak
#

you sure you replied within 3s as specified?

chilly zephyr
#

Submitting the modal you mean? Yes

#

I tried it with 3 minutes as well, same result

nocturne kayak
#

try supplying less coll option and recheck

chilly zephyr
#

Sorry could you rephrase that please?

#

<Interaction>.fields.fields.toJSON() returned [] as well

split fulcrum
chilly zephyr
#

NekoNod It returned nothing

split fulcrum
#

what are you trying to get? the embed fields?

chilly zephyr
#

Any data to try and get the collection event to trigger

#

It's returning nothing in the end event so I'm trying to figure out why it's not working

split fulcrum
#

show me your code

chilly zephyr
#

[removed code snippet]

split fulcrum
#

Hmm

chilly zephyr
#

Had to strip some stuff cause of the char limit but most of the code in between are unrelated to DJS anyways

split fulcrum
#

if you try to get the data from the collector

#

try console.log(collector)

#

see what you get

median junco
#

I'm trying to create a simple select menu but i get this error:

  constructor({ options, ...data }) {
                ^
TypeError: Cannot destructure property 'options' of 'undefined' as it is undefined.
    at new SelectMenuBuilder (P:\Discord\voting-bot\node_modules\discord.js\src\structures\SelectMenuBuilder.js:12:17)
    at PollCommand.<anonymous> (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:120:35)
    at step (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:48:23)
    at Object.next (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:29:53)
    at P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:23:71
    at new Promise (<anonymous>)
    at __awaiter (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:19:12)
    at PollCommand.closePoll (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:189:16)
    at PollCommand.<anonymous> (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:60:22)
    at step (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:48:23)
    at Object.next (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:29:53)
    at P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:23:71
    at new Promise (<anonymous>)
    at __awaiter (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:19:12)
    at PollCommand.execute (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:91:16)
    at CommandRegistry.<anonymous> (P:\Discord\voting-bot\src\bot\command\CommandRegistry.ts:33:21)

CODE:

        const secondOption = new SelectMenuOptionBuilder().setLabel('Option 2').setValue('two')

        const selectMenuBuilder = new SelectMenuBuilder().setCustomId('testMenu').setMinValues(1).setMaxValues(1).setOptions(firstOption, secondOption)

        // @ts-ignore
        await command.reply({components: [selectMenuBuilder]})
nocturne kayak
#

you cant pass a selectmenu directly to message payload without it being in an actionrow
about your q, it's a known bug. temp fix is to pass an empty obj to the constructor (like SelectMenuBuilder({}))

split fulcrum
forest elm
split fulcrum
#

ahh yea ^^^^

chilly zephyr
#

Oh wow that seemed to have fixed it

#

Thanks a lot you two this has been bothering me for a while now KEK

median junco
# nocturne kayak you cant pass a selectmenu directly to message payload without it being in an ac...

i added the action row and the empty object but i get another error: ```
P:\Discord\voting-bot\node_modules\discord.js\src\structures\SelectMenuBuilder.js:15
options: options.map(({ emoji, ...option }) => ({
^
TypeError: Cannot read properties of undefined (reading 'map')
at new SelectMenuBuilder (P:\Discord\voting-bot\node_modules\discord.js\src\structures\SelectMenuBuilder.js:15:26)
at PollCommand.<anonymous> (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:122:35)
at step (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:48:23)
at Object.next (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:29:53)
at P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:23:71
at new Promise (<anonymous>)
at __awaiter (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:19:12)
at PollCommand.closePoll (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:189:16)
at PollCommand.<anonymous> (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:61:22)
at step (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:48:23)
at Object.next (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:29:53)
at P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:23:71
at new Promise (<anonymous>)
at __awaiter (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:19:12)
at PollCommand.execute (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:91:16)
at CommandRegistry.<anonymous> (P:\Discord\voting-bot\src\bot\command\CommandRegistry.ts:33:21)

median junco
split fulcrum
#

what does the manager do?? i just get undefined when i call it

forest elm
#

what manager

plain roverBOT
forest elm
#

this?

split fulcrum
#

yea

#

Btw is this a discord error?

forest elm
#

update @discordjs/rest

split fulcrum
#

ahh

#

ok

amber sleet
#

Why event in my eventHandler is not a function

urban belfry
amber sleet
urban belfry
#

clearly not

#

you know what, do this
right before that line

if(typeof event !=== "function") console.log(dir, file) 
```if it's not a function, log the file path
urban belfry
#

the line that errors of course

amber sleet
#

Nothing show in console @urban belfry

urban belfry
#

and it still errors?

amber sleet
void abyss
#

Hi how can I get message id of response message from modal interaction?

scarlet tangle
#

Error

 DiscordAPIError[50035]: Invalid Form Body
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required

Code

let page = 0
// a button to paginate forward in a array of embeds
page = page + 1 < embedslist.length ? ++i : 0;
                                    message.edit({
                                        embeds: [embedslist[page]]
                                    });
// a button to paginate backward in a array of embeds
page = page > 0 ? --page : embedslist.length - 1;
                                    message.edit({
                                        embeds: [embedslist[page]]
                                    });
copper jetty
#

what is embedslist

scarlet tangle
#

a array containing embeds

new Embed().setTitle(`Total Whitelisted Users : ${data.whitelist.length}`).setDescription(`${temporary.map(e => `\`${nom++}\` | ${ctx.interaction.guild.members.cache.get(e).user.tag} | <@${e}>`).join("\n")}`).setColor(0x2F3136)
``` contains this
copper jetty
#

you can't construct Embed unless you use old dev version

nocturne kayak
#

gotta use EmbedBuilder

sharp pine
#

Why do i get that error?

median junco
#

which error?

sharp pine
median junco
#

code?

copper jetty
sharp pine
#
const { ApplicationCommandType } = require('discord.js');
const { Modal, TextInputComponent, showModal } = require('discord-modals');

module.exports = {
    name: 'redeem',
    description: "Redeem your license key!",
    type: ApplicationCommandType.ChatInput,
    cooldown: 3000,
    run: async (client, interaction) => {

        const modal = new Modal()
        .setCustomId('redeem-key')
        .setTitle('Reedeming - License Key')
        .addComponents(
          new TextInputComponent()
          .setCustomId('redeem-input-key')
          .setLabel('Some text Here')
          .setStyle('SHORT')
          .setMinLength(4)
          .setMaxLength(10)
          .setPlaceholder('Insert license key here')
          .setRequired(true)
        );


        showModal(modal, {
      client: client, // Client to show the Modal through the Discord API.
      interaction: interaction // Show the modal with interaction data.
    })
    }
};
copper jetty
sharp pine
sharp pine
#

which type do i need to use?

#

@copper jetty i get this

copper jetty
sharp pine
wicked tusk
#

how is Collection named in v14?

spare fiber
#

same as v13?

wicked tusk
#

no?

spare fiber
#

r u sure

copper jetty
wicked tusk
#

where can i see the new names like MessageEmebed is now EmbedBuilder ?

copper jetty
wicked tusk
#

let messageCollection = new Discord.Collection();
TypeError: Cannot read properties of undefined (reading 'Collection')

#

so it's not same

wicked tusk
#

const { Discord, ButtonBuilder, SelectMenuBuilder, ActionRowBuilder, TextInputBuilder, EmbedBuilder, ButtonStyle, Collection } = require('discord.js');

wicked tusk
#

if i only do Collection same error comes

copper jetty
spare fiber
#

there are no exports named Discord lol

wicked tusk
#

only discord or what

spare fiber
#

Collection still Collection

#

did you mean const Discord instead const { Discord }

wicked tusk
#

where is the difference

spare fiber
#

const Discord means you import all module, const { Discord } means you only destructure Discord export. but there are no exports named Discord

wicked tusk
#

so i just do const Discord and then do Discord.Collection right?

spare fiber
#

yup

#

if you have any destructure, const Discord, { Client }

#

as i see in your code. you already imported Collection. why dont use it instead?

wicked tusk
#

i tryed it but idk the error came so i just use Discord.Collection now it's kinda ugly then but at least it's working

#
        var user;
        try {
          user = await GetBot(message, args);
        } catch (e) {
          return message.reply("ERROR: " + e);
        }
        if (!user || !user.id)
          return message.reply(
            "![crossred](https://cdn.discordapp.com/emojis/939238440359321600.webp?size=128 "crossred") Did not find the BOT ... ERROR | Usage: `,invite @Bot` / `,invite BOT NAME` / `,invite BOT ID`"
          );
        message.reply({
          embeds: [
            new Discord.EmbedBuilder()
              .setColor(client.config.color)
              .setTitle(`Invite link for: ${user.tag}`)
              .setThumbnail(user.displayAvatarURL())
              .setDescription(`πŸ“― Invite link:\n
              > [Click here](https://discord.com/oauth2/authorize?client_id=${user.id}&scope=bot&permissions=8)`),
          ],
        });
      }

CombinedError: Received one or more errors
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:1471:23)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:114:88)
at EmbedBuilder.setFooter (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@discordjs\builders\dist\index.js:264:25)
at Client.<anonymous> (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\commands.js:7229:16)
at Client.emit (node:events:402:35)
at MessageCreateAction.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:251:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
errors: [
ExpectedValidationError: Expected values to be equals
at LiteralValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:675:76)
at LiteralValidator.run (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:103:23)
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:1466:32)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:114:88)
at EmbedBuilder.setFooter (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@discordjs\builders\dist\index.js:264:25)
at Client.<anonymous> (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\commands.js:7229:16)
at Client.emit (node:events:402:35)
at MessageCreateAction.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31) {
validator: 's.literal(V)',
given: undefined,
expected: null
},
ValidationError: Expected a string primitive

#

what in jesus name

#

is it because the footer?

copper jetty
#

this error isnt referring to this code

wicked tusk
#

this erros shows up when i try this command

#

yes it was because of the footer

#

but i didn't send the full code so yea

#

my bad

scarlet tangle
#

Typeerror : cannot read property isChatInputCommand of undefined

sharp pine
copper jetty
sharp pine
#
const { ApplicationCommandType, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');

module.exports = {
    name: 'redeem',
    description: "Redeem your license key!",
    type: ApplicationCommandType.ChatInput,
    cooldown: 3000,
    run: async (client, interaction) => {
        const modal = new ModalBuilder()
            .setCustomId('redeem')
            .setTitle('Redeeming - License Key');

            const favoriteColorInput = new TextInputBuilder()
            .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 TextInputBuilder()
            .setCustomId('hobbiesInput')
            .setLabel("What's some of your favorite 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 ActionRowBuilder().addComponents(favoriteColorInput);
        const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);

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

        await interaction.showModal(modal);
    }
};
scarlet tangle
sharp pine
#

it was called like that, but i renamed it to redeem.js

scarlet tangle
copper jetty
copper jetty
plain roverBOT
#

The order of function parameters must match between definition and function call.

function execute(client, message, args) { ... };
execute(message, client, args);

β€’ mismatch! you pass a Message where the client is expected
β€’ mismatch! you pass the Client where a Message is expected

brittle robin
#

perhaps ^
@scarlet tangle

scarlet tangle
sharp pine
#

@copper jetty

#

i get that error when launching my bot

#

(intents)

scarlet tangle
#

Code:

i.update({ components: i.message.components.map(f => {
                    if(f.components.find(s => s.customId === "claim_ticket")) {
                        return { ...f, components: f.components.map(s => {
                            if(s.customId === "claim_ticket") return new Discord.ButtonBuilder(s).setDisabled(true).setLabel(`Ticket Claimed`)
                            return s
                        })}
                    }
                    return f
                    })
                })

Error:

Error: Cannot properly serialize component type: undefined
    at createComponentBuilder (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@discordjs\builders\dist\index.js:511:13)
    at c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@discordjs\builders\dist\index.js:524:46
    at Array.map (<anonymous>)
    at new ActionRowBuilder (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@discordjs\builders\dist\index.js:524:35)
    at new ActionRowBuilder (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\ActionRowBuilder.js:12:5)
    at c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\MessagePayload.js:135:84
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\MessagePayload.js:135:49)
    at ButtonInteraction.update (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:222:56)
    at Client.<anonymous> (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\ismm.js:623:25)

What's the problem guys?

outer bane
#

the problem is that you try to send an action row object (not a class instance) with received components inside. there was a pr to allow builders in such a case but received components need to be inside an actionrow

wicked tusk
#

Where can I see the new names in v14 like EmbedBuilder() and stuff like that

outer bane
#

should be in the preview updating guide which is pinned here

copper jetty
#

just add Builder at the end to builders

scarlet tangle
outer bane
#

that should work

sharp pine
#

@copper jetty i keep on getting this

outer bane
#

known bug, pass {} to builder constructors

sharp pine
outer bane
#

ModalBuilder in your case

#

you can see it in the stacktrace

sharp pine
#

alr did

outer bane
#

new ModalBuilder()

#

where do you pass {} to it?

sharp pine
outer bane
#

how would you pass it when importing it?

sharp pine
#

now i get this, am i doing something wrong?

woeful pollen
#

it was correct before you removed the parentheses

#

you just had to pass an empty object to the constructor

sharp pine
#

like this?

slow storm
sharp pine
#

no it is just a weird way to call it, since i am an og v12 coder and never did v13/14

slow storm
slow storm
sharp pine
#

not my fault that there is an bug i am not aware of, does not mean i need basic js knowledge

sharp pine
slow storm
sharp pine
#

if i say this; je moet het gene tussen de haakjes aanpassen aan de functie / object zelf die je oproept

#

do you understand it then? cause function / object is an international word, that's how my brain functions when it comes to explanations in english

copper jetty
#

object is {} <--- this

sharp pine
#

how would i react to the same message and open the modal? (to prevent Interaction has already been acknowledged.)

vague coyote
#

you can only either reply or open modal, not both, or at least you cant open the modal after replying

sharp pine
#

How would i prevent the message, Application did not respond?

vague coyote
#

well, reply to the interaction

#

opening a modal is a kind of reply

sharp pine
#

true, but i want for example that it replies: In progress… then it opens the modal

vague coyote
#

that is not possible

#

the user doesnt really see messages anyway when you open the modal

sharp pine
#

is there an option to add a button to the private interaction, when he clicks one open the modal, otherones kills the interaction, and from there retrieve data and maybe edit the alr sended interaction?

amber sleet
#
DiscordAPIError[50035]: Invalid Form Body
data.components[BASE_TYPE_REQUIRED]: This field is required
data.custom_id[BASE_TYPE_REQUIRED]: This field is required
data.title[BASE_TYPE_REQUIRED]: This field is required
    at SequentialHandler.runRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:488:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:201:11)
    at async ChatInputCommandInteraction.showModal (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
    at async Object.execute (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\commands\configuration\set.ts:105:4)
    at async exports.default (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\events\basic\interactionCreate.ts:18:4) {
  rawError: {
    code: 50035,
    errors: { data: [Object] },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'post',
  url: 'https://discord.com/api/v10/interactions/964976235803463761/aW50ZXJhY3Rpb246OTY0OTc2MjM1ODAzNDYzNzYxOjBFbW13aVlOSGtjN1I5OXpKOXVCZlppbE9hUVo5UERicW1lYWN5d2hjMFdXSGRiVUFpMTFUQkRMcnZxOWNZdjlsVXlnM2NSQmI1cFRieVQyeFRVU2hNVG5CbzFPZHBIQkhsbms3allVZ3dGZnZUdTRpRWNZZExGV09FMkhpSERx/callback',
  requestBody: { files: undefined, json: { type: 9, data: [Object] } }
}

Someone knows what to change / add because I don't know literally why it doesn't work

forest elm
#

whats modal.execute()

amber sleet
#

Current code @forest elm

forest elm
#

you arent using the latest dev version

#

update

#

youll need to pass an empty object to the ModalBuilder constructor because of a bug once you update

main basin
#

Hello, ive read the docs 5 times now, and it mentions nothing about a change to "MANAGE_MESSAGES" Does anyone know what could be causing this?

forest elm
#

its ManageMessages

main basin
#

Let me change them all rq see if that fixes all

forest elm
#

all permissions are pascal case

amber sleet
forest elm
#

ok, and how did it go

tame gazelle
amber sleet
#

Aaa wait

tame gazelle
#

nice thanks

#

any updates?

forest elm
#

did you make an issue for it on github?

tame gazelle
#

they said they’ll do ._.

uncut kelp
#

"I would make" is an encouragement for you to do it

rapid umbra
#

Hi, Is it possible to make the user upload an image in an input model?

vague coyote
#

no

fluid summit
#

Is anyone else seeing when clicking on the slash command response? Seems to only happen when a slash command is used to initiate a modal. Seems more likely to be an issue on the Discord API side.

uncut kelp
#

Nothing in the Discord client is related to discord.js

hardy wind
#

Hi guys
With the latest few Discord.js developer releases I am receiving errors about emojis when attempting to create buttons using the button builder.
I'm not able to get the full error right now but will post it as soon as possible.

fluid summit
tame gazelle
#
TypeError: Cannot read properties of undefined (reading 'map')
    at new SelectMenuBuilder (/root/ObitoInteractions/node_modules/discord.js/src/structures/SelectMenuBuilder.js:15:26)
    at Object.execute (/root/ObitoInteractions/commands/context-menus/Social.js:22:5)
    at Object.execute (/root/ObitoInteractions/events/interactionCreate.js:56:31)
    at Client.<anonymous> (/root/ObitoInteractions/Structure/Client.js:48:37)
    at Client.emit (node:events:526:28)
    at InteractionCreateAction.handle (/root/ObitoInteractions/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12)
    at Object.module.exports [as INTERACTION_CREATE] (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketShard.js:304:10)

Social.js:22:5 => new SelectMenuBuilder({})

outer bane
#

{ options: [] }

tame gazelle
#

thanks

amber sleet
#

Can you help me beacuse I have still problem with modalBuilder even though I gave an empty object to the modalBuilder constructor

Error:

DiscordAPIError[50035]: Invalid Form Body
data.components[BASE_TYPE_REQUIRED]: This field is required
data.custom_id[BASE_TYPE_REQUIRED]: This field is required
data.title[BASE_TYPE_REQUIRED]: This field is required
    at SequentialHandler.runRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:488:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:201:11)
    at async ChatInputCommandInteraction.showModal (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
    at async Object.execute (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\commands\configuration\set.ts:105:4)
    at async exports.default (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\events\basic\interactionCreate.ts:18:4) {
  rawError: {
    code: 50035,
    errors: { data: [Object] },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'post',
  url: 'https://discord.com/api/v10/interactions/965007997573148722/aW50ZXJhY3Rpb246OTY1MDA3OTk3NTczMTQ4NzIyOlFYbkVUc3M3bGdUQ2tRcUZrTW1wS3FYZ3EzYzRYYkhJWGxYYk9rQVQ5RGI0V2o5UU91Tm00b2d6Vkpna3NDRnI3R1hsWVpNbVY0U1ZLMGpNR3h0SDVxTWVmWnk2VmdadERJUnJncXh3MFZQWXl2V2wyeko2cEExcmpCQU1TbHBh/callback',
  requestBody: { files: undefined, json: { type: 9, data: [Object] } }
}```

**`Version:`**
discord.js: 14.0.0-dev.1649937833-b01f414
@discordjs/builders 0.13.0-dev.1649937819-b01f414

**`Code:`**
#
        } else if (subCommand === 'reklama') {
            const modal = new ModalBuilder()
            .setCustomId('setAdModal')
            .setTitle('Ustaw reklamΔ™')
            const modal2 = new TextInputBuilder()
            .setCustomId('adContentModal')
            .setLabel('TreΕ›Δ‡ reklamy')
            .setStyle(TextInputStyle.Paragraph);
            const firstActionRow = new ActionRowBuilder().addComponents(modal2);
            modal.addComponents(firstActionRow);
            await interaction.showModal(modal);
        }
    },
} as Command;
amber sleet
knotty plover
#

I misread nvm

#

You also need to put MessageContent intent in your Client

fluid summit
knotty plover
#

Enabling in the dev portal does nothing if you dont request it in your code

#

Yeah its a separate intent

knotty plover
#

This isnt that error

fluid summit
#

I think it's a current issue

#

Making this change worked for me

knotty plover
#

Is that interaction.showModal definitely line 105 of your command

#

Its a bug with Buttons, not modals to my knowledge

#

Yes I'm completely positive

knotty plover
#

No it does not cover that

fluid summit
knotty plover
#

Unverified bots in fewer than 75 servers are not affected at all.
Not actually true, there's just no restrictions applied to enabling the intent. Same as they did with Guild Members

amber sleet
# fluid summit Have you tried it? I believe it should work

Ohh error

data.components[BASE_TYPE_REQUIRED]: This field is required
data.custom_id[BASE_TYPE_REQUIRED]: This field is required
data.title[BASE_TYPE_REQUIRED]: This field is required
    at SequentialHandler.runRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:488:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:201:11)
    at async ChatInputCommandInteraction.showModal (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
    at async Object.execute (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\commands\configuration\set.ts:105:4)
    at async exports.default (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\events\basic\interactionCreate.ts:18:4) {
  rawError: {
    code: 50035,
    errors: { data: [Object] },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'post',
  url: 'https://discord.com/api/v10/interactions/965015305615183892/aW50ZXJhY3Rpb246OTY1MDE1MzA1NjE1MTgzODkyOk53cnB0QzMyQlNCc282QlNpNmxTYjVkbW9SRGsyNjVLaXhGWGFrMThvb2NhUWNucVBYM1ZYU3FjTUFsUzRROGk2TGNCbzNIYUt5Mk9xNmpHNFIzYXZpcWRTdkNLcHFRMkJ2bzRGcmhSNlBtSVJkUHhoaFNsSnNhNW1rcWxFSEVH/callback',
  requestBody: { files: undefined, json: { type: 9, data: [Object] } }
}
#

Same error still

amber sleet
knotty plover
#

You do on API v10, which is what v14-dev runs

amber sleet
#

yea

knotty plover
#

No idea why they've failed to document it - we do in our docs

amber sleet
knotty plover
#

whats line 105 of your code? definitely that modal?

amber sleet
knotty plover
#

okay show the current error stack

amber sleet
#
data.components[BASE_TYPE_REQUIRED]: This field is required
data.custom_id[BASE_TYPE_REQUIRED]: This field is required
data.title[BASE_TYPE_REQUIRED]: This field is required
    at SequentialHandler.runRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:488:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:201:11)
    at async ChatInputCommandInteraction.showModal (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
    at async Object.execute (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\commands\configuration\set.ts:105:4)
    at async exports.default (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\events\basic\interactionCreate.ts:18:4) {
  rawError: {
    code: 50035,
    errors: { data: [Object] },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'post',
  url: 'https://discord.com/api/v10/interactions/965016477067517972/aW50ZXJhY3Rpb246OTY1MDE2NDc3MDY3NTE3OTcyOjJXSDhNTUN5eE9BRTNRbnBnUmF2a296Yk9iM05YUDFoWjhYSHl1RXdiOU5JdzJ2cFFFQ0hjTnNBajRLaGpkV3dYNWZNTVl3WTVlSjhPd0V3VFdHbWhHdEVmOFlxczd3ZnJxTGxJN0pFSGZja3Q0ZlpaZWZPcGhLYWRwRkRiOTNW/callback',
  requestBody: { files: undefined, json: { type: 9, data: [Object] } }
}
knotty plover
#

Well the error is thrown from line 105 of set.ts

amber sleet
#

I only have 103

knotty plover
#

have you saved and rebuilt your code

amber sleet
#

Ahh I forgot I off auto save XDD

#

I am so sorry for that

velvet jasper
shy birch
#

how to solve this error?

#

using modal

knotty plover
#

Well it didn't receive a response in time

#

And you didn't catch the promise rejection I guess

shy birch
#

how do i create a sink for the modal?

shy birch
knotty plover
#

A... Sink?

#

You haven't shown your code yet

shy birch
#

how to create one collector for modal

#
const filterModal = (interaction) => interaction.customId === 'test';
  const collector = new InteractionCollector(client, { filterModal, time: 10000, guild: interaction.guild, interactionType: InteractionResponseType.Modal })
  collector.on('collect', interaction => {
    console.log(interaction)
})

shy birch
knotty plover
#

filterModal is not the right property name

#

It's filter

#

Looks fine otherwise

#

You probably want to set max: 1 too

shy birch
#

truth, I hadn't even seen this error, the correct one is filter: filterModal

shy birch
#

@knotty plover

  const filterModal = (interaction) => interaction.customId === 'test';
  const collector = new InteractionCollector(client, { filter: filterModal, max: 1, time: 5000, guild: interaction.guild, interactionType: InteractionResponseType.Modal })
  interaction.showModal(modal);

  collector.on('collect', interaction => {
    console.log(interaction)
})
#

when i send nothing is returned

knotty plover
#

5 seconds isnt very long for them to reply but that looks right

shy birch
#

I put 1 minute, but as it's for testing, I think it doesn't matter

#

I just wanted to know why the collector doesn't get anything when I submit

#

@knotty plover

knotty plover
#

I said it looks right, pinging me isnt going to change that

nocturne kayak
shy birch
#

Thank you so much, it helped me a lot ❀️

burnt umbra
#

how to get who submited a modal?

nocturne kayak
#

modalsubmitinteraction#user

tropic karma
#

MODALS work in v13 too?

nocturne kayak
#

v13.7, soonℒ️

rapid umbra
#

Can we rename the "Submit" button in the modal?

nocturne kayak
#

no

tropic karma
rapid umbra
#

How to make the modal return a custom error?

copper jetty
#

throw new Error("something")

rapid umbra
#

like that

uncut kelp
#

You can't

rapid umbra
#

damn

rapid umbra
#

It's possible to add context menu in the modal ?

copper jetty
#

no

#

and it will never be possible probably

woeful pollen
#

context menu in modals? waitWhat

wicked tusk
#

@knotty plover can you help?

woeful pollen
#

maybe dont ping and wait for help

knotty plover
#

nah no idea

tropic karma
#

Code:

  if (message.author.bot) return
  // if (message.channel.type !== 'GUILD_TEXT') return
  if (!message.content.startsWith(prefix)) return
  const args = message.content.slice(prefix.length).trim().split(/ +/g)
  const cmd = args.shift().toLowerCase()
  if (cmd.length === 0) return
  let command = client.commands.get(cmd)
  if (!command) command = client.commands.get(client.aliases.get(cmd))

  if (command) {
    if (command.cooldown) {
      if (cooldown.has(`${command.name}${message.author.id}`))
        return message.channel.send({
          content: `You are on \`${ms(
            cooldown.get(`${command.name}${message.author.id}`) - Date.now(),
            { long: true }
          )}\` cooldown!`,
        })

      if (command.userPerms || command.botPerms) {
        if (
          !message.member.permissions.has(
            PermissionsBitField.Flags[command.userPerms] || []
          )
        ) {
          const userPerms = new EmbedBuilder()
            .setDescription(
              `🚫 ${message.author}, You don't have \`${command.userPerms}\` permissions to use this command!`
            )
            .setColor('Red')
          return message.reply({ embeds: [userPerms] })
        }
        if (!message.guild.me.permissions.has(command.botPerms || [])) {
          const botPerms = new EmbedBuilder()
            .setDescription(
              `🚫 ${message.author}, I don't have \`${command.userPerms}\` permissions to use this command!`
            )
            .setColor('Red')
          return message.reply({ embeds: [botPerms] })
        }
      }

      command.run(client, message, args)
      cooldown.set(
        `${command.name}${message.author.id}`,
        Date.now() + command.cooldown
      )
      setTimeout(() => {
        cooldown.delete(`${command.name}${message.author.id}`)
      }, command.cooldown)
    } else {
      if (command.userPerms || command.botPerms) {
        if (
          !message.member.permissions.has(
            PermissionsBitField.Flags[command.userPerms] || []
          )
        ) {
          const userPerms = new EmbedBuilder()
            .setDescription(
              `🚫 ${message.author}, You don't have \`${command.userPerms}\` permissions to use this command!`
            )
            .setColor('Red')
          return message.reply({ embeds: [userPerms] })
        }
        if (!message.guild.me.permissions.has(command.botPerms || [])) {
          const botPerms = new EmbedBuilder()
            .setDescription(
              `🚫 ${message.author}, I don't have \`${command.userPerms}\` permissions to use this command!`
            )
            .setColor('Red')
          return message.reply({ embeds: [botPerms] })
        }
      }
      command.run(client, message, args)
    }
  }
})
#

error:

  Overload 1 of 2, '(event: "messageCreate", listener: (message: Message<boolean>) => Awaitable<void>): Client<boolean>', gave the following error.
    Argument of type '(message: Message<boolean>) => Promise<Message<boolean>>' is not assignable to parameter of type '(message: Message<boolean>) => Awaitable<void>'.
      Type 'Promise<Message<boolean>>' is not assignable to type 'Awaitable<void>'.
        Type 'Promise<Message<boolean>>' is not assignable to type 'PromiseLike<void>'.
          Types of property 'then' are incompatible.
            Type '<TResult1 = Message<boolean>, TResult2 = never>(onfulfilled?: (value: Message<boolean>) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<...>) => Promise<...>' is not assignable to type '<TResult1 = void, TResult2 = never>(onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<...>'.
              Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
                Types of parameters 'value' and 'value' are incompatible.
                  Type 'Message<boolean>' is not assignable to type 'void'.
  Overload 2 of 2, '(event: never, listener: (...args: any[]) => Awaitable<void>): Client<boolean>', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'never'.ts(2769)```
#

i'm to stupid! if i set message: any i have no fails but my command didnt work with my prefix

copper jetty
#

do message: Message

tropic karma
# copper jetty do message: Message
  Overload 1 of 2, '(event: "messageCreate", listener: (message: Message<boolean>) => Awaitable<void>): Client<boolean>', gave the following error.
    Argument of type '(message: Message) => Promise<Message<boolean>>' is not assignable to parameter of type '(message: Message<boolean>) => Awaitable<void>'.
      Type 'Promise<Message<boolean>>' is not assignable to type 'Awaitable<void>'.
        Type 'Promise<Message<boolean>>' is not assignable to type 'PromiseLike<void>'.
          Types of property 'then' are incompatible.
            Type '<TResult1 = Message<boolean>, TResult2 = never>(onfulfilled?: (value: Message<boolean>) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<...>) => Promise<...>' is not assignable to type '<TResult1 = void, TResult2 = never>(onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<...>'.
              Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
                Types of parameters 'value' and 'value' are incompatible.
                  Type 'Message<boolean>' is not assignable to type 'void'.
  Overload 2 of 2, '(event: never, listener: (...args: any[]) => Awaitable<void>): Client<boolean>', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'never'.ts(2769)
#

same

tall verge
#

It's trying to install a monorepo repository, strange should install correctly

copper jetty
#

BUG

woeful pollen
#

new bug alert

urban belfry
#

really? can't reproduce

woeful pollen
#

I saw someone get the same error trying to install rest in #djs-help-v14