#djs-in-dev-version

1 messages · Page 19 of 1

jaunty vault
#

maybe it's the fact that I changed the createComponent thing to createComponentBuilder? I forgot to mention that. Is that the problem maybe? Did I do it wrong?

@sacred eagle

outer bane
#

yes, that would explain why you get builders in received data

jaunty vault
glacial island
#

How do you update to v14

vague coyote
#

pins

glacial island
#

And is there docs or anything for it yet?

vague coyote
#

pins

glacial island
#

I dont see the changes

vague coyote
#

then you must look closer, there is a big ass guide preview pinned

glacial island
#

Why do you got to be so hasty

vague coyote
#

if we would explain that to everyone who asks, we would not be able to do anything else

brave mulch
#

what happened to

Embed.setDescription()```
vague coyote
#

EmbedBuilder

steel lance
#

hello for some reason message content is empty

vague coyote
#

you need the MessageContent intent

#

yall forgot about that? dead

steel lance
#

i have it enabled

vague coyote
#

enabling is just half of it

#

you also need to have it in your client constructor

steel lance
#

i have GuildMessages enabled

vague coyote
#

Again, MessageContent

steel lance
#

oh

vague coyote
#

which you need to import from discord-api-types but v10 instead of v9

steel lance
#

alr ty

glacial island
#

does anyone know what would be cuasing this problem?

    this.components = data.data.components?.map(c => createComponent(c)) ?? [];
                                                     ^

TypeError: createComponent is not a function
vague coyote
glacial island
#

wdym pr

dark light
#

pull request on github

woeful pollen
#

pull request

glacial island
#

o

#

is there any known time when it will be fixed?

woeful pollen
#

when the pr is merged

long narwhal
glacial island
#

so it has been fixed just not merged yet?

long narwhal
#

it isn't really "fixed", it just has an open solution

glacial island
#

oh ok

sharp rampart
#

Is there any reason why my component only has these two attributes?

uncut kelp
#

a component. From that screenshot, there is no information to narrow anything down

sharp rampart
#
async execute(interaction: ButtonInteraction): Promise<void> {
    if (!interaction.client.user || !interaction.client.application || !interaction.guild || !interaction.channel) {
        return;
    }

    // Does not show label property but logs the following:
    console.log(interaction.message.components[0].components[0]);
},
{
  custom_id: "upvote|2",
  emoji: { id: "959512287130042418", name: "24" },
  label: "0",
  style: 1,
  type: 2
}
idle galleon
#

It doesn't know that the component is a SelectMenu ig

knotty plover
#

Doesn't interaction.component exist

#

That should know the correct typing

kindred kite
#

how woudl i get all vcs my bot is in?

next gull
#

``` throw new Error(Found unknown component type: ${data.type});
^

Error: Found unknown component type: 4```

knotty plover
#

That suggests you're not actually on the dev release because it's erroring on a text input

latent lion
#

Why is message.content a empty string

idle galleon
#

Most likely bc you didn't enable the MessageContent intent in the code

latent lion
#

How do you enable

#

I have 32767 intent

fallow steppe
#

Is it possible to get all members of a guild? AFAIK, with WS you can .members.fetch(). How is this done with REST? Is REST limited to 1,000 at a time?

plain roverBOT
idle galleon
#

@fallow steppe

idle galleon
#

The number you used doesn't include the MessageContent intent

#

It's why prefer to just the enums instead of magic literals

fallow steppe
#

I run a very large scam list (it's a gaming bot) that periodically scans an entire members list and compares it to the scam list to notify the admins

#

IDK if this is the best approach, but made a recursive function for it. 🤷

async function getGuildMembersAll(
  guildId: Snowflake,
  after?: Snowflake,
): Promise<RESTGetAPIGuildMembersResult> {
  const apiGuildMembers = await rest.get(
    Routes.guildMembers(guildId),
    {
      query: new URLSearchParams({
        ...after !== undefined ? { after } : {},
        limit: '1000',
      }),
    },
  ) as RESTGetAPIGuildMembersResult;

  return apiGuildMembers.length === 1_000
    ? [
      ...apiGuildMembers,
      ...await getGuildMembersAll(guildId, apiGuildMembers.at(-1)!.user!.id),
    ]
    : apiGuildMembers;
}
spare fiber
#

use ws if you want more than 1000, or if in djs manager GuildMemberManager#fetch()

fallow steppe
#

Unfortunately, with the size of my bots and their general purpose - responding to slash commands/context menus with dynamic images - using DJS' WS is just a waste of resources — even after all of the custom cache features.

Since switching to Fastify/HTTPS interactions only, and using REST, I can now nicely serve a couple hundred K servers with less RAM and resources than my laptop is using RN for the Discord client - currently a small 96MB RAM, for example.

This is the only situation thus far where WS would be beneficial.

knotty plover
#

I have to like, hugely disagree there

#

If one of its jobs is scanning an entire member list that's far better served with caching and gateway, not http interactions

#

Monitor guildMemberAdd and you don't even have to fetch and scan periodically

tardy charm
#

In previous version we can fetch the message and get it's embed then only edit certain part of the embed but it's not possible in dev version

#

Do i really need to recreate whole embed again

pallid ice
#

you can recreate the embed using the data of the API embed

#

with whatever changes you need to make to it

tardy charm
#

in ImageUrlOptions dynamic: true is not working

#

while the interface has dynamic

#

extension and size is working just fine

idle galleon
tardy charm
#

I see.

#

then why interface still has it

idle galleon
#

Enable forceStatic to override this

#

Idk, looking at old code?

#

Or prob looking at the wrong rest package version

tardy charm
#

yeah i think i need to restart my IDE

fallow steppe
dark crest
#

hi

#

how can i send a video with a text?

#

with MessageAttachment?

knotty plover
#

Yep, attach the video

dark crest
#

ohh thx

ripe hollow
#

Hello,
I have a error,

const { Client, Intents, MessageEmbed, MessageActionRow, MessageSelectMenu, MessageButton, MessageAttachment } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS] });
const client = new Client({ intents: [Intents.Flags.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS] });
                                              ^

TypeError: Cannot read properties of undefined (reading 'Flags')
nocturne kayak
#

IntentsBitfield

ripe hollow
#

?

nocturne kayak
#

Intents => IntentsBitfield

ripe hollow
#

Like that ?

#
const { Client, IntentsBitfield, MessageEmbed, MessageActionRow, MessageSelectMenu, MessageButton, MessageAttachment } = require('discord.js');
const client = new Client({ intents: [IntentsBitfield.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS] });

nocturne kayak
#

ofc you have to change all occurrences of Intents to IntentsBitfield

ripe hollow
#
const client = new Client({ intents: [IntentsBitfield.FLAGS.GUILDS, IntentsBitfield.FLAGS.GUILD_MESSAGES, IntentsBitfield.FLAGS.GUILD_MEMBERS, IntentsBitfield.FLAGS.GUILD_VOICE_STATES, IntentsBitfield.FLAGS.GUILD_MESSAGE_REACTIONS] });  
                                                      ^

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

IntentsBitField
sorry

ripe hollow
#

Ok ok
But I have a new error kek

const client = new Client({ intents: [IntentsBitField.FLAGS.GUILDS, IntentsBitField.FLAGS.GUILD_MESSAGES, IntentsBitField.FLAGS.GUILD_MEMBERS, IntentsBitField.FLAGS.GUILD_VOICE_STATES, IntentsBitField.FLAGS.GUILD_MESSAGE_REACTIONS] });  
                                                            ^

TypeError: Cannot read properties of undefined (reading 'GUILDS'
plain roverBOT
pallid ice
small mica
#
options: [
    {
        name: 'create',
        description: "Create a custom slash command!",
        type: ApplicationCommandOptionType.Subcommand,
        options: [
            {
                name: "name",
                description: "Name of the custom slash command",
                type: 'STRING',
                required: true,
            },
            {
                name: "response",
                description: "Response of the custom slash command",
                type: 'STRING',
                required: true,
            }
        ],
    }, 
     
    
  ],```
This is my slash command options structure. In `type: 'STRING',` what shud it be? `ApplicationCommandOptionType` only?
knotty plover
#

Yeah, enums only

hexed tapir
knotty plover
#

You could but bad practice, that's why enums exist

small mica
#

Why isn't getString shown?

#

