#djs-in-dev-version

35223 messages · Page 23 of 36

idle galleon

We don’t make the features, Discord does

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

Thonk

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

I want to send an embed in the voice text channel when a new voice channel is created but I don't know how to send it

digital sequoia

would be good

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

Thonk

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

sadge

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?

D_wot

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

help

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

scarlet tangle
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

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

lol

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

lol

vague coyote

waitWhat

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

regal mason
regal mason

I'm not using builders, how can I set it autocomplete ?

I just have to add autocomplete: true in the options array, right ?

tame gazelle

ah no

dusty otter

Turns out embed coloring with EmbedBuilder is case sensitive with color names

so you have to type Red not RED

uncut kelp

Hm?

dusty otter

For v14 currently in the dev build

when you use new EmbedBuilder.setColor()

if you want to use a color name like RED or BLUE you have to make it Red or Blue, its case sensitive

Not sure if this is considered a bug just a slight annoyance.

uncut kelp

Is that an issue? I don't see any context

Just this message appeared from nowhere

uncut kelp
dusty otter

Yeah just wanted to point it out

Because in previous discord.js versions it wasn't like this

jaunty comet
scarlet tangle

Modal is not a constructor

bruh

jaunty comet
scarlet tangle

k thz

plain roverBOT

class SelectMenuBuilder
Class used to build select menu components to be sent through the API

woven grove

thats kinda the point for certain things

open heron

is there any major change in v14?

dawn phoenix

yes, many

scarlet tangle

is it possible to edit a modal already sent ?
editModal ?

keen rivet

No

scarlet tangle

k thz

subtle pivot

v14 is a matter of days or weeks?

im planning to write a new bot and im trying to figure out if i should wait for a couple more days or just use 13.8.0

knotty plover

Definitely not days I would think

dusky agate

<interaction member>.permissions changed?

hoary fox
plain roverBOT
dusky agate

i have this error when using the guildCreate event and apparently it is not an error in my code

knotty plover

Known issue in 13.8

Not related to guildCreate though, it's with webhooks

dusky agate

is the dev version

ok

knotty plover

Probably the same bug

It also got backported

jaunty comet

I updated it for the modals

subtle pivot

dev version shouldn't be used in production 😶
...and i'll be too lazy to change my code later if anything in dev will change

jaunty comet

so im fine with it

Also

is the discordjs/builders context menu different from the djs one

cause when using djs I have to set the type as 2, referring to a user type

scarlet tangle
scarlet tangle
green plume

I don't why I am getting this error since I upgraded my pakage.
client.channels.cache.get(process.env.ERROR_LOG).send()

plain roverBOT

Tag suggestion for @green plume:
• The provided id is incorrect (copy role ids from context menus, not message mentions)
• The client does not have this structure cached (try fetching instead)
• The client is not yet ready (move the code into any event listener callback)

fluid bronze

If all was correct you wouldnt get an error

green plume

As you see in the eval ss I have used the exactly same code which I use in the main code.

fluid bronze

Read the third statement of the tag

Just because it works in an eval doesnt mean that it will work everywhere in your code, the client needs to be logged in

green plume

Well it used to work previously. But after updating my package I am facing this issue.

modest drum

Did v14 change the embed?

