#djs-in-dev-version

35223 messages · Page 1 of 36

dawn phoenix

djs Drop your Q's we will find some A's

⚠️ You are using a development build. Things might break at any new commit.
please provide the full version (output of npm ls discord.js | yarn list discord.js | yarn why discord.js (yarn v3+) | pnpm list discord.js) you have installed when asking for support!

Please open threads for questions you anticipate might take some more time or back and forth to resolve

npm remove discord.js
npm install discord.js@dev

yarn remove discord.js
yarn add discord.js@dev

pnpm remove discord.js
pnpm install discord.js@dev

bun remove discord.js
bun add discord.js@dev

• Requires version 22.12 or later of Node.js node_js
• Documentation: https://discord.js.org/docs/packages/discord.js/main

What can you expect from the development version?

deny Use without crashes
deny Free of bugs
deny Consistent API (Things may change drastically from one commit to the next)
deny Refactor a large code base that a lot of people depend on to use this build

fast tulip

why i can type here

@dawn phoenix

dats dope

did u forget to lock the channel or what

dawn phoenix

what?

fast tulip

is that normal to type here?

dawn phoenix

this is a support channel for people trying out v14 by installing the at-dev build

quiet aurora

no this is a discussion channel for discord.js@dev

fast tulip

oh ahem

jolly pike

cool

fast tulip

sorry abt that bois

rigid haven

ohh ok i was confused too

dark wharf

Anyway, back to the channel topic

torn osprey

I know that I shouldn't ask it, and I know that I might not receive an answer to this question, but: is there a general ETA? Like before discord makes reading messages privileged intents?
I have been procrastinating updating my bot from v12 to v13, but if this comes before that discord intent update, I might be able to update straight to v14.

And again, sorry for this question. And I understand that there might not even be a date for a push to main (yet)

swift orchid

What alternatives are there to .deleted? Is there anything stopping me from unknowingly storing a reference to a now-deleted channel? I suppose we're just expected to .catch() all our function calls, is that correct?

outer bane
knotty plover
sturdy kiln

Is the "Ask to join" button for RPC a v14 feature? Because I can't find any way to integrate it right now.

torn osprey
knotty plover
sturdy kiln
knotty plover

Im not sure what button you're referring to anyway

sturdy kiln
plain roverBOT
knotty plover

You can read the buttons on a presence with discord.js

But otherwise, bots cannot create/set/interact with them

sturdy kiln
knotty plover

Are you sure? Because the game is definitely an Activity

sturdy kiln

Yeah, pretty sure

knotty plover

And its not a "presence" in the way bots use them, its RPC and its coming from the game on your local machine

sturdy kiln

But if I subscribe the client to that event, it never get fired, both on user A client nor user B

knotty plover

That is RPC

Bots cant join activities

You're looking at entirely user-land features here

These are not features of discord.js, because a bot
A) cannot set activities that can be joined
B) cannot join activities

sturdy kiln

Yeah I know, I'm talking about RPC, I was writing here asking if somebody knows if that is already a feature or it's planned to be added

knotty plover

Then this is the wrong channel, because this is for discussion of the discord.js dev release

RPC is not part discord.js

sturdy kiln

Sorry, I thought the new version 14 brought updates for the rpc as well

tame gazelle

all changes aren’t in the guide 'cuz v14 is still in dev right?

long narwhal
umbral slate

Should we make threads for ongoing issues to draw more attention to them?

I've already opened an issue on GitHub but it got no attention and it's pretty important

velvet jasper
umbral slate
brave mulch

Noice yya

knotty plover
umbral slate
knotty plover

Yeah idk, I did the initial component design but theres been so much change, especially with typings, since then that I dont want to touch it lol

umbral slate

The only issue with that bug is the fact that some types are made out of unions, so Omit doesn’t work on them

proper cape

So

Embed.addFields([/* Some api fields */]);

is throwing

ZodError: [
  {
    "code": "invalid_type",
    "expected": "object",
    "received": "array",
    "path": [
      0
    ],
    "message": "Expected object, received array"
  }
]

which i assume is a bug?

velvet jasper
proper cape

Heres the actual embed

new Embed()
    .setColor(grass)
    .setTitle('Welcome to #help')
    .addFields([
      { name:'Please keep conversations related to questions and answers.', value: 'Take other off topic conversations to their appropriate channels.' },
      { name:'You will be pinged when someone asks for help in #HelpDesk', value:'To avoid the ping, remove the help role using the button there.' },
    ])

i assume the parser doesnt hate trailing commas but idk

velvet jasper

like this:

.addFields(
      {
        name: 'Please keep conversations related to questions and answers.',
        value:
          'Take other off topic conversations to their appropriate channels.',
      },
      {
        name: 'You will be pinged when someone asks for help in #HelpDesk',
        value:
          'To avoid the ping, remove the help role using the button there.',
      }
    );
proper cape

oh... would be nice if the docs reflected that

current docs are relatively misleading in that case

uncut kelp

It's probably spread and doesn't show that

proper cape

probably, the link to src not working currently makes checking that annoying as well

uncut kelp
proper cape

Builders module, main branch, Embed

i assume main is on @digital dust @ dev

woops sorry about that ping

uncut kelp

Yeah it accepts a spread and seems the documentation don't wanna put that in

proper cape

in the function its spread, is it spread in the jsdoc?

because the documentation reads from jsdoc

uncut kelp

Ah uh this is TypeScript, we use typedoc