Is it renamed or something?

knotty plover
#

No

tropic raven
#

trying typing it manually

knotty plover
#

Intellisense isnt documentation

tropic raven
#

yeah intelisense does that a lot to me, and then when i fully type it out then it starts working. its like it hasn't cached it or smth

knotty plover
#

You haven't typeguarded the interaction either

small mica
#

typegaurded?

#

oh yes

#

well that still doesn't show getString

knotty plover
#

Just type it out

small mica
#

Yeah I did that but I thought it was removed so it isn't shown. Thanks

hexed tapir
knotty plover
#

Because magic numbers mean nothing to the developer in code. And if Discord ever changes the numbers (they probably wouldn't) it would break, but we can update the enum and you don't have to change your code

scarlet tangle
#

why is this change?? EnumResolvers.resolveButtonStyle('PRIMARY'); this is just bloating the code, long lines for no reason

#

or we need to include billion type exports just to get basic values

#

terrible

outer bane
#

known bug

knotty plover
#

There's nothing wrong with imports

scarlet tangle
#

"PRIMARY" is enum and clearly I cant use it

knotty plover
#

No that's a string

#

Not an enum

scarlet tangle
#

string representating enum

scarlet tangle
tame gazelle
#

just import ButtonStyle

tame gazelle
scarlet tangle
#

ah overlooked

knotty plover
scarlet tangle
#

there is no such thing as enum in js either its "just" an object

knotty plover
#

It serves the same purpose, replacing magic strings and numbers

scarlet tangle
#

strings are descriptive, its not magic string. anyway i wont argue with you. How can I set "RANDOM" embed color? Colors "enum" doesnt have Random || the worst, most annoying to use version so far||

#

😦 why there is no EmbedBuilder.addField(...) again making stuff complicated

outer bane
#

because addFields can also take a single field

knotty plover
#

Two methods that can do the same thing is more complicated than one

scarlet tangle
#

yes but from one liner its 5-7 liner

#
.addFieldd([
                { 
                    name: 'Price',
                    value: `${price}`, 
                    inline: true
                }
            ])
.addField('Price', `${price}$`, true)
outer bane
#

you can also write the first statement in one line. shorter code =/= better code

#

addFields also takes rest params, no need for the array brackets

hexed tapir
knotty plover
#

Yes, we made that improvement to remove an issue from our previous version

hasty gorge
#

Anybody knows why i get this issue?

0.options[0].type[NUMBER_TYPE_COERCE]: Value "STRING" is not int.
tame gazelle
#

use enums

hasty gorge
#

it even shows that type is an int

tame gazelle
hasty gorge
#

OH, nvm. Its the options type not the command type

dark crest
#

guys,i have the next code: ```js
client.on('messageCreate', async msg => {
if (msg.content.startsWith("!Hit ")) {
const mention = await msg.content.slice(5);

    if (mention.startsWith('<@') && mention.endsWith('>')) {
        const file = new MessageAttachment('./media/hit1.jpg');
        const embed = new MessageEmbed()
            .setTitle("Example")
            .setImage('./media/hit1.jpg')

        msg.reply({ embeds: [embed], files: [file] });
    }
}

})``` the problem is that the message don't appear

hasty gorge
#

i keep getting this error when sending a modal, anybody knows why? I can show code if necessary

scarlet tangle
#

How do you set emoji to a button? the zod errors are not helpful at all

hasty gorge
scarlet tangle
#

no its my own question 🙂

scarlet tangle
forest elm
#

actually the latest dev should support strings, show your code

scarlet tangle
#
const row = new ActionRowBuilder().addComponents(
                new ButtonBuilder({
                    emoji: `:upvote:`,
                    style: Discord.ButtonStyle.Primary,
                    custom_id: 'suggest_upvote'
                }),
                new ButtonBuilder({
                    emoji: `:downvote:`,
                    style: Discord.ButtonStyle.Primary,
                    custom_id: 'suggest_downvote'
                }),
                new ButtonBuilder({
                    emoji: '📝',
                    style: Discord.ButtonStyle.Secondary,
                    custom_id: 'suggest_note'
                })
            )
#

this is what I have there, discord converts it back so its just :upvote:

nocturne kayak
#

gotta use the emoji id
if you want custom emojis for your components

forest elm
#

oh you're using the constructor, it doesn't support strings yet

scarlet tangle
# scarlet tangle

Parse emoji is broken, in v13 it works by providing this. Util.parseEmoji doenst parse that string, only emoji ID...

hasty gorge
forest elm
scarlet tangle
#

actionRowBuilder.addComponents doenst work when passing an array of components, only when passing each component as separate parameter

forest elm
#

correct

scarlet tangle
#

its a bug

nocturne kayak
#

it isnt
just use rest param

scarlet tangle
#

ButtonBuilder.setEmoji('emojID') still doesnt work

#

it expects object

tame gazelle
#

try .setEmoji({ id: 'id' })

forest elm
scarlet tangle
#

I installed it 3 hours ago

scarlet tangle
forest elm
#

{ name: 'unicode emote' }

scarlet tangle
#

yea got it

#

hope this will be changed in the full release

forest elm
#

it was

#

are you using the builder from discord.js or builders

scarlet tangle
#

djs builders, tbh i dont know where I'm supposed to use it from anymore, its huge mess

forest elm
#

the discord.js one supports strings in setEmoji()

knotty plover
#

I do think we need better guides on the changes and how to use them

scarlet tangle
#

Why I cant use message.embeds[0].setDescription(...) ?
let me guess because its not EmbedBuilder but just Embed?

forest elm
#

everything was just poorly planned, and having the "reexported" builders behave differently than the ones from /builders is rather confusing

scarlet tangle
#

🤮

#

what has been done to this lib 😦

nocturne kayak
#

just construct a new EmbedBuilder
pretty much 1 line for you

tame gazelle
#

will new EmbedBuilder(Embed) work?

nocturne kayak
#

no

scarlet tangle
#

but why? why it cant be EmbedBuilder already? or why is this one step required?

nocturne kayak
#

new EmbedBuilder(<Embed>.toJSON()) should work

scarlet tangle
forest elm
forest elm
scarlet tangle
#

like?

forest elm
#

what

knotty plover
knotty plover
forest elm
#

... which invalidates the cache as it doesnt represent the original message anymore

scarlet tangle
#

yes I'm aware of that, i wanted to update the same message tho so in the end it wouldnt matter but okay

#

in other cases it is good

scarlet tangle
forest elm
#

the whole message

scarlet tangle
#

we're talking about Embed class not Message

knotty plover
#

The embed is just part of the message API data

scarlet tangle
#

okay

so are the djs builders be part of djs? or do I still keep them? and do I use the ones from djs or djs builders package?

#

its kinda nonsense to have them duplicated, as I see ButtonBuilder in djs and djs builders but SlashCommandBuilder is only in djs builders

#

Hey guys, I've moved from a js to ts and I have a problem with sending a message lmao

What's wrong here?
(client.channels.cache.get('951933757768753152') as TextChannel).send('sadasd')

getting a TypeError: Cannot read properties of undefined (reading 'send') error
tried almost everything D:

tame gazelle
#

bad ID?

scarlet tangle
#

nah, checked it

dawn phoenix
#

wrong id, trying to access it before ready/swept it manually, not in a server the bot is on

knotty plover
dawn phoenix
#

why? if you want to access channels you need to wait until the client has channels
the earliest is "ready", but you can use any event that emits after that as well, of course

hasty gorge
#

hey, for some reason my bot's activity doesnt get set anymore, only the status does, the activity doesnt. Is this a common issue? I am using <client>.user.setPresence()

scarlet tangle
#

EmbedBuilder.from() does not exist in djs builders@ dev but it is in djs@ dev

undone yew
#

How to fix?

tame gazelle
undone yew
#

.addOptions([])

tame gazelle
#

remove []

nocturne kayak
#

that or just use rest operator

tame gazelle
#

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

undone yew
#

Its loaded 2

#
                await rest.put(GUILD_ID ? Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID) : Routes.applicationCommands(CLIENT_ID), { body: slashCommands });

my code

tame gazelle
#

you wanna use global or guild commands?

undone yew
#

Global

tame gazelle
#

await rest.put(Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID), { body: [] });

#

this will remove all guild commands

undone yew
#

oh thanks

undone yew
#

