#djs-in-dev-version

35223 messages · Page 19 of 36

wicked nebula

I want to make it so when a guild is created it automatically sets <Guild>.config

outer bane

the preferred approach is a function which takes a guild(resolvable) instead of extending d.js classes

or use a weakmap to store additional data for instances

wicked nebula

Yes I currently have this until I realized that having one object for all guild-related properties is better

outer bane

well, extending d.js classes is not better, see the structures removal pr for reasons

mental inlet

uh bro we dont support external packages like discord-modals

mental inlet

if you want help i think there's other servers idk

copper jetty

you can use discord.js modals instead of discord-modals

urban belfry
burnt obsidian
urban belfry

discord.js v14 does and 13.7(will) support modals

urban belfry

read the (WIP) guide for modals

burnt obsidian

thanks

burnt obsidian
urban belfry

check pins, documentations are linked

select builders' main brain

burnt obsidian
urban belfry

pins, documentations
upper left corner

burnt obsidian

i know

urban belfry
burnt obsidian
TypeError: interaction.isModalSubmit is not a function

Code:

client.on('interactionCreate', async interaction => {
    if (interaction.isModalSubmit()) {
outer bane

did you install the dev version?

burnt obsidian
outer bane

see pins

burnt obsidian
outer bane

main

assuming that's the docs dropdown

burnt obsidian
outer bane

where?

burnt obsidian
outer bane

there's a link in the pins

burnt obsidian

i see, thanks

regal umbra
client.on('channelCreate', async channel => {
  const audit = await channel.guild.fetchAuditLogs({ type: 'CHANNEL_CREATE' })
  const ok = audit.entries.first()
  console.log(ok.executor.id)
})``` code is this
outer bane

you have to use enums instead of string types in the dev version

regal umbra

ok thanks

client.on('inviteCreate', async invite => {
  console.log(invite.code)
})
``` i created invite but not getting code in console
copper jetty
regal umbra

okh

stiff pivot

hi

copper jetty

Hi

stiff pivot

i'm make a permissions handler but...

// Ready event
        for (const command of commands) {
            if(!config.production) {
                const cmd = await guild.commands.create(command.data)
                const roles = await guild.roles.cache.filter(
                    (x) => x.permissions.has(command.permissions) && !x.managed
                )

                const permissions = roles.reduce((acc: [], v) => {
                    return [
                        ...acc,
                        {
                            id: v.id,
                            type: ApplicationCommandPermissionType.Role,
                            permission: true
                        }
                    ]
                })

                await guild.commands.permissions.set({
                    fullPermissions: [
                        {
                            id: cmd.id,
                            permissions
                        }
                    ]
                })
            }
        }
[DiscordAPIError[0]: 405: Method Not Allowed]
copper jetty
stiff pivot

oh

scarlet tangle

You can't do it in any library

copper jetty

you can

scarlet tangle

Where

copper jetty

you can edit it using bearer token

scarlet tangle

But who will do it, when you can manage it from Discord

copper jetty

discord.js will support that in the future dont worry!

you wont have to do that youirself

dawn phoenix

honestly, nobody.
perms can be edited in-app
just remove that part of the dashboard and spare yourself the effort to compete with a native UI

pallid ice
copper jetty

Im aware but thank you for letting all of us know

pallid ice

just making sure you're aware cos "discord.js will support that in the future dont worry!" isn't correct. from a developer POV, slash perms are no longer a responsibility

merry sigil

Is not being able to send embeds typed as EmbedData a bug or intentional behaviour? This throws a TypeError:

const myEmbed: EmbedData = {
    title: "some title",
    description: "descriptive description",
};
interaction.reply({ embeds: [myEmbed] });

Type 'EmbedData' is not assignable to type 'APIEmbed | JSONEncodable<APIEmbed>'. (full error: https://www.toptal.com/developers/hastebin/nogitoliwi) Ignoring the type error gives no runtime errors at all though

outer bane

EmbedData is the argument type of EmbedBuilder's constructor, it includes stuff like timestamp numbers which the constructor resolves to iso date strings

merry sigil

ah alright, thanks for clarifying

stiff pivot

Hi guys i tried to make a sub command but ...

    data: new SlashCommandBuilder()
        .setName("tickets")
        .setDescription("The tickets command is used to create a ticket.")
        .addSubcommand(subcommand =>
            subcommand
                .setName('send')
                .setDescription('Send the embed')
        )
    ,
options[0].type[BASE_TYPE_REQUIRED]: This field is required

  requestBody: {
    files: undefined,
    json: {
      name: 'tickets',
      name_localizations: undefined,
      description: 'The tickets command is used to create a ticket.',
      description_localizations: undefined,
      type: undefined,
      options: [Array],
      default_permission: undefined
    }
  }
outer bane

you have to call toJSON on the builder

stiff pivot

oh yeah

thx


                const actionRow = new ActionRowBuilder();

                actionRow.addComponents([
                    new ButtonBuilder()
                        .setLabel("\\📥・Ouvrir un ticket")
                        .setStyle(ButtonStyle.Success)
                ])

                interaction.channel.send({
                    embeds: [embed],
                    components: [actionRow]
                })

TS2322: Type 'ActionRowBuilder<AnyComponentBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.   Property 'type' is missing in type 'ActionRowBuilder<AnyComponentBuilder>' but required in type 'ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>'.

anyone can help me pls

copper jetty

ActionRowBuilder<ButtonBuilder>()

stiff pivot

oh ok thx

opal cloak
        options: [
          {
            name: 'channel',
            description: 'mention a channel that you wanna setup as suggestion channel!',
            type: ApplicationCommandOptionType.Channel,
            channelTypes: ChannelType.GuildText
          },
        ]```
rain bramble

channelTypes types should be in an array

opal cloak

im making a filter for the channel but Its not Working please help me

opal cloak
rain bramble

First one

civic topaz

sorry I want the docs,

vague coyote

waitWhat

tame gazelle

pins

plain roverBOT

class Client (extends BaseClient)
The main hub for interacting with the Discord API, and the starting point for any bot.

civic topaz

ok

vague coyote

Dude

civic topaz

ok

next time

granite yacht

how do i import intents

Like how, i have imported, but idk how

to make em work

opal cloak

help me..
I was using this code at v13 then I change to v14 and I get this err

granite yacht

ty

I only found another version of the url

the v 1060 one

Why do i get this error?

idle galleon

You tried to import discord-api-types directly

You have to import a version/subdirectory

E.g. discord-api-types/v10

clear isle

anyone know how now is named MessageAttachment ?

tame gazelle

Attachment

granite yacht

is .addChoice changed?

vague coyote

addChoices()

granite yacht

And i side en?

Em*

vague coyote

what

granite yacht

Like what to put inside the .addChoices

plain roverBOT
granite yacht

Is it the same as old?

vague coyote

it takes objects with name and value as properties

granite yacht

So like this?, If I have multiple choices:

. addChoices (
{name: "Name1", value: "Name1"},
{name: "Name2", value: "Name2}
)
?

vague coyote

try it

granite yacht

Can't rn

As I forgot smting at home and need to get it xD

vague depot

from this eval command i can only see the server name but i want to see the server member too

vague coyote

client.guilds.cache.map(g => g.memberCount).join('\n')

vague depot

ok thx

vague depot
vague coyote

then just return both in it

dont see how thats djs related

vague depot

ok

river harbor

why doesn't .setFooter({ text: 'Example', icon_url: interaction.client.user.avatarURL(), }) work?

it doesn't return any errors

it just contructs an embed footer without the icon

silk topaz
silk topaz
silk topaz

can you log interaction.client.user.avatarURL() alone and see what it logs?

river harbor

it's something to do with the builder

silk topaz

from where are you getting the embed buider? discord.js or builders?

vague coyote

shouldn't matter

the one from djs extends the one from builders

but yeah, its iconURL

silk topaz

I see 🤔

granite yacht

How do i fix this?

vague coyote
granite yacht
vague coyote

Make sure the ids are correct as well as the token

granite yacht

they are

like it worked completly fine with djs v13 earlier

granite yacht

Wait

i forgot to update the rest to djs v14

works now

Why do i get this errror?

forest elm

show the full stack

granite yacht

the full error?

forest elm

you need to pass an array to addFields()

granite yacht

like this?
.addFields([
{name:"Hey", value:"LOL"}
]}?

scarlet tangle

yes

granite yacht

back to changing again 💀

scarlet tangle

What's the latest discordjs guide preview?

knotty plover

Guide previews aren't "latest"

They show content of individual updates

So one preview will contain one set of changes and another will have a totally different page or change

scarlet tangle

oh... is avaliable any preview with some changes in djs14?

vague coyote

checkthepins

scarlet tangle

thanks

scarlet tangle

What's the issue

jaunty vault
scarlet tangle
jaunty vault
scarlet tangle
rancid dagger

how can i edit channel permission in v14?

celest dagger

Hello, idk if that's an issue with the v14 but the presence isn't set

const activity = [{
        name: `NOOT NOOT`,
        type: `WATCHING`,
    },
    {
        name: `to the NOOT NOOT song`,
        type: `LISTENING`,
    },
    {
        name: `in the NOOT NOOT war`,
        type: `COMPETING`,
    },
    {
        name: `the NOOT NOOT game`,
        type: `PLAYING`,
    },
];

// tests ??
const index = Math.floor(Math.random() * activity.length);
await this.client.user.setActivity(activity[index].name, {
    type: activity[index].type
});
setInterval(() => {
    const index = Math.floor(Math.random() * activity.length);
    this.client.user.setActivity(activity[index].name, {
        type: activity[index].type
    });
}, 60000);```

if with an eval i do this.client.user.setActivity('test') it works idk why

obtuse crater

you have to use enums instead of string types

celest dagger

yes ```js
*eval this.client.user.setActivity('discord.js', { type: 'WATCHING' });


this does not set the status and throw now errors but setPresence sets it correctly
celest dagger

should throw an error but yeah okay

zenith basin

Is there a doc on all valid input types for modals?

tame gazelle

only text inputs

zenith basin

ah i assume more are coming?

urban belfry

Yea

west fjord

is there a way to tell the difference (without any extra steps like fetching guild commands and checking against cache) between a global command and a guild-specific command in an interaction? looking at d.js docs and dapi docs i presume not, just asking here in case i missed something

velvet jasper
west fjord
west fjord

so i just tested this, the size 0 collection is the guild's commands being fetched, the object below is from the interactionCreate event, using a global command. it appears it always will put it there, even if it's a global command?

gloomy kayak

That's a ChatInputCommandInteraction so guildId here is the id of the guild where the command was executed

You may use interaction.command to see the command object

west fjord

oh jesus christ... im so dumb lol, thanks

yeah that works

copper nymph

Why is this happening?

west fjord
copper nymph

Ok well the guide didnt include that so I need to change, thanks

copper nymph
west fjord

GatewayIntentBits is now the enum, you basically use it like this

copper nymph

so its literally just remove the _

west fjord

yeah the keys have been changed to follow the new case standard

surreal lake
knotty plover

Modals

See pins

silk topaz

i literally told them to check pins when i suggested them to ask here angry

copper nymph

have they changed this?

silk topaz
surreal lake

@knotty plover

if (interaction.isModalSubmit()) {
        if (interaction.customId === 'staff_apply') {
            const staffName = interaction.fields.getTextInputValue('staff_name');
            const staffAge = interaction.fields.getTextInputValue('staff_age');
            const staffWhyYou = interaction.fields.getTextInputValue('staff_why_you');
            if (isNaN(staffAge)) {
                return interaction.reply({
                    content: ":x: Your age must be a number, please resend the form.",
                    ephemeral: true
                })
            }
            if (!isNaN(staffName)) {
                return interaction.reply({
                    content: ":x: Your name must not includes a number.",
                    ephemeral: true
                })
            }
            interaction.reply({
                content: '✅ Your staff application has been submit successfully.',
                ephemeral: true
            })

what should i delete to prevent it making errors if it doesn't contain numbers

I want it contains links

hoary fox
silk topaz
copper nymph Trying to find that

you can destructure it from the lib i believe, like { ActivityType } = require('discord.js') unless you have to get it from discord-api-types directly, but i dont think that shouldcbe the case

copper nymph

Yep that worked thanks

knotty plover
surreal lake
knotty plover

And you thought the best way to respond to me being annoyed at a direct ping (which breaks one of our server rules) was to reply to me with another ping...

Go away

noble kernel

how do i get the message from the interaction?

basically i want to edit an interaction's action row but keep the embed

knotty plover

interaction.message

Though if you dont pass embeds when editing it shouldnt change them

noble kernel
knotty plover

yes it is?

Assuming youre looking at an interaction type that comes from a message

plain roverBOT
noble kernel

ah okay

civic topaz

embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required

what does this error means

rain reef

Shouldn’t the modalSubmit event be integrated into interactionCreate

Since you are technically creating an interaction

Or maybe I’m just stupid to think that

knotty plover

There literally is no modalSubmit event

Because it literally is interactionCreate

So yes, I have no idea what youre thinking

scarlet tangle
rain reef

Yes

scarlet tangle

discord.js v14 (dev) has modals so you don't need any other external libraries

also discord-modals is not by djs so we cannot do anything in that

rain reef
scarlet tangle

it isn't

knotty plover

Nope

rain reef

Maybe I will switch to v14 dev then

scarlet tangle

you should

rain reef

👍

scarlet tangle
rain reef

Ok thanks

I will look into it

urban belfry

Note modals would be added in 13.7

That would be the safer Option than using djs@dev in prod

knotty plover

because whatever you put in there is not an embed?

Hard to know without the error stack or your code

civic topaz

API: 50035 Invalid Form Body
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
at SequentialHandler.runRequest (/home/runner/ka-dev/node_modules/@discordjs/rest/dist/index.js:708:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/runner/ka-dev/node_modules/@discordjs/rest/dist/index.js:511:14)
at async MessageManager.edit (/home/runner/ka-dev/node_modules/discord.js/src/managers/MessageManager.js:166:15) {
rawError: {
code: 50035,
errors: { embeds: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'patch',
url: 'https://discord.com/api/v10/channels/966520619632054332/messages/971949233336893440',
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [Array],
components: [Array],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
}
}
}

Promise {
<rejected> DiscordAPIError[50035]: Invalid Form Body
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
at SequentialHandler.runRequest (/home/runner/ka-dev/node_modules/@discordjs/rest/dist/index.js:708:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/runner/ka-dev/node_modules/@discordjs/rest/dist/index.js:511:14)
at async MessageManager.edit (/home/runner/ka-dev/node_modules/discord.js/src/managers/MessageManager.js:166:15) {
rawError: { code: 50035, errors: [Object], message: 'Invalid Form Body' },
code: 50035,
status: 400,
method: 'patch',
url: 'https://discord.com/api/v10/channels/966520619632054332/messages/971949233336893440',
requestBody: { files: [], json: [Object] }
}
}

full error

knotty plover

yeah whatever you passed to the embeds is not an embed

Well, not an object

Might be a string or another nested array or something

civic topaz

can u join my repl for a while, I cannot send the full function (text too long)

knotty plover

no thanks

Just show the embeds and sending part

civic topaz
module.exports.pages = pages;
async function pages(message, ...embeds) {
  let page = 0;
  let pages = embeds.flat(Infinity);
  const row = <ComponentRow>;
  
  const curPage = await message.reply({
    embeds: [pages[page]],
    components: [row]
  });
  let collector = <PageCreateCollector>
  collector.on('collect', async(i) => {
    switch(i.customId) {
      // Custom Id Switch Change
    };
    row.components[4].label = `${page + 1} / ${pages.length}`;
    await i.deferUpdate();
    await curPage.edit({
      embeds: [pages[page]],
      components: [row]
    });
    collector.resetTimer();
  });
  // collect end
}

shorten a lot

knotty plover

check what pages[page] is

could be undefined

civic topaz

help command is from CTK-WARRIOR/Discord-Bot-For-Starters branch discord.js v13 (rewrite to v14)

civic topaz
knotty plover

yeah the ones that arent undefined

if page ends up bigger than the number of actual pages

civic topaz

but at first all pages works

knotty plover

It'll be undefined

civic topaz

but after 1-2 sec delay not clicking btns, ithen start to click, it starts throwing error

oh

nothing ik now

ok now

I changed embeds.length to pages.length

knotty plover

yeah that makes sense

civic topaz

the embeds will be [[Object]]

knotty plover

?

civic topaz

because I use pages(message, [EmbedObject])

instead of pages(message, emb, emb2, emb3)

cinder bane

how do I remove existing ChatInput or ContextMenu commands?

silk topaz
cinder bane

im not directly using the api, how do I do it with djs?

this.bot.guilds.cache.first().commands.set([])
doesnt seem to be working

ok nvm it worked now..

silk topaz

peeposhrug

silver robin

TypeError: MessageActionRow is not a constructor

silver robin

TypeError: MessageButton is not a constructor

silver robin
flat ice
silver robin

my bad

silver robin
flat ice
TypeError: Found non-callable @​@​iterator
    at ActionRowBuilder.addComponents (/root/PanelBot/node_modules/@​discordjs/builders/dist/index.js:526:21)
    at Client.<anonymous> (/root/PanelBot/index.js:69:5)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
scarlet tangle
silver robin
scarlet tangle

Should we use SlashCommandBuilder from discord.js or use the enums for creating slash command ??Which method is recommended?

low summit

I have a similar question to this, but I'm wondering what to do for my use case involving an attachment option ^

silver robin

how to show a modal via a button

south python

Look at the guide for the modals explained

river harbor

Can someone please explain to me the GuildMember.disableCommunicationUntil() parameters? I don't understand how you are supposed to specify the duration.

plain roverBOT
knotty plover

Do you mean this?

oh what, why didnt the other one show up in docs

river harbor
knotty plover

Uhh sort of

timeout you just pass how long

disableCommunicationUntil accepts a timestamp in the future

I think the docs explain timeout badly though

river harbor

Yes I got confused.

knotty plover

timeout(30000) = 30 seconds

disableCommunicationUntil(Date.now() + 30000) = until 30 seconds in the future

timeout does Date.now+ for you

river harbor

You can timeout any user for however long you want? There are presets on the discord client though...

knotty plover

Up to the max yeah I think so

river harbor

Huh I did not know that. Thanks 🙂

I think that was why I was getting lots of errors

Using the wrong functions

knotty plover

Yes?

low summit

SlashCommandBuilder is probably the move

scarlet tangle
low summit

I figured it out cause I was just messing with it

knotty plover
river harbor

I get CombinedPropertyError (1) Received one or more errors input[0] | CombinedPropertyError (2) | Received one or more errors | | input.value | | MissingPropertyError > value | | A required property is missing | | input.name | | MissingPropertyError > name | | A required property is missing Whenever I run embed.addFields([{ name: 'Reason', value: `${reason}`, inline: false }])

What's happening here? I've tried UnsafeEmbedBuilder as well but that doesn't work either.

knotty plover

Might be on an older version that doesn't use arrays?

What doesn't work with the unsafe one?

river harbor
scarlet tangle
knotty plover

Because you randomly pinged me out of nowhere. Refer to rule 6 thanks

scarlet tangle

😂😂😂😂😂

steel lance

is the new permissions v2 in djs dev

knotty plover

No

steel lance

ok

halcyon nest
halcyon nest
scarlet tangle

😐

halcyon nest

?

knotty plover

Because intellisense is not documentation

It literally just remembers things youve typed before

wicked tusk
                    let embed = new Discord.EmbedBuilder()
                    .setColor("RED")
                    .setTitle(`![accepted](https://cdn.discordapp.com/emojis/972108521028059197.webp?size=128 "accepted") Banned \`${member.tag}\``)
                    .setDescription(`asdasd`)
                    .setTimestamp()
                    await message.channel.send({
                        embeds: [embed],
                      });

why is it not sending the embed?

jaunty vault
wicked tusk

yes if i only do message.channel.send("hi") it works

jaunty vault

put a log above and below the .send()

wicked tusk
jaunty vault put a log above and below the `.send()`
            try{
                    
                    let embed = new Discord.EmbedBuilder()
                    .setColor("RED")
                    .setTitle(`![accepted](https://cdn.discordapp.com/emojis/972108521028059197.webp?size=128 "accepted") Banned \`${member.tag}\``)
                    .setDescription(`asdasd`)
                    .setTimestamp()
                    console.log("1")
                    await message.channel.send({
                        embeds: [embed],
                      });
                      console.log("2")
                   // await member.ban();
                }catch{
                    console.log("ERROR -> Bann")
                }
``` not logging anything

only the error

jaunty vault

so there's an error?

wicked tusk

obviously but i don't see the problem here

nocturne kayak

maybe actually log the error?

digital spire

For ModalSubmitInteraction
i am using deferReply as soon as i get it and then editReply throws an error saying "The reply to this interaction has not been sent or deferred."

is this not how this is supposed to be done?

ohh i am very sorry my bad

i was missing await

celest dagger
urban belfry
south python
cinder bane

im receiving this error even tho my bot is online, there are no errors either

jaunty vault

@slow storm I don't think addComponents takes an array

it's ...components

uncut kelp

Outdated

jaunty vault
uncut kelp

What else would be?

jaunty vault

the typings ¯_(ツ)_/¯

uncut kelp

Which belongs to... discord.js? Lol

Update your version

It's been a change since the latest pin

jaunty vault
forest elm

ActionRowBuilder<ButtonBuilder>

jaunty vault

ok thanks

scarlet tangle

Hi, how to close discord.js modal?

outer bane

you don't, the user closes it

autumn forum

Does discord send an event when user cancels a modal

outer bane

no

autumn forum

Damn

scarlet tangle

Bc it gives me an error even if everything is correct

In modal

outer bane

and the error is?

scarlet tangle
outer bane

do you reply to the modal submit interaction?

scarlet tangle

No

I used edit

outer bane

that is the issue, you have to respond to the new interaction

scarlet tangle

Oh, my bad

Thank you!

wicked tusk
module.exports = {
  name: "setupbug",
  category: "System",
  run: async (client, message) => {
    if (message.member.permissions.has("ADMINISTRATOR")) {
        let embed = new EmbedBuilder()
            .setTitle("Bug Report")
          .setDescription(
            `If you want to report a **bug** in one of our bots, a thread will be opened, and we are trying to fix the bug.`
          )
          .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");
      }
  },
};
this.components.push(...components);
                        ^

TypeError: Found non-callable @@iterator

what's that?

outer bane

addComponents takes an array

wicked tusk

like this?

outer bane

no, an array, not an object: addComponents([button])

wicked tusk
raven latch

not related to the v14 branch but how can i install the dev branch of v13?

urban belfry
raven latch

thanks!

i guess i need git for this

unreal cedar

How do I fix this in v14

How do I send components

Cuz apparently now its impossible to do

Please ping me once someone of you has an answer

The row variable is a ActionRowBuilder btw

Ok fixed it myself lol

tired ridge

How can I create button... if someone click is opening window to write text

urban belfry
tired ridge

where is it, i can't find

tired ridge

thx a lot

urban belfry

it's in the pins

tired ridge

i have to update from v13 to v14?

urban belfry
red mountain

or if you can't be patient then use v14 but you're going to accept the risk of getting your code break at anytime (sorry if my grammar is bad)

acoustic temple
split fulcrum

What does this mean?

idle galleon

Expected an Array, but didn't smth else

split fulcrum

Hmm

Did AddFields change from Array?

its the str its error on

idle galleon

I think it changed back to Array

urban belfry

addFields takes an array now yes

idle galleon

I lost track of this Array vs rest param thing tbh

split fulcrum

so value use array? or?

idle galleon

Array

urban belfry

well, the plan is that all these will be taking arrays, but like the release of builders 0.13 takes in rest

idle galleon

Trust in the ts typings

split fulcrum

do i have to name anything in the Array?

idle galleon

Wdym? Arrays aren’t named

sharp pine

what do i need to fill in at adaptiveCreator?

plain roverBOT

property Guild#voiceAdapterCreator
The voice state adapter for this guild that can be used with @discordjs/voice to play audio in voice and stage channels.

river harbor

What intents do you need to recieve DM messages?

tame gazelle

DirectMessages intent and Channel partial

also the MessageContent intent if you want the content of it

river harbor

It's changed in v14.

tame gazelle

pins

urban belfry
tame gazelle

ah yeah

urban belfry

like messages that are directed towards the bot, the bot will get the content
that's how mention prefixes would work
bot ping -> directed at bot
bot dm -> directed at bot

scarlet tangle

why message.content is empty (client[intents] has guildMessages)

urban belfry
scarlet tangle
urban belfry

and the intent?

scarlet tangle
urban belfry and the intent?

My client part is like this

  const client = new Client({
    partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.User, Partials.GuildMember, Partials.GuildScheduledEvent],
    intents: [GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions, GatewayIntentBits.DirectMessageTyping, GatewayIntentBits.Guilds, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildScheduledEvents, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildWebhooks]
  });```
urban belfry

there isn't GatewayIntentBits.MessageContent there

urban belfry

you're welcome! 🤠

river harbor

If you create a channel under a category without any options, does it automatically inherit the category's permissions?

river harbor

how do you check if a message is from a bot?

message.bot doesn't work

white nebula
river harbor

what are the types of permission overwrites?

idle galleon
river harbor
idle galleon

Use the enums

It's either 0 and 1 or 1 and 2

river harbor

oh okay

idle galleon

You can check discord.dev if you want to be sure

0 for role, 1 for member

Plus, it’s easier for others to understand what it is

civic topaz

why discord.js use combined errors and what is this

urban belfry
civic topaz
urban belfry

show the entire error?

idle galleon
prisma kiln

can I set default permissions for my slash commands like to have "manager server" perms

dawn phoenix
wicked tusk
    const user =
    message.mentions.members.first() ||
      message.guild.members.cache.get(args[0] ? args[0] : null) ||
      (await message.guild.members
        .fetch(args[0] ? args[0] : null)
        .catch(() => {})) ||
      (await client.users.fetch(args[0] ? args[0] : null).catch(() => {}));

Why is user.tag not working?

dawn phoenix

because GuildMember#tag is not a thing

wicked tusk

then what can i do instead get username + discriminator?

dawn phoenix

GuildMember#user#tag
the issue is that you have mixed return types here

namely the return type is GuildMember | User here.

if you get a User, user.tag works, if you get a GuildMember instance it'd need to be user.user.tag

wicked tusk

ah thank you

dawn phoenix

you should probably decide on what you actually need here, a user or a member, and make the return type consistent so you know what it is.
alternatively instanceof checks after, i suppose

halcyon nest

anyone got docs on APIMessageComponentEmoji

urban belfry

it'd be easier to access the types on your end and check

halcyon nest

ah I see, ty

fallow lily

hello,
I'm trying to create a form with the new modal. However, there are more than 5 fields in it so I can't use only one modal.
So I tried to do 2 modals but you cant open another modal from the interaction of another modal. So I sent an ephemeral message with a button to continue however, that means that the button will stay for a while.
I also tried to update the ephemeral message to remove everything in it, but then I can't show the second modal.
So is having an ephemeral message the only solution or is there someone who has an idea?

knotty plover

You can just update the ephemeral when you get the response of the second modal

ModalInteraction#update will target the ephem message with the button in it

fallow lily

the only way I found to update an ephemeral is by using a collector an update it's interaction

oh

I'll try that thanks

Hum, I don't have ModalInteraction, only ModalSubmitInteraction and there is no update or edit on it

knotty plover

oh thats what I meant

It should have update though

You might need to isFromMessage() first

plain roverBOT
fallow lily

So, I was missing the isFromMessage() and now I have access to update but now discord says

message: 'Interaction has already been acknowledged.',
code: 40060```

Oh, because I already replied.
That should be doable now

dim moss

what is this err for :/

outer bane

EmbedBuilder#addFields takes an array

you passed something else which doesn't have a length property

unique ledge

Where can I find the equivalent of the following v13 code in v14?

const { Permissions } = require('discord.js');
Permissions.FLAGS['ADMINISTRATOR'];

I seem to be unable to find any permission flags, this was my approach for checking if provided permissions are actual valid discord permissions (with input being ['MANAGE_SERVER', 'SEND_MESSAGES', ...perms]). How would I go about validating permissions now?

hoary fox
unique ledge

So that's why it didn't work when I tried with PermissionsBitField facepalm
Thanks a ton!

wicked tusk
const { ButtonStyle, ButtonBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder }  = require('discord.js')

module.exports = {
  name: "setup-quickhelp",
  category: "System",
  run: async (client, message) => {
    if (message.member.permissions.has("ADMINISTRATOR")) {
        let embed = new EmbedBuilder()
            .setTitle("Bug Report")
          .setDescription(
            `You can find a list of **frequently asked questions** and other **guides** here.`
          )
          .setColor(client.config.color);

          let Selection = new SelectMenuBuilder()
          .setCustomId("QuickHelpSelection")
          .setMaxValues(1) 
          .setMinValues(1) 
          .setPlaceholder("What do you need help with?") 
                    .addOptions([
                        {
                            label: 'Report Bug',
                            description: 'This is a description',
              emoji: '![error](https://cdn.discordapp.com/emojis/946845633296355358.webp?size=128 "error")',
                            value: 'bugModal',
                        },
                    ]);
          let row2 = new ActionRowBuilder().addComponents([Selection]);
          message.channel.send({
            embeds: [embed],
            components: [row2],
          });

      } else {
        message.reply("no Valid Permissions");
      }
      client.on('interactionCreate', async interaction => {
      if (interaction.customId === 'bugModal') {
        await interaction.reply({ content: 'Something was selected!'});
      }
    });
  },
};

If selected bugModal it's not replying

vague coyote

besides, you aren't creating a anything with the customId bugModal

wicked tusk

so what do i have to do?

vague coyote

what
your issue makes no sense

you are creating a selectmenu with the id QuickHelpSelection

wicked tusk

but i want the value so i do interaction.value or what?

vague coyote

what

again

remove that event in there

use a collector

and again, the customId is not the same

manic lynx

How do I set the new slash command permissions?

dawn phoenix
manic lynx
manic lynx
hoary fox
manic lynx
hoary fox
nocturne kayak
manic lynx
manic lynx
crisp island

does @-dev support modals?

bro this man

crisp island

lmfaoo accidently ghost pinged some poor guy

nocturne kayak
manic lynx
nocturne kayak

that would be valid payload, yes

scarlet tangle

Is there any collector for modals?

plain roverBOT
manic lynx

with my tes acc

scarlet tangle

I am getting interaction already replied error on interaction.showModal()

nocturne kayak

showModal counts as an interaction reply

scarlet tangle
outer bane

don't defer

you can only use one of defer(Reply/Update) / reply / update / showModal per interaction

scarlet tangle

*other way

outer bane

no, it's exactly as I said

scarlet tangle
outer bane

respond to the ModalSubmitInteraction with any of the above methods (excluding showModal)

hybrid folio

hi can i ask what is this and does djs dev version have it ?

hoary fox
urban belfry

modals, check the pinnned (wip) guide

hybrid folio

oh okay, is there a limit for that form ?

i mean like character limit

tranquil hollow

Can you show modal in sequence with djs?

hoary fox
tranquil hollow
hoary fox
tranquil hollow
hybrid folio

thank you i think that's enough lol

wicked tusk

return Result.err(new CombinedError(errors));
^

CombinedError: Received one or more errors
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:1470:23)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:113:88)
at EmbedBuilder.setDescription (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@discordjs\builders\dist\index.js:261:54)
at Object.run (C:\Users\Simon Stark\Desktop\koojeAPI\modules\commands\Information\help.js:9:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errors: [
ExpectedValidationError: Expected values to be equals
at LiteralValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:674:76)
at LiteralValidator.run (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:102:23)
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:1465:32)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:113:88)
at EmbedBuilder.setDescription (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@discordjs\builders\dist\index.js:261:54)
at Object.run (C:\Users\Simon Stark\Desktop\koojeAPI\modules\commands\Information\help.js:9:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
validator: 's.literal(V)',
given: undefined,
expected: null
},
ValidationError: Expected a string primitive
at StringValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:1371:70)
at StringValidator.run (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:102:23)
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:1465:32)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:113:88)
at EmbedBuilder.setDescription (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@discordjs\builders\dist\index.js:261:54)
at Object.run (C:\Users\Simon Stark\Desktop\koojeAPI\modules\commands\Information\help.js:9:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
validator: 's.string',
given: undefined
}
]
}

can anyone help`?

white nebula

Looks like a setDescription call received undefined as its argument

wheat sequoia

hi, i want to do permissions in slash commands, but this not works. No error in console

if(cmd.permy && !interaction.member.permissions.has(cmd.permy)) return interaction.reply({ embeds: [error(interaction, `Nie posiadasz permisji: \`${cmd.permy}\``)] })
permy: ["ADMINISTRATOR"],
high fjord

I co to jest za embed ty mi powiedz xD

wheat sequoia

funkcja w oddzielnym pliku xd

high fjord

A no dobra, spróbuj cmd.permy[0]

rapid umbra

How did they put an input image into a slash command choice?

tame gazelle
acoustic temple
rapid umbra

oh okay thx

rapid umbra

la

acoustic temple

wow 😅

rapid umbra
acoustic temple

yep

rapid umbra

Too bad, I'll wait for 13.7 xD

lilac hedge

@coral pumice how do i play music

scarlet tangle

i want the page of changes

vague coyote

checkthepins

finite mason

how can I get an message attachment link or the file?

knotty plover

interaction.options.getAttachment('option name')

Then attachment will have a url

plain roverBOT

property Message#attachments
A collection of attachments in the message - e.g. Pictures - mapped by their ids

finite mason
knotty plover

Then you aren't on latest dev or something

finite mason

I just installed the new dev a few mins ago

knotty plover

I mean if you're using messages it's not a dev question at all

And it's what Jaw0r3k said

plain roverBOT
hard bridge

Is there any reason that a ModalSubmit interaction in a DM returns different than a ModalSubmit in a guild channel?
In guild: interaction.message.components[].components[].data.options
In dm: interaction.message.components[].components[].options
Edit: using v10 API and discord.js@14.0.0-dev.1651493371-4ba0f56

slow storm
idle galleon

Could you show the actual types?

hard bridge

Is this what you are after? Both interactions (DM and guild) show the same

idle galleon

I’m talking abt the message

And the nested components

warm mural

Hey, do we have an approximate period of when we could be expecting v14? im not looking for anything specific, just trying to see if i should wait for the update or go with a third party to get modals

hard bridge

On closer inspection, there is an array of components containing ActionRow[s] in both interactions (directly nested under the interaction. On the DM interaction, the interaction.message is of type Object (as are the components[] under it), where the guild interaction is of type Message (and everything is propery typed under that)

nocturne kayak
idle galleon

You can install v13 dev from the github

Since v13 is not a mono repo

warm mural

oh will v13.7 include modals? i expected them to only be in v14

idle galleon

Yes

warm mural

interesting, then with the same aspect, anything about its expected release date i might have missed? i prefer staying away from dev since it tends to change a lot

idle galleon

It still is changing a lot

Esp since the other packages aren’t even v1

tidal lichen

alright so this is the first time I've use Discord.js v14 dev build and am working with typescript
I've been unable to find a valid reason for why I'm getting shown this error when I followed the "preview" link on the pinned message

idle galleon

You can’t put Modals in a ActionRow

It should be TextInputBuilder

tidal lichen
idle galleon You can’t put Modals in a ActionRow

na I figured out the issue and it's already made within a textinputbuilder which is required to be passed to an actionrowbuilder

for whatever reason when trying to add it anyway besides .addComponents() it returns that error so if I tried

const modal = new ModalBuilder({
  customId: `test`,
  title: `Test Modal`,
  components: [firstActionRow]
})

I was given that error but

const modal = new ModalBuilder({
  customId: `test`,
  title: `Test Modal`,
  components: []
}).addComponents([firstActionRow])

it would work

idle galleon

Oh, it’s supposed to be TextInputComponent

tidal lichen

what's the maximum amount of text inputs allowed on a modal?
is it 25?

tidal lichen

thank you

manic lynx

how do I setup the new slash command permission in my bot?

pallid ice

slash command permissions are handled by server owners now

tidal lichen

oh also anyone know if the dm_permission boolean will be added in the future?

manic lynx

I know I can do that.

pallid ice
manic lynx
pallid ice

no

manic lynx
pallid ice no
module.exports = {
    name: "help",
    description: "List of the commands.",
    type: ApplicationCommandType.ChatInput,
    defaultPermission: 'Administrator',```
pallid ice

its a boolean

true or false

manic lynx

wdym?

so I cant do only Admin can use that?

or something?

pallid ice

there are probably ways, but it's not the bot developers responsibility to set perms for slash commands anymore

pallid ice
manic lynx wdym?

defaultPermission: false denies the command to anyone without the builti-in permissions. by default, anyone with the Administrator perm can use all slash commands anyway

manic lynx

I mean like eval command or something

pallid ice
manic lynx
pallid ice

so don't push the ones you don't want to push globally

pallid ice

just don't?

I don't understand the question

manic lynx
const { ApplicationCommandType } = require('discord.js');

module.exports = async (client, globPromise, ascii) => {
  const table = new ascii('Slash Commands Loaded');
  table.setHeading('File', "Load Status");
  const slashCommands = await globPromise(
    `${process.cwd()}/src/SlashCommands/*/*.js`
  );

  const arrayOfSlashCommands = [];
  slashCommands.map((value) => {
    const file = require(value);
    const L = value.split('/');
    
if (!file?.name) {
  return table.addRow(L[7], '❌');
} else {
  client.slashCommands.set(file.name, file);
  table.addRow(L[7], '✅');
};

    if ([ApplicationCommandType.Message, ApplicationCommandType.User].includes(file.type)) delete file.description;
    arrayOfSlashCommands.push(file);
  });
  client.on("ready", async () => {
    // Register for a single guilds
    await client.guilds.cache.get('926400183867146290').commands.set(arrayOfSlashCommands);

    // Register for all the guilds the bot is in
    // await client.application.commands.set(arrayOfSlashCommands)
  });
  console.log(table.toString());
}``` this is my code.

Or your meaning is delete the file and if the commands is set in all guild I will back it right??
manic lynx
pallid ice

so you're currently only registering them for one guild anyway, but you can just not put any sensitive commands in to arrayOfSlashCommands and put them in a different array that you register on a different guild

but thats not really a d.js thing and more a basic JS thing

pallid ice

you could filter I guess, or just not put them in in the first place

manic lynx
vague depot
DiscordAPIError: Invalid Form Body
components[1].components[0].options[1].emoji.id: Invalid emoji
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async TextChannel.send (/home/container/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15)
    at async Object.execute (/home/container/commands/info/help.js:207:23) {
  method: 'post',
  path: '/channels/960462723836170271/messages',
  code: 50035,
  httpStatus: 400,
  requestData: {
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: [Array],
      components: [Array],
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: [Object],
      flags: 0,
      message_reference: [Object],
      attachments: undefined,
      sticker_ids: undefined
    },
    files: []
  }
}
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
    at Object.execute (/home/container/commands/info/help.js:215:35)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
manic lynx

is dm_permission is added?

knotty plover

To discord.js? No

But if you're just uploading json you can

tidal lichen

so I noticed when I click submit for modals it doesn't automatically close the modal is there a way to do this?
nvm just it not replying/deferring correctly

manic lynx
manic lynx
hoary fox
plain roverBOT
plain roverBOT

discord Application Commands: Application Command Object
read more

vague depot
tame gazelle
manic lynx

How do I set a client status in v14?

nocturne kayak

similar to how you do in v13, except you gotta have to import ActivityType enum instead of using string

silk topaz
vague depot
DiscordAPIError: Invalid Form Body
components[1].components[0].options[1].emoji.id: Invalid emoji
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async TextChannel.send (/home/container/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15)
    at async Object.execute (/home/container/commands/info/help.js:207:23) {
  method: 'post',
  path: '/channels/960462723836170271/messages',
  code: 50035,
  httpStatus: 400,
  requestData: {
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: [Array],
      components: [Array],
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: [Object],
      flags: 0,
      message_reference: [Object],
      attachments: undefined,
      sticker_ids: undefined
    },
    files: []
  }
}
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
    at Object.execute (/home/container/commands/info/help.js:215:35)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
gusty bane

hello, is it possible with

collector.on('collect', async (collected) => {
            if (collected.customId === "some") ```
read a modal? 

i mean if i log the interaction in the interactionCreate event he give me the output with customId: :/
nocturne kayak

no. modal isnt a message component
use awaitModalSubmit() instead

gusty bane

k

scarlet tangle

Oh my god no way it’s discord.js v14

I hate that

14 is unlucky number

pine granite

how long more till the production release of discord.js v14?

sterile hemlock

When it's ready™️

pine granite

thanks

sterile hemlock

anytime

thorny haven
const { GatewayIntentBits } = require('discord-api-types/v10')

const Mean = require('./client/Mean');

const mean = new Mean({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildBans,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildPresences,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.GuildScheduledEvents,
        GatewayIntentBits.MessageContent
    ],
    disableMentions: { parse: ['everyone', 'here'] }
});

global.mean = mean;

mean.login();``` I rarely ask questions here, but right now I can't find the answer myself. I'm switching from v13 to v14. And I don't find ClientOptions.disableMentions in the documentation. What has changed?
vague coyote
plain roverBOT
thorny haven

And I need to turn them off

sand adder
vague coyote
thorny haven

it's just that I sometimes ping users in my code

vague coyote

no, you have to provide allowedMentions in it to take effect

plain roverBOT
forest elm
sand adder

hm

ok i fixed it

thanks

thorny haven

@vague coyote I apologize for the ping, but what is the name of the dynamic (user.displayAvatarURL) option on v14?

forceStatic ?

scarlet tangle
thorny haven
scarlet tangle
tame gazelle
thorny haven

thanks emoji_33

tame gazelle
scarlet tangle

ah i see

thorny haven

it's still difficult for me to figure it out, I'm sorry

scarlet tangle
tame gazelle
thorny haven

so has dynamic option changed or not?

tame gazelle

dynamic option is now called forceStatic

thorny haven
forest elm

the previous dynamic: true behaviour is now the default behaviour, as forceStatic defaults to false

thorny haven

Permissions -> PermissionsBitField

plain roverBOT
scarlet tangle

wtf is this? all of my interactions suddenly stopped working ;-; help

white nebula

We can't help without your code

dawn phoenix

hard to say without other information - your app doesn't respond to that interaction instance

scarlet tangle

this ;-;

the modals and the application commands seems to work fine but select menus and buttons ain't working

thorny haven

The color in the embed can't be in the string now? EmbedBuilder().setColor()

scarlet tangle

yes it can't

thorny haven

and how do I translate color to number?

scarlet tangle
white nebula
forest elm
dawn phoenix

if you trust discord to validate it people can change that in server settings
this is just a default you as a bot dev can set, people can override that

thorny haven

what?

util.resolveColor outputs the same rgb array

scarlet tangle
scarlet tangle

Hi, how to add permissions to slash commands?

dawn phoenix
scarlet tangle

Danke!

wheat sequoia
copper jetty
wheat sequoia

i'll try

it's working, ty

wicked tusk

How can i get the value in interactionCreate now?
{
label: 'Report Bug',
description: 'This is a description',
value: 'bugModal',
},

copper jetty
thorny haven

is it possible to implement a modal collector instead of awaitModalSubmit?

I think the discord.js developers thought about it, but what's wrong with this modal?

dawn phoenix
scarlet tangle
thorny haven
dawn phoenix

then use the collector?

proven wolf
thorny haven
dawn phoenix

then what's your question/concern?
you asked why a collector doesn't exist, but it does

scarlet tangle
proven wolf

But is not really useful because you can receive only one submit interaction by showable modal

copper jetty
scarlet tangle

welll

thorny haven
dawn phoenix

i linked you to the source code for the await* above, it demonstrates exactly how the collector within is used

plain roverBOT

class 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...)

thorny haven

ok, I'll take a look

frank moss

What is the reason?

thorny haven

not channel cache

frank moss

what needs to happen

dawn phoenix

the client needs to be ready, presumably (or you need to fix the ID or invite the bot to the channel with that id)

frank moss
interaction.channel.send({content: "asd"})```

this code also gives the same error

urban belfry
frank moss

no dm

urban belfry

try enabling the Channel Partial first

amber sequoia

why isn't RANDOM working for color on embed with embedbuilder?

embeds[0].color[NUMBER_TYPE_COERCE]: Value "RANDOM" is not int.

frank moss

Can you post an example of sending a message to the channel in discord.js v14?

gentle bane
tame gazelle

nothing changed

frank moss
gentle bane

probably interaction.channel is undefined try to console.log it

frank moss

console.log is running

outer bane

do you have the Guilds intent and a bot user in the guild?

frank moss
client.channels.cache.get("id").send({content: "asd"})

this command doesn't work either

outer bane

do you somehow remove channels from the cache?

frank moss

No

i will try again tomorrow

outer bane

can you log client.channels.cache.size

gentle bane

what i'm doing wrong?

urban belfry

you need to pass the type to the generic

gentle bane

oh okey thank you so much!

thick prism

plys my send docs discord.js v14

vague coyote

checkthepins

copper nymph

How do I resolve the thing for discord status type so I can use a config file to change it based on a list of different statuses? I have the list but it doesn’t change for playing, watching, listening and streaming.

wicked tusk

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

const title = interaction.fields.getTextInputValue('title');

what is the error?

oh nvm found it

thick prism
thick prism
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require("discord.js");
module.exports = {
    name: "ticket",
    run: async (client, message, args) => {
        message.delete().catch(e => console.log('e'))

        let ticket = new ActionRowBuilder().addComponents(
            new ButtonBuilder().setCustomId("ticket").setStyle("SECONDARY").setLabel("Open Ticket").setEmoji("📩")
        );

        let embed = new EmbedBuilder()
        .setTitle(message.guild.name)
        .setDescription(`Para abrir um ticket click no \"📩\"`)
        .setColor(client.color)
  
        message.channel.send({ embeds: [embed], components: [ticket] })
    }
}

not function, not error

hoary fox

whats bad?

wicked tusk

What is that

TypeError: Found non-callable @@iterator

const firstActionRow = new ActionRowBuilder().addComponents(title);

urban belfry
thick prism

which matrix plus the code is not answering if it would not delete the message

urban belfry

and the style should use the ButtonStyle Enum

wicked tusk

TypeError: components.map is not a function

modal.addComponents(firstActionRow, secondActionRow, thirdActionRow);

array as well?

hoary fox
thick prism
let ticket = new ActionRowBuilder().addComponents(
            new ButtonBuilder().setCustomId("ticket").ButtonStyle("SECONDARY").setLabel("Open Ticket").setEmoji("📩")
        );
hoary fox

setStyle to enum not what u do

tidal lichen

.setStyle(ButtonStyle.Secondary)

copper nymph
copper nymph
copper jetty

Import it from discord.js

thick prism
wicked tusk

Anyone mind having a look at the code https://sourceb.in/jumw990PoF and telling me why it's only replying to the interaction but not creating a thread, sending a message?

thick prism

new Embed() or new EmbedBuilder()??

tidal lichen

EmbedBuilder

copper nymph
copper jetty Import it from discord.js

Yes because that totally will work. I would have to take the discord.js value and put that code as part of my database so like “Discord.watching” or something just to make the fact I look through a database of statuses that are updated by my website updates and stuff…

thick prism
hoary fox
copper nymph
thick prism

Code:

client.on("messageCreate", (message) => {
    if (message.content.startsWith(`<@!${client.user.id}>`) || message.content.startsWith(`<@${client.user.id}>`)) return message.reply({ content: `🟢 **|** Olá eu so o bot de ticket da **Green Codes** para ver meu preço vai até o [#972625786051887144](/guild/222078108977594368/channel/972625786051887144/)` });

    if(message.channel.type === 'dm') return 
    if(message.author.bot) return;
    if(!message.content.toLowerCase().startsWith('g.')) return;
    if(!message.guild) return;
      
    if(message.content === 'g.ticket') {
        message.delete().catch(e => console.log('e'))

        let ticket = new ActionRowBuilder().addComponents(
            new ButtonBuilder().setCustomId("ticket").setStyle(ButtonStyle.Secondary).setLabel("Open Ticket").setEmoji("📩")
        );

        let embed = new EmbedBuilder()
        .setTitle(message.guild.name)
        .setDescription(`Para abrir um ticket click no \"📩\"`)
        .setColor(client.color)
  
        message.channel.send({ embeds: [embed], components: [ticket] })
    }
})

not function

hoary fox
tidal lichen

mean non functional I believe
questioning why it isn't working

thick prism
wicked tusk
hoary fox
thick prism

yes I'm using all the intens

const { Client, Collection } = require("discord.js");
const client = new Client({ intents: [32767] })

copper nymph

Ok now I have all the gateway intents… why won’t my bot show the content of a message?

dawn phoenix

it's literally just one you need, having all is very much not a good idea

copper nymph

Yes I am aware but I am trying to figure out the ones I need when testing in one server then removing those I don’t need. I just can’t see any message content from my server and it’s weird.

Surely this would mean I can read message content?

thick prism

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

UnknownEnumValueError: Expected the value to be one of the following enum values:
at NativeEnumValidator.handle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@sapphire\shapeshift\dist\index.js:1602:66)
at NativeEnumValidator.parse (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@sapphire\shapeshift\dist\index.js:113:88)
at ButtonBuilder.setStyle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\builders\dist\index.js:583:48)
at module.exports (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\eventos\interactionCreate.js:13:14)
at Client.emit (node:events:539:35)
at InteractionCreateAction.handle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:384:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
value: 'DANGER',
enumKeys: [ 'Primary', 'Secondary', 'Success', 'Danger', 'Link' ],
enumMappings: Map(15) {
'Primary' => 1,
1 => 1,
'1' => 1,
'Secondary' => 2,
2 => 2,
'2' => 2,
'Success' => 3,
3 => 3,
'3' => 3,
'Danger' => 4,
4 => 4,
'4' => 4,
'Link' => 5,
5 => 5,
'5' => 5
}

fluid bronze
hoary fox
thick prism
copper nymph

Yes the GuildMessages intent does not work.

dawn phoenix
thick prism
hoary fox all intents == 131071 your intents are old intents without message content and s...

C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\builders\dist\index.js:526
this.components.push(...components);
^

TypeError: Found non-callable @@iterator
at ActionRowBuilder.addComponents (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\builders\dist\index.js:526:21)
at Client.<anonymous> (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\index.js:24:45)
at Client.emit (node:events:527:28)
at MessageCreateAction.handle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:527:28)

copper nymph
dawn phoenix

so then i'm just too blind to see where you supply MessageContent?

copper nymph

Oh that isn’t on the list of intents…

dawn phoenix

what list?

copper nymph

From discord api

Liar of intents.

dawn phoenix

have they still not documented that, wew

copper nymph

Nope 😂

dawn phoenix

it's 1 << 15, but should be in the types you import there

copper nymph

Ok cool. Now I just need to figure out how to set my status to watching…

Because apparently discord.playing works but discord.watching and discord.listening don’t.

dawn phoenix
copper nymph

Uhm… activity type?

Yeah… .setActivity({type: <enum>})

Or whatever it is… it sets the message but not the type.

dawn phoenix

oh, that, right, but why discord.playing?
i think we export those under ActivityType.Playing etc?

copper nymph

Because Discord is discord.js

dawn phoenix

but we don't export "playing" on discord.js

-ev Discord.playing

forest geyserBOT
dawn phoenix

-ev Discord.ActivityType.Playing

forest geyserBOT
dawn phoenix

might be because discord.playing is undefined and that trips 0? which is Playing, which is "playing..."

copper nymph

So how do I set it to watching or listening or streaming?

Like that’s what I am trying to do… I have 4 messages. Playing on a MC server, watching a YouTube video, listening to a podcast and streaming to twitch…

The message and links are all in a database that gets pulled from in a loop… so that’s why I need to figure out what to put in the field to make it work…

dawn phoenix
copper nymph

Ok so then I would just have to basically use an if statement to check what it is in the database and then use the correct import.

dawn phoenix

alternatively saving the numbers and supplying/casting those

copper nymph

Thanks.

Wait… where is a list of the numbers?

dawn phoenix
copper nymph

-ev Discord.StatusType.Watching

dawn phoenix

maybe not by trying to eval things on my bot

copper nymph

Oh

That would make sense…

Thanks for your help.

scarlet tangle

Can we add more than 4 buttons(interaction)

outer bane

you can add up to 25 buttons per message

scarlet tangle
outer bane

each row can have up to 5 buttons (nothing else), in v13 and 14

thick prism

ERROR

    this.components.splice(0, this.components.length, ...components);
                                                         ^

TypeError: Found non-callable @@iterator
    at ActionRowBuilder.setComponents (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\@discordjs\builders\dist\index.js:530:21)
    at Client.<anonymous> (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\index.js:24:45)
    at Client.emit (node:events:527:28)
    at MessageCreateAction.handle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)Green\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:527:28)

CODE


        let ticket = new ActionRowBuilder().setComponents(
            new ButtonBuilder().setCustomId("ticket").setStyle(ButtonStyle.Secondary).setLabel("Open Ticket").setEmoji("📩")
        );

        let embed = new EmbedBuilder()
        .setTitle(message.guild.name)
        .setDescription(`Para abrir um ticket click no \"📩\"`)
        .setColor(client.color)
  
        message.channel.send({ embeds: [embed], components: [ticket] })```

plys welcome

const { Client, Collection, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");

thick prism

what dear matrix i'm here to wonder how to fix the code not that has a matrix

exotic nexus

?

is that a translator

thick prism

yes

Tell me how I can fix the error

exotic nexus

Monbrey told you

thick prism

and oq takes I don't know bro i don't intendi oq he talked

exotic nexus

no idea what you're saying

thick prism

in idea what he's saying

thick prism
exotic nexus

what's so hard to understand about that

thick prism
const { Client, Collection, EmbedBuilder, ActionRowBuilder, ButtonBuilder, setComponents } = require("discord.js");
exotic nexus
let ticket = new ActionRowBuilder().setComponents(
            new ButtonBuilder().setCustomId("ticket").setStyle(ButtonStyle.Secondary).setLabel("Open Ticket").setEmoji("📩")
        );

setComponents() takes an array

thick prism

Dude has no sense of what he said

exotic nexus

that's what I want to say to you right now

thick prism

bro speaks oq i have to fix not this

has fixed the error

the way it works

exotic nexus

what

get a better translator

thick prism

my send code fix

knotty plover

No we will not fix your code

thick prism

send me the fixed code

exotic nexus

no

thick prism

C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\rest\dist\index.js:709
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, res.status, method, url, requestData);
^

DiscordAPIError[50035]: Invalid Form Body
components[0][COMPONENT_TYPE_INVALID]: The specified component type is invalid in this context
at SequentialHandler.runRequest (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\rest\dist\index.js:709:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\rest\dist\index.js:512:14)
at async TextChannel.send (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15) {
rawError: {
code: 50035,
errors: {
components: { '0': { _errors: [ [Object] ] } }
},
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'post',
url: 'https://discord.com/api/v10/channels/972624681133821992/messages',
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [ { description: 'oi', color: 65280 } ],
components: [
{
type: 2,
emoji: undefined,
custom_id: '1',
style: 2,
label: 'Open Ticket'
}
],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
}
}
}

wicked nebula

Actually garbanzo

idle galleon
plain roverBOT

guide Interactions: Building and sending buttons
read more

idle galleon

Dev is the same, but you don’t include Message in the class name

thick prism

man much more really thank you finally someone who sends the docs instead of just talking shit

exotic nexus

not our fault you don't understand what an array is

tough gulch

How do I echo the picture a user attached in a command back to the user?
reply = { content: textResponse, attachments: [interaction.options.getAttachment('photo', false)] };
Is what I tried

tough gulch

I also tried this function that I wrote since calling toJSON on the attachment object doesn't seem to match the Discord API:

function attachmentConverter(att) {
    var response = att.toJSON();
    return {
        id: response.id,
        filename: response.name,
        description: response.description,
        content_type: response.contentType,
        size: response.size,
        url: response.url,
        proxy_url: response.proxyURL,
        height: response.height,
        width: response.width,
        ephemeral: response.ephemeral
    };
}

That doesn't seem to work either

pastel flare
light fox

Wondering how this guy hasn't met the Hammer yet riceCat

dawn phoenix

that was hours ago, kindly move on, thanks firY

amber sequoia

Can modal be shown by clicking a button ?

urban belfry
amber sequoia

I get this error DiscordAPIError[40060]: Interaction has already been acknowledged.

urban belfry

well, have you replied to it?

i mean you have as the error states

amber sequoia

i deferUpdate every interaction though (in interaction event)

urban belfry
amber sequoia

oh ok

can i use messagecomponentcollector for recieving modal submittions ?

copper jetty

no

modals aren't components

amber sequoia

i need to get the submittion info in the command file itself as im using a command handler

copper jetty

construct new InteractionCollector or use awaitModalSubmit()

amber sequoia

k thx

scarlet tangle
const menu = new SelectMenuBuilder()
      .setCustomId('maintenace')
      .setPlaceholder('Defina uma função:')
      .addOptions([
        {
          label: 'BOT',
          description: `Coloca o BOT em manutenção.`,
          emoji: '🤖',
          value: 'bot',
        },
        {
          label: 'Comando',
          description: `Colocar algum comando em manutenção.`,
          emoji: '📃',
          value: 'command',
        },
      ]);

Is this way to build a SelectMenu in v14 correct?

copper jetty
scarlet tangle
const menu = new SelectMenuBuilder()
      .setCustomId('maintenace')
      .setPlaceholder('Defina uma função:')
      .addOptions([
        {
          label: 'BOT',
          description: `Coloca o BOT em manutenção.`,
          emoji: { name: '🤖' },
          value: 'bot',
        },
        {
          label: 'Comando',
          description: `Colocar algum comando em manutenção.`,
          emoji: { name: '📃' },
          value: 'command',
        },
      ]);
hallow violet

try using option builder

plain roverBOT
copper jetty

i tried using option builder in my code and it didnt work i had to use objects but maybe it will work for you

pliant salmon

is this issue already known?

copper jetty
pliant salmon
copper jetty

it is required trust me

tame gazelle

you can still do .reply(string)

pliant salmon
copper jetty

dude

it would say optional if it isnt required

pliant salmon

literally says OR there

which literally means it isnt required at all

forest elm

It's required

You have to pass one of those

pliant salmon

yes, but the options arent required

forest elm

Yes they are

pliant salmon

again, they arent

its literally on the types

if you pass in a string you dont need to pass options

forest elm

The string is the option

pliant salmon

but he is saying that i need to pass in the options object

when i literally dont have to

forest elm

Nobody said that

pliant salmon

again, my point is that i get random crashes with that error and i was just asking if its a known error

forest elm

It's not an issue with discord.js

You probably passed null to it

pliant salmon

i didnt

im only sending strings to it

forest elm

Show the code

pliant salmon
forest elm

JSON.stringify can return undefined

pliant salmon
vague coyote

Does it tho, log it

pliant salmon
forest elm

Your error is caused by passing undefined (or nothing at all) to reply()

pliant salmon

the thing is that im always replying

pliant salmon

Lovely

urban belfry
pliant salmon
urban belfry

i don't have a clue
perhaps to split up the types for the modal actionrows and message action rows, i haven't kept up at all 🤷‍♂️

pallid ice
pliant salmon
amber sequoia

why is this not in docs but written in type on the left? (neither is EmbedField or smth)

idle galleon

Which doesn’t have a docs site

amber sequoia

How am i supposed to know how to write it in code then

idle galleon

Prob bc it’s ts types only

Most editors are good at giving hints

Otherwise, you can check the source code directly or the discord.dev docs

copper jetty
tame gazelle

is it possible to add a field to a specific position?