deep jetty

its typescript theres no types in the jsdoc

proper cape

oh wait right

welp i guess its just a matter of whenever the documentation website gets updated

distant prawn

Should I update my bot to v14 now? Or wait until the stable version is released.

vocal sapphire

You can update, just expect some breaking changes sometimes

lethal trail

What is changed is v14?

scarlet tangle

Hey checking out the guide and I saw this

In addition, #isCommand, now indicates whether the command is an application command or not. This differs from the previous implementation where #isCommand indicated if the interaction was a chat input command or not.

velvet jasper

yes

you can have chat input commands, user commands, or message commands

scarlet tangle

So isCommand now triggers for all 3 cases?

velvet jasper

it's true for all 3 of those cases yeah

scarlet tangle

wait what's a chat input command vs message command

velvet jasper

user and message commands are the context menu commands

chat input commands are slash commands

scarlet tangle

ahhh, ok

Out of curiosity do you know any use cases where someone would use the more broad one over the specific ones?

twilit bobcat

they're all technically commands

context menu interactions extend the base command interaction class

scarlet tangle

oh i guess in djs they are

One such use case could be to handle the application commands (chat input + context menus) together in one handler

velvet jasper
twilit bobcat

they're registered the same way you register any application command

just with a USER / MESSAGE type instead of CHAT_INPUT and other stuff like lack of options

scarlet tangle
icy dew

So i use numbers for types in slash commands, are they subject to change?

(e.g. i use type: 1 for chat input, and for options i use type: 3 for STRING)

Is it better to use exported values or are they the same?

knotty plover

Numbers are fine

icy dew

alright, thanks

umbral slate
icy dew

i prefer numbers, probably since I've used them a lot now

woven grove

your question is "are they subject to change"

every value is

hence the enums

icy dew

ah alright then

summer elbow

Is there a What’s new page of sorts for the dev branch?

Or is it just the refactoring for the name changes and enums?

deep jetty

theres the commit history if you want a full list but theres a WIP migration guide page ^

summer elbow
split fulcrum

What is new in v14?

Or what will be new?

vague coyote
split fulcrum

Okm

obtuse crater

Is it intentional that <User>.flags.toArray() always returns None, even when user has flags?

obtuse crater

Yes

velvet jasper
obtuse crater

Sure

lost ledge

Will modals be implemented in v13 or v14?

velvet jasper
lost ledge

oh alright

cinder scaffold

Why djs v14?

vague coyote

Why not?

cinder scaffold

I think no need of it

V13 was enough

woven grove

lol

vague coyote

lmao

velvet jasper

omegalul

silk topaz

damn

scarlet tangle

hey discord..js v14 not support @dry tulipjs/builder

vague coyote

thats a separate package siris is more intelligent than me KEKW

velvet jasper
scarlet tangle
+ const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');