I have created a SelectMenu, but I want to do how to send a message. how will I do?

tame gazelle
#

do what?

undone yew
#

let fetch = interaction.fetchReply();

tame gazelle
#

await the fetch

undone yew
#

Unknown Webhook

#

what's the deal

#

let fetch = await interaction.fetchReply();

tame gazelle
#

try just doing this:
const msg = await interaction.reply({ ..., fetchReply: true })
const collector = msg.createMessageComponentCollector(...)

undone yew
#

DiscordAPIError[50006]: Cannot send an empty message

what?

#

im fixed

#

but not send embed

tame gazelle
#

ActivityType.Watching

hasty gorge
undone yew
forest elm
#

whats fetch, and show the options you used in the component collector

undone yew
#

interaction.reply() after that it doesn't work.

hasty gorge
forest elm
#

show the code

tame gazelle
#

no prob

undone yew
forest elm
#

you arent sending any components at all

undone yew
forest elm
#

how what? you just arent. look at your interaction.reply()

tame gazelle
undone yew
#

return interaction.reply({ content: "Select a category!", components: [Row]})

I'm sending a command

forest elm
#

thats not what you have in your screenshot

undone yew
forest elm
#

you're creating the collector on the reply you are sending on your screenshot

#

it has no components, so it wont collect anything

undone yew
#

I'm move to command

#

no error, but not send embed

forest elm
#

show the updated code

undone yew
#

wait

#

result?

#

where is error

#

@forest elm

forest elm
#

you tell me, whats happening?

undone yew
#

i don't know

scarlet tangle
#

Hi again,
how to get an array of members connected to voice channels in the whole guild?

Here's the code that I was trying;

        console.log(connected_members)```
forest elm
#

<GuildMember>.voice is not nullable, that filter isnt doing anything

forest elm
scarlet tangle
forest elm
#

map the collection by channel.members and flat it

#

that will rely on cache, so you should fetch all the guild members before doing all of that as the other person suggested

scarlet tangle
#
data.components[1].components[0].options[0][MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType

any what does it mean i don't get it

                               type: 3,
                                placeholder: "Please select a page.",
                                custom_id: "help",
                                min_values: 1,
                                max_values: 1,
                                options: [categories.map((cmd) => {
                                    return {
                                        label: cmd.directory,
                                        value: cmd.directory?.toLocaleLowerCase(),
                                        //emoji: emojiObject[cmd.directory?.toLowerCase()] || null
                                    }
                                })]
``` this is the component causing the error
scarlet tangle
forest elm
scarlet tangle
forest elm
#

correct, and <Array>.map() returns the mapped array

#

so either remove the [] surrounding it or spread it

scarlet tangle
#

hmm so can't i just make a variable and do the same stuff then through the map i'll return the object and then assign the variable to it will that work?

forest elm
#

no idea what you said

scarlet tangle
#

nvm anyways thanks for the help

forest elm
scarlet tangle
forest elm
scarlet tangle
signal rampart
#

Why does this pops up when I submit a modal?

forest elm
signal rampart
#

Oh

#

And can we fix it?

forest elm
#

read the messages above

signal rampart
#

"fixed in this pr"

#

What's pr?

hoary fox
forest elm
signal rampart
#

oh

forest elm
#

what about it, that was fixed in the pull request i linked

signal rampart
#

how for long the bug has been fixed?

forest elm
#

the pull request wasnt merged, which means it technically hasnt been fixed yet

forest elm
#

yea

scarlet tangle
#

is is possible to await modal input?

vague coyote
scarlet tangle
#

but how? do I do it on the channel? the message? or the interaction itself? I dont know how the modals work

forest elm
#

the former doesnt exist and the latter does nvm

scarlet tangle
#

there is no type

#

modal

vague coyote
#

textinput?

forest elm
#

modals arent components

scarlet tangle
#

if its just one text input, and the modal has several text inputs, it detects only whichever was written first or no?

forest elm
#

it doesnt detect anything because modals arent components

#

you need to listen to the interactionCreate event and use the interaction.isModalSubmit() and get the fields using the fields resolver, interaction.fields

#

you can probably use an interactioncollector too ig

scarlet tangle
#

terrible, anyway what is textInput componentType for then?

forest elm
#

TextInput is a ComponentType

#

you can either wait for somebody to pr it or just make a custom solution yourself

carmine bridge
#

Why this error

#

Is slashbuilder

pallid ice
#

That’s what I do with a few commands in one of my projects I manage

sudden bobcat
#

Does v14 support nodev16?

vague coyote
#

wdym support, its necessary

#

v16.9

#

it was already necessary in v13

tame gazelle
#

new features

#

important changes

#

check pins

scarlet tangle
pallid ice
#

but the PR for the fix has already been reviewed and should get merged at some point in the coming days

scarlet tangle
#

I¨ve always had my config in json file, now I cant because it requires your enums, How can I still keep it in a json file?

scarlet tangle
forest elm
velvet jasper
#

That or just convert your json files to TS/JS

scarlet tangle
#

What do I change these "magic strings" to?

woeful pollen
#

with their respective enums

scarlet tangle
#

if it wasnt obvious I was asking how are the enum imports called

velvet jasper
scarlet tangle
#

yes I did, I cant find it in the guide nor in the code. I thought it would be Permissions.ViewChannel or PermissionOverwrites.ViewChannel its neither, and no idea what would the type be
thus, I'm asking here

plain roverBOT
velvet jasper
#

You can just use PermissionFlagBits.<Permission> directly

#

Based on your screenshot it would be PermissionFlagBits.ViewChannel

scarlet tangle
#

I meant OverwriteType (role or member) but I already found it

river harbor
sudden bobcat
vague coyote
#

not like its pinned

velvet jasper
#

No it supports node v16.9 and above

acoustic temple
#

Guys, when I select an option of Select Menu, it keeps selected. How do I "unselect" the option and set the placeholder back?

woeful pollen
#

update the message with the same exact component

acoustic temple
#

hum

acoustic temple
knotty plover
#

I think you need to rebuild it

#

Though if you're resending without any changes that should probably be supported

acoustic temple
#

So, how can I detailed unselect the select menu?

#

I got it making this:

const row = i.message.components[0]
const selectMenu = row.components[0]
const newRow = new ActionRowBuilder()
.addComponents(new SelectMenuBuilder(selectMenu.data))
i.update({ components:[newRow] })
knotty plover
#

oh right, my bad

#

Yeah odd that its required though

#

they should just be resendable

crystal valve
#

hi, so I have a command handler + discordjs v13
just updated to v14, and switched partials to the Partials.Channel stuff and kept intents the same, intents: 32767,

the only command that exists right now is .ping
it seems that the bot doesn't log in anymore, or at least the bio of the bot doesn't change like normal

there are no errors

is there something else I should change?

I have read the documentation as well

outer bane
#

32767 does not include the MessageContent intent

crystal valve
#

oh, is there something you would recommend then for all the intents?

outer bane
#

yes, don't use all

knotty plover
#

Not using magic numbers so your intents are actually readable

#

Use the intents you actually need

crystal valve
#

alright, sounds good
i'll try that

hasty gorge
#

anybody knows why i get this error when submitting to a modal

outer bane
#

known bug

dull mulchBOT
hasty gorge
crystal valve
#

I've never done it without just using 32767, which ones am I supposed to use other than these,
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.Messages],
is Messages an intent?

vague coyote
#

GuildMessages or DirectMessages

crystal valve
#

ah, alright

vague coyote
#

also you use the ones you need

#

there is no "which ones am I supposed to use"

crystal valve
#

alr

vague coyote
#

for that question I would wait 41 minutes meguFace

hasty gorge
#

ok so its fixed but not merged, welp

woven grove
#

Link?

#

Done

hasty gorge
#

ok merged nice

knotty plover
#

Now wait for the release in 12 hours or so 🙂

#

maybe i dont know the schedule lol

woeful pollen
#

wow it was that easy

woven grove
#

40m or 1h40m unsure

#

But yes

#

Somewhere around that time

