#djs-in-dev-version

1 messages · Page 30 of 1

vague coyote
#

nothing other than text inputs are documented by discord, so thats a big no

dusk heath
vague coyote
#

they are not supported willingly

#

just happen to be sendable already

exotic nexus
#

these are what radio buttons should look like probably

dusk heath
vague coyote
#

djs wont support stuff until its documented by discord.

manic lynx
#

My channelTypes in slash commands doesn’t work but I did it right

split fulcrum
#

Have MessageAttachment change its name??

#

or is it just me??

forest elm
#

its just Attachment now

split fulcrum
#

Ohh

#

So I just remove Message?

split fulcrum
#

what does it mean??

forest elm
#

addComponents takes an array

split fulcrum
#

ahh

#

So i just need to add []

frank moss
#

Does anyone have an example where I can see how to make radio buttons in modals?

bronze gulch
#

Greetings all,
I am encountering a peculiar error with messageComponentCollectors. I have a definition module which adds and listens to buttons on messages to flip the embed definition in a sort of "pages" system. However, when a message with an active collector is deleted, my bot immediately crashes with the error attached bellow. The stack trace shows that all is coming from within Discord.js itself, and unrelated to my code. May I receive some insight on how I may fix this issue?

frank moss
#

it's here but

dusk heath
#

But? kekHuh

hoary fox
bronze gulch
#

Lol the modal is definitely fake 😂

bronze gulch
fiery widget
#

hey, there is anything new after the Modal update? i mean new bot features like modals & inputs, etc? thx 😄

unreal stump
#

no

lavish snow
#

Hey, what are these new embeds called?

woven grove
#

Nothing about this is new

proven wolf
crude gust
#

thats a suggestiong in github and in the ddevelopers server its not an actual preview

proven wolf
#

"that would be good" ≠ confirmed

brave dagger
#

Hello, I don't understand an error