const command = {
  name: 'ping',
- type: 'CHAT_INPUT',
+ type: ApplicationCommandType.ChatInput,
  options: [
    name: 'option',
    description: 'A sample option',
-   type: 'STRING',
+   type: ApplicationCommandOptionType.String
  ],
};```

we need to change if (!interaction.isCommand()) return;?

vague coyote

<Interaction>.isCommand() checks if the interaction is a CommandInteraction

so, thats up to you

scarlet tangle
vague coyote

CHAT_INPUT -> CommandInteraction -> isCommand()

scarlet tangle
vague coyote

I have no idea what you want xD

<Interaction>.isCommand() checks if the interaction is a CommandInteraction
so, thats up to you

slim wharf
woven grove

the enums are "raw"

because they are -types enums

velvet jasper

Also let’s assume discord changes the type of chat input to “2”, if you’re using an enum you wouldn’t be affected by this change

icy dew
scarlet tangle
icy dew
timid talon

How to install discordjs dev version using yarn

scarlet tangle

or the channel topic, whichever feels closer

timid talon
scarlet tangle

You don't need anything special for yarn

timid talon

oh ok

scarlet tangle

just add the @dev tag

vague coyote
median jetty

guild get response undefined

urban belfry
vague coyote

yes, thats intended behaviour.

Not sure what you expect.

The client isn't ready, thus has no data.

hollow spoke

v14 preperation? 😳

vague coyote

yes?

minor versions wont do it in long term

timid talon

Why isn't Embed#setColor("BLURPLE") not working

uncut kelp

It doesn't parse strings iirc

timid talon

oh

uncut kelp

For now you can import resolveColor() from Util and do <Embed>.setColour(<Util>.resolveColor("BLURPLE")) or something

timid talon

It gives me this error

ZodError: [
{
"code": "invalid_type",
"expected": "number",
"received": "string",
"path": [],
"message": "Expected number, received string"
}
]
uncut kelp

Yea it's currently a known issue. I think something is gonna be done to remedy it, but not sure just yet

timid talon

Thanks

median jetty

I can made video on youtube on djs v14

uncut kelp

You what

median jetty

I can make a video on v14

uncut kelp

Okay

o,o

tall verge

Hello, does anyone know where the list of permissions?

uncut kelp

What is a permit

uncut kelp

Go there and ask

tall verge

I mean all permissions names of v14

._.

uncut kelp

I mean nothing has changed

uncut kelp

You're welcome!

tardy frost
dawn phoenix

you'd think correctly

undone yew
        "GUILD_MEMBERS",
        "GUILD_BANS",
        "GUILD_EMOJIS_AND_STICKERS",
        "GUILD_INTEGRATIONS",
        "GUILD_WEBHOOKS",
        "GUILD_INVITES",
        "GUILD_VOICE_STATES",
        "GUILD_PRESENCES",
        "GUILD_MESSAGES",
        "GUILD_MESSAGE_REACTIONS",
        "GUILD_MESSAGE_TYPING",
        "DIRECT_MESSAGES",
        "DIRECT_MESSAGE_REACTIONS",
        "DIRECT_MESSAGE_TYPING"

what is the name of these intents in v14?

icy dew

Same, but PascalCase instead of SCREAMING_SNAKE_CASE iirc

undone yew
uncut kelp
urban belfry

the names are the same, just the style's have changed

uncut kelp

You import from discord-api-types

icy dew

GUILD_MEMBERS become GuildMembers

and so on

median jetty

When will version 14 of djs

urban belfry
tame gazelle

is it still possible to use them as string (like intents in v13) ?

undone yew

@uncut kelp how to import?

urban belfry

literally the guide i've sent

uncut kelp

You were told above

icy dew
median jetty

Version 14 may be buggy

urban belfry
velvet jasper
undone yew

how do i import it?

uncut kelp

It's literally above

In many screenshots

Many people talking

undone yew

I using

icy dew
velvet jasper

Which docs?

icy dew

because i checked the main branch and the IntentsResolveable accept strings

uncut kelp

I guess they're not updated

velvet jasper

Oh yeah gotta fix that

icy dew

oh you found it

velvet jasper
velvet jasper

Lol

tame gazelle

it works like this

no error

velvet jasper

Hmmmm

urban belfry

i checked strings, it worked, then i updated, now it doesn't work

icy dew

I'm confused now

tame gazelle

it's the latest dev right?

icy dew

lemme check npm

vague coyote

14.0.0-dev.1643544396.388f535

seems about right

icy dew

14.0.0-dev.1643544396.388f535

tame gazelle
icy dew

I'm slow

lol

icy dew
tame gazelle

I didn't get error like BITFIELD_INVALID so yes ig

icy dew

hmm alright

vague coyote

I highly doubt thats working

velvet jasper
tame gazelle

gonna try

interactionCreate only needs Guilds intent right?

so I can test a / command?

icy dew

idk

iirc yes

tame gazelle

I'll add guildCreate event

icy dew

or that

hea

tame gazelle

for make sure

urban belfry

just add GuildMessages (with Guilds of course) and a messageCreate listener

icy dew

you can try using GuildMessages

tame gazelle

it works

get an error inside the guildCreate event but it works ._.

icy dew

what error?

tame gazelle

Discord.MessageEmbed isn't a constructor

icy dew

ah

dawn phoenix

Embed

icy dew

So intentional or bug

for intents using array of strings

velvet jasper
tame gazelle

regardless

velvet jasper

Ok that’s a bug then

tame gazelle

I didn't update all the code yet

velvet jasper
tame gazelle

I meant that I have the error in my code

it's not a d.js issue

velvet jasper

Ok

tame gazelle

I didn't get correctly your question ._.

we cannot pass string for .setColor() ?

icy dew

nope

use the resolver

velvet jasper
icy dew

I'm assuming this is the same for JSON embeds as well?

velvet jasper

Iirc that would work there

tame gazelle
icy dew

hmm ill try and see s

slow storm
plain roverBOT

Documentation suggestion for @tame gazelle:
_ (static) Util.resolveColor()
Resolves a ColorResolvable into a color number.

icy dew

ignore mine, use ^

oh it wasn't in the guide, i saw it somewhere else mb

tame gazelle

and VSC is saying that <GuildChannel>#isText() is still a method

icy dew

it is

tame gazelle

ah yeah

finite fog
plain roverBOT
tame gazelle
icy dew

TextBased includes GuildNews , Text and so on

vague coyote

isTextBased() is the old isText() and is isText() is now only a guild text channel

icy dew

also I'm assuming this is a discord bug right? (links not resolving) or is it docs

vague coyote

works for me

icy dew

I'm on mobile

so Discord ig

woven grove

*android

vague coyote

can confirm, doesn't work on android OMEGALIDL

tame gazelle
vague coyote

what will not get removed

urban belfry

using strings for intents

tame gazelle

and partials

woven grove

yeah you cant use strings

use the enums

icy dew

alright

tame gazelle

in the latest dev I can so it means that you will remove this?

icy dew

probably, since it isn't intended

woven grove

most likely

scarlet tangle

is this right js const client = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessageReactions]});

scarlet tangle

so this changejs const { MessageEmbed } = require("discord.js"); now js const { Embed } = require("discord.js");

tame gazelle

yup

scarlet tangle
tame gazelle

check the guide in the pin

scarlet tangle
const but = new MessageButton().setCustomId("ne").setLabel("1").setStyle("SECONDARY");``` is this change?
velvet jasper

nope

scarlet tangle
velvet jasper

no, please check the guide

scarlet tangle
velvet jasper

you need enums instead of strings