crystal valve
#
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
            partials: [Partials.Channel, Partials.Message, Partials.Reaction],
            allowedMentions: {
                repliedUser: false,
            },```
so I have this now, but it doesn't log in, no errors though
knotty plover
#

looks correct to me, shouldnt prevent login

#

Turn on the debug event

crystal valve
#

erm how do I do that

#

I don't think it's process.traceDeprecation = true right

knotty plover
#

client.on("debug", console.log)

crystal valve
#

it just did this-

knotty plover
#

so it is logged in

crystal valve
#

normally it looks like this

knotty plover
#

yeah

#

Why did you say it doesnt login when it clearly does in both sets of logs?

crystal valve
#

before I updated to v14, meaning in v13, it responded to a command, and it successfully changed it's bio in the ready event

vague coyote
#

message command?

crystal valve
#

yeah

vague coyote
#

You need the MessageContent intent, available from the dapi types v10

crystal valve
#

ah got it

client.user.setActivity({ name: `${client.config.prefix}help`, type: "PLAYING" });```
does this look right to you? it worked in v13, but it doesn't set the activity anymore
plain roverBOT
velvet jasper
#

Actually wait

#

I forget the name

outer bane
stuck fiber
#

Are modals not finished yet for djs main yet?
Are they considered a component? and wouldn't it extend the Component class ?

outer bane
#

they are not components

#

finished in the sense of you can send (and after the next dev release) receive them

#

afaik modal collectors will be added at some point too

stuck fiber
#

okay cool, thank u
is it not a component because they dont appear in chat or something 🤔

knotty plover
#

No, because they just arent components at all

#

They're a type of Interaction response

#

I get how they appear similar since they have a builder etc, but Embeds arent components either

#

The TextInputs in the modal are components though just to be confusing, but they cant go in messages

stuck fiber
#

ahh alright
that clears it up, thanks

novel notch
#

Where do I see the permissions for discord.js v14

crystal valve
#
  {
    "code": "custom",
    "message": "Input not instance of UnsafeSelectMenuOptionBuilder",
    "path": []
  }
]
    at handleResult (/home/runner/v14/node_modules/zod/lib/types.js:28:23)
    at ZodUnion.safeParse (/home/runner/v14/node_modules/zod/lib/types.js:141:16)
    at ZodUnion.parse (/home/runner/v14/node_modules/zod/lib/types.js:120:29)
    at /home/runner/v14/node_modules/@discordjs/builders/dist/index.js:843:159
    at Array.map (<anonymous>)
    at SelectMenuBuilder.addOptions (/home/runner/v14/node_modules/@discordjs/builders/dist/index.js:843:34)```
`const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, SelectMenuBuilder} = require("discord.js")` using this
```js
const row = new ActionRowBuilder()
            .addComponents(
                new SelectMenuBuilder()
                    .setCustomId('select')
                    .setPlaceholder('Backpack')
                    .addOptions([
                        {
                            label: 'Fishes',
                            description: '',
                            value: '0',
                        },
                        {
                            label: 'Animals',
                            description: 'This is also a description',
                            value: '1',
                        },
            {
                            label: 'Potions',
                            description: 'This is also a description',
                            value: '2',
                        },
            {
                            label: 'Craftable',
                            description: 'This is also a description',
                            value: '3',
                        },
            {
                            label: 'Tools',
                            description: 'This is also a description',
                            value: '4',
                        },
                    ]),
            );```
knotty plover
knotty plover
#

Docs need updating

novel notch
crystal valve
plain roverBOT
crystal valve
novel notch
plain roverBOT
#

Documentation suggestion for @crystal valve:
<:_: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.

crystal valve
#

yeah, I read it, but how does it relate to the SelectMenuBuilder
for options

forest elm
#

you're passing an array to addOptions, and you must use rest parameters

velvet jasper
#

It doesn’t take an array it takes an indefinite amount of arguments ie function(one, two, three) vs function([one, two, three])

dawn phoenix
#

don't pass an array, pass multiple arguments
if you have an array because that's just easier to handle for you, spread it

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.

hasty gorge
dawn phoenix
#

what?

hasty gorge
crystal valve
forest elm
#

function(one, two, three) vs function([one, two, three])

yes

dawn phoenix
#

@hasty gorge release what? i need some context to evaluate that

novel notch
#

Where can I see the name of the permissions in discord.js v14?

novel notch
#

Thanks

hasty gorge
forest elm
#

yes, there will be a new dev release in a bit

dawn phoenix
#

ah, the automated dev releases, yes, every 12h
midnight and 12PM UTC

hasty gorge
hasty gorge
forest elm
#

it should, yes

hasty gorge
#

30 rn

dawn phoenix
#

can we stop the countdown though? thanks

coarse yoke
#

is this v14?

scarlet tangle
#

pr 7649 merged?

dull mulchBOT
river harbor
#

thank fucking god pull req 7649 was merged. my clients were getting very angry with me for delays.

knotty plover
#

k

#

Probably shouldnt be using an unstable version of the library for commercial work imo

river harbor
#

well it works for it's fine 🤷

knotty plover
#

It literally didnt work hence why that merge was required

river harbor
#

how do you fetch the content of a modal field?

#

mine is just returning undefined

knotty plover
#

<ModalSubmitInteraction>.fields.getTextInputValue(customId)

river harbor
velvet jasper
#

There’s a guide that goes over this btw

river harbor
velvet jasper
#

Pins

river harbor
#

oh i didn't see it there

bitter schooner
#

hello guys

#

i have an issue in last djs 14 build

#

i have blank message content fields

#

i have all the intents enabled

dawn phoenix
#

read pins

#

nah, you don't

bitter schooner
#

1sec

dawn phoenix
#

well, maybe enabled, but you don't set it in client settings

bitter schooner
spare fiber
#

but you don't set it in client settings

bitter schooner
dawn phoenix
#

guess i'm bringing the pins to you then

#

Where did my message content go?

  • Make sure you are granted the intent (Discord app dashboard toggle/verification request)
  • Make sure you also set the intent in Client settings MessageContent = 1 << 15 (this was not needed on previous versions)
bitter schooner
#

oh

#

1 sec

#

it worked

#

thanks :)

loud sentinel
#

hey, is there a overview of all changes coming in v14 somewhere?

tame gazelle
#

pins

hasty gorge
#

Hey, im sending a reply to an interaction then making a component collector so when the user interacts it shows a modal, but when i submit the modal the collector isnt triggered

outer bane
#

modals are not components, you have to use an InteractionCollector

hasty gorge
#

so i make 2 collectors?

outer bane
#

that or handle the modal / components in the interactionCreate event

hasty gorge
outer bane
#

you could also use an InteractionCollector for both components and modals

hasty gorge
#

let me open docs one sec

outer bane
#

sure, both are interactions

hasty gorge
hasty gorge
#

oh you cannot be fr 😭

rotund kite
#

How to install v14?

hasty gorge
rotund kite
#

Ok

vague coyote
rotund kite
#

Thanks

hasty gorge
scarlet tangle
#

i dont have the message content intent in the client settings but it still can see contents

stuck solstice
#

iirc they're not enforcing it just yet, also you should see content if your bot is mentioned

scarlet tangle
#

ok happycat

hasty gorge
coarse flame
#

What's the error?

scarlet tangle
slow storm
#

A fix was merged. So installing new update should fix it

coarse flame
#

🆗

scarlet tangle
#
TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)
    at V.resolveRequest (C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\node_modules\@discordjs\rest\dist\index.js:7:3723)
    at V.queueRequest (C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\node_modules\@discordjs\rest\dist\index.js:7:2608)
    at Y.request (C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\node_modules\@discordjs\rest\dist\index.js:7:5494)
    at Y.put (C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\node_modules\@discordjs\rest\dist\index.js:7:5346)
    at C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\Src\Structures\Client\Client.js:113:28
    at RolexBot.RegisterSlash (C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\Src\Structures\Client\Client.js:119:11)
    at RolexBot.RegisterRolex (C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\Src\Structures\Client\Client.js:102:22)
    at new RolexBot (C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\Src\Structures\Client\Client.js:49:14)
    at Object.<anonymous> (C:\Users\jitup\Downloads\SussyRolex-main\SussyRolex-main\index.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
``` any idea why its happening? i am using a property for my application commands named userPermissions which has the flags and if the GuildMember#permissions.has(FLAG) then i just pass in the cmd but it seems to give me a error i am not sure why