#
C:\Users\zazbi\Documents\Nael\PROGRAMMATION\DiscordBots\TicketBot\node_modules\@discordjs\rest\dist\index.js:714
        throw new DiscordAPIError(data, "code" in data ? data.code : data.error, res.status, method, url, requestData);
              ^

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width
data.components[0].components[2][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width
data.components[0].components[3][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width
data.components[0].components[4][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width
    at SequentialHandler.runRequest (C:\Users\zazbi\Documents\Nael\PROGRAMMATION\DiscordBots\TicketBot\node_modules\@discordjs\rest\dist\index.js:714:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\zazbi\Documents\Nael\PROGRAMMATION\DiscordBots\TicketBot\node_modules\@discordjs\rest\dist\index.js:517:14)
    at async ChatInputCommandInteraction.showModal (C:\Users\zazbi\Documents\Nael\PROGRAMMATION\DiscordBots\TicketBot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5) {
  rawError: {
    code: 50035,
    errors: {
      data: { components: { '0': { components: [Object] } } }
    },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'post',
  url: 'https://discord.com/api/v10/interactions/982716556779851857/aW50ZXJhY3Rpb246OTgyNzE2NTU2Nzc5ODUxODU3Om9nYVZtZVhTUU51QkVsd2J4TE1BSVl0YVV5RFY1Umx2TmREZjJ3Rkd5TmE4VzJqQzY2eENSa3pNYUlFZWZDd0o3VlBkQ09kS1NhdnlBTTJFbmJ3OURyWlpwYlR1cGFiOWV2NGkzdlRtNjhFWFVMaGpMU2s0clo4ZGlYUFRtNTcw/callback',
  requestBody: {
    files: undefined,
    json: {
      type: 9,
      data: {
        title: 'Choices',
        custom_id: 'modal_data',
        components: [ { type: 1, components: [Array] } ]
      }
    }
  }
}```
brave dagger
# brave dagger ``` C:\Users\zazbi\Documents\Nael\PROGRAMMATION\DiscordBots\TicketBot\node_modul...

Modal before the show modal:

{
    "title": "Choices",
    "custom_id": "modal_data",
    "components": [
        {
            "type": 1,
            "components": [
                {
                    "type": 4,
                    "custom_id": "label_0",
                    "label": "Choice n°1",
                    "placeholder": "Your answer",
                    "required": false,
                    "style": 1
                },
                {
                    "type": 4,
                    "custom_id": "label_1",
                    "label": "Choice n°2",
                    "placeholder": "Your answer",
                    "required": false,
                    "style": 1
                },
                {
                    "type": 4,
                    "custom_id": "label_2",
                    "label": "Choice n°3",
                    "placeholder": "Your answer",
                    "required": false,
                    "style": 1
                },
                {
                    "type": 4,
                    "custom_id": "label_3",
                    "label": "Choice n°4",
                    "placeholder": "Your answer",
                    "required": false,
                    "style": 1
                },
                {
                    "type": 4,
                    "custom_id": "label_4",
                    "label": "Choice n°5",
                    "placeholder": "Your answer",
                    "required": false,
                    "style": 1
                }
            ]
        }
    ]
} 
proven wolf
#

An action row can only contain a single text input

shut comet
#

I can't seem to get permissionOverwrites to work for channels. It doesn't throw any error, but it doesn't add the permission in the channel either. Here's the code:

const newChannel = await interaction.guild?.channels.create(channelName, {
              topic: `Donator channel: ${interaction.user}.`,
              permissionOverwrites: [{ id: interaction.user.id, allow: ["ViewChannel"] }]
            }).catch((err) => { return interaction.editReply({ content: "Error creating the channel.\n" + err }); });
proven wolf
shut comet
#

how do I specify?

vague coyote
#

you shouldn't need that?

tame gazelle
#

is there a PR for get guild member's banner?

proven wolf
#

Value is OverwriteType enum

vague coyote
#

idk why

tame gazelle
#

oh wrong screenshot

knotty plover
#

Yeah, for members. To get their url

tame gazelle
knotty plover
#

Was merged 13 days ago

#

But I don't think you get the banner hash for guild members currently

#

So the data necessary to generate it isn't available

tame gazelle
vague coyote
#

aren't banners on users, not guild members?

knotty plover
#

Oh, yeah hours

tame gazelle
tender spoke
knotty plover
#

Definitely can't get guild banner

vague coyote
#

oh lol, since when
I always thought its just avatar

tame gazelle
#

3 months or more

shut comet
plain roverBOT
proven wolf
shut comet
#

yep, it should be

tame gazelle
shut comet
#

it creates the channel and adds the topic, but not the perms

tame gazelle
#

data are info received by the API?

knotty plover
#

Yes

proven wolf
shut comet
shut comet
shadow nacelle
#

It there any way the bot can send a messages to a text-voice-channel?

tender spoke
steel haven
#

Hello I have a error :

Type 'ActionRowBuilder<SelectMenuBuilder>' is not assignable to type 'ActionRowBuilder<TextInputBuilder>

code:

    modal.addComponents([
        (await new ActionRowBuilder().addComponents([time])) as ActionRowBuilder<SelectMenuBuilder>
    ]);
hoary fox
#

u can put only text inputs to modals

steel haven
tender spoke
steel haven
#

Oh okey

graceful bolt
#

It's normal when i do client.user.setActivity("Hi !", {type: "WATCHING"});, this don't work. no activity presence...

graceful bolt
tender spoke
vague coyote
#

thats the name, not the type

tender spoke
# graceful bolt ........

good you found the setActivity method in the docs you just need to click the blue ActivityOptions text

uncut kelp
#

You are looking at the wrong thing

vague coyote
#

you are still looking at the wrong thing

tender spoke
graceful bolt
vague coyote
#

again, use the ActivityType enum to set the type or use PascalCase

#

aka Watching not WATCHING

#

not sure if it works with strings tho

graceful bolt
vague coyote
little oak
#

Hi, Is Text in voice channel discord built-in can be handle by discord js

little oak
#

How ?

uncut kelp
#

Feel free to look at the source code

little oak
#

Can you help me please I am so coufused with the source code

uncut kelp
#

Why do you need to know how it works?

tender spoke
#

i think he can't find the correct files

vague coyote
digital sequoia
#

What is this?

TypeError: Found non-callable @@iterator
    at ActionRowBuilder.addComponents (/root/cloepremium/node_modules/@discordjs/builders/dist/index.js:532:21)
    at Object.run (/root/cloepremium/SlashCommands/info/help.js:45:22)
    at commandExecute (/root/cloepremium/events/guild/interactionCreate.js:107:15)
    at /root/cloepremium/events/guild/interactionCreate.js:148:11
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
vague coyote
#

you didnt pass an array where one was expected

#

help.js line 45

digital sequoia
#

thats my function:

                    new ActionRowBuilder()
                    .addComponents(
                        new SelectMenuBuilder()
                            .setCustomId(`${client.user.id}_cloeHelpMenu`)
                            .addOptions([
                                {
                                    label: `What are JSON Embeds?`,
                                    emoji: '🗄',
                                    value: 'jsonEmbeds',
                                },
                                {
                                    label: `What features does Cloe have?`,
                                    emoji: '💫',
                                    value: 'features',
                                },
                                {
                                    label: `Why Cloe don't give roles? (AutoRole & ReactionRole)`,
                                    emoji: '❓',
                                    value: 'roles',
                                },
                            ]),
                    ),
#

line 45 is .addComponents

uncut kelp
#

(You were answered)

digital sequoia
#

Omfg

#

Okay thx HAHHAHA

proven wolf
buoyant steeple
#

holo

digital sequoia
#
 [antiCrash] :: Unhandled Rejection/Catch
TypeError: (intermediate value).setColor(...).setTitle(...).addField is not a function
    at Object.run (/root/cloepremium/SlashCommands/moderation/giveaway.js:307:18)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) Promise {
  <rejected> TypeError: (intermediate value).setColor(...).setTitle(...).addField is not a function
      at Object.run (/root/cloepremium/SlashCommands/moderation/giveaway.js:307:18)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
}

What is wrong with that?

            const Giveaway_Embed = new EmbedBuilder()
                .setColor(globalcolor)
                .setTitle(`${getPrize}`)
                .addField("Time Remaining", `Not started yet.`, true)
                .addField("Hosted by", `${getHoster}`, true)
                .setFooter({
                    text: `${getWinners} Winner${getWinners > 1 ? "s" : ""}`,
                    iconURL: client.user.displayAvatarURL({
                        dynamic: true
                    })
                });
```` ?
proven wolf
#

And addFields take an array

digital sequoia
#

.addField is 1 to 1 the old methode from djs xd

proven wolf
digital sequoia
#

As I said its 1 to 1 the old method

#
const { EmbedBuilder } = require('discord.js');
module.exports = Object.defineProperties(EmbedBuilder.prototype, {
    // Append users' ranks to guild
    addField: (name, value, inline) => {
        return this.addFields({ name, value, inline });
    }
});
proven wolf
digital sequoia
#

Why did discord.js such crab changes?

#

But thanks for the help ❤️

tender spoke
digital sequoia
#

Idk if its easier but for me it isnt since I know need to rewrite over 14 categorys and many functions

proven wolf
#

To be most generic

#

setFields take an array so addFields too

#

Same for setComponents and addComponents

digital sequoia
#

v13 dont use an array

knotty plover
#

This isn't the v13 channels though

#

The plan is to add back support for both I think? It's not clear

manic lynx
#

Is there a posible to add a attachment into a modal?

idle galleon
#

Add an image to a modal?

#

No

manic lynx
idle galleon
#

No

manic lynx
idle galleon
manic lynx
idle galleon
#

They have their own website for suggestions/feature requests

plain roverBOT
#

We are not Discord, just some nerds who develop discord bots!
/report reports (harassment/hacking/spam/abuse) and appeals
/support anything discord related
/billing payment/nitro
/feedback feedback/feature requests

idle galleon
#

The last link

scarlet tangle
#

Why is this happening?

knotty plover
#

No reaction with that id on the message

#

Resolved to null

scarlet tangle
#

but it is there

#

and i even use that same line of code in another file and i have no issues

knotty plover
#

Well that's all that can throw an error on that line. Sure it's the right message?

scarlet tangle
#

i'll check again

#

oh wow, i apologize, it wasn't

#

no wonder

green plume
#

I am above the bot, still the bot say me I must be above. Is this a bug of djs?

if (ctx.interaction.member.roles.highest.position < ctx.interaction.guild.members.me.roles.highest.position || ctx.interaction.member.user?.id !== ctx.interaction.guild.ownerId) return ctx.interaction.reply({ content: `${process.env.FAILURE_EMOJI} | You must be above me to use this command.`, ephemeral: true });
jaunty comet
green plume
jaunty comet
knotty plover
#

are you the guild owner?

green plume
jaunty comet
#

Thats why it’s not working

green plume
#

I want the cmd to work if a user have higher role than bot as well as if the user is guild owner

jaunty comet
#

Cause ur using an or operator

green plume
#

Can I use like this?

if (ctx.interaction.member.user?.id !== ctx.interaction.guild.ownerId && ctx.interaction.member.roles.highest.position <= ctx.interaction.guild.members.me.roles.highest.position) return ctx.interaction.reply({ content: `${process.env.FAILURE_EMOJI} | You must be above me to use this command.`, ephemeral: true });
knotty plover
#

using an && should work

jaunty comet
#

Yeah an && would work

green plume
#

okay

jaunty comet
#

Actually @green plume what if the owner has like no roles

green plume
#

cause owner doesn't require roles to ban someone

jaunty comet
#

Yes but the && means both have to be true

#

Or false actually

knotty plover
#

Exactly

jaunty comet
#

the first one is false but the 2nd one is true technically cause the owner has no roles

knotty plover
#

He wants them both false

#

Owner can have roles

#

You could flip it to be a positive pass on owner

#

But it's fine with them both false

green plume
jaunty comet
knotty plover
#

Doesn't work like that

knotty plover
#

That's why you use &&

jaunty comet
#

Is there a thing where the owner is already classified as the “highest role”

knotty plover
#

No

green plume
knotty plover
#

No, both have to be true

green plume
#

Oh okay

jaunty comet
#

Oh wait I see why itd work now

#

Nvm I was thinking it the other way around

knotty plover
#

Because if one condition isn't true, it won't return

jaunty comet
#

Yeah exactly

green plume
#

ya

jaunty comet
#

I was thinking as if both had to be false

#

So wait since the builders are gonna be in the actual api

#

How would I be able to access the builders

knotty plover
#

wdym

#

Just import them

jaunty comet
knotty plover
#

for the re-exported ones yeah

jaunty comet
#

Or

exotic nexus
#

doesn't discord.js export builders now? or am I tripping

jaunty comet
exotic nexus
#

no idea myself, I'm asking

#

it seemed to work when I tried it

jaunty comet
#

I see

exotic nexus
#

should probably take a look at source

jaunty comet
#

From the looks of it SlashCommandBuilder is in discord.js, but the course isnt updated

jaunty comet
#

guide still uses builders

#

oh nevermind

#

I think I checked the wrong one

scarlet tangle
#

Hi, can sb help me?

(05.06.2022 10:06:03) [ERROR]: TypeError: TypeError: component.toJSON is not a function
import { ColorResolvable, Message, Util } from 'discord.js';
import { ActionRowBuilder, ButtonBuilder, EmbedBuilder } from '@discordjs/builders';
import { Client } from '../../classes/client';
import { ButtonStyle } from 'discord-api-types/v10';

export default async (bot: Client, message: Message) => {
    if (message.channel.isDM() && !message.author.bot) {
        const buttonHelp = new ButtonBuilder()
            .setCustomId(`ticket-${message.author.id}`)
            .setLabel('Potrzebuję pomocy!')
            .setStyle(ButtonStyle.Success);

        const buttonCancel = new ButtonBuilder()
            .setCustomId(`ticket-${message.author.id}`)
            .setLabel('Anuluj!')
            .setStyle(ButtonStyle.Danger);

        const buttonHelpRow = new ActionRowBuilder()
            .addComponents([buttonHelp]);

        const buttonCancelRow = new ActionRowBuilder()
            .addComponents([buttonCancel]);

        const helloEmbed = new EmbedBuilder()
            .setColor(Util.resolveColor(<ColorResolvable>bot.colors.green))
            .setDescription(`Witaj ${message.author}!.`)
            .setFooter({ text: `Ticket - ${message.author.id}`, iconURL: message.author.displayAvatarURL() });
        await message.channel.send({
            embeds: [helloEmbed],
            components: [buttonHelpRow, buttonCancelRow],
        });
    }
};
scarlet tangle
sacred eagle
#

They seem to take an array on the latest commit. You sure this is updated?

scarlet tangle
sacred eagle
#

Make sure it's updated then.

scarlet tangle
#

but is it possible to put buttons inline?

sacred eagle
#

Add them to the same row instead of seperate action rows

scarlet tangle
#

okay

#

Thanks

tall verge
#

there is something wrong with the typings

#

Is this a typings error?

knotty plover
#

No? I don't understand the question

#

What's wrong here

#

Oh it doesn't match the jsdoc

#

Well one of them is wrong I guess

prisma kiln
knotty plover
#

A modal is not an action row

#

It's a Modal / ModalBuilder

prisma kiln
#

oh, ok thx

little oak
tall verge
proven wolf
#

like in a TextChannel

prisma kiln
#

can I use select menu in modal ?

tender spoke
proven wolf
prisma kiln
#

oh, ok

#

I hope it will be in new version

tame gazelle
#

iirc you can send them

proven wolf
little oak
#

It's only in the dev version ?

proven wolf
little oak
#

It's a private bot for a unique server so i don't need I think

digital sequoia
#

How can i show a modal?

proven wolf
digital sequoia
#

thx

tame gazelle
#

is it possible to use Attachment for create an attachment or we have to use AttachmentBuilder ?

forest elm
#

the latter, that's why it exists

tender spoke
#

why we can contruct Attachment if AttachmentBuilder is a thing i dont understand it

forest elm
#

the constructor is private

tame gazelle
forest elm
#

idk if it works or not, but the constructor is private, so you should not be using it

tender spoke
forest elm
#

it might work now, but it might not work at a later stage

dull mulchBOT
median jetty
#
        this.client.on("ready", async () => {
            const commands = this.client.commands.map((command) => ({
                name: command.name,
                description: command.description,
                options: command.options,
                type: command.type
            }))
            await this.client.guilds.cache.get("960547412567539763").commands.set(commands);
        })

Don't refresh commands

tall verge
#

Are you using the correct ID?

median jetty
tall verge
#

try client.application.commands.set(commands)

median jetty
tall verge
digital sequoia
#
const applyModal = new Modal() 

Error:

TypeError: Modal is not a constructor

huh?

forest elm
#

ModalBuilder

digital sequoia
mental inlet
#

Why does typescript complain when I try to define client.commands, I have a discord.d.ts file to silence it..
discord.d.ts file:

import { Collection } from 'discord.js';

interface ExtraData {
    commands: Collection<unknown, any>
}

declare module 'discord.js' {
   export interface Client extends ExtraData {}
}
forest elm
#

is that .d.ts file included in the tsconfig

mental inlet
crude valley
#

what's the problem here?

#

*using dev version ^14.0.0-dev.1654430643-7a1095b

indigo fable
#

can i use discord.js to write a serverless bot?

velvet jasper
#

No

crude valley
obtuse crater
#

new ActionRowBuilder<ButtonBuilder>() iirc

digital sequoia
#

Whats wrong with that?
TypeError: components.map is not a function

Code:

            const applyModal = new ModalBuilder() 
            .setCustomId(`${client.user.id}_apply_${interaction.guild.id}`)
            .setTitle(`${interaction.guild.name} Application`)
            .addComponents(
                new ActionRowBuilder()
                .addComponents(
                    comps // Array of TextInputs
                )
            )
obtuse crater
#

addComponents takes an array

digital sequoia
#

Both?

obtuse crater
#

yes

crude valley
digital sequoia
#

New error

  Expected the value to be one of the following enum values:

  | Short or 1
  | Paragraph or 2

    at NativeEnumValidator.handle (/root/cloepremium/node_modules/@sapphire/shapeshift/dist/index.js:1666:66)

obtuse crater
#

what is comps

digital sequoia
#

an array of textInputBuilders

obtuse crater
#

can you show the code for them?

digital sequoia
#
            let comps = []
            guildDB.application.questions.forEach(entry => {
                comps.push(
                    new TextInputBuilder()
                    .setCustomId(`${entry.ID}`)
                    .setLabel(`${entry.question}`)
                    .setStyle(`${entry.type}`)
                    .setMinLength(entry.min)
                    .setMaxLength(entry.max)
                    .setPlaceholder(`${entry.placeholder}`)
                    .setRequired(entry.required), 
                )
            })
crude valley
#

How can I implement a new description to a Message's embed

velvet jasper
#

EmbedBuilder.from(firstLog.embeds[0]).setDescription()

crude valley
#

damn, thank you

obtuse crater
velvet jasper
digital sequoia
velvet jasper
#

If TS allows that it’s unintentional and needs to be fixed

digital sequoia
#

I dont use ts

velvet jasper
#

Ok well considering js allows you to do anything unsafe, there’s nothing we can do about that

digital sequoia
#

Okay so this should still work?

          const Embed = message.embeds[0];
          Embed.fields[1].value = `**Approved** by ${modal.user.tag}!\n**Reason from ${modal.user.username}:** ${reason}`;
          Embed.color = "#098A09";    
          Embed.author.name = `Approved ${Embed.author.name}`;  
          let error;
    
          await message.edit({
            embeds: [Embed],
          }).catch(err => {
            error = true;
          })
#

Or do I need <Embed>.from()

velvet jasper
#

It would but you shouldn’t be modifying the cache like that

digital sequoia
#

why?

velvet jasper
#

Bc if you modify the cache it’s no longer in sync. The cache should only be managed internally by djs

#

It’s like changing the .content of a recieved message

pseudo thicket
#
          name: 'channel',
          description: 'The channel to link the event log to',
          required: true,
          type: ApplicationCommandOptionType.Channel,
          channelTypes: [ChannelType.GuildText]
        }```
can some1 lmk why this is showing all channels instead of just text channels
uncut kelp
#

If you're sending raw requests, you're using camel case

pseudo thicket
#

are u referring to me

marsh matrix
#

yes

pseudo thicket
#

is it meant to be channeltypes

pseudo thicket
#

ahh ok

crude valley
velvet jasper
#

No

crude valley
#

oops, ok

#

another thing I was wondering, why is log.target a type of never?

velvet jasper
#

No idea, can you please make a bug ticket for that?

green plume
#

Which one is correct?
message.author.id or message.author.Id

exotic nexus
#

id

green plume
#

👍🏻

crude valley
uncut kelp
#

Can you paste that code here

#

I'm lazy

crude valley
#

how am I supposed to paste it when im on phone :/

#

ok imma just go on laptop one sec

uncut kelp
#

wat

crude valley
# uncut kelp Can you paste that code here
    const auditLogs = await ban.guild.fetchAuditLogs({
        limit: 10,
        type: AuditLogEvent.MemberBanAdd,
    });

    const findCase = auditLogs.entries.find((log) => log.target.id === ban.user.id);
#

do u mean this

uncut kelp
#

It says log.target is possibly null

#

That's why it won't work

crude valley
#

hmm how can I fix that

#

so it's not a bug?

uncut kelp
crude valley
#

Just noticed it's the same for every auditLogEvent

uncut kelp
#

Now it sounds more like an issue with your TS server

crude valley
#

So what I do is this

pseudo thicket
#

is there a way to limit a user to only 1 option from something like this?

forest elm
#

those arent even valid option names

pseudo thicket
#

its an example

forest elm
#

either use subcommands or a single option with choices or something

pseudo thicket
#

im asking something else

pseudo thicket
#

choices dont take user input right?

forest elm
#

not sure what that means

prisma kiln
#

what's the modal fields limit

forest elm
#

idk what you're asking exactly, but if you're asking the max amount of components in a modal, its 5

crude valley
prisma kiln
jaunty comet
#

Is a Modal just an ActionRow

forest elm
#

this is a modal

jaunty comet
#

Oh I see

#

Looks cool

forest elm
#

why is that

undone yew
#

how to fix error?

jaunty comet
#

Ok so I just got the dev build

#

but the GatewayIntentBits are not part of discord.js

#

theyre part of the discord-api-types

undone yew
forest elm
jaunty comet
forest elm
# undone yew

one or more of those emojis you're passing in the values was not found

jaunty comet
#

is it fine to use discordapitypes then

forest elm
#

yes

jaunty comet
#

alright thx

forest elm
#

you can just import the enum from discord.js and use it normally

jaunty comet
#

in the final build will it be in discord.js by default?

#

oh wait nvm they appear in discord.js now

#

I just needed to refresh my vs code window

slow storm
#

@velvet jasper Why AttachmentBuilder and Attachment have unknown toJSON type?

jaunty comet
#

So I was going to the buttons page on the new guide

#

doesnt work

#
app.f3e620f8.js:7 TypeError: Failed to fetch dynamically imported module: https://deploy-preview-1011--discordjs-guide.netlify.app/assets/buttons.html.263d8360.js
velvet jasper
plain roverBOT
#

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

forest elm
hardy wind
#

With the latest dev releases, I'm unable to send attachments, with the following error:

    at findName (/srv/cosmic_goat/node_modules/discord.js/src/structures/MessagePayload.js:240:17)
    at Function.resolveFile (/srv/cosmic_goat/node_modules/discord.js/src/structures/MessagePayload.js:254:31)
    at /srv/cosmic_goat/node_modules/discord.js/src/structures/MessagePayload.js:221:85
    at Array.map (<anonymous>)
    at MessagePayload.resolveFiles (/srv/cosmic_goat/node_modules/discord.js/src/structures/MessagePayload.js:221:56)
    at TextChannel.send (/srv/cosmic_goat/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:174:50)
    at leveling.update (/srv/cosmic_goat/modules/leveling.js:247:31)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
jaunty comet
#

would client.users.fetch() work the same way as client.api.users(person.id).get()?

forest elm
#

the latter would not work, but if you mean from previous versions, yes

#

the different is the former returns a User instance and the latter returns raw api data

jaunty comet
#

and it seemed to work

forest elm
#

because client.api was removed

jaunty comet
#

yeah I assumed so

forest elm
#

and it was a private thing anyway, which you shouldnt be using

jaunty comet
#

oh I didnt know that

hardy wind
jaunty comet
#

If I wanted to use the raw api I would prob be using the actual rest api I assume

tame gazelle
#

so now it isn't necessary to set the fetchReply option to true for get a Message object?

#

from the interaction reply

jaunty comet
#

Let me try without it cause I didnt know that

tame gazelle
#

didn't work ._.

jaunty comet
#

Same here

tame gazelle
#

ah ok I read the PR bad

#

now we only get a Message object not an APIMessage

jaunty comet
#

How would I be able to pop up a Modal

plain roverBOT
digital sequoia
forest elm
#

pass 0x<hex value> instead of a string

#

or import the builder from discord.js instead

digital sequoia
#

ok thx

jaunty comet
#
let component = new ModalBuilder()
        .addComponents([
            new TextInputBuilder()
            .setCustomId("hello")
            .setValue("TextInputStyle")
        ])
#

anyone know whats wrong with this

neat pier
#

Error?

jaunty comet
#

ValidationError > s.string
Expected a string primitive

Received:
| undefined

forest elm
#

you didnt set the label of the textinput

#

however, you must wrap the textinput component in an actionrow

jaunty comet
#

Ohhh

#

well I did this

 let component = new ModalBuilder()
        .addComponents([
            new ActionRowBuilder().addComponents([
                new TextInputBuilder()
                .setCustomId("hello")
                .setValue("TextInputStyle")
                .setLabel("something")
            ])
        ])
#

didnt work

#

same error as last time

#

after some digging

#

I found the customId was the problem

#

I still dont know how to fix it so imma just find one

marsh matrix
jaunty comet
#

But I found SHORT

digital sequoia
#
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width

for what in the modal is this?

outer bane
#

max 1 text input per row

digital sequoia
#

lol

outer bane
#

you can't put action rows into other action rows

digital sequoia
#

huh?

#

that are 2 diffrent action rows

outer bane
#

scratch that, yes

digital sequoia
#

ok thx

digital sequoia
#

Is there a way to make a forEach or something like that with <modal>.fields ?

#

I need to forEach the inputs

knotty plover
#

yeah why not

#

Just add rows to the modal inside your forEach

#

Wait, do you mean the submitted fields?

#

[...<ModalSubmitInteraction>.fields.fields.values()]

velvet jasper
#

Tc39 Iterator helpers proposal can’t come soon enough

digital sequoia
jaunty comet
#

is it supposed to say this

#

cause I can grab the info the person submitted

#

but it says something went wrong

knotty plover
#

Not responding to the modal submit

jaunty comet
#

do I have to do like

#

an interaction.reply

#

or something else

velvet jasper
#

You can do that

#

Also heads up if you're using the latest dev version the channel-based typeguards methods are removed instead you should just check the type of the channel:

-if (channel.isText()) { }
+if (channel.type === ChannelType.GuildText) { }
jaunty comet
plain roverBOT
jaunty vault
jaunty comet
#

alr

tame gazelle
jaunty comet
tame gazelle
#

it does too

dusty oracle
#

@crude valley, Hi, what kind of font do you use?

crude valley
#

but the name is this if you want

jaunty comet
#

I used to use just regular text lol

green plume
#

How to check if a member is banned or not?

tame gazelle
green plume
#

👍🏻

slow storm
#

builder's new dev version wasn't released along with djs dev which imports RestOrArray from builder

uncut kelp
#

The releases are automated, you need to wait

tame gazelle
#
- Attachment('url', 'filename.jpg')
+ AttachmentBuilder('url', { filename: 'filename.jpg' })

right?

slow storm
slow storm
#

The typing is wrong in current dev version and the pr is merged

slow storm
tame gazelle
tame gazelle
#

ah ok

#

thanks

slow storm
tame gazelle
uncut kelp
tame gazelle
#

ah didn't see ._.

exotic wind
#
const { ActionRowBuilder, SelectMenuBuilder } = require('discord.js');

const row = new ActionRowBuilder()
  .addComponents(
    new SelectMenuBuilder()
      .setCustomId('select')
      .setPlaceholder('Nothing selected')
      .addOptions([
        {
          label: 'Select me',
          description: 'This is a description',
          value: 'first_option',
        },
        {
          label: 'You can select me too',
          description: 'This is also a description',
          value: 'second_option',
        },
      ]),
  );

console.log(row.toJSON());
``````js
TypeError: Found non-callable @@iterator
vague coyote
tall verge
#

Shouldn't it be GuildMemberManager#fetchMe that instead of Guild#fetchMe?

inner breach
#

hello excuse me NGS_SadOkeyy
how do i can fix this problem which suddenly came after I updated the discord.js@dev package??

exotic crow
#

Is there any ETA on this update release?

jaunty vault
#

When it's ready™️ :)

woven grove
#

What type of release even

#

Dev releases are there

noble kernel
uncut kelp
#

Cause it doesn't exist

woven grove
noble kernel
#

ah

#

may i have a full list of changes?

uncut kelp
#

Check the guide in pins

mental inlet
#

i'm trying to create a select menu however typescript keeps showing an error, anyone know why?

uncut kelp
#

Not getting that error

mental inlet
#

hmm, not sure why

#

(im on the latest dev version btw)

uncut kelp
#

Which is?

mental inlet
#

14.0.0-dev.1654519696-fba9710

#

could it be due to this discord.d.ts file?

import { Collection } from 'discord.js';

interface ExtraData {
    commands: Collection<unknown, any>
}

declare module 'discord.js' {
   export interface Client extends ExtraData {}
}
uncut kelp
#

fba9710 is not published to npm

#

How are you using it?

mental inlet
#

so if it isn't published, i'm not sure

uncut kelp
#

To be pedantic, it's not the version on npm nor the latest commit, which would be 86d8fbc

#

I don't know what you have... but it's probably why I can't reproduce this

#

Reinstall discord.js from npm and try again

mental inlet
#

alright ill try that indeed

mental inlet
uncut kelp
#

Hmm now I reinstalled it and I'm getting fba9710... that's from /builders it seems

mental inlet
#

hmm

uncut kelp
#

But I still can't reproduce the error

mental inlet
#

so i don't know my issue there

#

ty lol

#

no longer supported?

#

so you're telling me fba9710 did get published??

uncut kelp
#

Old dev versions are deprecated

mental inlet
#

ah okay

uncut kelp
#

You probably just installed the latest dev version again, not sure how all that works

mental inlet
#

all i did was this lol

uncut kelp
#

Yeah I dunno, I can't reproduce your error

mental inlet
#

hmm

uncut kelp
#

All is fine

mental inlet
#

i went back to fba9710 and the error is gone

#

not sure how this happened i guess

uncut kelp
#

Welp

tame gazelle
dawn phoenix
#

care to elaborate?

uncut kelp
#

That would be too logical a move

jaunty comet
#

So wait is a text input builder the only component I can add to a modal currently

small light
real smelt
#

Is there a change log for v14, if so where can I find it

jaunty comet
small light
#

deal ty

little burrow
jaunty comet
tender spoke
#

yes

jaunty comet
#

Ok good

small light
#

yo so like i have slash commands, when i run one of them, the others wont work and it says application did not respond here is my handler: ```js
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
const fs = require("fs");

const ascii = require("ascii-table");

// Create a new Ascii table
let table = new ascii("(/) Commands");
table.setHeading("Command", "Load status");

module.exports = async (client) => {
const commands = [];
const commandFiles = fs
.readdirSync("./slashCommands")
.filter((file) => file.endsWith(".js"));

for (const file of commandFiles) {
const command = require(../slashCommands/${file});
commands.push(command.data.toJSON());
client.slashCommands.set(command.data.name, command);
if (command.data.toJSON().name) {
table.addRow(file, "✅");
} else {
table.addRow(file, ❌ -> Not able to load);
continue;
}
}
const token = process.env.TOKEN;

const rest = new REST({ version: "10" }).setToken(token);

try {
console.log("Started refreshing application (/) commands.");
const {clientId} = require(../config.json)
await rest.put(Routes.applicationCommands(clientId), { body: commands });
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}

// Log the table
console.log(table.toString());
};

jaunty comet
scarlet tangle
#
let row = new ActionRowBuilder()
      .addComponents([
        new ButtonBuilder()
        .setCustomId('bang1')
        .setLabel('Bang')
        .setStyle(1)
        .setEmoji('🔫'),
        new ButtonBuilder()
        .setCustomId('bang2')
        .setLabel('Bang')
        .setStyle(1)
        .setEmoji('🔫'),
        new ButtonBuilder()
        .setCustomId('bang3')
        .setLabel('Bang')
        .setStyle(1)
        .setEmoji('🔫'),
        new ButtonBuilder()
        .setCustomId('hunting-info')
        .setLabel('What is Hunting?')
        .setStyle(2)
        .setEmoji('🤔')
    ])

I have an action row with buttons. How can I take a button from the action row, disable the button, and edit the action row into a message?

velvet jasper
#

that like you know beforehand

scarlet tangle
#

I'm editing the button within a collector that's below.

#

Though, the button that needs to be edited depends on which of the first three is clicked.

#

The last one isn't relevant for what I want to do.

#

@velvet jasper

velvet jasper
#

can you show your collector code?

#

for the record builders is kinda in flux there's probably going to be major changes soon

scarlet tangle
#
collector.on('collect', async (i) => {
        row = ButtonBuilder.from(row.components[row.components.findIndex((c) => c.custom_id === i.customId)]).setDisabled(true)

        await i.update({ compontents: [row] })
      })
#

@velvet jasper

#

here is the confusing part

#

oh wait a minute wow

#

"compontents"

neat pier
#

Xddd

sacred eagle
scarlet tangle
sacred eagle
#

Not to mention you're assigning a button to "row" which should be an action row correct?

scarlet tangle
#

i already changed ButtonBuilder to ActionRowBuilder

sacred eagle
#

Okay is it all good now? Does it work?

scarlet tangle
#

hold on i was about to see

neat pier
#

Hmm try without from, calling a constructor instead

sacred eagle
#

Make sure it is imported from discord.js

scarlet tangle
#

ok

scarlet tangle
#

oh, would it be c.data.custom_id?

sacred eagle
#

Maybe. Try it. Also split it up. Everything after the from call, move it to another line

scarlet tangle
#

now i'm getting this error

sacred eagle
#

Did you move it to another line?

scarlet tangle
#

oh, i didn't

scarlet tangle
sacred eagle
#

Also if you still have issues, just describe it with as much detail as needed
Goodnight

scarlet tangle
#

oh, goodnight

wintry bear
#

anyway to acknowledge interaction.reply without actually replying

idle galleon
#

deferReply

#

Then you can editReply later

wintry bear
#

er anyway to close modal automatically?

i.awaitModalSubmit({filter2, time: 10000}).then(modal => {
// some code
}).catch(e => {
// fail, close modal automatically
})```
forest elm
#

you cannot close a modal

#

and you are not passing the filter to awaitModalSubmit correctly

#

it expects a filter option, and not filter2

wintry bear
small light
# jaunty comet how are you executing your commands
let Discord = require('discord.js')
require('../client.js')
  module.exports = {
    name: "interactionCreate",
    once: true,
    async execute(interaction){
      const { client } = interaction;

      let guildQueue = client.player.getQueue(interaction.guildId)

      if (!interaction.isCommand()) return;
      
      const command = client.slashCommands.get(interaction.commandName, interaction);
      
      if (!command) return;
      
      try {
          await command.execute(client, interaction, Discord, guildQueue);
      }catch (error) {
        console.log(error);
        await interaction.followUp({
          content: "There was an error while executing this command!",
          ephemeral: true,
        });
      }
    }
  }
jaunty comet
#

Otherwise it’ll only execute once, which happened to you

small light
#

worked

#

ty

jaunty comet
#

Np

clever mortar
#

When v14 will release?

knotty plover
#

when its ready

queen sable
clever mortar
#

Okay

prisma kiln
#

Why can't I edit reply after answering the modal, like when I reply to button interaction I can edit last reply, but when I'm trying to answer to modal and edit last reply message I cant

idle galleon
prisma kiln
#

no editReply

#

there is no update method available

plain roverBOT
#

Documentation suggestion for @prisma kiln:
method ModalSubmitInteraction#update()
Updates the original message of the component on which the interaction was received on.

prisma kiln
#

oh, wait

idle galleon
#

It should work since the modal originated from a message component interaction

#

editReply requires that you alr called reply, update, or the defer variant of either

prisma kiln
#

but the interface not contain update method for ModalSubmitInteraction

idle galleon
#

It’s documented

prisma kiln
#

maybe I should update the package

idle galleon
#

Oof, it’s not in the ts types

prisma kiln
#

lmao

idle galleon
#

Oh, it’s a different class name

#

ModalMessageModalSubmitInteraction

#

You get it by checking .isFromMessage()

prisma kiln
#

oh, ok thank you very much

silk axle
#

where can i find djs 14 docs?

#

and the changes between v13 and v14

idle galleon
silk axle
#

ty

noble kernel
#
if(message.member.roles.cache.has("971537773444100146")) {

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

white nebula
#

message.member is null, which most commonly happens when the message was sent in DMs

noble kernel
#

but i have if(!message.guild) return;

white nebula
#

what triggered that error? It may be that an application was added without the bot scope, so it's not technically a member of the guild

noble kernel
#

it's in the messageCreate event

#

am i definitely on the correct version?

thorny haven
#

a lot of changes to be honest. how do I get СomponentType now?

#
const { ComponentType } = require('discord-api-types/v10')
``` this path does not give me anything
tame gazelle
sacred eagle
#

ComponentType is there, what do you mean it doesn't give you anything?

light crescent
#

found a bug in GuildInviteManager

when you try to force fetch guild invites it won't really work as force option does not really exist
only cache option does exists in fetch method

guild.invites.fetch({ force: true });

this code gives the error in the SS

docs says there is a force option while it does not work and as i reviewed the source of the method i couldn't seem to find any option with the name 'force'

uncut kelp
#

guild.invites.fetch({ force: true }); I'm pretty sure this is not a correct overload anyway, there is no force option when fetching all invites

#

Because it's always forced

#

So it probably thinks you're fetching a singular invite but you didn't supply a code

sacred eagle
#

Yep, if you provide force, for the FetchInviteOptions, code isn't optional

uncut kelp
#

It's also not documented here

light crescent
uncut kelp
#

What your code is doing and what you are looking at are both completely different

#

You're looking at the documentation to fetch a singular invite, but your code is fetching all invites

light crescent
#

oh wait got it there is literally 1 character difference

uncut kelp
#

Yea, the plural

light crescent
#

so if i do invites.fetch() without any options its already forced

split fulcrum
#

What does it mean?? ModelType??

jaunty vault
split fulcrum
cinder wraith
#

don't you need to toJSON() an EmbedBuilder before sending it

split fulcrum
#

No?

tame gazelle
#

the label for buttons maybe?

split fulcrum
#

they use Emojis

tame gazelle
#

ah yeah

cinder wraith
#

then it wouldn't point to data.embeds[0]

versed canopy
#

How to give donations?

cinder wraith
split fulcrum
#

For it has not been a problem befor

mental inlet
#

donations to discord.js or donations for your own bot?

split fulcrum
#

and i don't json my embeds for i use the same way on other commands and it works fine

cinder wraith
split fulcrum
#

i use array

cinder wraith
#

doesn't look like it takes Array<EmbedBuilder>

split fulcrum
#

:/

tame gazelle
#

no need to call .toJSON()

cinder wraith
#

just try

#

it's not going to explode your machine

#

at worst the error won't go away

split fulcrum
#

EmbedBuilder should support Array

jaunty vault
#

what?

cinder wraith
#

that is not what that says

#

nor that's not how that works

outer bane
# cinder wraith

docs seem to be outdated, types are correct embeds?: (JSONEncodable<APIEmbed> | APIEmbed)[]

cinder wraith
#

interesting given how they refresh every time i open them, but sure
blameCrawl

outer bane
split fulcrum
#

Hmm ok weird

#

So it's a discord.js error or is it on my side??

outer bane
#

it's on you for providing an invalid payload

split fulcrum
#

Let me check that out Thonk

split fulcrum
rocky vessel
sacred eagle
jaunty comet
#

To a color resolvable

sacred eagle
#
setColor(color) {
    return super.setColor(color && Util.resolveColor(color));
  }```no, it calls it internally
jaunty comet
#

What does that even return

sacred eagle
#

It means that internally, Util.resolveColor is called
you don't need to call it yourself and pass it

#

And it returns the Embed Builder, and the resolveColor returns a number

jaunty comet
#

I see

#

Well yeah Ik the resolve color is a number

sacred eagle
#

The EmbedBuilder in the builders package only takes a number or an rgb tuple
the extended djs class takes in a color-resolvable, it resolves it internally to make it work for the builders' setColor

tame gazelle
tame gazelle
regal mason
#

I added descriptionLocalizations to my Slash Commands but when I change the locale of Discord to this language ("fr") the descriptions are still in english

regal mason
#

Idk if this build has localizations:

"discord.js": "^14.0.0-dev.1650931749-df64d3e",
velvet jasper
regal mason
#

OH I see now

#

I haven't the override

#

How I can get it. I forgot where I got it

tame gazelle
#

maybe remove this from pins? ^

uncut kelp
#

Did the rest thing get merged

tame gazelle
uncut kelp
#

Heh nice

#

The pin hath gone then

tame gazelle
neat pier
#

The fetch returns a Collection if there’s no id passed

#

But doesn’t seems wrong, do you have the GUILD_MEMBERS intent?

neat pier
#

And member returns what?

jolly pike
#

when receiving a message component interaction in a guild, when can member be an APIInteractionGuildMember?

uncut kelp
#

I don't think it can?

jolly pike
#

also why can't a GuildMember object be constructed since the docs say ** member is sent when the interaction is invoked in a guild, and user is sent when invoked in a DM, so shouldn't a full guild member object be received?

uncut kelp
#

@velvet jasper ^ :eyes:

outer bane
#

you get the raw object when the guild isn't cached afaik

uncut kelp
#

So yeah if it's in an uncached guild, it's the raw object

#

I'm pretty sure there was a pull request to always return discord.js instances though

outer bane
#

only for messages

uncut kelp
#

Oh

outer bane
#

guild members have a direct reference to a guild, no getter

#

though that could probably be changed too

jolly pike
#

it looks like GuildMember relies heavily on the guild not being null so I'll just make sure its in a cached guild instead

tender spoke
#

someone renamed this channel

tame gazelle
#

#analyse

hardy wind
#

Is there currently an issue with the messageCreate event? It's not firing on my bot right now.

plain roverBOT
regal mason
#

How do you make dynamic choices like in /docs ?

tender spoke
#

not choices

#

but it looks like choices

velvet jasper
hardy wind
leaden python
#

Excuse me, everyone. I would like to ask for help, what function should I use? The expectation of this should be that the previous objects won't add up or stack up with each other but it should only display what the objects would only be. Here's a source code. Hope someone could help me with my problem.

const colsheads = () => {
let tempArray = [];
tableData.map((head) => {
head.list_attributes.map((columnheaders) => {
const tempObj = { field: "", headerName: "" };

    tempObj["field"] = columnheaders.list_attr_data_key;
    tempObj["headerName"] = columnheaders.list_attr_data_key;
    tempArray.push(tempObj);
  });
});
return tempArray;

};

However the outcome of this in my display would be like this.

knotty plover
#

How is this discord.js related

cinder bane
#

if any message is deleted in a voice channel then does it not emit the messageDelete event?

uncut kelp
#

It should... why?

cinder bane
#

i tried doing so but it didnt work

#

when i did the same on a normal text channel it got emitted

uncut kelp
#

I am unable to reproduce that. I deleted a message in a text-in-voice channel and the event got emitted.

cinder bane
#

do i need some intent or smth

cinder bane
#

"discord.js": "^14.0.0-dev.1651147765-679dcda",

#

im on this one rn

#

yup it worked after updating the package.

cinder bane
#

what is the alternate for Guild#me ? since its removed in v14

spare fiber
cinder bane
#

okay thanks

hasty beacon
#

Am I doing something wrong? I can't seem to tell whether a message is edited. I'm sending a message and storing it

const message = await channel.send({content: 'Hello world!'});

and later on (many seconds later), I edit it

message.edit({content: 'Good morning, world!'});

However, afterwards (many seconds later), editedAt and editedTimestamp are null, even after fetching it (even with force: true)

await message.fetch(true);
console.log(message.editedTimestamp); // => null
#
const message = await channel.send({content: 'Hello world!'});

setTimeout(async () => {
    message.edit({content: 'Good morning, world!'});
}, 2000);

setTimeout(async () => {
    await message.fetch(true);
    console.log(message.editedTimestamp);
}, 6000);
spare fiber
#

try resolve Message#edit promise, await it

hasty beacon
#

Ok, that seems to work...is there no other way to tell if a message was edited?

spare fiber
#

compare content, embeds, components with old message maybe? if you want other tricky way. the best to do is check for editedAt and editedTimestamp

hasty beacon
#

awaiting edit only works if I can actually keep the return value of await message.edit(...)

#

if that was done in another context, editedTimestamp will still be null on the original message

#
const content = 'Hello world!';
const message = await channel.send({content});

setTimeout(async () => {
    const editedMessage = await message.edit({content: 'Good morning, world!'});
    console.log(`after edit: ${editedMessage.editedTimestamp}`);
}, 2000);

setTimeout(async () => {
    await message.fetch(true);
    console.log(`later: ${message.editedTimestamp}`);
}, 6000);
after edit: 1654663077932
later: null
#

Ahhh- message.fetch might not do what I think it does.

#

nope. I thought message.fetch might return a new message object, but the return value still has null for editedTimestamp

message = await message.fetch(true);
console.log(`later: ${message.editedTimestamp}`); // later: null
green plume
#

I have added this code in my bot to stop error when we try to unban someone who is not banned. But this I get this error

            if (!ctx.interaction.guild.bans.fetch(user?.id)) return ctx.interaction.reply({ content: `${process.env.FAILURE_EMOJI} | The given user is not banned!` });
spare fiber
#

catch the rejection

green plume
#

huh?

spare fiber
jaunty comet
spare fiber
#

you need to catch the rejection, not resolving em

proven wolf
green plume
#

👍🏻

hasty beacon
jaunty comet
hasty beacon
#

ah, so the actual use case is that when someone clicks a button, the message is edited. The bot later needs to know if the message was edited or not, ideally without having to manually keep track of that myself

#

so the send and edit won't be done together, unlike the repro

jaunty comet
#

In the .then you could add the event in it

#

And then make it so that if they click the button it edits it

hasty beacon
#

I appreciate your input. I could, but I would consider that a workaround. I was hoping I could use the library for what I expected it to do

jaunty comet
jaunty comet
#

And then check if msg.editedAt exists

#

probably not what ur looking for but yea

hasty beacon
jaunty comet
#

like msg.editedTimestamp = Date.now()

thorny haven
#

Hello! And where can I see permissions in string?

#

PermissionsBitField.Flags outputs only bigint, and I want to see them in string

jaunty comet
#

oh wait nvm ur doing perms

plain roverBOT
hasty beacon
#

Would that get you what you want?

thorny haven
#

🙄

hasty beacon
#

oh, you're trying to print out every permission? Try using PermissionsBigField.Flags

dawn phoenix
#

not too sure what you expected with a "new" permission bitfield

#

ofc that's gonna be 0

jaunty comet
#

pretty sure

thorny haven
#

🐈

hasty beacon
#

You can take the keys of that object if you want just the strings

jaunty comet
#

actually if u wanted to do that

thorny haven
#

no, I understand that it is possible to do this, but before discord.js itself printed out the flags beautifully. by MANAGE_MESSAGES type

dawn phoenix
#

beauty lies in the eyes of the beholder

#
news = ""
for i = 0, i < len(flag) - 1, i++:
  if isUpper(flag[i]) && i != 0:
    news += "_" + flag[i]
  else
    news += upper(flag[i])

or sth like that

thorny haven
#

I understand that when creating a channel, string permissions from discord dev portal are supported

#

👏

jaunty comet
thorny haven
#

permissionOverwrites supports allow with string type permissions?

jaunty comet
#

dont think so

#

actually idk lol

thorny haven
#
this.permissions = [
    {
       id: "798867454205231124",
       deny: ["VIEW_CHANNEL"]
    }
]```I wanted to do something like this
jaunty comet
#

or something along the lines of that

spare fiber
#

use static flags lel

dawn phoenix
#

in your code, just use the enum

hasty beacon
#

I believe strings are going away in v14

jaunty comet
#

as in they give me the permissions bitfield

dawn phoenix
#

PermissionFlagBits.ViewChannel - clean and efficient

jaunty comet
#

looks good to me

thorny haven
jaunty comet
#

new Discord.PermissionsBitField(deny[0])

#

supposed to be a function

spare fiber
#

read what souji said

jaunty comet
thorny haven
dawn phoenix
#

what?

hasty beacon
#

if you put each permission on one line, it would be the same amount of lines

dawn phoenix
#

you needed flag strings, now you need flag enum properties, i don't see the big difference, tbh

#

alternatively you can just one-time compute the thing and pass the bigint

thorny haven
dawn phoenix
#

but that's obv. less readable

#

should prob. | those anyways

thorny haven
#

I just wish it was like before, but apparently it's no longer available

dawn phoenix
#

then write your own util function to make it happen

#

like, programming, extend things to fit what you want them to do

thorny haven
#

well

dawn phoenix
#

function, pass in strings, return a single bigint with the combined perms

jaunty comet
#

I was thinking of making it something like "ViewChannel", and then applying a .map on the array

dawn phoenix
#

can prob. even do that with dynamic property accessors

#

haven't tried yet, i usually use enums as enums, because they're great and verbose

#

but for other people lines of code is an issue, for some reason

jaunty comet
#

for me I just read the stuff after the .

hasty beacon
#

I prefer enums just in case the underlying value ever changes

dawn phoenix
#

for example that funny person that said eris is better because it has less lines of code

  • but i'm getting off topic here
thorny haven
#

I used to like that discord.js gave 2 options, either bigint or string permissions. and option 2 suited me, but right now it was removed. and it became somehow dreary

#

okay, I'll try to make a bicycle so that the strings are converted into bits

jaunty comet
#

But up to you

thorny haven
#

I told you, it gave an error

jaunty comet
#

But the other method is better anyway so use that

jaunty comet
dawn phoenix
#

-ev Discord.PermissionsBitField.resolve("BanMembers")

forest geyserBOT
jaunty comet
#

Either way he’d have to use a different string format

granite yacht
#

Does anyone know how to get modal interactions custom id to work?

#

f(interaction.customId === "banappealModal"){
const reasonofappeal = interaction.fields.getTextInputValue("appealtext")
const emailofuser = interaction.fields.getTextInputValue("emailofuser")
console.log(interaction.customId)

#

as this dosent work

knotty plover
#

doesnt work how

granite yacht
#

Like it dosent do anything

#

I also tried putting interaction.customId in

knotty plover
#

Show the code above it, how do you get to here

buoyant ingot
#

™️

#

hmm well if i dont use v14 is it fine

vague coyote
#

it's fine til we drop support for v13, then you will have to update at some point ramenCat

buoyant ingot
#

how to force someone

#

WAIT WHAT! I JUST STARTED LEARNING USING DISCORD JS.GUIDE AND V14

#

nvm

#

updated version to v14 and dint even updated code

vague coyote
#

everything you need to know in regards of updating to v14 is pinned

buoyant ingot
#

: >

buoyant ingot
# vague coyote https://deploy-preview-1011--discordjs-guide.netlify.app/additional-info/changes...
               ^

ReferenceError: Client is not defined
    at Object.<anonymous> (D:\aayush\skeyush bot\index.js:5:16)
    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```
#

sir you gave me alot of error

#

now help me :>

slow storm
buoyant ingot
#

:> yeah i was thinking to learn js again

#

Hmm lets wait for v14 to realease again

#

till what time to wait

vague coyote
#

til its done

#

spoiler: you should learn js before making the bot :)

buoyant ingot
#

bruh i know js

granite yacht
# knotty plover Show the code above it, how do you get to here

if(interaction.isModalSubmit()) {
if(interaction.customId === "suggestionModal") {
const suggestionstitle = interaction.fields.getTextInputValue('suggestiontitle')
const suggestion = interaction.fields.getTextInputValue("suggestion")
const row = new ActionRowBuilder().addComponents([

knotty plover
#

Is there anything above that causing it to return

granite yacht
#

Nope

#

OO

#

i think i found out why

#

I think i did it on the wrong }

hasty beacon
uncut kelp
#

What are your intents?

granite yacht
#

That was the reason

granite yacht
#

but do you know how to change the 16234324 timestamp thing to real time stamp, like 8. Juny 2022 11:42 am?

hasty beacon
uncut kelp
#

Do you know what a gateway intent is?

hasty beacon
#

Oh, those

GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
uncut kelp
#

Well from the list of intents, you are not looking for guild messages. Therefore, you are not receiving any updates

granite yacht
#

Yep

#

Jiralite, u know how to make so it dosent send out timestamp numbers, but shows the real timestamp?

#

These , i want em like 8. Juny 2022 11:46 Am

#

Like that instead of what it said

hasty beacon
#

Ahh, so I'm missing GuildMessages then arent I

granite yacht
#

Yep

hasty beacon
#

is that intent required to forcibly refetch a message too?

granite yacht
#

Think so

granite yacht
hasty beacon
#

you could use native js date objects, but keep in mind that it will always use the system's tz

granite yacht
#

Yeah

#

but can it display the timezone then?

plain roverBOT
#

Documentation suggestion for @granite yacht:
mdn Date.prototype.toLocaleDateString()
The toLocaleDateString() method returns a string with a language sensitive representation of the date portion of the specified date in the user agent's timezone.

hasty beacon
#

check out Intl.DateTimeFormat as well

granite yacht
#

What?

plain roverBOT
#

Message formatting (mentions, timestamps, emoji, etc.): learn more

granite yacht
#

Whats intl?

zealous otter
#

nvm, just saw the screenshot

granite yacht
#

is it interaction.DateTimeFormat?

#

@hasty beacon

plain roverBOT
#

Documentation suggestion for @granite yacht:
mdn Intl
The Intl object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting. The Intl object provides access to several constructors as well as functionality common to the internationalization constructors and other language sensitive functions.

#

mdn Intl.DateTimeFormat
The Intl.DateTimeFormat object enables language-sensitive date and time formatting.

granite yacht
#

how do i use it?

#

im really confused rn

nocturne kayak
#

by reading the docs. not djs related.

granite yacht
#

Fixed

median junco
#

can someone explain the error to me? It seems like I'm doing something wrong with the action row, because when I send the message without the components it works

nocturne kayak
#

doesnt look like you set customId for your selectmenu

median junco
#

oh

#

now it works! thanks

noble kernel
#
const member = interaction.options.getMember("user");
if(member.roles.highest.position >= interaction.guild.members.me.roles.highest.position) {}

Cannot read properties of undefined (reading 'roles')

i've been getting this error for a while now and i've never had issues with it

zealous otter
distant bane
#

Q: Am I correct that Channel#type is gonna get removed?

nocturne kayak
#

no

uncut kelp
#

What made you think that

distant bane
#

Thought I heard about it somewhere on djs' github

#

nvm them, crisis averted

green plume
#

How can I get total count of users who have administrator permission in a server?

green plume
#

👀 Okay, I will try

modest drum
#
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS], partials: ['MESSAGE', 'CHANNEL', 'REACTION']});
                                              ^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
    at Object.<anonymous> (C:\Users\whes1015\Desktop\B-MPR\index.js:3:47)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Node.js v18.3.0```
#

Is this correct in v14?

jaunty comet
#

No

#

You use gatewaybitintents

modest drum
#

What's correct in v14?

tame gazelle
modest drum
#

Is this correct for v14???

forest elm
#

no

#

look at the guide in the pins

modest drum
#

Where is v14 Documentation?

forest elm
#

pins

modest drum
nocturne kayak
forest elm
#

the link in the pins takes you to the main branch documentation

proud creek
#

pls help

mental inlet
vague coyote
#

either import GatewayIntentBits from discord-api-types or use IntentsBitField

plain roverBOT
outer bane
#

you can import it from d.js as well

#

everything from dapi-types is re-exported

vague coyote
mental inlet
#

what is better to use? gatewayintentbits or intentsbitfield?

vague coyote
#

doesn't matter, IntentsBitFields.Flags is GatewayIntentBits

mental inlet
#

ah okay

mental inlet
#

bumping

vague coyote
#

just has some extra methods

regal mason
#

Hi, how I can use autocomplete interactions ?

jaunty comet
regal mason
little burrow
# regal mason <@703364595321929730>

setAutocomplete(true) if you're using builders, in your slash command options. Though note not all accept autocomplete. Then just handle the interaction as usual in your interactionCreate event