scarlet tangle
Did you mean discordjs.guide?
The site you just tried to visit looks fake. Attackers sometimes mimic sites by making small, hard-to-see changes to the URL.```
scarlet tangle
velvet jasper
finite fog
scarlet tangle

not say for spoonfeed

you not change my code

just give ma small example

that not call as spoonfeed

scarlet tangle

what is this js const { EnumResolvers } = require('discord.js'); const enumValue = EnumResolvers.resolveButtonStyle('PRIMARY');

vague coyote

its explained there...

scarlet tangle

idk where it work for

vague coyote

just a question, why do you use the dev version and not v13

scarlet tangle

so js const but2 = new MessageButton(); now js const but2 = new ButtonComponent();

vague coyote

thats... what the guide says, yes

scarlet tangle
vague coyote

Obviously, yes

scarlet tangle
vague coyote

You should prioritize learning JS instead of using an in-dev version of djs.

scarlet tangle
icy dew

we don't know

it will be released when it will be released

vague coyote

its a very early in-dev version

scarlet tangle

client.on change now?

vague coyote

Please, stop.

scarlet tangle
icy dew
vague coyote

The guide tells you all major changes.

icy dew

so int it is

dark light

client.on didn't change

scarlet tangle
vague coyote

reallyFckingConfusedCat

tame gazelle

no strings allowed for button style too?

velvet jasper

yup

ButtonStyle.X

icy dew

or use the magic numbers but i think it isn't recommended

scarlet tangle
tame gazelle

ask here ._.

velvet jasper

also @tame gazelle strings for intents actually does work, it's a side-effect of us using the bitfield class

icy dew
scarlet tangle
icy dew

oop sorry for ping

velvet jasper

we'd have to change how BitField works

tame gazelle
vague coyote
scarlet tangle
icy dew

maybe in the guide, add the changes about .setColor() or color as well? I mean it's the same as button styles, so maybe a tip or something?

velvet jasper

i don't think a decision has been made about wheter we'll allow color strings or not

it just so happens the /builders version don't support color

icy dew

using JSON

distant canopy

.setColor()?

velvet jasper
icy dew

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

but using 0x00FF00 works

velvet jasper

yeah I think we're missing a step in serializing the json

icy dew

hmm alright

velvet jasper

this is what the old code is doing, so I think this needs to be added into the new code

icy dew

ah

scarlet tangle

is this right way js const embed1 = new Embed()

distant canopy

Looks about right

tame gazelle

looks like I've finished that are in the guide
thanks for help

something.hexColor still returns a string

do I have to do Util.resolveColor(someting.hexColor) ?

finite fog

Yeah, or you use .color

tame gazelle

.color would be better, thanks

jaunty vault

is there a reason that Embed is not in docs?

icy dew
velvet jasper
icy dew

oh

tame gazelle

does 0xDD000 still works for .setColor() ?

jaunty vault

Embed is part of builders now??

tame gazelle

you can import it from discord.js

icy dew
velvet jasper
jaunty vault
tame gazelle

dunno

icy dew

i use json so idk

velvet jasper
icy dew
msg.reply({ 
  embeds: [someEmbed], 
  components: [{
    type: 1, components: [
      { style: 1, label: "TestLabel", customId: "testing", type: 2 }
    ]}
  ]
})

this gives me an error components[0].components[0].custom_id[BUTTON_COMPONENT_CUSTOM_ID_REQUIRED]: A custom id is required

velvet jasper
icy dew

yea that works

so will snake_case be the new way to send stuff using JSON?

velvet jasper
icy dew
velvet jasper

if you can that would be greatly appreciated

icy dew

alright

tame gazelle

the class ContextMenuInteraction has been renamed?

jaunty vault
tame gazelle

thanks

icy dew

@velvet jasper hmm if i look at the builder docs, all of them use snake case. Could it be because of that?

velvet jasper

possibly

icy dew

alright

icy dew

I made an issue just in case

dull mulchBOT
median jetty

list of all intent

vague coyote

okay nvm, docs suck

median jetty

No the intents is changed

vague coyote

I see

@velvet jasper what happened with the intents OMEGALIDL

vague coyote

ah we had that talk already in internals, nvm then

median jetty
velvet jasper
vague coyote

they are not linked anymore btw

they are missing?

plain roverBOT

_ Partial
A Partial object is a representation of any existing object. This object contains between 0 and all of the original objects parameters. This is true regardless of whether the parameters are optional in the base object.

vague coyote

thats stable

quick elm

hawyeah

icy dew
median jetty

The new permission is this

velvet jasper
vague coyote

siris do you know where partials went

median jetty

Correct?

velvet jasper
median jetty
velvet jasper

yes

tame gazelle
median jetty
velvet jasper yes
    Perms: [
        "CREATE_INSTANT_INVITE",
        "KICK_MEMBERS",
        "BAN_MEMBERS",
        "ADMINISTRATOR",
        "MANAGE_CHANNELS",
        "MANAGE_GUILD",
        "ADD_REACTIONS",
        "VIEW_AUDIT_LOG",
        "PRIORITY_SPEAKER",
        "STREAM",
        "VIEW_CHANNEL",
        "SEND_MESSAGES",
        "SEND_TTS_MESSAGES",
        "MANAGE_MESSAGES",
        "EMBED_LINKS",
        "ATTACH_FILES",
        "READ_MESSAGE_HISTORY",
        "MENTION_EVERYONE",
        "USE_EXTERNAL_EMOJIS",
        "VIEW_GUILD_INSIGHTS",
        "CONNECT",
        "SPEAK",
        "MUTE_MEMBERS",
        "DEAFEN_MEMBERS",
        "MOVE_MEMBERS",
        "USE_VAD",
        "CHANGE_NICKNAME",
        "MANAGE_NICKNAMES",
        "MANAGE_ROLES",
        "MANAGE_WEBHOOKS",
        "MANAGE_EMOJIS_AND_STICKERS",
        "USE_APPLICATION_COMMANDS",
        "REQUEST_TO_SPEAK",
        "MANAGE_THREADS",
        "USE_PUBLIC_THREADS",
        "USE_PRIVATE_THREADS",
        "USE_EXTERNAL_STICKERS"
    ]
}```