```js
userPermissions: [PermissionsBitField.Flags.SendMessages]

this is how it looks like

nocturne kayak
#

?

#

you wanna catch modal interactions only?

brazen knoll
#

does userUpdate fire on banner change? And if so does the old banner exist on the oldUser

velvet jasper
#

It doesn’t

brazen knoll
#

sadge, ty

regal raptor
#

hi can anyone help me on how to make response of a form with checkboxes to be saved in a json file and then use that json file to create a graph

vague coyote
jaunty vault
#

the ModalSubmitInteraction#components type is wrong?

jaunty vault
#

wat

#

the typings for ModalSubmitInteraction#components is incorrect...

#

it should be an array still

#

actually, it says TODO fix this type
The array shows ActionRows so the type should be ActionRow[]

velvet jasper
#

Pretty sure there’s a pr to fix that

empty urchin
#

oh

digital root
#

also is it dev "stable" to use for bots (aka what are chances for crashing)

dawn phoenix
#

see the lower part of pins

#

your question for a chance isn't all that realistic. it's an automated 12h release, so if someone messed something up reviews didn't catch, it's bugged

topaz sinew
#

Caught

 DiscordAPIError[20001]: Bots cannot use this endpoint
    at SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:488:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:201:11)
    at async ApplicationCommandPermissionsManager.set (/home/container/node_modules/discord.js/src/managers/ApplicationCommandPermissionsManager.js:165:20) {
  rawError: { message: 'Bots cannot use this endpoint', code: 20001 },
  code: 20001,
  status: 403,
  method: 'put',
  url: 'https://discord.com/api/v10/applications/598475048952659978/guilds/563287374784888852/commands/952306523005136916/permissions',
  requestBody: { files: undefined, json: { permissions: [Array] } }
}

While trying to edit application command permission

median jetty
#

what is the relase of v14?

topaz sinew
#

14.0.0-dev.1648515273-ac4bc3a

scarlet tangle
#
const { OverwriteType } = require("discord-api-types");
permissionOverwrites: [
                { id: this.user.id, allow: PermissionFlagsBits.ViewChannel, type: OverwriteType.Member }, 
                { id: config.modRoleID, allow: PermissionFlagsBits.ViewChannel, type: OverwriteType.Role }, 
                { id: config.guildID, deny: PermissionFlagsBits.ViewChannel, type: OverwriteType.Role }
            ]
#

how else am I get the enum? its not exported from discord.js

#

collector = new InteractionCollector(bot, { channel: interaction.channel, guild: interaction.guild, interactionType: InteractionType.ModalSubmit })

scarlet tangle
#

only v8 v9 and v6

tame gazelle
scarlet tangle
#

then just add filter property to the object?

#

you can just omit the max option, hold a counter yourself and once you count your descired amount of interactions, stop the collector if the filter property doesnt work for oyu

#

embedbuilder#addFields doesnt accept array, please make it accept array as well as parameters

idle galleon
#

We're moving away from arrays as it stands

scarlet tangle
#

why?

#

its just one check to add support for both

idle galleon
scarlet tangle
#

no just first

idle galleon
#

Originally, Array.flat was used, so you could put arrays in multiple params

scarlet tangle
#

point of array is that you put it as single param

#

literally bruh but whatever

idle galleon
#

You can open a discussion abt it if you want to, but it seems like we're not gonna support both either way

dawn phoenix
#

it's just one operator to spread the iterable into multiple arguments as well

scarlet tangle
#

still doesnt work

#

there is no User enum, only Member or Role

#

:/

#

its not implemented yet

dawn phoenix
#

you don't need to supply a type, when creating
it's just that one of your ids is not valid

idle galleon
#

Specifying the type shouldn't allow that error to occur tho

#

Normally, d.js requires the user/role to be cached for the type to be resolved, but specifying the type bypasses that

idle galleon
#

The only other way you get that error is if one of the ids aren't of type string

dawn phoenix
#

i'm betting on undefined firNotes

idle galleon
#

That leaves me on number then

#

It rly should be a different error tho

scarlet tangle
#

undefined it was

also EmbedBuilder.setDescription('') throws error, it should just set the description to null as '' is falsy value but there'll be some reason to why this wont be done i bet

idle galleon
#

The behavior of builders is to give you the error if the input is invalid. It won't try to fix/resolve ur invalid input

tame gazelle
#

how do I get the locale of a random user? (not only the user who executed the interaction)

knotty plover
#

You don't

tame gazelle
knotty plover
#

Where does it say that? A link is more useful than a screenshot with all context cropped away

idle galleon
#

You need the identify scope for that

knotty plover
#

Right, you see it says "required oauth2 scope" is "identify"

#

So it's only available via Oauth

tame gazelle
#

I don't have the identify scope and I can get the ID using <User>#id ._.

idle galleon
#

Arguably, it also says that for id and username, which Discord def always provides

knotty plover
#

True lol

idle galleon
#

Not sure why Discord doesn't document oauth-only fields

knotty plover
#

Discord doesn't write their own docs half the time

tame gazelle
#

so, not possible? ._.

idle galleon
#

Not w/o oauth

narrow totem
#

Is there an issue with resending components? The code below worked fine until i updated to the latest version

interaction.update({components: interaction.message.components})

I get the following error now

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

I think there's another PR pending to address that, they should be directly resendable

vague coyote
#

dont think there is a pr yet with that?

#

or at least not merged

knotty plover
#

Siris didn't write it in his

#

I did in my v13 one

forest elm
#

the awaitModalSubmit method

#

alternatively you can just wait for it to be added to v14

#

its in the interactionresponses file

knotty plover
#

It doesnt work like that

#

My one was written for v13, copying it into v14 might not even work

forest elm
#

yeah you cant just copy paste it, but the fundamentals are still the same

#

you just have to use an InteractionCollector

knotty plover
#
const collector = new InteractionCollector({ max: 1, type: "Modal", time: 10000 }) // something like that, i forget exactly
const submit = await new Promise((resolve, reject) => {
  collector.on("collect", resolve)
  collector.on("end", (collected, reason) => {
    if(reason !== "limit") reject(reason)
  }
))```
#

Could just do something like that

forest elm
#

client is the first parameter of the interactioncollector constructor

knotty plover
#

promisify te collector

#

Yeah thats why I said I forget how it works exactly

#

Its a rough example

#

Thats the basics of how any of the awaitThing methods work

#

They're just promises wrapped around collectors

#

The actual method is in structures/interfaces/InteractionResponses.js if you want to look I think

coarse yoke
#

