#djs-in-dev-version

1 messages · Page 20 of 1

devout gazelle
#

okay ty

scarlet tangle
#

İs in v14 can get the inviter ?

#

When guildmemberadd

vague coyote
#

no

#

you will have to check the invites manually

regal mason
#

It is possible to make modals with discord.js ?

#

Or it will be added later ?

forest elm
#

interaction.showModal(<Modal>)

latent lion
#

How do I create a invite?

#

This doesn't work

dawn phoenix
#

inb4 it's a category channel

#

also a word of warning: don't invite yourself into other people's server like this, it's considered a surprising side effect of adding your bot and a developers tos violation

forest elm
dawn phoenix
#

don't think so, no

latent lion
forest elm
#

weird, theres no channelinvitemanager

dawn phoenix
#

told you the (likely) reason

latent lion
dawn phoenix
#

don't try to create invites on category channels?

gloomy kayak
#

Probably just use find to search a text channel for example, and then create the invite

latent lion
#

Alright

#

Doesn't work

#

Every channel in there is a category channel

dawn phoenix
#

then you are out of luck, i guess

latent lion
#

Can I not create a invite from the guild?

dawn phoenix
#

no

#

invites belong to channels

plain roverBOT
#

Discord does not condone bots creating invites without the expressed consent of the guild owner/admins. source (discord Developer Policy)

You may not use the APIs in any way to [...] process Discord Data in a way that surprises or violates Discord users' expectations.
• If you are experiencing problems with a particular guild, have your bot leave and/or blacklist it

kind pulsar
#

Why do I get this error when I send a row with a button?

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

TypeError: component.toJSON is not a function
    at C:\Users\Alejandro\Desktop\Cluber 57 (but with Discord.JS v14)\node_modules\@discordjs\builders\dist\index.js:537:64    
    at Array.map (<anonymous>)
    at ActionRowBuilder.toJSON (C:\Users\Alejandro\Desktop\Cluber 57 (but with Discord.JS v14)\node_modules\@discordjs\builders\dist\index.js:537:35)
    at C:\Users\Alejandro\Desktop\Cluber 57 (but with Discord.JS v14)\node_modules\discord.js\src\structures\MessagePayload.js:135:109
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (C:\Users\Alejandro\Desktop\Cluber 57 (but with Discord.JS v14)\node_modules\discord.js\src\structures\MessagePayload.js:135:49)
    at ChatInputCommandInteraction.reply (C:\Users\Alejandro\Desktop\Cluber 57 (but with Discord.JS v14)\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:106:56)
    at Client.<anonymous> (C:\Users\Alejandro\Desktop\Cluber 57 (but with Discord.JS v14)\index.js:42:27)
    at Client.emit (node:events:527:28)
    at InteractionCreateAction.handle (C:\Users\Alejandro\Desktop\Cluber 57 (but with Discord.JS v14)\node_modules\discord.js\src\client\actions\InteractionCreate.js:76:12)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:384:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21)
outer bane
kind pulsar
# outer bane what's the code that's causing this and the versions of d.js and builders?
const embed = new EmbedBuilder()
.setColor("Random")
.setDescription("Pong!");

const button = new ButtonBuilder().setStyle(ButtonStyle.Danger).setCustomId("Hello").setLabel("Hello!");
const row = new ActionRowBuilder().addComponents([button]);

await interaction.reply({ embeds: [embed], components: [row] });