I use this

for permission validation

is required js PermissionFlagsBits

velvet jasper

if it's a bitfield strings are allowed

median jetty

@velvet jasper

tame gazelle
velvet jasper

yes

tame gazelle
tame gazelle

I'm confused

vague coyote

you could have tested it

took me 3 minutes to test that

slim wharf
tame gazelle
river harbor

ah shit... here we go again...

tame gazelle

but Crawl said that it will be removed so ._.

river harbor

time to rewrite my bot...

vague coyote

do you have any benefit in using v14, lurker?

tame gazelle

me?

river harbor
vague coyote

this isn't a release

its an in-dev version

river harbor

no, but when it comes out i'll need to rewrite

vague coyote

that will still take some time

slim wharf
vague coyote already is

I can't understand, whats the reason.

I literally had to change 1000 of lines for v13 to UPPER_CASE permissions.
Now it is being removed, seriously?

With this kind of breaking changes, it is pointless to keep your bot up-to-date with the upstream

vague coyote

then dont do it, we use discord-api-types now

and we already used upper case permissions in v12

woven grove

Feel free to fork

jolly pike

write the bot in typescript, makes upgrading much easier

slim wharf
tame gazelle

in v14 you will be able too

slim wharf
tame gazelle

it does

vague coyote

Thonk

slim wharf
  • The v12 - v13 migration guide suggested it.
vague coyote

yes, thats the recommended way of using it, doesn't mean its the only way

jaunty vault

are builders getting better errors?

slim wharf

So now, I have to do PermissionFlagBits.Administrator?

vague coyote

Thats the recommended way, yes

vague coyote
urban belfry

looks like it hasn't been implemented yet

slim wharf
vague coyote

I cant tell you why they switched to how it is now

slim wharf
vague coyote

SNAKE_UPPERCASE :P

velvet jasper

we're following the microsoft style guide for this

novel notch

Does anyone know if there is already a discord.js v14 guide?

balmy ember

Yes, it is linked in the pinned messages

novel notch

Thanks

dawn phoenix
plush monolith
velvet jasper we're following the microsoft style guide for this

Hey, I understand your point, but on the other hand. Discord.js major version comes out every year or so, and you make so many major changes that I think are sometimes unnecessary. Wouldn't you like to take a slightly different tactic? I'm sure you wouldn't want to keep rewriting it either. For example, there was RichEmbed, then MessageEmbed, and now there will be Embed. Ok, that's enough just replacnut but there are also changes that require manual rewriting.

vague coyote
velvet jasper
novel notch

Someone knows how to put the buttons I get the error TypeError: MessageButton is not a constructor

novel notch

Thanks

flint bough

v14 already??

vague coyote

its still in development

isn't like thats what the first pin says

knotty plover

And the category name

And the channel name implies it

vague coyote

and the fact that the guide is a deploy preview KEKW

dawn phoenix
woven grove

Spoiler: because we can

novel notch

How can I search in the guide that the search engine does not load anything

vague coyote

Weird, agreed, doesn't work.

dawn phoenix

The deploy preview has probably been built before some breaking internal changes, so the search keys are still outdated

novel notch

Then someone can pass me the section of embed and buttons please xd

novel notch

Thanks

shadow plume

ow my a lot of changes yay

novel notch

I left to send an embed but without color xd

stray ferry

what is this?

scarlet tangle
gusty pier

guide seems to have conflicting info - it mentions both EnumResolvers#resolveButtonStyle and EnumResolvers#buttonStyle

icy dew
knotty plover

🧂

icy dew
sly narwhal so dumb btw

look at the pins if you want to see why it happened. Obviously no one wants to rewrite thousands of code, but they have to change it for consistency so that it's easier to spot bugs and actually not make the code hard to maintain

sly narwhal

will read

undone yew

how to fix?

tame gazelle

check the guide

in the pin

undone yew
tame gazelle
icy dew

I'm assuming channel.type will also return a number right?

so we would have to do if (<Channel>.type === 2) right?

or use the enum resolver

pliant salmon

Use enum resolver probably

channel.type should return what the api returns to you, so or it returns a string or djs itself implemented the enum resolver inside the type function

icy dew

so if (<Channel>.type === <EnumResolvers>.resolveChannelType("DM"))

or would it be Dm

pliant salmon

W8 lemme check, bcz i think you can just do "DM"

icy dew

I think it would Dm since they are changing from SCREAMING_SNAKE_CASE to PascalCase

So GUILD_TEXT becomes GuildText

pliant salmon

Idk, i just woke up saw the "news" abt djs v14 and im going to start converting stuff now

But im pretty sure channel.type will still return a string

icy dew
icy dew
undone yew

my code;

const { MessageEmbed } = require('discord.js');

         const embed = new MessageEmbed()
          .setTitle("Something went wrong...")
          .setDescription(`Sorry, you have **blacklisted** the bot by its \`Founder\` or \`Developer\`. You cannot use the bot's commands. `)
          .setTimestamp()

          return interaction.reply({ embeds: [embed], ephemeral: true})