whats going on here, why is this giving errorconst row = new ActionRowBuilder().addComponents([ // create a discord button new ButtonBuilder() .setCustomId('Verification') .setLabel('Verify') .setEmoji(':white_check_mark:') .setStyle(ButtonStyle.Primary) ]);

knotty plover
#

what error is it giving

forest elm
#

addComponents takes rest parameters, not an array

#

and you have to pass the unicode version of the emote in setEmoji, \✅

copper jetty
#

i think setEmoji takes an object

forest elm
#

discord.js' accepts strings

coarse yoke
coarse yoke
knotty plover
#

Nah it needs an object in latest builders

coarse yoke
#

what would the object be??

forest elm
#

or pass { name: 'unicode emote' }

acoustic temple
coarse yoke
#

ohhh, okay, simple enough

#

the documentation didn't state it was an object which is why I was so lost

velvet jasper
#

idk why it still wants an object it should accept strings after the PR

forest elm
#

/builders only accepts objects

coarse yoke
#

I pulled the latest dev installation a few hours ago

velvet jasper
#

import from djs

#

not from builders

coarse yoke
#

const { ButtonBuilder } = require('discord.js/node_modules/@discordjs/builders'); is the one I have

forest elm
#

why

#

remove everything after discord.js

coarse yoke
#

it automatically did that for me LMAO

#

const { ButtonStyle, ActionRowBuilder, SelectMenuBuilder, EmbedBuilder, ButtonBuilder } = require('discord.js'); then?

forest elm
#

yeah

coarse yoke
#

cheers

#

how do you add the ActionRowBuilder to the reply?

knotty plover
#

components: [ActionRowBuilder.toJSON()] I think

coarse yoke
#

interaction.reply({ content: "Test", components: [row] }) This is what I have

#

but it errors ofc

#

or, doesn't add the button rather

velvet jasper
#

what error is it

knotty plover
#

Need the error to help

coarse yoke
#

No no, it doesn't have an error

forest elm
#

show the rest of the code, what are you defining row as

coarse yoke
#

I lied, the error is component.toJSON is not a function

#
const row = new ActionRowBuilder().addComponents([
            // create a discord button
            new ButtonBuilder()
                .setCustomId('Verification')
                .setLabel('Verify')
                .setEmoji({name: '✅'})
                .setStyle(ButtonStyle.Primary)
        ]);

        interaction.reply({ content: "Test", components: [row] })
            .then(() => console.log(`${interaction.member.id}: (0) Verify; Verification sent`))
            .catch(err => console.log(`${interaction.member.id}: (0) Verify; Verification failed` + err));```
forest elm
#

remove [] from addComponents, it takes rest parameters and not an array

coarse yoke
#

it says it's an array fox_think

knotty plover
#

its wrong

forest elm
#

¯_(ツ)_/¯

coarse yoke
#

LMAO okay, well that fixed it

#

ty

acoustic temple
#

How to prevent this from happening?
DiscordAPIError[10062]: Unknown interaction
Is there a property that I can use for this?

gritty citrus
#

u prevent it by replying within 3s. Not replying twice

acoustic temple
#

I stressed select menu, selecting after it is selected

#

I'm deferring

gritty citrus
#

deferring is not an excuse, all reply must be done within 3s, to be able to extend the interaction to 15m.. deferReply/deferUpdate, reply, update, respond, a modal submit.

scarlet tangle
#
d.interaction.showModal(new Discord.ModalBuilder().setTitle('hi').setCustomId("id").addComponents(new Discord.ActionRowBuilder().addComponents(new Discord.TextInputBuilder().setLabel("hi").setCustomId("hi").setStyle(2))))
d.interaction.reply("hi")
#

Something is wrong?

#

It does not tell me any error, simply when sending a response the bot crashes

scarlet tangle
#

I already installed the most current dev, it is assumed that pr 7649 is already merged

trim bloom
coarse yoke
#

How do you wait for a modal response?

#

I'm trying this but its obviously wrong:

const filter = i => i.customId === 'myModal';
                const collector = interaction.channel.createMessageComponentCollector({ filter, time: 1800000, max: 1 });

                collector.on('collect', async i => {
                    console.log("In here 1");
                    if (i.customId === 'myModal') {```
white nebula
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...)

amber python
#

How would I use the attachment option in slash commands

jaunty vault
scarlet tangle
jaunty vault
forest ruin
#

What are valid responses to modal submit interactions?

idle galleon
forest ruin
idle galleon
#

Yes

coarse yoke
idle galleon
#

It doesn't count a submit tho

forest ruin
idle galleon
#

No

forest ruin
#

Ok, thanks!

idle galleon
#

If it came from a message, you could just do an empty update

#

Otherwise, ur stuck with reply then deleteReply

amber python
#

How would I use the attachment option in slash commands

knotty plover
#

.addAttachmentOption

#

.options.getAttachment

rain reef
#

What is the estimated ETA for v14?

idle galleon
#

There is none

rain reef
#

But like how much is done and how much is left?

rain reef
#

So when it is 100% complete v14 will be released?

idle galleon
#

Yes

rain reef
#

Ok thanks for your help

scarlet tangle
#

So I have a question how can I enable message content I checked the pins couldn't understand it?
In the intent of the client

#

in dev portal

#

and GUILD_MESSAGES intents

knotty plover
#

GUILD_MESSAGES is not message content

plain roverBOT
amber python
#

How would I use the attachment type with ApplicationCommandOptionData?

knotty plover
#

Just set the type to attachment on the enum

scarlet tangle
#

What are the possible inputs for modals?

uncut kelp
#

Text. That's it

scarlet tangle
#

is there a way to limit to put only a number?

#

or to make the modal not be able to submit if you put string into a number

#

anyways..

knotty plover
#

no

scarlet tangle
lament wave
#

does dev crash on text in voice interactions?

outer bane
nocturne kayak
#

is it possible to know if the user cancelled a modal submit by any means?

outer bane
#

no

tame gazelle
outer bane
#

the message means bots will receive the ws events, the pr for d.js to not ignore them is not merged yet

dawn phoenix
#

how, well, by using a command in a text in voice channel
(not rolled out to all servers yet)

tame gazelle
#

ah ok

#

thanks

brittle robin
dawn phoenix
#

this is still a support channel

brittle robin
#

oh sry. you're right

uncut kelp
#

No

scarlet tangle
#

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

Error From

if (ctx.interaction.member.roles.highest.position <= ctx.interaction.guild.members.cache.get(user?.id).roles.highest.position) return ctx.interaction.reply({ content: `${process.env.FAILURE_EMOJI} | You cannot do this action on this user due to role hierarchy.`, ephemeral: true });

_User Variable

const user = ctx.interaction.options.getUser("user");

can anyone help me with the error?

copper jetty
scarlet tangle
copper jetty
knotty plover
#

For modals?

#

I didn't, modals only submit once

#

Or not at all

#

That's a new modal though

#

I'd handle that with unique custom ids each time it's launched by including the ButtonInteraction id or something

#

Modal.setCustomId(${button.id}-modal)

#

That way you know it's bound to a specific button click

scarlet tangle
knotty plover
#

And I always make sure they time out

#

So if you open and close the modal 10 times, yeah you'll have 10 collectors possibly but they're all waiting for unique customIds

#

Standard collector time option

#

It's a required param on my awaitModalSubmit

#

Yeah that's okay

median jetty
#

What is DirectMessageTyping Intents?

jaunty vault
median jetty
#

And DirectMessages ?

jaunty vault
median jetty
#

How to send components

jaunty vault
median jetty
#

and it's possible edits components disabled

jaunty vault
#

wat

split fulcrum
#

what is the lastest discord dev version?

vague coyote
#

14.0.0-dev.1649160496-402514f

unique trout
#

Is it possible to add SelectMenu to Modal?

dawn phoenix
#

not yet, for now only text input, but discord is looking into expanding the range of possible components

pallid ice
#

having more textinput types like channels, roles, users etc would be really cool but I know it's unlikely to happen anytime soon

river harbor
#

js[  {    "code": "custom",    "message": "Input not instance of UnsafeSelectMenuOptionBuilder",    "path": []  }] This a known error with select menus?

scarlet tangle
#

Event

client.on('interactionCreate', async (interaction) => {
const d = {
interaction,
client,
db
}
if(d.interaction.isChatInputCommand()){
const slash = d.client.slashs.get(d.interaction.commandName)
if(!slash) return;
try{
slash.execute(d)
} catch(e) { console.log(e) }
} else if(d.interaction.isButton()){
const button = d.client.buttons.get(d.interaction.customId) 
if(!button) return;
try{
button.execute(d)
} catch(e) { console.log(e) }
} else if(d.interaction.isSelectMenu()){
const menu = d.client.menus.get(d.interaction.customId)
if(!menu) return;
try{
menu.execute(d) 
} catch(e) { console.log(e) }
} else if(d.interaction.isContextMenuCommand){
const context = d.client.contexts.get(d.interaction.commandName)
if(!context) return;
try{ 
context.execute(d)
} catch(e) { console.log(e) }
} else if(d.interaction.isModalSubmit()){
d.interaction.reply("hi") 
}
})
#

Handler

module.exports = (client) => {
const fs = require('fs')
const foldersCommands = fs.readdirSync("./cmds/")
for(const folder of foldersCommands){
const command = fs.readdirSync(`./cmds/${folder}/`).filter(x => x.endsWith(".js"))
for(const commands of command){
try{
const cmd = require(`./cmds/${folder}/${commands}`)
client.commands.set(cmd.name,cmd)
client.commands.set(cmd.type,cmd)
let type = client.commands.get(cmd.name)
type = type.type 
if(type == "slash"){
client.slashs.set(cmd.name,cmd)
} else if(type == "button"){
client.buttons.set(cmd.name,cmd)
} else if(type == "selectMenu"){
client.menus.set(cmd.name,cmd)
} else if(type == "contextMenu"){
client.contexts.set(cmd.name,cmd)
} else if(type == "modal"){
client.modals.set(cmd.name,cmd)
}
} catch(e) { console.log(e) }
} 
}
} 
#

Creating Modal

d.interaction.showModal(new Discord.ModalBuilder().setTitle('hi').setCustomId("id").addComponents(new Discord.ActionRowBuilder().addComponents(new Discord.TextInputBuilder().setLabel("hi").setCustomId("hi").setStyle(2))))
#

It doesn't tell me any error, it just turns off the bot

forest tree
#

Can someone give the dev version v14 from the package.json

brittle robin
#

@scarlet tangle its not Discord.Intents.FLAGS in v14 afaik.
U can use GatewayIntentBits or IntentsBitField tho

vague coyote
forest elm
#

no, read the pinned guide

brittle robin
# scarlet tangle like this?

If you imported GatewayIntentsBits yes, almost. Don't u have autocomplete in vscode? f.ex it's .Guilds not GUILDS,
but yeah - the guide

brittle robin
#

GatewayIntentBits.Guilds

scarlet tangle
#

yes

#

I did

forest elm
#

one or more "intents" you passed werent valid

brittle robin
#

ye just ask here @scarlet tangle if u are on v14

scarlet tangle
forest elm
#

whats that supposed to mean? does the property not exist?

scarlet tangle
#

yes

forest elm
#

upgrade discord-api-types

scarlet tangle
#

I updated the whole bot :)