(I'm just testing version 14 and I have no idea how it is now)

outer bane
#

remove the brackets from addComponents, it takes rest params instead of an array

kind pulsar
#

Woah

#

It worked

kind pulsar
plain roverBOT
#

<:_:957801942573256854> Rest parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.

kind pulsar
#

Okay, thanks

#

By the way, is there already a guide on how to update from version 13 to 14? Doing this without a guide is complicated

outer bane
#

there's a preview guide which you can find in the pins, though it might not be up to date at all times

kind pulsar
#

Ok 👍

balmy violet
#

Was there a rename for the setChannelType for the channelOption (slash command builder)?

uncut kelp
balmy violet
#

I looked up in discord and saw add and set in plural and singular forms but neither seems to work 🤔

#

Weirdly enough that gives me linting however, maybe it's a bug? I guess I will look into it more tomorrow, thanks either way 😄

copper jetty
uncut kelp
acoustic temple
#

How I make a collector of modal?

knotty plover
#

InteractionCollector

acoustic temple
# knotty plover InteractionCollector

Can I make it like this?

const col = new InteractionCollector({ guild: guildId, channel: channelId, interactionType: 5, max: 1, filter })

Modal needs filter user?

copper jetty
acoustic temple
#

oh, sure!

velvet jasper
acoustic temple
#

hum, that's a nice way

compact plover
#

If a user cancels a modal there is no way to know this right?

knotty plover
#

correct

compact plover
#

Alright thanks, usually disabled the button after pressing till the user answered or did not reply in time. Guess I will just do it on a timer now.

acoustic temple
# knotty plover correct

But how can I prevent this? Because I have a slash command that show a modal. The member cancel submit and then execute slash command again to show modal, when submit, cause error.

        throw new DiscordAPIError(data, "code" in data ? data.code : data.error, res.status, method, url, requestData);
              ^

DiscordAPIError[40060]: Interaction has already been acknowledged.
knotty plover
#

Youre responding to the same interaction and not the new one there

acoustic temple
#

It happens when the member cancel submit and then execute slash command again to show modal, when submit, causing error 😩

copper jetty
#

You can't reply to the same interaction twice

acoustic temple
#

But I can't reply if member cancel modal

#

And there is no collector for cancelling submit 😦

knotty plover
#

You need to have your collectors listening to unique custom ids

#

If you reuse the same customId on a new modal then yeah youll get duplication

acoustic temple
#

How I prevent this?

knotty plover
#

unique custom ids

acoustic temple
#

Can u help me on code? 🥺

knotty plover
#

no

copper jetty
crystal valve
#

DiscordAPIError[50035]: Invalid Form Body
0.options[0].type[NUMBER_TYPE_COERCE]: Value "STRING" is not int.

it doesn't tell me where the error arises...

i've scrolled up, and i've changed CHAT_INPUT to type: 1, as well... not sure what the issue seems to be

this is for a slash command

woeful pollen
#

the type of the first option in the command

acoustic temple
#

@copper jetty I solved it checking if interaction.ephemeral is different from null

crystal valve
# woeful pollen the type of the first option in the command

oh, I see

module.exports = new SlashCommand({
  name: "8ball",
  description: "Ask the magic 8ball a question.",
  type: 1,
  options: [
    {
      name: "question",
      description: "A question for the 8ball.",
      type: "STRING",
      required: true,
    },
  ],
  run: async ({ interaction }) => {```
what are my options instead of STRING? I can't find the docs for it
https://deploy-preview-1011--discordjs-guide.netlify.app/creating-your-bot/creating-commands.html#user-info-command
woeful pollen
#

ApplicationCommandOptionType from discord-api-types

white nebula
#

also, most of the other guide pages than the v13=>14 update guide aren't updated, so you should only rely on the docs

crystal valve
#

alright, thanks

#

shouldn't STRING work?

woeful pollen
#

ApplicationCommandOptionType is an enum exported from discord-api-types

crystal valve
#
  0.options[0].type[NUMBER_TYPE_COERCE]: Value "ApplicationCommandOptionType" is not int.```
woeful pollen
#
import { ApplicationCommandOptionType } from 'discord-api-types/v10';

type: ApplicationCommandOptionType.String```
crystal valve
#

oh

gentle coyote
#

is it member.permissions.has('MANAGE_GUILD') or member.permissions.has('ManageGuild') in v14 now?

plain roverBOT
scarlet tangle
nocturne kayak
#

yes

scarlet tangle
#

v14 is the current latest dev version

coarse yoke
#

Do Modals show up on mobile?

copper jetty
#

Yes

coarse yoke
#

Ok ty!

dusky flicker
#

Is there a release date for v14 yet?

jaunty vault
dusky flicker
frigid sleet
#

my error:

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

TypeError: interaction.isChatInputCommand is not a function
    at module.exports (C:\Users\Desktop\Anti Ping\events\interactionCreate.js:2:22)
    at Client.<anonymous> (C:\Users\Desktop\Anti Ping\index.js:19:68)
    at Client.emit (node:events:527:28)
    at InteractionCreateAction.handle (C:\Users\Desktop\Anti Ping\node_modules\discord.js\src\client\actions\InteractionCreate.js:76:12)
    at Object.module.exports [as INTERACTION_CREATE] (C:\Users\Desktop\Anti Ping\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Desktop\Anti Ping\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (C:\Users\Desktop\Anti Ping\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (C:\Users\Desktop\Anti Ping\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (C:\Users\Desktop\Anti Ping\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:527:28)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:384:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21)

I don't know why node:events plays a role here, but I did everything the same as before and then just updated things for the new @dev version, i.e. isCommand with isChatInputCommand()
can someone help me please?

frigid sleet
# copper jetty what is `interaction`
module.exports = async (interaction) => {
    if (!interaction.isChatInputCommand()) return;
    const client = require('../index');
    const command = client.slashcommands.get(interaction.commandName);

    if (!command) return;

    try {
        await command.execute(interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }    
}
#

ok, i try

neat dune
#

im creating a bot and need modal support, should i use @/dev branch, more importatntly does @/dev come with the MessageEmbed --> Embed chnage?

white nebula
#

you can read the guide in the channel pins* for all changes

neat dune
white nebula
#

You can manually change the files that the stable modals PR uses, but that's not recommended
the dev branch is basically all experimental changes combined

neat dune
white nebula
#

either wait for stable, upgrade to the unstable dev branch, or try to "install" the PR on stable yourself

neat dune
white nebula
#

that's technically an option, just make sure they have good support if something about it breaks

neat dune
scarlet tangle
#

this happens at receiving a modal interaction

copper jetty
scarlet tangle
spare saffron
#

hi

signal rampart
#

Input not instance of UnsafeSelectMenuOptionBuilder though my option is the same as v13 and worked well

velvet jasper
white nebula
#

Is there a significant difference between using discord-api-types GatewayIntentBits versus DJS IntentsBitField flags?

velvet jasper
#

They’re the same

forest elm
#

the one from dapi-types is just an object, and djs' is a whole bitfield class

white nebula
#

Alright, thanks both of y'all!

signal rampart
forest elm
#

use rest parameters instead of passing an array

signal rampart
#

i seem dumb but what are rest parameters?

plain roverBOT
#

<:_:957801942573256854> Rest parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.

forest elm
#

f(param1, param2, param2) vs f([param1, param2, param3])

signal rampart
#

oh ok

woeful pollen
#

though theres an open pr to revert it to array, right

velvet jasper
#

Yes

woeful pollen
# velvet jasper Yes

should you allow support for both rest and array? cuz people been changing from array to rest and now going back to array

velvet jasper
#

No for reasons I described in the PR

woeful pollen
#

oh I just saw

#

nvm

velvet jasper
#

Dev releases are subject to change at any moment

woeful pollen
#

yeah alright

umbral raptor
#

Will I need to rewrite my Discord.js v13 code for Discord.js v14?

vague coyote
#

you need to update your code according to the update guide when its time.

umbral raptor
vague coyote
#

you will need to update everything that has changed, obviously

compact plover
#

Am I missing something, shouldn this exist?

warm mural
#

hi hi, do we have any ETA of a v14 release by chance? just curious CB_dance

warm mural
#

All good thanks!

crystal valve
#

hello, my slash commands won't register, meaning when I type in /, my bot doesn't have any slash commands.

const commands = await globPromise(
    `${process.cwd()}/SlashCommands/*/*.js`
  );

  const commandArray = [];

  commands.map((value) => {
    const file = require(value);
    if(!file.name) return;  
    this.client.slashCommands.set(file.name, file);
    commandArray.push(file);
  });


    this.client.on("ready", async () => {
            await this.client.slashCommands.set(commandArray);```
this is for my handler ^^

```js
const {
  Client,
  CommandInteraction,
  ApplicationCommandType,
  ApplicationCommandOptionType,
} = require('discord.js');

module.exports = {
  name: 'balance',
  description: 'View the balance of your wallet and bank, or a specific user\'s wallet and bank',
  type: ApplicationCommandType.ChatInput,
  category: 'Economy',
  options: [
    {
      name: 'member',
      description: 'A specific member that you want view their wallet and bank',
      type: ApplicationCommandOptionType.User,
      required: false,
    },
  ],
  
  /**
   * @param {Client} client
   * @param {CommandInteraction} interaction
   * @param {String[]} args
   */

  run: async (client, interaction, args) => {

    return interaction.followUp({ content: 'hi!' });
  },
};

this is my command so far.

this is in v14 btw, and no errors

silk topaz
crystal valve
# silk topaz okay but how are you registering them on Discord? how are you sending them to th...
  const commands = await globPromise(
    `${process.cwd()}/SlashCommands/*/*.js`
  );

  const commandArray = [];

  commands.map((value) => {
    const file = require(value);
    if(!file.name) return;  
    this.client.slashCommands.set(file.name, file);
    commandArray.push(file);
  });
const rest = new REST({ version: '9' }).setToken(process.env["TOKEN"]);

        (async () => {
    try {
        console.log('Started refreshing application (/) commands.');

        await rest.put(
            Routes.applicationCommands('958848741790609468'),
            { body: commandArray },
        );

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();
        

    this.client.on("ready", async () => {
            await this.client.slashCommands.set(commandArray);```
I think the `REST` stuff does that
silk topaz
#

okay so, did you wait one hour at least?

crystal valve
#

ok so I logged commandArray, but there's nothing there.
[] is logged.

  const commands = await globPromise(
    `${process.cwd()}/SlashCommands/*/*.js`
  );```
crystal valve
crystal valve
#

[]

silk topaz
#

ok so you have to investigate your globPromise function

crystal valve
#

right

#

ok I think it worked, or at least it logged this
i'll wait now, hopefully it loads

silk topaz
crystal valve
#

ah alright, how would I do that ||sorry||

silk topaz
#

lemme see in the guide, im pretty sure theres something there

crystal valve
#

👍

silk topaz
#

just a few changes, so you can test things more easily an faster, you still have to be mindful of the ratelimit for creating / updating commands, which is 200 requests per day

crystal valve
# silk topaz just a few changes, so you can test things more easily an faster, you still have...

got it

DiscordAPIError[50001]: Missing Access
    at SequentialHandler.runRequest (/home/runner/v14/node_modules/@discordjs/rest/dist/index.js:679:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/home/runner/v14/node_modules/@discordjs/rest/dist/index.js:482:14) {
  rawError: { message: 'Missing Access', code: 50001 },
  code: 50001,
  status: 403,
  method: 'put',
  url: 'https://discord.com/api/v9/applications/958848741790609468/guilds/932785394355941406/commands',
  requestBody: { files: undefined, json: [ [Object] ] }
}```
so I re-invited my bot with application scopes, and still get the same error
silk topaz
#

uhhhhhhhh...

#

i dont know

crystal valve
#

alright, thanks anyway!!

crystal valve
# silk topaz i dont know

I got it :)

ok, so everytime I restart my bot, is there a way to make it so that the bot doesn't duplicate commands?

copper jetty
silk topaz
#

another way would be when you are done testing a command and its ready to be deployed globally, you can delete it from the guild

crystal valve
#

got it

#

thanks, to the both of you!!

wraith oyster
#

how can i set button style in v14? (.setStyle('SUCCESS') is not working)

velvet jasper
#

setStyle(ButtonStyle.Success)

wraith oyster
#

thanks

velvet jasper
#

Also please read the guide in the pins

wraith oyster
#

okey

plush monolith
#

<@&839912195994812420> ^

knotty plover
#

Yeah that's violates so many ToS rules

plush monolith
#

<@&839912195994812420> again ^

cyan jewel
#

Just spent the evening playing with dev, and I must say I like all the changes in v14 so far. Code is more readable, and modals are fantastic. Keep up the good work, and good luck with release. 💪

lapis blaze
#

was ButtonBuilder.setEmoji changed in v14 dev? I'm getting ZodError of Expected string, received null
current code:

tropic karma
#

any ata for v14?

lapis blaze
tropic karma
undone yew
#

How to fix error?

code:

    await rest.put(Routes.applicationCommands(client.user.id, { body: client.commands }))
knotty plover
#

I dont think client.commands is compatible JSON usually

plain roverBOT
#

<:_:862626783890636830> Interactions: Registering slash commands
read more

undone yew
#

client.commands = (global.commands = [])

knotty plover
#

that doesnt seem to be the case

scarlet tangle
undone yew
#
const commands = [];

const { REST } = require("@discordjs/rest")
const { Routes } = require("discord-api-types/v10")
const rest = new REST({ version: "10" }).setToken(client.config.bot.token)

fs.readdir("./src/commands/", async (err, files) => {
    if (err) throw new Error(err);

    files.forEach(async (file) => {
        if (!file.endsWith(".js")) return;

        let command = require(`./src/commands/${file}`);
        
        commands.push({
            name: command.name,
            description: command.desc,
            type: command.type ? ApplicationCommandType.ChatInput : ApplicationCommandType.ChatInput,
            options: command.options
        });

        await rest.put(Routes.applicationCommands("953716268685479936", { body: commands }))
        console.log(`✅ Command Loaded: ${command.name}`)
    })
});

what do i need to change?

knotty plover
#

nothing?

#

looks fine to me

nocturne kayak
#

command.type ? ApplicationCommandType.ChatInput : ApplicationCommandType.ChatInput
This doesnt quite make sense to me

knotty plover
#

maybe move the put outside of the foreach

undone yew
#

I'm fixed error

#

Routes.applicationCommands("953716268685479936", .....

Correct: Routes.applicationCommands("953716268685479936"), ....

tropic karma
#
    Partials.Channel,
    Partials.Message,
    Partials.User,
    Partials.GuildMember,
    Partials.GuildPresences,
  ],
#

Property 'GuildPresences' does not exist on type 'typeof Partials'.ts(2339)

#

all other go fine. Have anyone an idea for this error

dawn phoenix
#

i think you are confusing partials and intents right now

tropic karma
#
const client = new Client({
  intents: 32767,
  partials: [
    Partials.Channel,
    Partials.Message,
    Partials.User,
    Partials.GuildMember,
  ],
})
#

y i thinks so too now >.<

#

that is wrong? i am much confused now

#
onst client = new Client({
    intents: [
        GatewayIntentBits.Guilds, 
        GatewayIntentBits.GuildMessages, 
        GatewayIntentBits.GuildPresences, 
        GatewayIntentBits.GuildMessageReactions, 
        GatewayIntentBits.DirectMessages,
        GatewayIntentBits.MessageContent
    ], 
    partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.GuildPresences] 
});
woeful pollen
#

theres no presences partial

#

that's an intent

vague coyote
#

I think you should explain what you are trying to do

plain roverBOT
devout gazelle
#

how do you set a nickname in v14? user.setNickname() isn't working

vague coyote
#

it was never user.setNickname()

devout gazelle
#

whaa?

vague coyote
#

<GuildMember>.setNickname()

devout gazelle
#

so this isn't valid?

const user = interaction.options.getUser('user');
const nickname = interaction.options.getString('nickname');

if (!interaction.member.permissions.has('ManageNicknames'))
   return interaction.reply({ content: 'You don\'t have permissions to use this command', ephemeral: true });

user.setNickname(nickname);```
vague coyote
#

interaction.options.getMember('user')

devout gazelle
#

ah

sacred eagle
#

And name the variable member to avoid confusion later on

devout gazelle
#

ty

hexed flint
#

Hey there, does anyone have the link for the guide updated to the latest dev version? Seems like I’ve updated and tons of stuff just broke xD

uncut kelp
#

Pins

hexed flint
uncut kelp
#

What is missing

hexed flint
#

Everything has been working fine with some other v14 dev version today, I’ve update to the latest one and I’m now getting
Constructor of class 'Embed' is private and only accessible within the class declaration.

#

I’ve been using new Embed().setWhatever to make my embeds till now

forest elm
#

thats in the guide

uncut kelp
#

That wasn't in the latest dev update because that was made ages ago

#

It is in the guide

hexed flint
#

Yet it isn’t, at least for me

hexed flint
uncut kelp
#

I don't know what you're looking at

#

But it's right here

hexed flint
#

Property 'setFooter' does not exist on type 'EmbedBuilder'.

#

Well it may just be my brain being tired, but the guide is saying that EmbedBuilder.setFooter is a thing. Seems like TS isn’t

uncut kelp
#

Yea idk why you are getting this issue, works fine for me

hexed flint
#

I’ll just try reinstalling djs

hallow violet
#

use EmbedBuilder from @discordjs/builders or within the discord.js module

hexed flint
#

I’ve already tried using this

uncut kelp
#

No errors from TS

hexed flint
#

I’ve reinstalled discord.js@dev and its now working

#

Well I don’t know what could’ve been causing that

uncut kelp
#

Huzzah

hexed flint
#

Thanks for the help

tame gazelle
#

same as v13

#

.setFooter({ text: 'string', iconURL: 'string' })

tame gazelle
#

try passing rest params

#

remove the array

plain roverBOT
#

<:_:957801942573256854> Rest parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.

tame gazelle
#

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

#

replace ... with label etc..

#

what error?

snow estuary
#

Where can I find all examples of TextInputStyles?

sullen karma
#

How do I send a DM to everyone who has a role?

#

not for api abuse

vague coyote
#

correct, you dont

copper jetty
flint spade
dawn phoenix
#

okay, you can stop dogpiling now

#

technically, if it happens with the consent of the staff, it is consent for people to be in the guild
you should generally prefer to mention roles, whenever possible
but if it is not a surprising thing for your bot to do, and it is par of it's explicit purpose to give these notifications it's not the end of the world, and not a tos break.

fetch all members guild.members.fetch(), make sure the promise resolves successfully and access the role's role.members
it returns a filtered subset of all guild members (those who have that role)
you can then iterate over these and send a message to each via member.send("hi")
make sure to gracefully handle the promise rejection, as you cannot check if the member may have DMs disabled or your bot blocked.

plain roverBOT
#

<:_:874573879153160212> Role#members
The cached guild members that have this role

dawn phoenix
#

these are the docs for the things mentioned above
if you have trouble with a part, please make sure to specify which part of the explanation it is that is giving you trouble and what you need to know to resolve it

#

@sullen karma see above

wraith oyster
#
const modal = new ModalBuilder()
                .setTitle('TEST')
                .setCustomId('test')
                .addComponents(
                    new TextInputBuilder()
                        .setLabel('test')
                        .setCustomId('test')
                        .setRequired(true)
                )
            interaction.showModal(modal)
#
:\Users\Soro-\Desktop\discord-bot\node_modules\@discordjs\rest\dist\index.js:679
        throw new DiscordAPIError(data, "code" in data ? data.code : data.error, res.status, method, url, requestData);
              ^

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[BASE_TYPE_REQUIRED]: This field is required
    at SequentialHandler.runRequest (C:\Users\Soro-\Desktop\discord-bot\node_modules\@discordjs\rest\dist\index.js:679:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\Soro-\Desktop\discord-bot\node_modules\@discordjs\rest\dist\index.js:482:14)
    at async ChatInputCommandInteraction.showModal (C:\Users\Soro-\Desktop\discord-bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:242:5) {
  rawError: {
    code: 50035,
    errors: {
      data: { components: { '0': { components: [Object] } } }
    },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'post',
  url: 'https://discord.com/api/v10/interactions/962485064120270898/aW50ZXJhY3Rpb246OTYyNDg1MDY0MTIwMjcwODk4OkF1MFY2eHRlT0FvQkJiS3g0NzBBRHVaUVkxQ0dESHNIS3IyS21Md28zTDJYYVM3WWdhWGoxVnBKM0FYcGVyTUZDT0ppTjZHRVZSMjdmTUdRaGdRcHRVY0FxMmZVS2pTOG9EQURMYlNGcGQ4UTdYckpZNFpHZkpsVjQ0OGFpOW50/callback',
  requestBody: {
    files: undefined,
    json: {
      type: 9,
      data: {
        title: 'TEST',
        custom_id: 'test',
        components: [ { type: 1, data: [Object], components: [] } ]
      }
    }
  }
}
#

I getting this error when i use interaction

vague coyote
#

<ModalBuilder>.addComponents() takes ActionRow's, which have TextInputBuilder in them afaik

wraith oyster
#

hmm

crystal valve
#

what is the voice intent in v14
GatewayIntentBits.GUILD_VOICE_STATES is not it

#

oh wait nevermind, I found the logs

#
const Event = require("../../Structures/Classes/event");
const client = require("../../index")
const {
    EmbedBuilder
} = require('discord.js') //discord.js@dev (replace with MessageEmbed in v13/v12)

module.exports = new Event('voiceStateUpdate', async (oldState, newState) => {
  let newUserChannel = oldState.voiceChannel
  let oldUserChannel = newState.voiceChannel



    
let newaE = new EmbedBuilder()
    .setTitle('welcome')
    .setDescription(`${newUserChannel}; ${oldUserChannel}`)

      client.channels.cache.get('946544494487150633')?.send({
        embeds: [newaE]
    })
    
})```
is this not right? 
```js
  let newUserChannel = oldState.voiceChannel
  let oldUserChannel = newState.voiceChannel``` return undefined...
woeful pollen
#

oldState.channel

plain roverBOT
#

<:_:874573855715385394> VoiceState
Represents the voice state for a Guild Member.

crystal valve
# woeful pollen oldState.channel

like ```js
let newUserChannel = oldState.voice.channel
let oldUserChannel = newState.voice.channel

?
`TypeError: Cannot read properties of undefined (reading 'channel')`
plain roverBOT
#

Documentation suggestion for @crystal valve:
<:_:874573879153160212> VoiceState#channel
The channel that the member is connected to

crystal valve
#

yep, got it
<VoiceState>.channel

woeful pollen
#

oh right, my bad

crystal valve
#

no worries, tysm! got it to work finally

earnest garden
#

where can I see planned / in-dev (in discord.js@dev) things

nocturne kayak
#

what was your err

civic topaz
#

no error

nocturne kayak
#

we aint gonna debug your code

civic topaz
#

careless mistake

#

ok nothing

earnest garden
#

How do I define the GatewayIntentBits or whatever, how do I get it, I can't import it from api types, it didn't work with an error about something with a package.json

idle galleon
earnest garden
#

Should I do
import GatewayIntentBits from discord-api-types/v9 or smth

knotty plover
#

yes

velvet jasper
#

You don’t have to import from discord-api-types, you can just import from discord.js

scarlet tangle
carmine bridge
#

how

lapis blaze
#

is message.reactions.cache broken in dev?

#

count says 1 but there is no users

idle galleon
#

The user isn't cached

plain roverBOT
#

<:_:874573924988518500> ReactionUserManager#fetch()
Fetches all the users that gave this reaction. Resolves with a collection of users, mapped by their ids.

idle galleon
#

Use <Reaction>.users.fetch() to fetch them

devout gazelle
#

I'm tryna make a button give a role when someone clicks it but, interaction.user isn't working, so how do I make it know I'm tryna do it when a user clicks a button?

shadow socket
#

MessageEmbed has now been renamed to EmbedBuilder. but in example its Embed() not EmbedBuilder()

#

what to use?

vivid thicket
#

when is v14 out btw

knotty plover
#

when its ready

wraith oyster
#

How can i check modalSubmit event?

knotty plover
#

Theyre interactions

wraith oyster
#

okey thanks

signal rampart
#

Input not instance of UnsafeSelectMenuOptionBuilder I keep on having this, anyone has a snippet of code to fix it or to make me understand?

tame gazelle
carmine bridge
carmine bridge
ancient hound
signal rampart
#

so like .setOptions({ label: "one", value: "one" },{ label: "two", value: "two" })?

ancient hound
#

Yup

signal rampart
#

oh okay

signal rampart
#

wait no

#

nvm

signal rampart
copper jetty
plain roverBOT
#

<:_:957801942573256854> Rest parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.

ancient hound
#

Same as you did for setOptions

signal rampart
#

Okay now it works 👍 sorry for slow brain I got used to v13 so much

shadow socket
# carmine bridge

Did you use code from youtuber krazy developer?, If yes dm me I'll help you i know the fix

carmine bridge
#

Yes

tame gazelle
#

Manager#resolve() checks only the cache?

nocturne kayak
#

yes

tame gazelle
#

thanks

haughty lava
#

this is correct right? i am getting a error

tame gazelle
signal rampart
#

So this doesn't work anymore, so how, possibly, could I fix this?

roles.match(/<@&\d+>/g).forEach((string) => {
        let role = message.guild.roles.cache.get(string.match(/\d+/g)[0]);

        // CHANGE ARRAY TO REST PARAMETER
        array.push({
            label: role.name,
            value: role.id,
            emoji: role.unicodeEmoji ?? null,
            default: false,
        });
    });

    const newComponent = new Discord.ActionRowBuilder().addComponents(
        new Discord.SelectMenuBuilder()
            .setMinValues(1)
            .setMaxValues(maxSelect)
            .setCustomId(`setRoles_${actualComponents.length}`)
            .setPlaceholder(placeholder)
            .setDisabled(false)
            .setOptions(array) // array is still array :/
    );```
#

I know the problem is that the options is an array

#

if there are any ways, tell me as fast as you can 👍

vague coyote
#

just spread the array

plain roverBOT
#

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

signal rampart
vague coyote
#

try it

signal rampart
#

I have and it doesn't

signal rampart
vague coyote
#

well you will have to use the builder then

#

afaik they also take json so you could try to do it that way

signal rampart
#

This worked tho

const x = [
    { label: "one", value: "one" },
    { label: "two", value: "two" },
];
interaction.channel.send({
    components: [
        new Discord.ActionRowBuilder().addComponents(
            new Discord.SelectMenuBuilder()
                .setMinValues(1)
                .setMaxValues(1)
                .setCustomId("none")
                .setPlaceholder("Placeholder")
                .setDisabled(false)
                .setOptions(...x)
        ),
    ],
});```
uncut bone
#

I've noticed (much like everything else), that ButtonBuilder.setEmoji has changed; I can't figure out how to properly use it though.
Anyone got a clue?

#

I can see that it wants me to populate it with an object, however, how do I just use default Discord emojis?

vague coyote
uncut bone
#

That is correct.
However, how do I use the like default Discord emojis?

vague coyote
#

you just use the name then

uncut bone
#

Such as, 1️⃣, 2️⃣, 3️⃣, etc..

#

I've tried that and it says it's an invalid emoij.

#

So I'm lost.

#

I've even tried using the emoji unicode.

#

Oh, uhm, it's just randomly started working.

#

Okay, that's great.

uncut bone
#

Can msg.showModal() not be used if the reply has been deferred?

#

I find that to be a little bit weird.

uncut kelp
#

Nope

uncut bone
#

That sucks.

#
        msg.showModal({
            name: "Test",
            customId: "Main",
            components: [
                new ModalBuilder()
                    .addComponents(
                        new ActionRowBuilder()
                            .addComponents(
                                new TextInputBuilder()
                                    .setCustomId("Test")
                                    .setLabel("Test")
                                    .setPlaceholder("Test")
                                    .setStyle(TextInputStyle.Short)
                            )
                    )
            ]
        });

I've tried following the documentation and created this; it looks correct, however, it doesn't seem to work.

#

data.components[0][COMPONENT_TYPE_INVALID]: The specified component type is invalid in this context

#

Disregard. ^^ Figured it out.

#
msg.showModal(new ModalBuilder()
            .setTitle("Test")
            .setCustomId("test")
            .addComponents(
                new ActionRowBuilder()
                    .addComponents(
                        new TextInputBuilder()
                            .setCustomId("Test")
                            .setLabel("test")
                            .setStyle(TextInputStyle.Short)
                    )
            )
        )
woven grove
#

0 is the type

split fulcrum
#

what does this error mean have never seen it befor

#

Nvm fixed it.

undone yew
#

my code;

        success(content, emoji) {
            if (typeof emoji !== "string") return;

            const success = new EmbedBuilder()
                .setColor(Util.resolveColor("Green"))
                .setDescription(`${emoji} ${content}`)
                .setTimestamp()

            return success;
        }
#

how to fix?

vague coyote
undone yew
vague coyote
#

the whole code, not just... that

undone yew
#

ok

#

wait

#
const { Client, Message } = require("./src/frame")
const bot = new Client({ token: "" });
const i = new Message();


bot.on("ready", async () => {
   bot.channels.cache.get("955072493197074508").send({ embeds: [i.embed.success("Success!")]})
})
scarlet tangle
#

whats new Message()?

molten birch
#
let rp = message.member.roles.cache.hasAny(["618976181026422814","139836912335716352"])
if(rp) console.log("has role")

its takes more keys how i can do it for array ?
not works any1 help me
i need them in array

undone yew
vague coyote
scarlet tangle
# undone yew

Wouldn't it be new Messages() instead of Message()?

undone yew
scarlet tangle
#

BRUH

#

You send everything incomplete

undone yew
#

how?

vague coyote
#

if you didn't enable the MessageContent intent in the client constructor, that is indeed normal

wicked nebula
#

Do modal component text input custom Id's collide?

plucky swan
wicked nebula
#

Do what it says

plucky swan
velvet jasper
#

also this doesn't have anything to do with this channel

velvet jasper
wicked nebula
#

It's interesting discord even called it that, should've been like slash command options imo

wicked nebula
wicked nebula
#

@velvet jasper tried it out on two accounts & platforms at the same time, the customId being the same does not seem to have any effect

velvet jasper
#

cool good to know

burnt brook
#

on 14.0.0-dev.1649505803-3c0bbac right now, it seems message collectors no longer pass the message thats been collected correctly? tested with following code inside aninteraction

const filter = m => m.author.id == interaction.member.id && m.channel.id == interaction.channel.id;
const collector = interaction.channel.createMessageCollector({ filter, time: 10000, max: 1 });

collector.on('collect', async m => {
    console.log(m) // returns Map {}
    let channel = m.mentions.channels.first().id // Cannot read properties of undefined (reading 'id')
});

tested & working on 14.0.0-dev.1647259751.2297c2b

in fact, it looks (to me) like it always just returns Map {}, printing m.id, m.mentions etc all return Map {}

knotty plover
burnt brook
#

a-ha! i have to fetch the message before i can get the mentions

#

weird that it only happens since i bumped the dev build, wonder what changed.

knotty plover
#

well no, you just dont have the message content intent

#

Which is what I said

#

dev build uses API v10 where its required to be provided if you want message content, mentions etc

brisk path
#

Can modals be created from message input as well?

knotty plover
#

Modals can only be sent in response to an interaction

brisk path
#

oh i see

rustic goblet
#

First day looking into v14, is there any real advantage in using Builders instead of Unsafe Builders in production code, assuming you've (moderately) tested your code beforehand?

knotty plover
#

I mean, imo unsafe builders have no advantage over just raw JSON

#

They're just a stylistic choice for building data

#

regular builders do data validation so it will throw errors if you're ever putting through user input for example

rustic goblet
#

But like would there be any downside in say, prefixing all builders with Unsafe when pushing to prod?

knotty plover
#

You lose data validation

rustic goblet
#

i guess with user input yeah

knotty plover
#

If its static pre-validated data no, but then theres no advantage to a builder at all imo

rustic goblet
#

I guess thats true yeah, i just prefer the styling for it as well

knotty plover
#

then thats fine

rustic goblet
#

Yeah so for any builders where i just use my own hardcoded stuff i might as well use unsafe right

knotty plover
#

probably yeah

coarse yoke
#

Can you add buttons inside Modals?

woeful pollen
#

not yet, no

shadow socket
#
const textinput = new TextInputBuilder({
            customId: "balaaaaaaaaaadhuyaeuyfegfyuaegyiegfaygkfgjzhdkgfagyugalifbhj",
            label: "label boi",
            style: TextInputStyle.Short,
            minLength: 3,
            maxLength: 3000,
            required: true,
            value: "pre filled data k",
            placeholder: "place holder baka"
        });

        const row = new ActionRowBuilder({
            components: [textinput]
        });
        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
        const modal = new ModalBuilder({
            customId: "mymodal",
            title: "test title",
            components: [row]
        })
        modal.addComponents(firstActionRow, secondActionRow);

        await interaction.showModal(modal);

code above
error below

#
[antiCrash] :: Unhandled Rejection/Catch
ValidationError > s.string
Expected a string primitive
Received:
| undefined
at StringValidator.handle (/workspace/node_modules/@sapphire/shapeshift/dist/index.js:1372:70)
at StringValidator.parse (/workspace/node_modules/@sapphire/shapeshift/dist/index.js:114:88)
at validateRequiredParameters (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:762:21)
at ModalBuilder.toJSON (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:777:5)
at Object.run (/workspace/slashCommands/CHAT_INPUT/owner/modal.js:52:21)
at ChatInputCommandInteraction.showModal (/workspace/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:245:46)
at Object.run (/workspace/events/discord/guild/interactionCreate.js:107:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5) Promise {
<rejected> ValidationError > s.string
Expected a string primitive
Received:
| undefined
at StringValidator.handle (/workspace/node_modules/@sapphire/shapeshift/dist/index.js:1372:70)
at StringValidator.parse (/workspace/node_modules/@sapphire/shapeshift/dist/index.js:114:88)
at validateRequiredParameters (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:762:21)
at ModalBuilder.toJSON (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:777:5)
at ChatInputCommandInteraction.showModal (/workspace/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:245:46)
at Object.run (/workspace/slashCommands/CHAT_INPUT/owner/modal.js:52:21)
at Object.run (/workspace/events/discord/guild/interactionCreate.js:107:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
}
#

any clue why is it happening when im execing it

copper jetty
#

And min_length max_length

shadow socket
#

okay worked

#

can i use smth else instead of interaction event to ccatch the modal submits?

copper jetty
#

InteractionCollector

shadow socket
#

how?

plain roverBOT
#

<:_:874573855715385394> InteractionCollector (extends Collector)
Collects interactions. Will automatically stop if the message (Client#event:messageDelete messageDelete or Client#event:messageDeleteBulk messageDeleteBulk), channel (Client#event:channelDelete channelDelete), or guild (Client#event:guildDelete guildDelete) is deleted. (more...)

shadow socket
#

k

devout gazelle
#

how'd you do .addFields() in v14? I think I might have done it wron

copper jetty
devout gazelle
#
.addFields(
        { name: 'Name', value: `${user.username}`, inline: true },
      )``` so this is correct?
copper jetty
#

Yes

scarlet tangle
#
    .addStringOption(option =>
        option.setName('currency')
            .setDescription('currency to trade')
            .setChoices(
                {label: 'Bitecoin', value: 'btc'},
                {label: 'Endereum', value: 'eth'},
                {label: 'Riperl', value: 'xrp'},
                {label: 'Lintcoin', value: 'ltc'},
                {label: 'Stealer', value: 'xlm'},
                {label: 'Discoin', value: 'discoin'}
                                          
            )
            .setRequired(true))``` this returns multiple errors, how do we add choices?
vague coyote
#

Error being what

#

Doesnt choices consist of name and value

scarlet tangle
#

no idea

vague coyote
#

name and value, not label and value

scarlet tangle
#

thank you

#

I am not good at debugging these lol

#
const filter = (interaction) => interaction.customId === 'accept' && interaction.user.id === member.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 30_000 });
collector.on('collect', i => {
    i.reply('debug response')
});
collector.on('end', collected => {
interaction.editReply({content: 'this trade has expired'})
});
```did they change button collectors?
tame gazelle
#

you have to specify the component type no?

scarlet tangle
#

it straight up can't create the collector

tame gazelle
#

try to create it on a Message object

scarlet tangle
#

both interaction.message and interaction.message.channel doesn't work

#

the errors respectively

small mica
#

How to check if a deleted message is text, or an image?

woeful pollen
#

theres message.content and message.attachments which is a collection of attachments, check if the size is more than 0

karmic falcon
#

I have this odd error

CombinedPropertyError (1)
  Received one or more errors
  input.id
  | CombinedError (2)
  |   Received one or more errors
  |
  |   1 ExpectedValidationError > s.literal(V)
  |   |   Expected values to be equals
  |   |
  |   |   Expected:
  |   |   | undefined
  |   |
  |   |   Received:
  |   |   | null
  |
  |   2 ValidationError > s.string
  |   |   Expected a string primitive
  |   |
  |   |   Received:
  |   |   | null```
when using `.setEmoji("📜")` on a button
karmic falcon
#

Ohhh. Thanks!

copper jetty
karmic falcon
#

Lol honestly I was lost

velvet jasper
#

The djs builder allows emojis to be passed in directly

earnest garden
#

In the pinned messages, it says In client settings, where's that at?

woeful pollen
#

the options you pass when constructing a new client

earnest garden
#

Ok, how do I allow message content thinger? It says Make sure you also set the intent in Client settings MessageContent = 1 << 15

white nebula
#

Use the MessageContent intent flag

earnest garden
#

GatewayIntentBits.MessageContent?

worthy fog
#
const client = new Client({} /* Everything inside the curly brackets is considered client settings or options */)
earnest garden
#

it worked, ty

slow storm
copper jetty
slow storm
#

Ig this validation needs a fix to allow null because Util.parseEmoji will always return id null for default emojis

karmic falcon
devout gazelle
#

Whats the predicted time v14 will officially come out?

marsh matrix
#

at some point in the future

woeful pollen
#

when its ready

karmic falcon
rain bramble
#

This error occurs after removing store channels.
I think just removing a store channel type should't lead to this error.
What I also should to change?
All packages are on the latest version (3c0bbac)

new SlashCommandBuilder()
  .setName('name')
  .setDescription('Description')
  .addChannelOption((option) =>
    option
      .setName('name')
      .setDescription('Description')
      .addChannelTypes(
        ChannelType.GuildNews,
      ),
  ),
outer bane
#

seems like a version mismatch from discord-api-types

#

what does npm/yarn why discord-api-types show?

outer bane
#

you have both v0.29 and v0.31.1 installed. enums from different versions are considered different enums so you can't assign one to the other

rain bramble
#

So should I wait for the fix update?

outer bane
#

you can also use yarn resolutions or npm overrides to pin it to one version

#

seems like it got bumped in d.js for the store channels removal but not in the other packages

brazen knoll
#

do button clicks on uncached messages emit an interactionCreate or a raw event

copper jetty
#

InteractionCreate

brazen knoll
#

ty

#

wait raw event was removed?

stuck solstice
#

I get a zoderror, how do I start debugging it?
Relevant code:

const lfgEmbed = <Message>.embeds[0].data;
const guardians = lfgEmbed.fields.pop().value.split(", ");
const newEmbed = new EmbedBuilder()
    .setFooter(lfgEmbed.footer)
    .addFields(lfgEmbed.fields);
if(guardians.includes(ic.user.tag)){
    return ic.reply({content: "You're already in this LFG.", ephemeral: true});
} else {
    guardians.push(ic.user.tag);
    newEmbed.addFields({value: guardians.join(", "), name: `**Guardians Joined: ${guardians.length}/6**`});
}
<Message>.edit({components: <Message>.components, embeds: [newEmbed]});
copper jetty
stuck solstice
#

Line 80 is .addFields(lfgEmbed.fields);

copper jetty
#

Remove .data at first line

stuck solstice
#

but it's an object and the stuff is inside .data

outer bane
#

latest dev should give you shapeshift errors which are more descriptive

stuck solstice
#

Same error, same line

#

Imma update to latest to get more descriptive errors

#

Ah I see, I pass an array instead of rest

outer bane
#

does the received embed include some data you don't want to send? otherwise you can use EmbedBuilder.from to convert an Embed to a builder

stuck solstice
#

I edit one of the fields, rest would be fine

#

I guess I could just edit the field with the new embed then

#

DiscordAPIError[50035]: Invalid Form Body
components[0].components[BASE_TYPE_REQUIRED]: This field is required

Interesting hdthonk

forest elm
#

youre not on the latest version if youre getting zod errors

stuck solstice
#

I know I updated, irrelevant

outer bane
#

you can't resend actionrows currently, there's a bug with toJSON not including components

stuck solstice
#

oof

velvet jasper
#

Wait do y'all need the dev version of builders to be installed in order to use them for djs?

outer bane
#

I think so since d.js extends renamed classes

velvet jasper
#

That's strange bc I'm testing it right now doing new ActionRowBuilder and I only have the dev version of djs installed and it works

outer bane
#

you probably get the builders dev if you don't have it manually installed

velvet jasper
#

yeah ig thats why I'm confused bc I swear some people in here stated that you have to manually install the dev version of builders to get them to work with the dev version of djs. But it seems like installing just the dev version of djs is all that's needed.

outer bane
#

if you follow the d.js guide for slash commands you have to manually install builders since slash command builders are not re-exported

velvet jasper
#

yeah that might need to be reconsidered given the naming conflicts

#

bc vsc auto-import will only suggest builders if it's in your package.json. Most people just want to use the builders from djs

outer bane
#

yes, I think slash command builders were the first part of the builders package and nothing was re-exported back then. There's still other stuff like isJSONEncodable and embedLength which is not re-exported

velvet jasper
#

at this point I don't think it hurts to reexport everything from builders since it's a regular dep anyways

outer bane
#

that would hopefully solve the confusion with d.js re-exports behaving differently

velvet jasper
#

fix is in a pr

copper jetty
#

its commented out it doesnt change anything

knotty plover
#

Yeah its just jsdoc

#

But thanks for pointing it out

#

Its a component type for Modals

#

The only supported component type at the moment

velvet jasper
#

Idk about android but it’s supported on iOS

copper jetty
#

yes

#

i think style is 1 or 2, use TextInputStyle enum

#

you can't send empty embeds

knotty plover
#

Nothing that has a label, style, value and placeholder also has a description to my knowledge

#

Its telling you an embed needed a description, not a TextInput

#

no it does not

#

It goes in an ActionRow in a Modal

copper jetty
#

TextInputs don't have descriptions

knotty plover
#

You're not putting them in a Modal

velvet jasper
#

This is the correct one

knotty plover
#

are you attempting to send the modal in a message?

#

as a component?

#

Modals arent components

plain roverBOT
knotty plover
#

Interaction response type

rustic goblet
#

So, idk what happened but i uninstalled and reinstalled djs, and now im getting typescript errors lol
Discord.js version is still the same as before the uninstall (14.0.0-dev.1649505803-3c0bbac), however in my lockfile discord-api-types updated from 0.31.0 to 0.31.1 (Dependency of discord.js)

The error im getting is:

node_modules/discord.js/typings/index.d.ts:2970:14 - error TS2536: Type 'T' cannot be used to index type 'MappedChannelCategoryTypes'.

2970   ): Promise<MappedChannelCategoryTypes[T]>;
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/discord.js/typings/index.d.ts:3008:14 - error TS2536: Type 'T' cannot be used to index type 'MappedGuildChannelTypes'.

3008   ): Promise<MappedGuildChannelTypes[T]>;
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~

Strange thing is obviously that these are djs types and not in my control, but yeah im unable to build my source now

#

"skipLibCheck": true, works as a temp fix but id obviously prefix not to have to do that

knotty plover
#

show code please

#

and the error stack?

#

Not sure if EmbedBuilder needs to be toJSON'd

velvet jasper
#

I mean it shouldn’t make a difference but yeah you don’t have to tojson it

knotty plover
#

config is undefined

#

oh scoping of course

#

why do you have two separate try blocks

copper jetty
#

dont use var

#

use let or const

knotty plover
#

I mean yeah but if you hadnt used var you wouldnt

#

So just keep it in scope

rustic goblet
#

Is there any known issue with the message content intent? I have 4 bots running with the exact same config.
When fetching the same message, 2 of them get the full content, and 2 of them get a result without any content/author/etc.

knotty plover
#

I mean the only issue I can think of there is not having the intent enabled

rustic goblet
#

they all have the intent enabled and selected

#

an error would be thrown if im trying to identify with the intent without having it enabled in the dev panel right

knotty plover
#

and passed in ClientOptions?

#

yes

rustic goblet
#

yup

#

they use the same object of clientoptions lol

knotty plover
#

whats the intents field exactly

rustic goblet
#
export const config: ClientOptions = {
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildScheduledEvents,
    ],
}
copper jetty
#

it looks correct.

rustic goblet
#

yup seeing as 2 of them are able to get the content of the message i doubt its an issue in the config

#

its just very weird that 2 of them consistently cannot get the content

#

its the same 2 bots, persists across restarts too

knotty plover
#

and theyre all on v14/ API v10

rustic goblet
#

i mean unless i have to do something special to get them there, yes

knotty plover
#

thats optional chaining, which is sort of a way

rustic goblet
#

the 4 bots are launched in a for loop with the exact same settings, only the token is different ofc

knotty plover
#

It depends what you intend to do with the access

knotty plover
rustic goblet
#

very weird

#

Tried disabling and re enabling the message content intent in the dev portal as well but didnt change anything either

knotty plover
#

again, please show your code

#

So it doesnt exist because you didnt put a value in it, right?

#

So why dont you typeof it before trying to parseInt it

#

This is just coding basics

#

Check that its defined before trying to use it

#

So pass the false so that it isnt required, or catch that error since its basically already doing the check for you

summer sable
#

Why Type 'ApplicationCommandOptionType.String' is not assignable to type 'ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup | ApplicationCommandOptionType.Channel | ApplicationCommandOptionType.Attachment'?
I need to install another PR?

knotty plover
#

Usually mismatched API types version

summer sable
knotty plover
#

probably not? restart the ts server maybe

summer sable
#

No effect pensivemen

#

Is there a PR for discord-api-types that is on par with discord.js@dev?

idle galleon
#

Do npm why discord-api-types

silver dagger
#

npm why?

silver dagger
#

oh

shadow socket
#

https://srcb.in/30rQz95GHO code

Error: Cannot properly serialize component type: undefined
at createComponentBuilder (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:516:13)
at /workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:529:46
at Array.map (<anonymous>)
at new ActionRowBuilder (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:529:35)
at new ActionRowBuilder (/workspace/node_modules/discord.js/src/structures/ActionRowBuilder.js:8:5)
at /workspace/node_modules/discord.js/src/structures/MessagePayload.js:135:84
at Array.map (<anonymous>)
at MessagePayload.resolveBody (/workspace/node_modules/discord.js/src/structures/MessagePayload.js:135:49)
at ChatInputCommandInteraction.reply (/workspace/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:106:56)
at Object.run (/workspace/slashCommands/CHAT_INPUT/utility/help.js:251:41)

error above, why?

scarlet tangle
#

are default emojis not supported that way anymore?

woeful pollen
#

it's an object iirc

#

{ name: "🎉" }

median jetty
#

how to send components

nocturne kayak
#

same way to v13

naive briar
#

Will it still be possible to do prefix commands in v14?

woeful pollen
#

not recommended, you will need the MessageContent intent

dapper gull
forest elm
#

yes, it will be possible. thats it

#

as long as you have the message content intent

outer bane
scarlet tangle
#

ohh thanks i was on ^14.0.0-dev.1649160496-402514f

#

$tip @outer bane cookie

#

still the same error trollhd

forest elm
#

you didnt show any error, but are you importing the EmbedBuilder from discord.js?

naive briar
#

Only reason why I ask is because unless there's a way to hide certain slash commands and make it viewable to roles like admin. (Yes I know I can just block the commands from roles below but I'd prefer it to be unviewable to lower roles instead of it being listed in the slash commands.)

forest elm
#

that might be possible in the future with command permissions v2

dapper gull
#

Yeah that’s not possible at the moment

naive briar
#

Only reason why I'm still doing prefix commands. xD

dapper gull
#

You and me both, just keep your fingers crossed for a better permissions system in v2 🤞

outer bane
scarlet tangle
slow storm
# scarlet tangle

I had mentioned earlier. Util.parseemoji changes I'd to null and the validation at builder expects a string/undefined I'd which is causing the error. That validation needs a fix

outer bane
#

or the util resolver needs one

#

otherwise you'd have to change typings in builders too

chilly zephyr
#

Does the InteractionCollector also call/trigger "end" if the model was exited through esc for example?

outer bane
#

no, there is no way to detect that

chilly zephyr
#

Alright thank you

chilly zephyr
#

Is there something wrong with this builder?

const commandData = new ErisCommandBuilder().setName("profile").setDescription("Display someone's profile or edit yours.").setCategory("general")
    .addSubcommand(subcommand => subcommand.setName("view").setDescription("View your or someone else's profile.")
        .addUserOption(option => option.setName("member").setDescription("The member who's profile you'd like to see.").setRequired(false)))
    .addSubcommand(subcommand => subcommand.setName("edit").setDescription("Edit your profile.")
        .addStringOption(option => option.setName("modification").setDescription("What about your profile you'd like to edit.").setRequired(true)
            .addChoices([["description", "description"], ["image", "image"], ["color", "color"]])));```
```      CombinedPropertyError: Received one or more errors
          at ObjectValidator.handleIgnoreStrategy (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:973:66)
          at ObjectValidator.handleStrategy (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:907:47)
          at ObjectValidator.run (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:103:23)
          at ArrayValidator.handle (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:394:37)
          at ArrayValidator.parse (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:114:88)
          at MixedClass.addChoices (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:1083:22)
          at D:\PlanetLily\commands\general\profile.js:12:14
          at MixedClass._sharedAddOptionMethod (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:1293:50)
          at MixedClass.addStringOption (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:1282:17) {
        errors: [
          [ 'value', [CombinedError] ],
          [ 'name', [MissingPropertyError] ]
        ]```
nocturne kayak
#

addChoices takes rest param

chilly zephyr
#

Ah like so (?)

nocturne kayak
#

yes

chilly zephyr
#

Gotcha thank you

#

I think it still wants an object: ValidationError: Expected the value to be an object, but received string instead

.addChoices("description", "image", "color")
woeful pollen
#

{ name: "strinf", value: "string" }

chilly zephyr
#

Ah okay, that worked! Thank you

#

Did Constants.APIErrors change in any way? I can't find anything about it but can no longer use UNKNOWN_MESSAGE

wary holly
#

user clicks temporary message button
How to delete the button and open the modal?
(not delete Temporary messages)

velvet jasper
#

This channel is for questions regarding the dev version of djs v14 please use another channel

chilly zephyr
wicked nebula
#

Instead of returning null or undefined, the promise rejects when fetching a message which does not exist. I have code below the fetch to handle a missing message but now it just throws the rejection to my catch block and stops further execution, is this normal?

wicked nebula
#
try {
  for (const x of xArray) {
    const message = await channel.messages.fetch(x);
    if (!message) /** Does not ever reach this code, followed it through debugger**/
  }
} catch(error) {
  // Reaches this
}
outer bane
#

that is expected behaviour, you can handle the "no message" case in the catch block

wicked nebula
#

Why does it not just return undefined? I'd rather keep the catch block for errors.

outer bane
#

because you'd need an additional check after fetching and undefined doesn't convey any information like the error code

wicked nebula
#

Yes but now I have to copy an entire block of code over to the catch block

outer bane
#

what do you need to check if the promise resolves?

wicked nebula
#

What do you mean exactly?

outer bane
#

you said you'd have to copy an entire block of code, what do you do that you have to do in both cases?

#

also if you really need the promise to always resolve you can write your own fetch function which does all of this

wicked nebula
#

Well in this case specifically I first check if the old messages exists, and if it does I can just easily 'copy' the embed that is already on that message to use again. If a user has deleted the message it needs to construct a new one, the output of the if (!message) { } else { }; is later used as embed to send in a channel.

#

In this case it would not be that bad but maybe it would be nice if there was an option that makes it always resolve?

outer bane
#

as I said, wrap the fetch call in your own function which does the try catch

#

or use .catch

wicked nebula
#

Yes I'm going to do that for now, but do you think it is a good idea to include this in djs?

outer bane
#

I think that should be left to the end user, error propagation is a common concept and you loose a lot of information if you just return undefined / null. maybe you want to know if it failed due to a network outage or missing permissions or a deleted message or ...

wicked nebula
#

I'm suggesting an option is added like force and cache, e.g.: <Channel>.messages.fetch(id, { alwaysResolve: true })

outer bane
#

fetch(...).catch(e => { /* handle error, at least log it */ return null; })

#

I don't see how that option would be any different from the above line of code. silencing errors is in general not a good idea

wicked nebula
#

Well not unless your code is designed to expect <Message<boolean>> or undefined

outer bane
#

you can also return undefined from catch

wicked nebula
#

Testing that out right now ^

#

It works

#

Perhaps you can tell it to suppress errors, e.g.: <Channel>.messages.fetch(id, { suppressErrors: [10008] /** Is unknown message **/ })

#

Catch is indeed also a possibility, but would still like prefer this ^^

outer bane
#

you can define a function fn somewhere, handle different errors based on code and do fetch(...).catch(fn)

#

(you should also use dapi-types enums instead of magic numbers)

wicked nebula
#

Yes I know, I was just giving an example

outer bane
#

I still don't think this should be handled at the library level, but feel free to suggest it somewhere

wicked nebula
#

Maybe I'll open an issue on the GH

#

See what others think about it

frigid sleet
#

Hey
I need help, I would like to have the ID of a role, which can be selected with a SlashCommand option, but I always get undefined
Code:

//Slashcommand builder
.addRoleOption(option => option.setName('role').setDescription('The Role').setRequired(true))
//const the role
const word = interaction.options.get('role')
//how i try to get the id:
${word.id}

||I'm asking in v14 because I'm working on v14||

copper jetty
#

getRole()

frigid sleet
#

such small mistakes happen again and again, better if someone else looks over them, thank you

copper jetty
frigid sleet
median jetty
#

code: js let channels = (await guild.channels.fetch()).filter(ch => ch.permissionsFor(guild.me).has('SEND_MESSAGES') && ch.type === 'GUILD_TEXT') // Filters all the channels the bot has send messages perms & is a text channel

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

DiscordAPIError[50035]: Invalid Form Body
channel_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.

forest elm
#

i dont believe that code would have caused that error
but besides, you have to use SendMessages, and for the channel type you have to use ChannelType.GuildText

kindred moss
#

did the author field get removed from Embeds? or is this a bug?

velvet jasper
#

No it’s still there, what does your code look like?

forest elm
kindred moss
#

👍

copper jetty
#

so many bugs...

kindred moss
#

it's a development version, what did you expect?

velvet jasper
#

^

placid stone
#

npm install discord.js@dev

will that be v13 dev or v14 dev

forest elm
#

v14-dev

placid stone
#

So how do I get v13 dev

forest elm
#

there is no npm tag for that

placid stone
#

is modals in v13 main branch?

forest elm
#

youd have to install it from the repository

#

the main branch is v14-dev

placid stone
#

so what command do I run to get v13 main

kindred moss
#

on another note, the "MAX" option seems to be missing from the enum ThreadAutoArchiveDuration. is that also a known bug or is it in a different enum?

forest elm
plain roverBOT
#

<:_:874573940956217415> ThreadAutoArchiveDuration
A number that is allowed to be the duration (in minutes) of inactivity after which a thread is automatically archived. This can be: (more...)

placid stone
forest elm
#

yes

forest elm
placid stone
#

so
npm i https://github.com/discordjs/discord.js/tree/v13

forest elm
#

try it and see

kindred moss
placid stone
#

its working but will that give me what I want?

copper jetty
kindred moss
uncut kelp
#

I think your understanding of it is incorrect?

forest elm
#

it doesnt exist on runtime on the enum, the docs are wrong

uncut kelp
#

We allow sending it. Discord doesn't send it back to us

#

O_o

forest elm
#

okay, they arent "wrong", but discord.js' typedef and the discord-api-types enum arent the same

#

there is no discord.js enum on runtime for it, thats what i meant

plain roverBOT
#

<:_:874573924988518500> (static) Util.resolveAutoArchiveMaxLimit()
Resolves the maximum time a guild's thread channels should automatcally archive in case of no recent activity.

kindred moss
#

thanks

uncut kelp
#

Yay, phew

placid stone
#
TypeError: Discord.ModalBuilder is not a constructor
forest elm
#

you are using unsupported versions

placid stone
#

wdym

copper jetty
#

npm i discord.js@dev

forest elm
#

this is for v14-dev, not the v13 branch from the repo

kindred moss
#

doesn't seem to be in the current dev version yet though :P

placid stone
#

oh so I cant get help

#

dang

uncut kelp
#

Util.resolveAutoArchiveMaxLimit()? That's been out for a longgggg time

copper jetty
uncut kelp
#

Oh it's not in the typings

forest elm
kindred moss
uncut kelp
#

Just // @ts-expect-error, it'll work

#

You'll know when the fix is out because that'll line will error <:

forest elm
#

or you can just pass "MAX" to it

#

without using an enum

uncut kelp
#

Yea that'll work too

chilly zephyr
#

Can I deferReply and show a modal?

forest elm
#

no

chilly zephyr
#

Alright thank you

tropic karma
#

what did exactly mean? EmbedBuilder#setFooter() now accepts a sole FooterOptions object. (add link to dapi site) i get this error if i put footertext and footericon

kindred moss
cerulean bay
#

I'm receiving messages (probly partial) where message.author is null. Is that normal? I logged the Message and this is it.

knotty plover
cerulean bay
#

In partial messages, aren't we suppose to still get the authorid?

knotty plover
#

Not according to the docs, Message#author is marked as nullable/optional

cerulean bay
#

I just rechecked my code. What i'm doing is if the message is partial, (in message update), i fetch the message from the id. Seems like it's now fetching properly. I will need to do more test i guess

knotty plover
#

Whats the point of doing that...

cerulean bay
#

To get the author

knotty plover
#

In messageUpdate the new message isnt ever partial, and the old one can't be fetched otherwise you just get the new one again

cerulean bay
#

Maybe i'm wrong on what i'm doing. Let me recheck 😂

knotty plover
#

The only message in messageUpdate that can be partial is the old/previous state

#

But you cant fetch that - its old

forest elm
cerulean bay
#

Ho, i think i'm doing it in messageReactionAdd

knotty plover
#

Ahh okay fair enough

knotty plover
forest elm
#

you wont receive the event at all if you dont have the intent

knotty plover
#

The MessageContent intent?

forest elm
#

that doesnt affect the author

#

content is already nullable nvm, its isnt

knotty plover
#

I never said it effects the author, it effects the message typing

#

being Partial

forest elm
#

but you should still have everything apart from the content fields?

uncut kelp
#

I'm pretty sure if an uncached message event is updated, the new message will still have some null stuff?

knotty plover
#

Discord docs say MESSAGE_UPDATE might not send a full message

forest elm
#

so what, if you dont use the messagecontent intent every message you receive will be partial?

knotty plover
#

But in practice it always used to

knotty plover
#

Partial = not complete

#

Fields missing = not complete

#

Fields missing = partial

#

Unless we want to treat them as a "complete" message with null fields

#

Partials are kinda a messy area as it is

plain roverBOT
#

<:_:874573879153160212> Embed#fields
An array of fields of this embed

plain roverBOT
rain reef
#

Will v14 use the permissions system v2?

#

Or not yet

scarlet tangle
#

not yet. it is still not released

tepid gust
#

just started getting this error after updating discord.js@dev (as far as i know), anyone else have this issue?

nocturne kayak
#

send code

tepid gust
#

that is the code, it runs right after client ready event

nocturne kayak
#

function/timeloop.js

tepid gust
#

it's just a chain of async functions called after ready that lead up to that buttonbuilder

knotty plover
#

theres a known bug with setEmoji right now

#

Not sure if this is it though

#

Yeah this is new

knotty plover
tepid gust
#

yep that seems to fix it, should i make a bug report for it?

knotty plover
#

I'll fix it now in a PR

tepid gust
#

cool cool, thanks!

rain reef
knotty plover
#

There was actually already a PR pending oerge

#

Merge

pearl mantle
#
TypeError: Cannot destructure property 'emoji' of 'undefined' as it is undefined.
    at new ButtonBuilder (C:\Users\Jan\OneDrive\Dokumente\LDVoice\node_modules\discord.js\src\structures\ButtonBuilder.js:8:17)
    at C:\Users\Jan\OneDrive\Dokumente\LDVoice\interactions\slash\setup\setup.js:109:29
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.execute (C:\Users\Jan\OneDrive\Dokumente\LDVoice\interactions\slash\setup\setup.js:102:27)
    at async Object.execute (C:\Users\Jan\OneDrive\Dokumente\LDVoice\events\slashCreate.js:37:4)
    at async Client.<anonymous> (C:\Users\Jan\OneDrive\Dokumente\LDVoice\bot.js:63:23)
#

Can you help me with this one?

sterile hemlock
#

read like the last 10 messages lol. good timing

pearl mantle
#

oh

#

xd thank you

#
C:\Users\Jan\OneDrive\Dokumente\LDVoice\node_modules\discord.js\src\structures\Webhook.js:203
    const query = makeURLSearchParams({
                  ^

TypeError: makeURLSearchParams is not a function
    at InteractionWebhook.send (C:\Users\Jan\OneDrive\Dokumente\LDVoice\node_modules\discord.js\src\structures\Webhook.js:203:19)
    at ChatInputCommandInteraction.followUp (C:\Users\Jan\OneDrive\Dokumente\LDVoice\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176:25)
    at Object.execute (C:\Users\Jan\OneDrive\Dokumente\LDVoice\interactions\slash\setup\setup.js:143:21)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.execute (C:\Users\Jan\OneDrive\Dokumente\LDVoice\events\slashCreate.js:37:4)
    at async Client.<anonymous> (C:\Users\Jan\OneDrive\Dokumente\LDVoice\bot.js:63:23)
#

Another one i can't fix somehow

#

Already worked on the new version

#

But not it doesn't work anymore

rain reef
#

Error at line 63 in bot.js file

#

If you pay attention to the error you will see the problem

tulip valve
#

What can mean
TypeError: Cannot destructure property 'options' of 'undefined' as it is undefined.
in 14.0.0-dev.1649808570-01a423d?

knotty plover
#

Stack please? could be a known issue

#

Were you trying to build a SelectMenu?

tulip valve
knotty plover
#

Pass {} to the constructor to temporary fix it

tulip valve
woeful pollen
#

new SelectMenuBuilder({}).addOptions(...)

spice vector
#

.

kindred moss
#

I'm getting the same error when showing a modal, but the latest release should already contain this fix/PR (?)
Error: Cannot properly serialize component type: undefined

wicked tusk
tame gazelle
#

get the channel in the interactionCreate event and send it there

wicked tusk
#

yea ik like message.channel.send but what do i send?

scarlet tangle
#

modals are only available in interaction replies iirc

kindred moss
#

how are you able to show it in the first place?

wicked tusk
#
module.exports = async (client) => {
    const bugChannel = "955208454774063214";


const modal = new Modal() // We create a Modal
.setCustomId('modal-customid')
.setTitle('Test of Discord-Modals!')
.addComponents(
  new TextInputComponent() // We create a Text Input Component
  .setCustomId('textinput-customid')
  .setLabel('Some text Here')
  .setStyle('SHORT') //IMPORTANT: Text Input Component Style can be 'SHORT' or 'LONG'
  .setMinLength(4)
  .setMaxLength(10)
  .setPlaceholder('Write a text here')
  .setRequired(true) // If it's required or not
);

client.on('interactionCreate', (interaction) => {
    if(!interaction?.isButton()) return;
    const { member, channel, message } = interaction;
  if(channel.id == bugChannel && interaction?.customId == "bugModal") {
    showModal(modal, {
      client: client, 
      interaction: interaction 
    })
  }
  
});
}
tame gazelle
#

I think it's a third-party package

wicked tusk
#

where do i find the real package?

tame gazelle
#

well, it's discord.js

scarlet tangle
wicked tusk
tame gazelle
#

I meant

plain roverBOT
#

We do not provide any help with third party libraries like discord-buttons.
• Discord.js supports buttons natively: guide

wicked tusk
scarlet tangle
#

We don't help with any libraries other than djs

tame gazelle
wicked tusk
#

ah okay wait a sec

tame gazelle
#

no need to use another package for that

wicked tusk
#

if i do const { Modal, TextInputComponent, showModal } = require("discord.js");
const modal = new Modal() // We create a Modal
^

TypeError: Modal is not a constructor

chilly zephyr
#

You need to make a ModalBuilder

#

Make sure you're on the dev build of course

wicked tusk
#

a okay

#
const { Modal, TextInputComponent, showModal, Discord, ModalBuilder  } = require("discord.js");
module.exports = async (client) => {
    const bugChannel = "955208454774063214";




client.on('interactionCreate', (interaction) => {
    if(!interaction?.isButton()) return;
    const { member, channel, message } = interaction;
  if(channel.id == bugChannel && interaction?.customId == "bugModal") {
    const modal = new ModalBuilder()
    .setCustomId('modal-customid')
    .setTitle('Test of Discord-Modals!')
    .addComponents(
      new TextInputComponent() // We create a Text Input Component
      .setCustomId('textinput-customid')
      .setLabel('Some text Here')
      .setStyle('SHORT') //IMPORTANT: Text Input Component Style can be 'SHORT' or 'LONG'
      .setMinLength(4)
      .setMaxLength(10)
      .setPlaceholder('Write a text here')
      .setRequired(true) // If it's required or not
    );
    showModal(modal, {
      client: client, // Client to show the Modal through the Discord API.
      interaction: interaction // Show the modal with interaction data.
    })
  }
  
});
}
const modal = new ModalBuilder()
              ^

TypeError: ModalBuilder is not a constructor

wicked tusk
#

yea did that but now

        Discord.Intents.FLAGS.GUILDS,
                        ^

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

should i define client different?

tame gazelle
#

read the guide

#

pins

wicked tusk
#

if v14 only working with interactions?

chilly zephyr
#

No the stable versions work with interactions too but only the dev branch currently has modals

wicked tusk
#

and message and stuff ?

dawn phoenix
#

you can receive message via the "messageCreate" client event, provided you

  1. have the intent (dev dashboard/verification request, if verified bot)
  2. set the intent in client settings (in your code)
kindred moss
chilly zephyr
#

Many people use them, they work fine. Even if they don't, that's why it's the dev branch tlxCheckPins

wicked tusk
dawn phoenix
#

do not see a message content intent anywhere

tame gazelle
#

also GuildMessages no?

wicked tusk
#

oh true

dawn phoenix
#

right, not even that one

wicked tusk
#

D_MEMBERS, Discord.Intents.FLAGS.GUILD_MESSAGES], partials: [Partials.Channel] });
^

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

whats wrong with FLAGS, this also not working anymore?

#

ah nvm it's Flags right?

chilly zephyr
#

It changed to GatewayIntentBits

tame gazelle
wicked tusk
#

thanks

chilly zephyr
wicked tusk
#

var embed1 = new Discord.MessageEmbed()
^

TypeError: Discord.MessageEmbed is not a constructor

so messageEmbed not working anymore i guess?

wicked tusk
#

no modal it's just a help comand

chilly zephyr
#

Oh forgive me

#

Updated the link

wicked tusk
#

ah so i have to change the name from MessageEmbed to EmbedBuilder right?

chilly zephyr
#

Yeah that's all

wicked tusk
#

thank you sir at least someone helping here 🙏

chilly zephyr
#

If you go to the docs you can change the branch to main as well, that's where the WIP docs go to as well so you can find Modal stuff if you search through the main branch

wicked tusk
#

ah great

#

whats with this one now?

  constructor({ emoji, ...data }) {
                ^

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

can't find anything about this

copper jetty
wicked tusk
copper jetty
#

Yes

wicked tusk
copper jetty
#

Yes

wicked tusk
#

jeez what is this

                                                                     ^

CombinedPropertyError: Received one or more errors
    at ObjectValidator.handleStrictStrategy (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:998:70)
    at ObjectValidator.handleStrategy (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:910:47)
    at ObjectValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:951:17)
    at ObjectValidator.parse (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:114:88)
    at ButtonBuilder.setEmoji (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@discordjs\builders\dist\index.js:593:42)
    at ButtonBuilder.setEmoji (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\structures\ButtonBuilder.js:21:20)
    at swap_pages2 (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\utilfunctions.js:978:92)
    at Object.run (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\commands\Information\help.js:29:5)
    at Client.<anonymous> (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\commands.js:101:29)
    at Client.emit (node:events:402:35) {
  errors: [
    [
      'id',
      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.run (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:103:23)
          at ObjectValidator.handleStrictStrategy (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:983:40)
          at ObjectValidator.handleStrategy (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:910:47)
knotty plover
#

pass it as {id: "833802907509719130" }

wicked tusk
#

i don't know even which id is meant
.setCustomId('1') ?

#

ah the emoji+

#

so like .setEmoji({id: "833802907509719130"})

knotty plover
#

yeah

wicked tusk
#

could anyone tell me what is jesus christs name this is?

components: this.components.map((component) => component.toJSON())
                                                               ^

TypeError: component.toJSON is not a function

i've never had that error before

kindred moss
wicked tusk
#

yea like this? const allbuttons = [new ActionRowBuilder({}).addComponents([button_back, button_home, button_forward])]

tame gazelle
#

.addComponents doesn't take an Array

#

do const allbuttons = [new ActionRowBuilder({}).addComponents(button_back, button_home, button_forward)]

wicked tusk
#

now it gives me DiscordAPIError[50035]: Invalid Form Body

where do i see how to make an embed in v14?

chilly zephyr
#

Nothing else has changed

wicked tusk
#

its something with the components
DiscordAPIError[50035]: Invalid Form Body
components[0].components[1].emoji.id[NUMBER_TYPE_COERCE]: Value "🏠" is not snowflake.
at SequentialHandler.runRequest (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@discordjs\rest\dist\index.js:714:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@discordjs\rest\dist\index.js:517:14)
at async TextChannel.send (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15)
at async swap_pages2 (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\utilfunctions.js:983:19) {
rawError: {
code: 50035,
errors: {
components: { '0': { components: { '1': [Object] } } }

tame gazelle
#

name not id

devout narwhal
#

Just to confirm, GUILD_PRIVATE_THREAD should be GuildPrivateThread right

wicked tusk
tame gazelle
#

yes

devout narwhal
#

And would these also be pascalCase (scheduled events)

tame gazelle
#

nope you have to use enums

devout narwhal
#

Alright, thanks

wicked tusk
# tame gazelle yes

throw new DiscordAPIError(data, "code" in data ? data.code : data.error, res.status, method, url, requestData);
^

DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
components[0].components[2].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji

    let button_back = new ButtonBuilder({}).setStyle(ButtonStyle.Primary).setCustomId('1').setEmoji({name:"833802907509719130"}).setLabel("Back")
    let button_home = new ButtonBuilder({}).setStyle(ButtonStyle.Danger).setCustomId('2').setEmoji({name:":house:"}).setLabel("Home")
    let button_forward = new ButtonBuilder({}).setStyle(ButtonStyle.Primary).setCustomId('3').setEmoji({name:"832598861813776394"}).setLabel("Forward")

i did name like you said

tame gazelle
#

.setEmoji({ name: '🏠' })
.setEmoji({ id: '832598861813776394' })

wicked tusk
#

ah okay that makes sense

#

whats wrong with filter?

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

TypeError: Cannot read properties of undefined (reading 'filter')
tame gazelle
#

code

wicked tusk
#

huh

tame gazelle
#

what's the code that is causing this error?

wicked tusk
#
    client.on("ready", async () => {
        //get the right guild
        let guild = client.guilds.cache.get(guildId)
        if(!guild) return;
        //fetch all members of that guild
        let aM = await guild.members.fetch().catch(()=>{})
        //get the memberswho need the role, because they have the right status but not the the role yet
        let members_who_need = [...aM.filter(m => 
            !m.user.bot && !m.roles.cache.has(roleId) &&
             m.presence && m.presence.activities.some(({ state }) => state?.includes(textInStats) || state?.includes(textInStats2))
        ).values()];
        //get the members who have the aM, but not the right status
        let members_who_remove = [...aM.filter(m => 
            !m.user.bot && !m.roles.cache.has(roleId) &&
            (!m.presence || !m.presence.activities.some(({ state }) => state?.includes(textInStats) || state?.includes(textInStats2)))
        ).values()];
        //add the roles for those who needs it
        for(const m of members_who_need){
            await m.roles.add(roleId).catch(() => {});
            await delay(350); //wait 0.35 secs
        }
        //remove the roles for those who needs it
        for(const m of members_who_remove){
            await m.roles.remove(roleId).catch(() => {});
            await delay(350); //wait 0.35 secs
        }
    })
wicked tusk
#
else if (cmd == "setupbug") {
                        if (message.member.permissions.has("ADMINISTRATOR")) {
                            let embed = new EmbedBuilder()
                            .setTitle("Ticket Support")
                            .setDescription(`If you need **help**, select your concern down below.`)
                            .setColor(client.config.color)
                            const button = new ButtonBuilder()
                            .setCustomId('bugModal')
                            .setLabel('Report Bug')
                            .setStyle(ButtonStyle.Primary)

                            let row2 = new ActionRowBuilder().addComponents(button)
                            message.channel.send({
                                embeds: [embed],
                                components: [row2]
                            });
                        } else {
                            message.reply("no Valid Permissions")
                        }
                    }

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

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

#

there is no emoji so why this error?

scarlet tangle
#

tbh you are asking a lot of questions unrelated to the dev version here

#

some not even related to d.js

haughty lava
#

btw how to get discordjs/builders dev version ?

scarlet tangle
#

@discordjs/builders@dev

haughty lava
#

but the typings are broken

wicked tusk
scarlet tangle
outer bane
wicked tusk
wicked tusk
#

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

How do i get the Input now and send it to a channel?

#

with Args?

plain roverBOT
scarlet tangle
#

where is problem? "discord.js": "^14.0.0-dev.1649808570-01a423d"

woeful pollen
scarlet tangle
#

👌

woeful pollen
#

it's a known issue, will be fixed soon

scarlet tangle
#

ok

median jetty
#

code: js let channels = (await guild.channels.fetch()).filter(ch => ch.permissionsFor(guild.me).has('SEND_MESSAGES') && ch.type === 'GUILD_TEXT') // Filters all the channels the bot has send messages perms & is a text channel

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

DiscordAPIError[50035]: Invalid Form Body
channel_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.

uncut kelp
#

Have a slight suspicion they're on 13.7-dev

#

It's just very slight, like... super slight

regal mason
#

How to build an actionRow with buttons in ? I'm having trouble to do that

woeful pollen
#

what's the error?

regal mason
kindred moss
#

using DataResolver.resolveFile() throws an ExperimentalWarning. is that intended? and can you disable that warning somehow? I can't find a --experimental flag for this

stiff pivot
#

Hi guys, why when do client.guilds.fetch(ID) i've this format ?

  '644238052062920705' => OAuth2Guild {
    id: '644238052062920705',
    name: 'Discord DEV',
    icon: 'dc83fd81e2db474ab856e5ec8afa5156',
    features: [],
    owner: false,
    permissions: PermissionsBitField { bitfield: 1071698665025n }
  }
scarlet tangle
stiff pivot
scarlet tangle
#

show code

gloomy kayak
scarlet tangle
#

make sure the code in some event (after ready event)

stiff pivot
#
                    const guild = await client.guilds.cache.get(lfg.message.guild); // "lfg.message.guild" return good id

kindred moss
scarlet tangle
stiff pivot
forest elm
scarlet tangle
regal mason
forest elm
#

pass MessageActionRowComponentBuilder as the first generic parameter of ActionRowBuilder

stiff pivot
stiff pivot
scarlet tangle
#

that's not how it works

#

lfg.message.guild should be a string to begin with, not converted to a string

stiff pivot
#

But when fetch, the id is'nt problem

scarlet tangle
#

are you sure the id is correct and same

#

even fetch checks cache first

stiff pivot
#

i've say nothing it's the number thx men

gloomy kayak
devout narwhal
#

I'm probably missing something obvious, I set this as the type when creating a thread: ThreadChannelTypes.GuildPrivateThread. Its not working so I'm assuming its wrong, what would be the correct version?

#

This is the error:

Cannot read properties of undefined (reading 'GuildPrivateThread')```
forest elm
#

by doing what i sent before that

devout narwhal
forest elm
devout narwhal
#

Thanks!

hoary fox
forest elm
#

or GuildScheduledEventPrivacyLevel

devout narwhal
#

Thanks as well

wary holly
#

Suppose I set the vetting channel and save it to the database
Do I want to encrypt? Or save the ID directly?

scarlet tangle
#

what intents do i need to use the guildMemberUpdate event?

vague coyote
scarlet tangle
#

thx bro

brave dagger
#

what is the way to build a select menu (or anything else) in this version?

brave dagger
#

What's wrong here?

const rolesOptions = interaction.guild.roles.cache.map(role => { return { label: role.name, value: role.id } });
        rolesOptions.slice(0, 25);
        const selectMenu = client.functions.selectMenu("Chose roles")
            .setCustomId('roleId')
            .setOptions(rolesOptions)
            .setMaxValues(rolesOptions.length);
selectMenu: placeHolder => {
        return new SelectMenuBuilder().setPlaceholder(placeHolder);
    }

feelsTenseMan

urban belfry
brave dagger
#

didn't understand what he doesn't like

urban belfry
#

also what's that slice doing there?

#

slice retunrs a new array and doesn't modify modify the original
are you looking for splice?

brave dagger
brave dagger
scarlet tangle
#

where can i find the docs of discord.js@dev?

brave dagger
#

can I do something like

.setEmoji({ id: null, name: '📩' });

On a Button?

devout narwhal
#

How would I get the value of a select menu when a modal is submitted? All I need to know is what is after interaction.fields for select menus

scarlet tangle
#

What is this error? it is coming from another package, but it is from Discord.js

Error: Received one or more errors
outer bane
outer bane
outer bane