undone yew

uh, thx

pliant salmon
icy dew
pliant salmon
icy dew

ah

knew it

tame gazelle

numbers so?

icy dew

so either magic numbers or enum resolvers

icy dew
tame gazelle numbers so?

iirc you can use numbers, but if discord changes it, you will have to implement the changes yourself. If you use EnumResolvers, then you won't have to change anything

pliant salmon

@icy dew just import ChannelType from djs and do like so

icy dew

Oh yes that

pliant salmon

this should fix your problem without enum resolvers

tame gazelle

EnumResolvers would be better but does discord.js calls the resolver internally?

icy dew

but shouldn't it be ChannelType.Dm? or ChannelType.DM? DM is an acronym right?

pliant salmon

i mean, if you use vscode intellisense should do it for you

undone yew
tame gazelle
icy dew
- const button = new MessageButton();
+ const button = new ButtonComponent();

- const selectMenu = new MessageSelectMenu();
+ const selectMenu = new SelectMenuComponent();

- const actionRow = new MessageActionRow();
+ const actionRow = new ActionRow();
undone yew

thx

pliant salmon
icy dew

I have it, but it's gonna take years to load so forgive me if you hear me saying this, but I am using good ol' Notepad

pliant salmon

xd

are the activity type changes listed on the changelog? 🤔

icy dew

idts

i mean only this thing changed:

- new ActivityFlags()
+ new ActivityFlagsBitField()
pliant salmon

yeah i mean the activity type

icy dew

yea it isn't listed then

pliant salmon

they also changed that to enum but i didnt see it properly mentioned

icy dew

lmao

we could just use Channel.isDM()

instead of channel.type === "something"

pliant salmon

if isDM returns a boolean then there is no need to call it

but the code for it would literally be the same

icy dew

ye i mean if only we found this earlier

all methods btw

pliant salmon

the only reference i could possibly find about the changes in the activities is here (screenshot) but i think this should be listed anyways

icy dew

Most stuff isn't documented yet, and is subject to change, so we'll just have to wait ig

or notify one of the contributors or smth

pliant salmon

i mean, im fine bcz of vscode i just think that it should be documented for anyone who starts

icy dew

pretty sure it's in their to-do list

yup

undone yew

how to fix?

pliant salmon

also, that doesnt look like a djs error

but maybe try to look at this

undone yew

There was no such thing before the discordjs error v14.

.setColor(ctx.config.color.default)

icy dew
icy dew
undone yew

how to fix?

hazy vine

monbreyFacepalm

icy dew
undone yew

Do I need to send numbers?

pliant salmon

yes

undone yew
icy dew
pliant salmon

also, there is other thing missing on the documentation for v14, just leaving the note here that dynamic got removed

undone yew
icy dew