#

nvm

#

its working

ancient hound
#

What has MessageEmbed changed to in dev?

woeful pollen
#

EmbedBuilder

ancient hound
#

ty

crystal valve
#
      const createButton = (style, emoji, id, status, label) => {
        return new ButtonBuilder()
          .setStyle(style)
          .setEmoji(emoji)
          .setCustomId(id)
                    .setLabel(label)
                    .setDisabled(status)
      }

        let scopeBack = createButton('PRIMARY', 961072959571771442, 'backScope', 'true', null)```
Expected number, received string
what am I doing wrong?
#

this isn't completely a @dev question, but I'm using v14@dev

uncut kelp
#

The style is a number

crystal valve
#

oh

uncut kelp
#

The disabled state is a boolean

crystal valve
#

how is style a number?

crystal valve
#

oh I see alright

crystal valve
forest ruin
#

Why does this throw an error?

new Discord.ActionRowBuilder().addComponents(
  new Discord.SelectMenuBuilder()
    .setCustomId('test')
    .setPlaceholder('Test')
    .setOptions([
      {
        label: 'Test1',
        description: 'Test1.',
        value: 'test1',
        emoji: { name: '1️⃣' },
        default: true,
      },
      {
        label: 'Test2',
        description: 'Test2.',
        value: 'test2',
        emoji: { name: '2️⃣' },
        default: false,
      },
    ])
);

Error:

ZodError: [
  {
    "code": "custom",
    "message": "Input not instance of UnsafeSelectMenuOptionBuilder",
    "path": []
  }
]
velvet jasper
#

Hmmm

#

Are you updated to the latest dev version?

forest ruin
#

I am, yes

uncut kelp
#

Does the options need to be spread

crystal valve
crystal valve
velvet jasper
#

Oh yeah it’s a rest param

uncut kelp
forest ruin
crystal valve
crystal valve
#
let scopeBack = new ButtonBuilder()
          .setStyle(EnumResolvers.resolveButtonStyle('PRIMARY'))
          .setEmoji('961072959571771442')
          .setCustomId('backScope')
                    .setDisabled(true)```
"message": "Expected string, received null"
for the emoji
long narwhal
#
try {
  user.send({ content: `\`< Staff >\`: ${content}` });
  i.reply({ content: "Successfully sent message!", ephemeral: true });
} catch(err) {
  i.reply({ content: "User does not have DMs on.", ephemeral: true });
}

I'm still getting the S[50007]: Cannot send messages to this user error.
Can anyone tell me why

crystal valve
white nebula
long narwhal
#

ah, thanks

river harbor
#
for (let i = 0; i < json.length; i++) {
  menu.addOptions({
    label: json[i].name,
    description: `Canarian Air Flight ${json[i].name}`,
    value: i,
  });
};``` Is returning the error:
#
  {
    "code": "custom",
    "message": "Input not instance of UnsafeSelectMenuOptionBuilder",
    "path": []
  }
]```
tame gazelle
river harbor
knotty plover
#

Is this a known bug?

#

I think it is

#

Nope cant find it

river harbor
#

What's the ZodError actually telling me? I cannot work it out.

#

Is it internal or something to do with my code?

knotty plover
#

Try this

#
menu.addOptions(new UnsafeSelectMenuOptionBuilder({ your options }))```
#

It should support the object too but looks broken

tame gazelle
#

that's weird I don't have this issue

river harbor
#

Will I need to include this in the future?

tame gazelle
river harbor
#

I'm running v14.0.0-dev.1649030898-5748dbe

#

If that helps idk 🤷

knotty plover
#

nah we'll apply a fix

tame gazelle
knotty plover
#

or it might be possible that your option isnt valid, but its throwing the wrong response from the validator

knotty plover
river harbor
long narwhal
#
module.exports = {
    name: "interactionCreate",
    on: async(client, i) => {
        if(i.isChatInputCommand()) {
            client.log(`@Interactions Manager`, `received a Slash Command`, { ID: i.guild.commands.cache.find(c => c.name === i.commandName ).id, Name: i.commandName });
            const script = client.get('slash command', i.commandName);
            script.on(client, i);
        } else if(i.isContextMenuCommand()) {
            client.log(`@Interactions Manager`, `received a Context Menu Command`, { ID: i.guild.commands.cache.find(c => c.name === i.commandName ).id, Name: i.commandName });
            const script = client.get('context menu', i.commandName);
            script.on(client, i);
        } else if(i.isModalSubmit()) {
            if(i.customId === "examplemodal") {
                const resp = [];
                console.log(i.fields);
                i.fields.forEach(field => {
                    console.log(field.data);
                })
            }
        } else if(i.isButton()) {
            
        }
    }
}

So, I'm currently messing with modals, and what i'm getting right now is:
TypeError: i.fields.forEach is not a function

i.fields is a Collection according to what I saw in the console, and the Collection class has the forEach method. Can someone help?

river harbor
river harbor
tame gazelle
plain roverBOT
#

Documentation suggestion for @long narwhal:
<:_:874573855715385394> ModalSubmitFieldsResolver
Represents the serialized fields from a modal submit interaction

long narwhal
# tame gazelle `ModalSubmitInteraction.fields` isn't an Array or a Collection
ModalSubmitFieldsResolver {
  components: [
    ActionRow { data: [Object], components: [Array] },
    ActionRow { data: [Object], components: [Array] },
    ActionRow { data: [Object], components: [Array] },
    ActionRow { data: [Object], components: [Array] },
    ActionRow { data: [Object], components: [Array] }
  ],
  fields: Collection(5) [Map] {
    'test1' => TextInputComponent { data: [Object] },
    'test2' => TextInputComponent { data: [Object] },
    'test3' => TextInputComponent { data: [Object] },
    'test4' => TextInputComponent { data: [Object] },
    'test5' => TextInputComponent { data: [Object] }
  }
} <ref *1> [class Collection extends Map] {
  default: [Circular *1]
}
long narwhal
#

so i.fields.fields is what i need? Wheeze

tame gazelle
#

yes

long narwhal
#

welp, alright then.
is there a way to get the label of the component?

trim bloom
#

Current discord.js version: discord.js@14.0.0-dev.1649160496-402514f

On TypeScript I was using ModalBuilder and a received ChatInputCommandInteraction from the event interactionCreate to show a Modal:

const Modal = new ModalBuilder()
    .setCustomId('verify')
    .setTitle('Verification Form')
    .addComponents(
        new ActionRowBuilder<TextInputBuilder>()
            .addComponents(
                new TextInputBuilder()
                    .setCustomId('name')
                    .setRequired(true)
                    .setLabel('Full Name')
                    .setPlaceholder('Your name here')
                    .setStyle(TextInputStyle.Short)
    );

Output:

Error: Cannot properly serialize component type: undefined
    at createComponentBuilder (<workspace>/node_modules/@discordjs/builders/dist/index.js:511:13)
    at <workspace>/node_modules/@discordjs/builders/dist/index.js:524:46
    at Array.map (<anonymous>)
    at new ActionRowBuilder (<workspace>/node_modules/@discordjs/builders/dist/index.js:524:35)
    at new ActionRowBuilder (<workspace>/node_modules/discord.js/src/structures/ActionRowBuilder.js:8:5)
    at file:///<workspace>/build/commands/some_command.js:123:28
    at async Object.value (file:///<workspace>/build/utilities.js:111:13)
    at async value (file:///<workspace>/build/utilities.js:72:13)
    at async Object.execute (file:///<workspace>/build/events/interactionCreate.js:18:17)

I also verified that any combination of TextInputBuilder components produces this error.
It was working at the yesterday's version of discord.js@dev but not today's. Was there a change to ModalBuilder?

knotty plover
#

I believe so, there's another bugfix pending

trim bloom
#

Okay thanks for noting! FeelsBadMan

split fulcrum
#

When i try to Select a role and see what data i can get it just says null

spare fiber
#

case matter here

split fulcrum
#

ahh now it works

#

thanks

fresh prawn
#

Did the modalSubmit event get removed?

vague coyote
#

what modalSubmit event, it was always interactionCreate?

fresh prawn
#

Oh, i prob confused it with another package

long narwhal
# fresh prawn Oh, i prob confused it with another package

you can always make your own

Client#on('interactionCreate', async(interaction) => {
  if(i.isModal()) {
    Client#emit('modalSubmit', (interaction));
  }
});

then call it like:

Client#on('modalSubmit', async(interaction) => {});

not sure if this is recommended/removed, this is just how i remember it being done

fresh prawn
#

👌

shrewd sparrow
#

What is the new "Text in Voice" feature? I didn't quite understand.

dawn phoenix
#

boils down to

• Users can now send messages to voice channels in guilds that get the feature (gradual rollout)

shrewd sparrow
narrow totem
#

i recently faced an issue with not being able to resend components and it happened to be a bug. Was the issue resolved? How can i track such bugs and is there any way for me to know when a fix gets pushed? for info, im talking about me receiving components[0].components[BASE_TYPE_REQUIRED]: This field is required for trying to resend components

pearl stag
forest willow
#

has interaction.options.getString() changed ?

tame gazelle
#

nah

forest willow
tame gazelle
#

I don't use TS

plain roverBOT
forest elm
#

or type interaction as ChatInputCommandInteraction

forest willow
#

thanks

split fulcrum
#

if i use interaction.options.getSubcommandGroup() can i do interaction.options.getSubcommandGroup().getSubcommand("name here")??

woeful pollen
#

no, you still get it from the options

#

interaction.options.getSubcommandGroup() and interaction.options.getSubcommand()

split fulcrum
#

How would i get the getRole from a Subcommand?

forest elm
#

just getRole()

forest willow
#

displayAvatarURL() doesnt accepts format: anymore?

forest elm
#

renamed to extension

forest willow
#

oh

#

and .setFooter() is accepting only one option, contradicting to the previous one accepting string and image separately

forest elm
#

correct

forest willow
#

so is there any option to pass images?

#

like how do i do it

plain roverBOT
#

<MessageEmbed>.setFooter() and <MessageEmbed>.setAuthor() now each take an object:

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

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

thanks again

shrewd sparrow
brisk path
woeful pollen
#

thats one of the use cases

forest willow
#

how to set activity in setActivity()?

plain roverBOT
forest willow
#

thanks

forest willow
#
    .addComponents(
      new ButtonBuilder()
        .setLabel('Some option!')
        .setURL('https://youtu.be/dQw4w9WgXcQ')
        .setStyle(ButtonStyle.Link),
    );```