TypeError: MessageEmbed is not a constructor
    at Object.embed (C:\Users\whes1015\Desktop\B-MPR\B-MPR-Release\core\structure.js:22:30)
    at Object.main (C:\Users\whes1015\Desktop\B-MPR\B-MPR-Release\core\console.js:35:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
dawn phoenix

see pins 13 > 14 guide

plain roverBOT
buoyant ingot
plain roverBOT
scarlet tangle

RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: VIEW_CHANNEL
where can i find bitfield flags

vague coyote
scarlet tangle

k thz

vague coyote

PermissionFlagsBits is reexported in djs

scarlet tangle

CombinedPropertyError (6)
Received one or more errors

input.guild
| UnknownPropertyError > guild
| Received unexpected property
|
| Received:
| | Guild {
| | id: '80....',
etc

at js ButtonBuilder.setEmoji(client.emojis.resolve("852246257366990878"))

the emoji should be a "APIMessageComponentEmoji"

vague coyote

it expects an object with name, id and animated

if its a default emoji, only name is required, if its a custom emoji id is required, if its animated, id and animated are required

scarlet tangle

how do i access to <EmbedBuilder>.fields ?

vague coyote

embedbuilder.data.fields?

scarlet tangle

k

scarlet tangle

is it possible to hide or disable a textinput on a modal ?

nocturne kayak

no

indigo tide

How do you get all members that have a specific role (not only cached)?

uncut kelp

Fetch all members the iterate over them and check their roles

mental inlet

anyone know how to check if an embed image url is a well formed url so that i don't get errors like this?

neat pier

Well formed urls starts by https:// or http:// so verify if it starts with it

mental inlet

ah okay then ill do just that

jaunty comet

I’ll just look on the discord docs

plain roverBOT

Suggestion for @jaunty comet:
guide Interactions: Modals
read more

jaunty comet

Wait I meant context menu

Mixed them up whoops

brittle robin
jaunty comet

User is 2, message is 1 I assume

brittle robin

ApplicationCommandTypes? @jaunty comet

discord-api-types have ApplicationCommandType enum

knotty plover

Message is 3

jaunty comet
brittle robin
fierce hatch

have intents changed? i am getting this following error: ```
throw new RangeError('BITFIELD_INVALID', bit);
^

RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: Guilds.
at Function.resolve (C:\Users\HiTech\Desktop\hjs\node_modules\discord.js\src\util\BitField.js:152:11)
at C:\Users\HiTech\Desktop\hjs\node_modules\discord.js\src\util\BitField.js:147:54
at Array.map (<anonymous>)
at Function.resolve (C:\Users\HiTech\Desktop\hjs\node_modules\discord.js\src\util\BitField.js:147:40)
at Client._validateOptions (C:\Users\HiTech\Desktop\hjs\node_modules\discord.js\src\client\Client.js:550:33)
at new Client (C:\Users\HiTech\Desktop\hjs\node_modules\discord.js\src\client\Client.js:76:10)
at Object.<anonymous> (C:\Users\HiTech\Desktop\hjs\index.js:20:13)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
[Symbol(code)]: 'BITFIELD_INVALID'
}
```from this code: new discord.Client({ intents: ['Guilds', 'GuildMessages', 'MessageContent'] })

fierce hatch

oh, i seem to be using the wrong version. Sorry

pallid peak

I tried giving v14 a spin today and the first thing I noticed is that the return type of SnowflakeUtil.generate() no longer matches the declared type of Snowflake.

The type of Snowflake in discord-api-types@0.33.5 is type Snowflake = string, however SnowflakeUtil.generate() in @sapphire/snowflake@3.2.2 returns a bigint.

uncut kelp

Where did discord-api-types comes from

pallid peak

Its a dependency of discord.js

uncut kelp

I just don't understand how it affects your problem

You're trying to use a generated snowflake in one of discord.js's methods?

pallid peak

No, I was using SnowflakeUtil.generate() to generate ids for related information in a database. In v13, this method returns a string. In v14, it now returns a bigint.

uncut kelp

If you want a string just stringify it

pallid peak

Regardless of the type of Snowflake, changing the return type for generate() is a breaking change that isn't obvious at first glance.

cinder wraith

well, technically, the major version changed between v13 and v14

pallid peak

Yes, you can .toString() it, but I had to go back and verify that the return value from SnowflakeUtil.generate() in v13 returned a decimal formatted number to ensure I just needed to do SnowflakeUtil.generate().toString() and not SnowflakeUtil.generate().toString(16) for hexadecimal (or something else). And that was to verify the result matched the format I would expect in my database.

That's fair, but It seems arbitrarily inconsistent to have SnowflakeUtil.generate() return something else. At the very least I would hope that would be called out in a breaking changes document somewhere (assuming you have something like that, I couldn't find one for v14 so far).

It's not a major issue, just an inconvenience and I wanted to clarify whether it was an intentional change or just overlooked.

cinder wraith

that's fair

slate mango

You should always use bigint for DB, if you're using it for it, btw

cinder wraith

How is that relevant

slate mango

But if you want a string, you can just do so with bigint.toString() or String(bigint), the utility just outputs the raw result from the operations, so if you want to use bigint, you can do so without further perf impact

pallid peak

as I said, it just boils down to intent. Was the change in return value intentional or overlooked? I was able to catch it quickly because I use TypeScript and was warned at compile time. If you're using this from JS you might only find out if/when something breaks.

slate mango

The change in return was intentional, yes

pallid peak

Is it expected that all Snowflake values in discord.js and discord-api-types (or any other related packages) will remain as string, or will those also eventually become bigint to match?

slate mango

Doesn't matter

It's @sapphire/snowflake, a third-party package, not discord.js nor any @discordjs/ package

And it represents better with the internal representation of snowflakes after all, Discord stores snowflakes as bigints

They just send them as strings because JSON doesn't support bigint

cinder wraith

so why does it matter what do they store it as

slate mango

And we don't convert them back to bigints because that requires a lot of extra steps

So no, it's going to be a numeric string

pallid peak

Yes, but it replaced the built-in SnowflakeUtil and wasn't exactly a drop-in replacement. I'm just pointing out the inconsistency that exists now, and only asking whether that inconsistency will be addressed or left as is.

slate mango

And the return type of the utility won't change either