so ```js
const { Embed, Util } = require("discord.js")

const embed = new Embed().setColor(Util.resolveColor("GREEN"))

undone yew

thx

pliant salmon

just .setColor("#00FF00")

icy dew
pliant salmon

or if you prefer setColor(0x00FF00)

icy dew

according to docs

icy dew
pliant salmon
icy dew

int !== string

pliant salmon

0x00FF00 === "#00FF00"

icy dew

nope

pliant salmon

both represent hex values

icy dew

but the type is different

tame gazelle

the second one doesn’t work

only 0xyddhdjz

pliant salmon
icy dew
pliant salmon

bcz using #00FF00 used to work

pliant salmon
icy dew

it's not listen in change logs

pliant salmon

that explains it but also doesnt make sense

icy dew
pliant salmon

it used to be

lemme see smtg

icy dew

at first i was confused, until someone said to use util.resolveColor in this channel

if you want RANDOM, then use util.resolveColor

pliant salmon

na

i think im fine,
biggest part of the embeds i use just grab the color from the user

icy dew

ah, then you should be fine

pliant salmon

yeah

  • i have my own fromHex function if needed

but i will take a look at djs one just for curiosity

undone yew

uhh

pliant salmon

use the enum values

undone yew

how?

pliant salmon

where you are creating the buttons

icy dew

use EnumResolvers for button styles

pliant salmon

create them with the new enums instead of "PRIMARY" and stuff like that

icy dew

^

undone yew
pliant salmon

thats one of the main changes

icy dew

either import ButtonStyles and do ButtonStyles.Primary

undone yew

database of buttons

icy dew

or import EnumResolvers and use EnumResolvers.resolveButtonStyle("Primary")

pliant salmon
icy dew

hmm, the guide shows caps

tame gazelle
icy dew

Because it's ButtonStyle.Primary

so i thought it should be the same with resolveButtonStyle()

I think something isn't intended

pliant salmon

the old way was also caps

icy dew

why isn't Primary in caps?

oh one uses discord-api-types and one is from djs itself

undone yew
icy dew
tame gazelle

<Message>#type is a number now?

undone yew
icy dew

ButtonStyle.Primary or EnumResolvers.resolveButtonStyle("PRIMARY")

icy dew

mb

tame gazelle

how can I display <ChannelType>#type as string?

pliant salmon
tame gazelle
undone yew
icy dew
tame gazelle
pliant salmon
icy dew
pliant salmon

even tho idk why they did that bcz if you compile enum from ts you can use both number and string

so it doesnt make sense to me the route they went

tame gazelle
icy dew

not all ppl use ts

pliant salmon
icy dew
icy dew

if we do resolveChannelType(2), will it return a string?

pliant salmon
undone yew

new error

@icy dew do you know?

icy dew
pliant salmon

like...

icy dew

so both return numbers

pliant salmon

yes

undone yew
pliant salmon

thats why they could keep string, and if its string you index it to the enum

icy dew

your emoji has to be a raw object

i.e client.emojis.cache.get(config.emoji.button.delete)

undone yew

config

icy dew

and so on

undone yew
icy dew
undone yew

okay

tame gazelle
pliant salmon
tame gazelle

the error said that it's line 79

rain bramble
tame gazelle

Shouldn't it be { name: "name", value: "value", inline: true }?

tame gazelle

isn't that for .addFields() ?

pliant salmon
icy dew
tame gazelle

._.

undone yew

AA

pliant salmon
icy dew
undone yew

using customId:

icy dew

it's custom_id: now

pliant salmon

addField: { name: string, value: string, inline: boolean | undefined }
addFields: [{ name: string, value: string, inline: boolean | undefined }]

so instead of spamming addField you can just create a bunch in 1 function

tame gazelle

yeah but I add fields in a if statement ._.

pliant salmon

its valid to just do addField a bunch of times

tame gazelle

I do that

pliant salmon

but its redundant

thats why addFields exists

urban belfry
undone yew AA

that's not how it works
it should be type: 1, components: [....]
what you have is the completely wrong format
again, show your code

pliant salmon

ofc if you use if statments to define them there isnt much to do

undone yew

It works, but the buttons do not work

if(button.customId == 'delete') {}

icy dew
pliant salmon
undone yew

v15: Embed => MessageRichEmbed .D

pliant salmon

welp i havent messed with buttons for a while

icy dew

welp time to refactor my code

i think all camelCase properties for classes in builders will be changed to snake_case

pliant salmon

at least the only thing i had to change in my client was the DM type and interaction isCommand

icy dew

yea

pliant salmon

commands will be the problem

icy dew

i mean vsc has find and replace

shouldn't be that hard

pliant salmon

it isnt

icy dew

you just press enter all along the way

pliant salmon

but some of my bots i do not maintain anymore so i gotta ask the current coder to learn how to do that bcz he uses webstorm

the only thing im rly wondering is if people rly use the collection functions

undone yew
icy dew
pliant salmon
undone yew
            system.on('collect', async (button) => {
        
              if(button.custom_id == 'delete') {
        
                interaction.deleteReply();
        
                await button.deferUpdate();
        
              } else if(button.custom_id == 'previous') {...}

where error?

icy dew

hmm, that returns a ButtonInteraction

pliant salmon

maybe wrap it in a try...catch to see the error?

tame gazelle
icy dew
undone yew

Interaction failed error occurs when pressing the button

tame gazelle

it takes an object too

pliant salmon

then reply to the button bcz i dont see where interaction is defined

pliant salmon
tame gazelle

.addFields() doesn't take an array

pliant salmon

it does

tepid narwhal

"await interaction.deleteReply()" normaly ?

icy dew

what?

tame gazelle

wrong reply

icy dew
pliant salmon

fields is not field

tame gazelle

I know

tepid narwhal
tame gazelle
undone yew
icy dew
tame gazelle
pliant salmon

they added ...

icy dew

bruh

pliant salmon

undocumented changes

pliant salmon
icy dew bruh

not documented, you can see on my screenshot they added ...

icy dew

yea, i guessed it

pliant salmon

now you can just do it without the []

undone yew
pliant salmon

which is pain

pliant salmon
pliant salmon
tame gazelle

for?

ah Formatters?

pliant salmon

yes

tame gazelle

I've never used it

pliant salmon

idk

i think they have something but im not sure

they do

scarlet tangle

discord.js v14 !?

vague coyote
dawn phoenix

unsure what you expect as an answer to that query

scarlet tangle

and what happened to v13 guide

vague coyote

all you need to know so far is pinned

scarlet tangle

I remember there is a another site explaining think better

dawn phoenix
scarlet tangle
dawn phoenix

also linked here

scarlet tangle

ok

pliant salmon

i think this should be addressed asap

3 lines with that error on djs types

undone yew
dawn phoenix

then it doesn't even reach that point of your code

undone yew

what could be the problem?

dawn phoenix

hard to say, try to find out where your code stops execution/differs execution wise from what you expect

pliant salmon

Souji, should i open a issue about the types?

dawn phoenix

i have no idea what's going on there, but i did update a bot yesterday with the recent at-dev release and did not encounter any errors

undone yew
dawn phoenix

and how are we supposed to find it then?

pliant salmon
undone yew

Definition:
button.customId

Button:
custom_id

Interaction failded

dawn phoenix

what is "button" even?

undone yew

i don't know

dawn phoenix

then find out?

undone yew

My context (includes buttons) file

what is the problems?

help

vague coyote

are WE supposed to debug your whole code now?
No thanks 💀

Thats still your job

tame gazelle

the dynamic option has been removed?

for avatar

vague coyote

its now forceStatic

set that to false

kinda weird that its on rest now 🍣

undone yew

I couldn't find the problem

tame gazelle
undone yew
if(button.customId === 'last')
          ^^^^^^^^ 

What should I write here?

vague coyote

what is button

undone yew
vague coyote what is button
            let fetch = await interaction.fetchReply();
            const system = fetch.createMessageComponentCollector({ componentType: 'BUTTON', filter: (clicker) => clicker.user.id == interaction.user.id })

            system.on('collect', async (button) => {

              if (button.customId === 'delete') {
        
                interaction.deleteReply();
        
                await button.deferUpdate();
        
              } else if (button.customId === 'first') {...}
vague coyote

log button

and show the output

undone yew

button didn't respond to it either

urban belfry

wait it's still going to be called MessageComponentCollector?

vague coyote

rip

undone yew

what will i write?

vague coyote

log button
and show the output

undone yew
vague coyote

explain that

undone yew
urban belfry

no, even i don't understand what "button didn't respond to it either" means exactly

undone yew

No movement in console.

no output

these were working fine without custom_id, when I did v14 customId started giving error.

if(button.customId === 'delete') {...}
          ^^^^^^^^

I just don't know what to write here

urban belfry

@undone yew import ComponentType from discord.js and access ComponentType.Button instead of this componentType: 'BUTTON'

undone yew

which one will i write

urban belfry

the latter of course

undone yew

workedddd

where error?

finite fog

The stacktrace tells you what method you used and where you used it, the error tells you what was expected and what was received.
I'm not sure what more you'd need.

undone yew

i don't know

icy dew

something needed a string, but you gave undefined

pliant salmon

already talked about that here

vague coyote
undone yew

cough setAuthor takes an name option, not content
cough addFields takes multiple field objects, not an array

urban belfry

so the docs for addFields is wrong too?

vague coyote

yes

pliant salmon
icy dew

question, is it just me or does anyone else get FATAL ERROR: Committing semi space failed. Allocation failed - JavaScript heap out of memory

never got this in v13, but i get this in v14.

could it be because i have multiple setTimeout or smth

undone yew
pliant salmon

we where talking about that idk how you didnt see it

pliant salmon

i will open a issue for the types

icy dew
tame gazelle
pliant salmon

they didnt document that yet so its normal

vague coyote
pliant salmon
vague coyote

if you click on imageurloptions in the docs, it directs you to the proper page

pliant salmon

ah yes

but there is no information that it got changed thats what i meant

vague coyote

Yes, but you should always look at the docs if you get a problem like that anyway reallyFckingCuteCatHihi

pliant salmon

and its rare for me to go to the docs since i have all directly on my ide, thats how i found the errors in the types

pliant salmon
vague coyote

just to clarify, you changed yours to forceStatic, right?
Not that you think it got removed notLikeCrawl

pliant salmon
vague coyote

wut, its none by default according to docs

pliant salmon

rly?

w8 a sec

this is what i saw

vague coyote

ah okay

idk, should say false, none confuses

pliant salmon

true now its the oposite of the dynamic: true (?)

urban belfry

if we use dynamic as an example, by default now it's dynamic: true

forceStatic: true would be explicitly saying dynamic:false

pliant salmon

Yes

Thats what the guide suggests at least

vague coyote
pliant salmon

ForceStatic forces the url to be the static one

So having it to true is the same as dynamic: false

vague coyote

well yes, saying its none by default is not correct tho

it doesn't matter really, but I think showing it default false in the docs is cleaner

pliant salmon

I didnt see none tbh

pliant salmon

But that maybe happened bcz the type is forceStatic?: boolean or forceStatic: boolean | undefined

Docs maybe got confused with that

urban belfry

it doesn't mention @default false
unlike MakeURLOptions.extension

pliant salmon

Yeah, and for what im aware the docs arent made by hand so it got confused

They can change that ez but its not smtg that will break your code

gleaming parcel

whats gonna change with v14?

slate mango

Many things, please check pins

undone yew
        const button = new ctx.Discord.ActionRow(
            new ctx.Discord.ButtonComponent(
                { name: "Boy", style: ctx.Discord.SUCCESS, emoji: ctx.client.emojis.cache.get(ctx.config.emoji.OptionalEmojis.AccountUser), custom_id: 'boy', disabled: false }
            )
            
        )

where is error?

pliant salmon
vague coyote
undone yew
urban belfry

oh no sory

vague coyote

since when does ActionRow takes a buttoncomponent in the constructor Thonk

urban belfry

it doesn't

it takes an apiactionrowcomponent, which has a type property and a components array

@undone yew pass nothing to the constructor and use addComponents

icy dew
undone yew

😑

urban belfry

well.. what is fetch?

undone yew

fetch = interaction.fetchReply();

vague coyote

prooommiiissseee

plain roverBOT
pliant salmon

await moment

undone yew

-_-

pliant salmon

oh, im actually curious now

does djs have any plans to support ESModules?

urban belfry

@undone yew you're being difficult, that error's not telling us much, show us the code if you want someone to be able to answer you

undone yew
urban belfry

instead of passing an object, use the builder methods

like ButtonComponent.setLabel('something')
also this is a good time to mention, content?? button.content?

vague coyote

lmao

also addComponents doesn't take an array afaik
same as addFields in an embed

vague coyote

also addComponents doesn't take an array afaik
same as addFields in an embed

urban belfry

but setComponents takes an array of components

vague coyote

yes

urban belfry

whereas setFields takes a rest parameter

pliant salmon
urban belfry

i understand not wanting to support multiple types of input, but they should be consistent
i'd expect setFields and setComponents to be consistent

undone yew

bruh

urban belfry

again, you're not showing code

pliant salmon

thats a v14 change for some reason

urban belfry

well they aren't now 🙃

undone yew