I am using it in another file as:
```import { row } from "../index";
 msg.reply({content:`some text!`, components:[row]});```
#

ig its probably a type error but am not sure

magic flare
#

it is a type error the builder isnt returning the correct type

forest ruin
#

if I set the defaultPermission for a global slash command to false when creating it, how do I enable it on a per-guild basis

outer bane
#

you can allow the guild's everyone role to use the command

outer bane
#

that would work, yes

forest ruin
#

Can you fetch a command by name?

tame gazelle
#

no

#

but you can fetch all of them and then find by name

forest ruin
#

got it, thanks

crystal valve
#
let scopeBack = new ButtonBuilder()
          .setStyle(EnumResolvers.resolveButtonStyle('PRIMARY'))
          .setEmoji('961072959571771442')
          .setCustomId('backScope'
          .setDisabled(true)```
```issues: [
    {
      code: 'invalid_type',
      expected: 'string',
      received: 'null',
      path: [Array],
      message: 'Expected string, received null'
    }
  ],```
this is for the emoji. any idea why it's saying it received null?
idle galleon
#

.setEmoji takes an object

crystal valve
#

so instead of an ID, what would I use?
ah

idle galleon
#

.setEmoji({ name: "…", id: "…" })

crystal valve
#

alright thanks, I'll try that

#

it works, thanks!!

scarlet tangle
#

I have a problem, my editor is telling me that string is not assignable to any in the field

crystal valve
#

ping

uncut kelp
#

What

crystal valve
#

nvm, I got a ping here

scarlet tangle
knotty plover
#

yeah just saw that

scarlet tangle
knotty plover
#

How are you doing new MessageEmbed on the dev version anyway

scarlet tangle
#

ah

#

i'm at the dev channel srry, didn't see

knotty plover
#

all good, so youre not on v14, just need to know

#

yeah no idea, looks fine. Does it work?

#

Seems like your editor is just being dumb

safe plume
#

Hi

quick moon
#

Is there a way to prefill a modal field with text? For example, grabbing data from a database and having it displayed inside a paragraph field.

knotty plover
#

You can set placeholder or value, yes

plain roverBOT
quick moon
#

Awesome, thanks!

dawn phoenix
#

or placeholder, if you want it to not be editable and just display usage examples

safe plume
#

As i have seen there is but what should be in place of .showModals

dawn phoenix
#

"in place of"?

#

the builder supplies the data for the button resoponse showModal

dawn phoenix
#

?

velvet jasper
safe plume
#

Thanks for it

safe plume
river harbor
#

what are the permission ids?

#

a link to the a list?

plain roverBOT
#

Documentation suggestion for @river harbor:
<:_:874573879153160212> (static) PermissionsBitField.Flags
Numeric permission flags.

river harbor
#

@tame gazelle I have no clue how to use bitfields. Are there any IDs we can specify that are just numbers?

tame gazelle
#

you can use strings yknow?

#

like GuildMember.permissions.has('ManageGuild')

river harbor
plain roverBOT
#

Documentation suggestion for @river harbor:
<:_:874569322742308864> (static) Permissions.FLAGS
Numeric permission flags. All available properties: (more...)

tame gazelle
#

same in dev version just in PascalCase instead of SCREAMING_SNAKE_CASE

river harbor
tame gazelle
river harbor
#

so why did you specify it as "same in dev version"?

tame gazelle
#

because I sent the stable (v13.6.0) doc

devout gazelle
#

Does RANDOM not work in v14? (For .setColor)

nocturne kayak
#

pretty sure you can pass Util.resolveColor('Random') to setColor()

devout gazelle
#

okay ty!

onyx finch
#

How do I create channels in d.js v14?
This isn't working

interaction.guild.channels.create(`${name}`, { 
            type: "GuildText",
        });```
forest elm
#

you have to use the ChannelType enum

#

or just omit the type entirely as thats already the default

onyx finch
#

oki ty

ancient hound
#

Is the interaction.isChatInputCommand() specific to / commands on dev, as opposed to just interaction.isCommand() on 13.4?

dawn phoenix
#

the canonical name of slash commands is "chat input command"

scarlet tangle
#

Hello When im trying to get role member count

Always give me the count 1

vague coyote
forest willow
#

help would be appreciated

magic flare
# forest willow any fixes?

i would have to see the rest of the code but my guess would to to have the builder return MessageActionRow type as i think that is the expected type

forest willow
#

i tried it

outer bane
#

you can provide a generic to the actionrowbuilder

forest willow
magic flare
#

do you need the builder? why not export the pre-built row?

outer bane
woeful pollen
#

generics, meaning smth like new ActionRowBuilder<ButtonBuilder>()

forest willow
#

oo lol, my bad

blissful drum
#

Quick question, do modals support images and videos in modalfielddata?

woeful pollen
#

no

nocturne kayak
#

for now you can only put text input

blissful drum
#

Noted, thank you

devout gazelle
#

If I made a code showing a members badges, it would show smth like VERIFIED_DEVELOPER or HOUSE_BRILLIANCE in v13, now will that look like VerifiedDeveloper or HouseBrilliance in v14?