#djs-in-dev-version

35223 messages · Page 8 of 36

small mica

Is anything wrong that I am doing?

somber mirage

I installed discord.js@dev
And I got this error:

long narwhal
somber mirage
long narwhal

I see, now I guess we wait for a merge

tame gazelle

like this: exports.Modal = require('@discordjs/builders').ModalBuilder; ?

somber mirage
long narwhal

aight, thanks

tame gazelle

I take that like a "yes" then ._.

long narwhal
tame gazelle

^

long narwhal

oH okay

somber mirage

btw does ActionRow don't work for you aswell?

long narwhal
forest elm

you have to use ActionRowBuilder

somber mirage

TY

edgy lichen

hi is the permission of send message in a channel

SEND_MESSAGE
or
SEND_MESSAGES

forest elm

SendMessages

long narwhal

guessing it's something that i'll just need to wait for on djs' end

forest elm

should be Components.createComponent(c), with const Components = require('../util/Components');

maybe @umbral slate can add that into their existing pr

somber mirage

I really don't know what I'm doing wrong

Error:

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
data.components[0].components[0].options[0].value[BASE_TYPE_REQUIRED]: This field is required

Code:

const actionRow = 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',
            },
        ])
);

await interaction.reply({ content: "Please choose on what to report.", ephemeral: true, components: [actionRow] });
forest elm

addOptions takes rest parameters, not an array

somber mirage

set options too?

forest elm

yes

somber mirage

So what I need to do?

forest elm

remove the square brackets

somber mirage

thank you so much

tame gazelle

how can I know where it could be from?

forest elm

you have the channel id (from the url), the message content

tame gazelle

ah yeah thanks

somber mirage

What I need to put in awaitMessageComponent - componentType?

A string or enum or idk

forest elm

ComponentType enum

somber mirage

How can I use showModal if I already replied to the interaction?

dawn phoenix

you cannot

modals are an initial response type

tame gazelle

is it normal that we can still import ActionRow, ButtonComponent etc from discord.js?

urban belfry

read the PR, that should explain with more detail than ben on phone 🤠

tame gazelle

I see thanks

scarlet tangle

Hi

hazy light

Hey can someone explain what changed in Djs@dev i can't pass add components to my message :

const raw = new ActionRowBuilder().addComponents(button);
        const embed = new EmbedBuilder()
            .setTitle(game.name)
            .setColor(Colors.Gold)
            .setAuthor({name: cuser.username, iconURL: url})
            .setDescription(game.description)
            .setFooter({text: game.winrate});
        channel.send({embeds: [embed], components: [raw]});

in components: [raw] i have

Type 'ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRow<...> | (Required<...> & ActionRowData<...>)'.
  Type 'ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>' is not assignable to type 'JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>>'.
    The types returned by 'toJSON()' are incompatible between these types.
      Type 'APIActionRowComponent<APIButtonComponent | APISelectMenuComponent | APITextInputComponent>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent>'.
        Type 'APIButtonComponent | APISelectMenuComponent | APITextInputComponent' is not assignable to type 'APIMessageActionRowComponent'.
          Type 'APITextInputComponent' is not assignable to type 'APIMessageActionRowComponent'.
Type 'APITextInputComponent' is not assignable to type 'APIButtonComponentWithCustomId'.
              Types of property 'style' are incompatible.
                Type 'TextInputStyle' is not assignable to type 'ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger'.ts(2322)
hoary fox

send button builder

urban belfry

you can cast your actionrow to the first type ActionRowBuilder<MessageActionRowComponentBuilder>

hazy light

oh its work ty

scarlet tangle

wait

did ActionRow change to ActionRowBuilder now?

tame gazelle

yes

Embed => EmbedBuilder

scarlet tangle

but buttoncomponent is the same?

tame gazelle

ButtonComponent => ButtonBuilder

scarlet tangle

breuh

SelectMenuBuilder too?

tame gazelle

yes

scarlet tangle

and EmbedBuilder?

tame gazelle

yes

scarlet tangle

whoops

gotta change my code

scarlet tangle
tame gazelle

yes

scarlet tangle

they like Builder huh

edgy lichen

hello i have this code

const mmm = message.channel.messages.fetch(m => m.content == "hi hi hi")

if(mmm) {
message.reply(`found ${mmm.id}`)
} else {
message.reply("didn't")
}

it reply with found but mmm.id is undefined

any help will be appreciated

tame gazelle
edgy lichen

o

vestal ibex

Version: 14.0.0-dev.1647130097.549716e
I am not using modal now.
How to fix?

hazy light

delete the line lol it's a wrong import

the line in discord.js/src/index.js who try to import Modal

scarlet tangle

@tame gazelle bruh

did you just lie?

copper jetty

Import it from @discordjs/builders

not discord.js

forest elm

its exported in discord.js

urban belfry
scarlet tangle

I did tho

urban belfry

restart ts server
show your output from npm ls discord.js

scarlet tangle

ok i updated again

lemme check now

lethal trail

where is the new guide now ;-;

exotic tusk

Im getting this, literally just required discord.js

hazy light

and wait a pr for fix this definitely

tame gazelle
spark iron

Did you just break modals on 14.0.0-dev.1647130097.549716e?

scarlet tangle

It's generally not good to monkeypatch so you can also just wait for the PR

exotic tusk

thank you, does the version currently allow for modals?

uncut kelp

One's being planned fyi

exotic tusk

also, how do we create an embed now?
let emb = new MessageEmbed() ^ TypeError: MessageEmbed is not a constructor

scarlet tangle

EmbedBuilder

hazy light

EmbedBuilder

lethal trail

why this isn't updated yet-

urban belfry

the guide's still a WIP

exotic tusk

rip, they removed the ability to do "BLURPLE"..

urban belfry

there is still Util.resolveColor no?

hazy light

you can just import Colors

exotic tusk
lethal trail

if guide not updated where im supposed to see the changes-

hazy light
lethal trail
exotic tusk
lethal trail hm

this is a beta my men, not everything is finalised meaning documenting everything would be a waste.

perhaps not a total waste but still

lethal trail

ill just wait for another month or two till djs v14 stable is out

exotic tusk

btw, how do we do footers, it just said deprecated on v13 so I stopped using it instead of looking into it

lethal trail

its not gonna hurt my bot as api v9 wont be deprecated till next year

exotic tusk

.setFooter({ text: "© 2020 General Land", icon_url: "htl.png" }) there we go, like this?

exotic tusk

sorry ping*

hazy light

you can ping me np

exotic tusk
    if(message.content == '!sendV') {
        message.channel.send({embeds: [emb]})
    } })``` any idea why this wont work?, all intents enabled etc.
forest elm

messageCreate

hazy light

its messageCreate

forest elm

and dont enable all intents

exotic tusk

owh yeah, i kept on using message for a year soo

exotic tusk
forest elm

so what

hazy light

It's a better practice to just enable intents you need

copper jetty

and your pc if you're running it on pc

scarlet tangle

help

exotic tusk
copper jetty Why would you like to slow down your bot

it needs to handle everything in the server from leveling to moderation. I dont know how much it can slow it down by but hardware is not an issue. feel like its best business to not go on about how it makes something worse after the person explicitly told you they need it or / and dont mind having them enabled. - thank you for your concern tho

hazy light
scarlet tangle help

It's an error from the current version you can cast like this to avoid : components: [(row as ActionRowBuilder<MessageActionRowComponentBuilder>)]

civic topaz

why replit prompt this problem?

TypeError: Cannot read properties of undefined (reading 'GUILDS')
    at Object.<anonymous> (/home/runner/ka/index.js:5:23)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at REPL1:1:1
    at Script.runInThisContext (node:vm:129:12)
civic topaz

ok

thx

exotic tusk

.setColor(88, 101, 242) - should return blurple yet it returns this;

tame gazelle

just do .setColor('Blurple')

exotic tusk

I was trying "BLURPLE" for some reason vs code didnt fill it up automatically

tame gazelle

if you wanna use RGB it should be .setColor([88, 101, 242])

exotic tusk
civic topaz
scarlet tangle
exotic tusk
tame gazelle

I saw that it takes ColorResolvable

exotic tusk

yeah apperiantly not, would be a nice addition tho.

forest elm
exotic tusk

let emb = new discord.EmbedBuilder() - I do.

civic topaz
weak ridge

Hi! Does anyone know where this error comes from?

C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\structures\ActionRowBuilder.js:6
class ActionRowBuilder extends BuildersActionRow {
                               ^

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\structures\ActionRowBuilder.js:6:32)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\index.js:74:28)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)

Node.js v17.2.0
tame gazelle

install builders dev version

weak ridge

How?

tame gazelle

npm i @discordjs/builders@dev

weak ridge

Ok

tame gazelle
exotic tusk

thanks

weak ridge

That works, thanks !

civic topaz

why GatewayIntentBits.Guilds also returns error:

TypeError: Cannot read properties of undefined
tame gazelle

it's IntentsBitField

IntentsBitField.Flags.Guilds

urban belfry

no wait GatewayIntentBits should be a thing

civic topaz
const { Client, GatewayIntentBits, Partials } = require('discord.js');
urban belfry

npm ls discord.js on your terminal

tame gazelle

he just forgot .Flags prop no?

urban belfry

no it's just an enum, IntentsBitField.Flags is GatewayIntentBits

urban belfry

now do what i told you, show me the output of npm ls

civic topaz

ik now

replit auto installed 13.6

Error: Cannot find module './structures/Modal'
Require stack:
- /home/runner/ka/node_modules/discord.js/src/index.js
- /home/runner/ka/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/runner/ka/node_modules/discord.js/src/index.js:131:17)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

but it returns this

urban belfry

yeaaaa it's a bug, there's a pr, wait till that gets fixed

boom, now merged, just wait for the next released

exotic tusk

did button creation etc. change on djs 14?

scarlet tangle
exotic tusk

it became a builder as I understand - or what vscode suggests rather

scarlet tangle

what

exotic tusk

would this be right?

scarlet tangle
exotic tusk

with setLabel then setText - whats wrong

scarlet tangle

is not setText

exotic tusk

yeah, figured that out as I sent it lol

scarlet tangle

you have to set a custom id

exotic tusk

ik ik

scarlet tangle

and a style

exotic tusk

yeah, just asked if the builders were correct.

scarlet tangle
exotic tusk

and would this be right aswell for the style?

scarlet tangle

it is easier to put the number

exotic tusk

no idea what the numberes are soo

copper jetty
copper jetty
scarlet tangle

1 = PRIMARY
2 = SECONDARY
3 = SUCCESS
4 = DANGER
5 = LINK

.setStyle(discord.ButtonStyle.PRIMARY) => .setStyle(1)

urban belfry

no it's unreadable and we don't recommend magic numbers

scarlet tangle

why

urban belfry

code characters isn't always what you want to look at, readability is very important too

scarlet tangle

ok

exotic tusk

.setEmoji("⛵") - how would this become an object, I seriously dont see why we need to use an object for thşs

urban belfry

{name: "⛵"}

exotic tusk
urban belfry

if it's a custom id, id: "23234234234234

exotic tusk

owh yeah animated etc aswell for the variables - I get it

urban belfry

animated doesn't really do anything from what i've tested

exotic tusk

my anxiaty says this is not how we defer replies on buttons, is it?

scarlet tangle

help

scarlet tangle
exotic tusk

thanks

worthy fog

But why are you doing as Embed anyways?

scarlet tangle

this typescript isjust hurting my brain

worthy fog

What’s embed defined as?

scarlet tangle

new EmbedBuilder(...)

now that

worthy fog

Okay so either so as EmbedBuilder or remove the as all together

scarlet tangle
urban belfry

perhaps call .toJSON() on it?

worthy fog

Or do as unknown as EmbedBuilder

scarlet tangle
worthy fog
scarlet tangle

Ok

exotic tusk
                name: "captcha.jpeg",
                file: captcha.JPEGStream
            }]``` how can I send attachments - this returns a... large error
rain bramble
scarlet tangle

I tried with no as and it didn't work so

exotic tusk

thanks

urban belfry

i'm unsure of the recommended system as the PR shows you passing a builder to embeds

but i am sure that it does take in an APIEmbed, so @scarlet tangle EmbedBuilder.toJSON() try passing thatr

scarlet tangle

I'll try that later when I fix all of the other errors

scarlet tangle
urban belfry

i think so

weak ridge

Hi! Does anyone know how I can fix this error?

Error: Cannot find module './structures/Modal'
Require stack:
- C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\index.js
- C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Structures\Utils\Bot.js
- C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Structures\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\index.js:131:17)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\felal\\Desktop\\PRODEFIX\\Discord\\Bot-Slash-3.0\\node_modules\\discord.js\\src\\index.js',
    'C:\\Users\\felal\\Desktop\\PRODEFIX\\Discord\\Bot-Slash-3.0\\Structures\\Utils\\Bot.js',
    'C:\\Users\\felal\\Desktop\\PRODEFIX\\Discord\\Bot-Slash-3.0\\Structures\\index.js'
  ]
}
urban belfry

wait for the next release, it's a bug that's already fixed

exotic tusk

can we add images to modals?

weak ridge
urban belfry

well i know but it is a fix, you'll have to wait for the next release
this isn't the stable branch you know, you shouldn't depend on this for your bot

weak ridge

Ok

exotic tusk
urban belfry

i'll ask later on about this

on what they recommend for the users

exotic tusk

how can I send a modal I created

rain bramble
scarlet tangle

should I just delete that line?

rain bramble
scarlet tangle

I just deleted it for now

what

rain bramble
scarlet tangle

is there a PR?

rain bramble

idk

scarlet tangle

any way to fix this?

urban belfry

let me see

oh shhit looks like it renamed to createComponentBuilder haha

scarlet tangle

ooooohhk

urban belfry

i'll see if that is indeed the case and make a pr 🤠

really hoping for a ts rewrite soon, the pr broke a lot of things and tbh without ts, it's pretty hard to keep track of too

rain bramble
urban belfry

elaborate

scarlet tangle

now i get this

urban belfry

why are you using raw objects?

also log the values and show that

scarlet tangle
exotic tusk

interaction.createMessageCollector is not a function what happened to this

urban belfry

you can't wait for messages on interactions? but it should be a thing on channels
interaction.channel

exotic tusk

thanks, completely forget that sometimes

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

  if (interaction.customId == 'start') {
        interaction.deferUpdate()
        let emb2 = new discord.EmbedBuilder()
        .setTitle("Captcha Verification!")
        .setDescription(`
Now that you came all the way here, you may verify yourself thru the 
captcha below, good luck sailor!
        `)
        .setColor([88, 101, 242])
        .setImage(`${prop}`)
        .setFooter({  text: ":copyright: 2020 General Land", icon_url: "https://i.imgur.com/QXQZQ3l.png" });

      interaction.reply({embeds: [emb2], ephemeral: true})```
idle galleon

You can't reply after deferUpdate

It doesn't look like ur doing any hefty computation or api calls, so I wouldn’t even call defer

Just use update or reply

Tho, you can’t edit/update a message to become ephemeral

scarlet tangle

im trying to get a text input value but it doesnt work (it says the field doesnt exist)

small mica

show code

scarlet tangle
forest elm

on the djs source

small mica

Even I have problems with modals

forest elm

because they're broken in the latest dev build

small mica

.

scarlet tangle

I just changed it to createComponentBuilder()

forest elm

thats not right

scarlet tangle

so change it back to createComponent?

forest elm

read the comment

scarlet tangle

this?

forest elm

yes

scarlet tangle

what do i do with that

forest elm

you can either make the changes yourself or wait for rodry

scarlet tangle

i wanna fix it as fast aspossible

nimble plaza

is there docs for dev ?

urban belfry

check pins

gloomy kayak

well, this is a general JS error, not related with djs

copper jetty

You didn't reply

scarlet tangle

Oh 1 minute

@copper jetty idont understand

await interaction.showModal(modal);

Then ?

copper jetty

Then collect the ModalSubmitInteraction and reply to it

white nebula

Just found out that <MessageSelectMenu>.spliceOptions was removed on the SelectMenuBuilder
I saw nothing about it in the guide, so was there any sort of replacement for it, or should I just work on doing something similar with normal <Array>.splice ?

copper jetty
tame gazelle

with the Embed constructor we were able to pass a ColorResolvable, will it be possible with EmbedBuilder constructor ?

white nebula
uncut kelp

Damn

gritty citrus
tame gazelle

you saw that on a PR?

gritty citrus

no im looking at the main branch code, oh EmbedBuilder

tame gazelle

before the Embed constructor only accepted a number and after they changed it to a ColorResolvable

and now with EmbedBuilder .setColor takes a number

gritty citrus

it seems like it only takes a number now Thqnkqng or an array

tame gazelle

rip

forest elm

if you were using a hex string, simply use 0x<hex>
if you were using one of the predefined colors, just use the Colors enum

whats the big deal

tame gazelle

I don’t have an issue with that
I made changes when this channel opened

it was just for knowing

forest elm
white nebula

I couldn't find any prs explaining why it should be removed, so that was my guess too

either way I found a workaround now that .setDefault() exists on option classes

forest elm

actually, was that ever a thing?

plain roverBOT
white nebula

It was the only method removed in the builder other than normalizeOption(s)

forest elm

oh i thought you were saying it was on builders initially

because it wasnt, it was never added to builders

shadow nacelle

how can i set an emoji ButtonComponent?

forest elm

search for setEmoji on this channel, it has been answered plenty of times

scarlet tangle

Is this a new v14 function?

dull mulchBOT
scarlet tangle

when is this gonna get merged?

urban belfry
scarlet tangle

finally updated and working code

btw when is djs 14 gonna use API v10?

urban belfry
scarlet tangle

🆗

weak ridge

Hi! Does anyone know how I can fix this error?

TypeError: Cannot set property disabled of #<ButtonComponent> which has only a getter
    at Object.disableAllButtons (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Structures\Utils\Bot.js:78:62)
    at Object.execute (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Buttons\BotSuggestion\Accept.js:20:64)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Code:

disableAllButtons(components) {
    for (let x = 0; x < components.length; x++)
        for (let y = 0; y < components[x].components.length; y++)
            components[x].components[y].disabled = true;
    return components;
}
vague coyote

.setDisabled(true)

weak ridge

components[x].components[y].setDisabled(true) ?

TypeError: components[x].components[y].setDisabled is not a function
    at Object.disableAllButtons (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Structures\Utils\Bot.js:78:53)
    at Object.execute (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Buttons\BotSuggestion\Accept.js:20:64)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at processImmediate (node:internal/timers:437:9)
scarlet tangle

10 is bigger than 9 and it has 2 letters

scarlet tangle
shadow nacelle

<channel>.awaitMessageComponent Supports Modals?

copper jetty
shadow nacelle

so, how can i await modals?

scarlet tangle

You don’t

copper jetty
shadow nacelle

I want to do something like, show a modal, and then when that modal is responded, so send another modal

copper jetty

You can't reply to modal with another modal

shadow nacelle

so, there is no way to do that

copper jetty

no

scarlet tangle

I want to upgrade to djs @ dev for Modals, will I have to change stuff around like the change from v12 to v13?

copper jetty

yes

umbral slate
scarlet tangle
umbral slate
civic topaz

can anyone send me the list of intents (@14.0.0-dev)

uncut kelp

Pins

civic topaz

thx

tawdry mist

does anyone know if the discord.js v14 change log is out yet?

I just want to see the changes incase I gotta rewrite some code

tawdry mist
tawdry mist
novel notch

Help Plis

Code

let test = new Discord.ActionRow()
            .addComponents(
            new Discord.SelectMenuComponent()
            .setCustomId("test")
            .setPlaceholder('Test')
            .setMinValues(1)
            .setMaxValues(1)
            .addOptions({
                label: "test",
                description: "test2",
                value: "test"
            })
            )

Error

TypeError: Cannot destructure property 'components' of 'undefined' as it is undefined.
scarlet tangle

ActionRowBuilder()

SelectMenuBuilder()

novel notch

EmbedBuilder ?

Yes it's good thanks for the help

scarlet tangle
novel notch
novel notch
scarlet tangle

All "Component" rename to Builder

same to Modal => ModalBuilder

novel notch

Ok

slate kelp

Do messages accept EmbedBuilder or Embed? or EmbedBuilder#toJSON ?

also this

outer bane
slate kelp

but then this

outer bane

it implements JSONEncodable<APIEmbed> though. make sure all packages are up to date and try restarting ts server

slate kelp
    Types of property 'embeds' are incompatible.
      Type '(APIEmbed | JSONEncodable<APIEmbed>)[]' is not assignable to type '(APIEmbed | Embed)[]'.```
Seems like the typings weren't updated here
outer bane

yes, known oversight, there's already a pr to fix it

hardy bone

.

anyone?

slate kelp

can I collect Modals with Interaction#awaitMessageComponent?
ok, i'll use InteractionCollector

hardy bone

someone willing to look into my problem 😐

worthy fog

You don’t have a dev script

hardy bone

the error below it

worthy fog

Oh

hardy bone

;-;

here is the error

worthy fog

No I saw it. Where’s your code?

hardy bone
import { Client } from "discord.js";

const client = new Client({
    intents: []
});

client.on("ready", () => {
    console.log("WORRRRRRRRRRRKS!");
});

client.login("TOKEN")

its just basic discord.js code

worthy fog

You need intents broski

First o all

hardy bone

which intent do i need ;-;

i am making a bot that interacts using interactions only so

i added the guilds intent, im still getting the same error @worthy fog

spare fiber

you need GUILDS

hardy bone
worthy fog

It’s different for v14

hardy bone
worthy fog

It’s a different name

It’s Guilds not GUILDS

spare fiber

yea import it from enum, but still you need guilds intent

hardy bone
import { Client, IntentsBitField } from "discord.js";

const client = new Client({
    intents: [
        IntentsBitField.Flags.Guilds
    ]
});

client.on("ready", () => {
    console.log("WORRRRRRRRRRRKS!");
});

client.login("")
worthy fog

But idk much about v14

I’m still on v13

hardy bone

hmm so @spare fiber is the code correct?

spare fiber

read the guide, i didnt use v14 yet. and make sure all dev package are up to date

hardy bone
spare fiber

yea

hardy bone

that didnt fix it lol

frank atlas
frank atlas
spare fiber

they using ts

hardy bone

when i compile the code from ts to js it gives me the error

hardy bone
icy dew

this only happens when you use the dev version? or does it happen when you use v13 as well?

hardy bone

stable works fine

spare fiber

try to edit tsconfig

hardy bone
icy dew

that's odd, try what kagchi said / reinstall the dev version

hardy bone

same error ;-;

scarlet tangle
hardy bone
{
  "name": "project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@discordjs/builders": "^0.12.0",
    "@discordjs/rest": "^0.3.0",
    "discord-api-types": "^0.29.0",
    "discord.js": "^14.0.0-dev.1647216471.87a6b84"
  }
}

@scarlet tangle

scarlet tangle
scarlet tangle

yarn

hardy bone
scarlet tangle

try running the bot

hardy bone

same error

scarlet tangle

not really much idea then, might be a library issue

slow storm
hardy bone

so um the error?

civic topaz

I have an error from my bot, can anyone help me?

 [antiCrash] :: Unhandled Rejection/Catch
TypeError: (intermediate value).setTitle is not a function
    at module.exports.run (/home/runner/ka/events/messageCreate.js:28:12) Promise {
  <rejected> TypeError: (intermediate value).setTitle is not a function
      at module.exports.run (/home/runner/ka/events/messageCreate.js:28:12)
}
sonic moth
hardy bone
civic topaz
let embed = new Embed(); // declared before.  ->  `const {Embed} = require("discord.js")`
.setTitle("xxx")
.setDescription("xxx")
.setColor("GREEN")
hardy bone
fluid bronze

The name is right

I dont know what that ; is doing there, and you should check the changes since setColor doesnt accept a string

hardy bone

yea

hardy bone
fluid bronze

Showing the code might be useful

hardy bone
//index.ts
import { Client, GatewayIntentBits } from "discord.js";

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds
    ]
});

client.on("ready", () => {
    console.log("WORRRRRRRRRRRKS!");
});

client.login("TOKEN")
fluid bronze

Oh wait, the error comes from the typings

No clue then

hardy bone

hmm

civic topaz
fluid bronze

Pinned

hardy bone
fluid bronze

and the setColor

frank atlas
civic topaz

idk 😅

hardy bone
frank atlas
hardy bone

ig it didnt get fixed?

frank atlas

yea

scarlet tangle
fluid bronze

Yeah ik, realised after they said

scarlet tangle
slate kelp

if we send a modal we can't reply to the interaction on which we sent the modal?

fluid bronze

That doesnt mean that you cant open a thread there

slow storm
urban belfry
knotty plover

The modal is the reply

slate kelp

To send a modal on message the best way is to send a button and then reply the ButtonInteraction with the modal?

knotty plover

Sure I guess

burnt brook
SCRIPT ERROR in promise (unhandled): TypeError: Cannot read properties of undefined (reading 'resolveColor')
> Embed.setColor (C:\Users\ericm\Desktop\fxserver\server-data\resources\EasyAdmin\node_modules\discord.js\src\structures\Embed.js:207)
> getServerStatus (@EasyAdmin/server/bot/server_status.js:10)
> updateServerStatus (@EasyAdmin/server/bot/server_status.js:114)
> processTicksAndRejections (node:internal/process/task_queues:96)

in dev, looks like PR #7615 was reverted?

scarlet tangle

Util.resolveColor('BLUE') -> 'Blue' (notice the caps)

burnt brook

but i want to use hex 😆

actually this might be my fault

ah no, still happens, im just using setColor(colour || 65280) (colour would be a different hex value)

burnt brook
knotty plover

Known bug iirc on that one

burnt brook

gotcha

dawn phoenix

what are you even doing to reproduce that?

burnt brook

(colour in this case can just be any hex)

urban belfry

wait what? why does Embed still include setColor?

knotty plover

Is it undefined though?

urban belfry

Util is wrongly exported on the file, just checked

you want to use EmbedBuilder instead of Embed

but EmbedBuilder should have methods like these
setColor should not exist on Embed

burnt brook

that'll do it, guess i missed that 😆

scarlet tangle

Is the guide updated?

urban belfry

for what? no it's still a WIP

scarlet tangle

Or where can i find all changes in v14?

copper jetty

You cant

vague coyote

there is only the v13 to v14 upgrade guide, see pins

urban belfry

which isn't complete

vague coyote

well thats the point of an in dev version reallyFckingCuteCatDudu

knotty plover

v14 isn't finished so there can always be more changes

scarlet tangle

Fine but where can I find the changes done in v14 till now?

gloomy kayak

If you want a guide you can check the one pinned in this channel (may not be updated)

scarlet tangle
copper jetty
tame gazelle

you can check the commit history ig

tall verge

Is it possible to put back the EmbedBuilder#setColor method that accepts strings?

copper jetty

Use Colors enum

knotty plover
slow storm
scarlet tangle

errorbash C:\Users\oyund\Desktop\projectGeneral\node_modules\discord.js\src\structures\MessageAttachment.js:81 if ('size' in data) { ^ TypeError: Cannot use 'in' operator to search for 'size' in asd
code```js
const attachment = new discord.MessageAttachment(data, "RankCard.png", "asd");

    message.reply({ content: "here ya go", attachments: [attachment] });

help please

fluid bronze

Remove the asd

scarlet tangle

thanks, it works

scarlet tangle

error:DiscordAPIError[40060]: Interaction has already been acknowledged.
code: ```js
interaction.update({embeds: [omgemb], components: []})
let randomNum = Math.round(Math.floor(Math.random() * 100) + 30)

        interaction.reply({ content: `${interaction.user} collected a price of ${randomNum}` })
tame gazelle

update is a reply
you're replying twice

icy dew

error says it all, you can't update then reply, use followUp after updating if you wanna send a new reply

scarlet tangle

thanks, didnt know followup was a reply - just used it to edit the message.

tame gazelle

it doesn't edit ._.

scarlet tangle

does kinda

icy dew
tame gazelle

ah yeah you're right

proven forge

how fix this

urban belfry
shadow nacelle

There is any color resolver that supports
BURPLE
#00c8ff
I mean to set the embed color, idk if with a resolve could set it with the color name and with the hexColor too

Oh, thanks i got it

tame gazelle
shadow nacelle
narrow badge

when will modals be available in v13.7?

tame gazelle

"when it's ready"

narrow badge

i hope not longer than v14

tame gazelle

logically no but who knows

indigo rampart

discord.js@14.0.0-dev.1647259751.2297c2b I tried to import Modal builder from the package like the pinned message say, but it says that Modal does not exist

split fulcrum

try to do npm remove discord.js

then npm install discord.js@dev

indigo rampart

k

oook, it worked thx

split fulcrum

Np

indigo rampart
copper jetty
indigo rampart

didnt work too

wait

kindred island

can we not access embed.footer in discord.js@dev? i don't see anything about it in the guide pinned here

copper jetty

We can

kindred island

this is in a function with the args being embed: Embed

so i'm not too sure what's going on

rain bramble
kindred island

hm ok

oh, thank you

rain bramble

But embed.footer should work too

rain bramble
indigo rampart

I created an ActionRow using ActionRowBuilder, i tried to reply a message with it but its saying that the type cant be attributed (14.0.0-dev.1647259751.2297c2b)

tame gazelle

is it possible to put a video in an embed?

copper jetty

no

tame gazelle

also there is a video option on the EmbedBuilder constructor

urban belfry
tame gazelle

yes

urban belfry

Well there you go
APIEmbed is a raw received embed from discord

Everything you're looking at is probably the received data

tame gazelle

received data from the embed right?

urban belfry

Ya

tame gazelle

so
why is there a way to receive an embed's video if we cannot put a video? (I'm probably annoying but I'm trying to get ._.)

urban belfry

Okay I don't know a link by memory but that's an example, YouTube links generate a video embed

tame gazelle

oh I get it

thanks

lament wave
TypeError: Class extends value undefined is not a constructor or null
24|snakebe |     at Object.<anonymous> (/home/clauz/snake/beta/node_modules/discord.js/src/structures/ActionRowBuilder.js:6:32)
24|snakebe |     at Module._compile (node:internal/modules/cjs/loader:1097:14)
24|snakebe |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
24|snakebe |     at Module.load (node:internal/modules/cjs/loader:975:32)
24|snakebe |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
24|snakebe |     at Module.require (node:internal/modules/cjs/loader:999:19)
24|snakebe |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
24|snakebe |     at require (node:internal/modules/cjs/helpers:102:18)
24|snakebe |     at Object.<anonymous> (/home/clauz/snake/beta/node_modules/discord.js/src/index.js:74:28)
24|snakebe |     at Module._compile (node:internal/modules/cjs/loader:1097:14)

what is this? i get this at bot startup

tame gazelle

install builders dev version

lament wave

uhm how?

uncut kelp

It's an error, I think you mean how you mitigate it

Gotta learn to ask the question you actually want to ask

tame gazelle
lament wave

ok thank you

tame gazelle
H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43
    this.components = data.data.components?.map(c => createComponent(c)) ?? [];
                                                     ^

TypeError: createComponent is not a function
    at H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43:54
    at Array.map (<anonymous>)
    at new ModalSubmitInteraction (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43:45)
    at InteractionCreateAction.handle (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\actions\InteractionCreate.js:69:25)
    at Object.module.exports [as INTERACTION_CREATE] (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:520:28)
outer bane

known oversight, there's already a pr for it

wicked nebula

Could have been worse 😂

wicked nebula

So if you want to build an embed from another embed, you have to use const replyEmbed = EmbedBuilder.from(<APIEmbed>).<AnyChanges>.data?

outer bane

you don't have to access .data from the builder

velvet jasper

Yeah ^

wicked nebula

If I don't, .edit({ embeds: [replyEmbed] }) won't take it.

copper jetty
velvet jasper

Also .from accepts a component or api data

outer bane
copper jetty

theres data property in documentetion

velvet jasper

Wdym

It exists but in this case there’s no point in using it

outer bane

edit not accepting it is a typings issue

copper jetty

ok

wicked nebula

If I don't include .data:

Type 'EmbedBuilder' is not assignable to type 'APIEmbed | Embed'.
  Type 'EmbedBuilder' is missing the following properties from type 'Embed': fields, title, description, url, and 5 more.
velvet jasper

Yeah you can ts-ignore it for now

wicked nebula

(When using <Message>.edit({ embeds: [myEmbed] }))

velvet jasper

It’s a typings bug

wicked nebula

Ahh

I was wondering because I looked at MessageEditOptions and it matched the types.

I just ts-expect-error'ed it.

velvet jasper

yeah thats better than ts-ignore

wicked nebula

In this case, yea 😄

hardy bone
urban belfry
urban belfry

idk, check djs' package.json perhaps?

hardy bone

this?

urban belfry

i think so yes

civic topaz

How to send message attachment and make attachments? (use for canvacord)

civic topaz

anyone here?

latent lion

<Message>.channel.send({ files: [<Attachment>] })

worthy fog

<TextChannel>.send({ files: [<attachment>] })

civic topaz

but it says invalid image type

(canvacord rank card)

rain bramble
manic cloak

Hi, addOptions doesn't seem to take an array anymore. How can I solve this part?

willow garnet

don't pass an array

plain roverBOT

_ Spread syntax (...)
Spread syntax (...) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.

manic cloak

it worked thanks

stuck solstice

Anyone have the version of dev that has modals merged? For some reason they won't work on my end.
Using: discord.js@14.0.0-dev.1647259751.2297c2b
Error: TypeError: Modal is not a constructor
Relevant code:

const {Modal} = require("discord.js");
function showTagModal(interaction){
    const modal = new Modal().setTitle("Tag creation").setCustomId("tag-create");
    const tagName = new TextInputComponent().setCustomId("tag-name").setLabel("Tag name").setStyle(TextInputStyle.Short);
    const tagText = new TextInputComponent().setCustomId("tag-text").setLabel("Tag text").setStyle(TextInputStyle.Paragraph);
    const tagRow = new ActionRow().addComponents(tagName);
    const textRow = new ActionRow().addComponents(tagText);
    modal.addComponents(tagRow, textRow);
    interaction.showModal(modal);
}

Also is dev alr a monorepo, or do I need builders or smth

urban belfry

it's now ModalBuilder, no?

stuck solstice

ah, explains

urban belfry

in the guide i did suggest the modification of the example

stuck solstice

yee I tried the guide way before going to the source x)
thx ben Neps_Hugs

urban belfry
stuck solstice

Ran into
this.components = data.data.components?.map(c => createComponent(c)) ?? [];
Read up and saw there's a PR for this, gonna go look

urban belfry

yeah that's going to be fixed, already a pr,
i don't recommend modifying the source code but this bit should be okay
but yeah perils of using an wip version

stuck solstice

yee you can expect this when using dev, fix'd it stickDance

urban belfry

if you say this is exactly the example, it's not and it can't be since you're using the Dev version

civic topaz

then how can I make the code for dev version?

urban belfry

do you not have a code that you already claimed doesn't work?

civic topaz

I ask my friend and he says MessageAttachment only accepts .webp. Idk this whether true because I never use MessageAttachment

urban belfry

your friend is wrong, and from what it seems, i've searched that error, it doesn't seem like it's a djs error, ask canvacord support

scarlet tangle

How to see what’s new in 14

ty

scarlet tangle

what is the max TextInputs in one Modal?

copper jetty

5

scarlet tangle
copper jetty

no

scarlet tangle

Thank you

wicked nebula

You can find all this at the Discord API documentation.

How do you pass a unicode emoji into SelectMenuComponentOptionData.emoji?: APIMessageComponentEmoji

tame gazelle

.setEmoji({ name: '🍎' })

wicked nebula

Ah ok

scarlet tangle

do modals allow being sent on the messageCreate event?

tame gazelle

don't think so

only with interactions

scarlet tangle

he said he just used the plain api so idk really

tame gazelle

he's making API request himself
but I think you need to have an Interaction object (interaction id and token iirc)

scarlet tangle

any way you can think of to bypass it?

tame gazelle

dunno

scarlet tangle

how do we make modals again, lemme try a simple one to see if it works

tame gazelle

there's actually a bug when you're trying to receive them

scarlet tangle

I think ill just use the discord modals package and just add a confirmation button in that case lol - should do the job for now.

copper jetty
wicked nebula

Hmm, how do I make an action row with a select menu? It's not letting me add them to components.

Current:

const selectMenu = new ActionRowBuilder().addComponents(
            new SelectMenuBuilder()
                .setCustomId(`roles:main:${user.id}`)
                .setMinValues(1)
                .setMaxValues(1)
                .setPlaceholder('Select the category you would like to view')
                .setOptions(...await constructMain()))
tame gazelle

and it doesn't work?

wicked nebula

at:
await interaction.editReply({ embeds: [mainEmbed], components: [selectMenu, button], content: null })

(Errors on selectMenu & button)

copper jetty

you need to cast action row

scarlet tangle

why do the content: null - just dont have it. Altho thats as much as I can help and its probably wrong lmfao

wicked nebula

Because I'm editing the reply, which originally had content in it.

scarlet tangle
wicked nebula
copper jetty

MessageActionRowComponentBuilder

wicked nebula
copper jetty

ActionRowBuilder<MessageActionRowComponentBuilder>()

tame gazelle

I've never used TS but isn't .setOptions((...await constructMain()) as MessageActionRowComponentBuilder)) ?

wicked nebula

constructMain is my own function, which returns an array of APISelectMenuOption

The casting is a bit annoying imo, is that just in the @dev or will that be brought into stable once it releases?

wicked nebula
gloomy kayak

Can we reply to a button/menu interaction with a modal or we can do it only with chat input commands?

tame gazelle
gloomy kayak

👍

scarlet tangle

how can I install latest discord.js beta from github

tame gazelle

npm i discord.js@dev

ah from GitHub ._.

urban belfry

i'd rather wait for it myself but what you have to do is clone it, build it then link it to your project to use it

scarlet tangle

#4466aa

yeah, I asked because I need a pull request

scarlet tangle
urban belfry

@scarlet tangle use EmbedBuilder not Embed

scarlet tangle

Ok

urban belfry

and just pass the hex setColor(0x4466aa)

scarlet tangle
                                                     ^

TypeError: createComponent is not a function``` was this fixed btw?
tame gazelle

check if the PR get merged ig

urban belfry

the pr still isn't merged

dull mulchBOT
scarlet tangle

yeah no

scarlet tangle
urban belfry

al mentioned what needed to be changed for your issue

that won't work now that it's a monorepo, i think

scarlet tangle

yeah it didnt

urban belfry

you can follow al's instructions and modify the code yourself
or you can just wait

scarlet tangle

thanks

imma just edit it myself fornow -better to have something that works then waiting

scarlet tangle
urban belfry

because it's not? read what i sent and what you used

scarlet tangle

Ohhh

urban belfry

Builder, spelling matters

scarlet tangle

reminds me of when I used to try pasting code into translate

scarlet tangle
urban belfry

how'd you define it and what version is it?

scarlet tangle

V14

tame gazelle

the exact one

scarlet tangle

const {EmbedBuilder} require.....

urban belfry

no the specific
show me the output of running npm ls discord.js

scarlet tangle

Wait a minute

scarlet tangle

replit doesnt support it out of the box so you need to get nvm

@urban belfry I wasnt able to do the changes my self lol

urban belfry

what does this have to do with the node version

scarlet tangle
urban belfry
scarlet tangle

yeah lol

scarlet tangle

imagine you jus chat and a modal pops up

novel notch

Did they change the partials?

scarlet tangle

Discord modal was add on v14 ?

tame gazelle
novel notch
tame gazelle

it returns a number now

novel notch

Ok

novel notch
novel notch

Thxs

scarlet tangle

How do I create a ModalSubmitInteraction collector

copper jetty
copper jetty
plain roverBOT

_ InteractionCollector (extends Collector)
Collects interactions. Will automatically stop if the message (Client#event:messageDelete messageDelete or Client#event:messageDeleteBulk messageDeleteBulk), channel (Client#event:channelDelete channelDelete), or guild (Client#event:guildDelete guildDelete) is deleted. (more...)

dusty turret

for to create a modal, in the docs (beta) show:

const { Modal } = require('discord.js')

but when i try, show

TypeError: Modal is not a constructor

Ps: I have discord.js@ dev (v14)
how to fix this? 🥺

scarlet tangle
copper jetty

it's ModalBuilder

dusty turret

oh, tyy

tame gazelle

why IntelliSence tells me that <EmbedBuilder>#setColor takes a ColorResolvable but when pass a ColorResolvable I got an error that is saying that .setColor takes a number? (I know I have to use resolveColor or Colors enum but just for knowing)

outer bane

it should take one, that's another oversight from the *builder pr that already has a pr to fix it

tame gazelle

I see thanks

dusty turret

is there another change in modal creation that hasn't been documented?

const text1 = new TextInputComponent()
    .setCustomId('first')
    .setLabel('anything!')
    .setStyle(TextInputStyle.Short);

exit with error:

TypeError: (intermediate value).setCustomId is not a function

uenditisti

dusty turret

thx again, i has view just in discordjs.guide

steep elk
// interaction is a ContextMenuCommandInteraction

const reply = (
    baseOptions: string | BaseMessageOptions,
    interactionOptions?: InteractionReplySpecificMessageOptions,
) => {
    if (interaction) {
        interaction.reply(Object.assign(baseOptions, interactionOptions || {}))
    }
}

const row =
    new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
        new ButtonBuilder()
            .setLabel("Original message")
            .setStyle(ButtonStyle.Link)
            .setURL(message.url),
    )

reply(
    {
        files: [
            {
                attachment: scaledBuffer,
                name: `${message.id}-${attachment.id}-scaled.png`,
            },
        ],
        components: [row],
    },
    { ephemeral: false },
)

is throwing this error:

Argument of type '{ files: { attachment: Buffer; name: string; }[]; components: ActionRowBuilder<MessageActionRowComponentBuilder>[]; }' is not assignable to parameter of type 'string | BaseMessageOptions'.
  Object literal may only specify known properties, and 'components' does not exist in type 'BaseMessageOptions'.ts(2345)

I'm guessing this is some update in v14 that I'm not aware of it. why does "components" no longer exist in "BaseMessageOptions"? How can I make this work again?

wicked nebula

Why is <CommandInteraction>.options.getSubcommand() (along with some other methods) omitted from <CommandInteraction>.options?

copper jetty

its bugged

wicked nebula

What's wrong with it?

copper jetty

nvm it should be ChatInputCommandInteraction i think

scarlet tangle

Error

const exampleEmbed = new MessageEmbed()
                           ^

TypeError: MessageEmbed is not a constructor
    at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:8:28)
    at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)   
    at Client.emit (node:events:520:28)
    at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:520:28)
velvet jasper
wicked nebula
initiate: async (interaction: NeutronCommandInteraction) => {
        if (interaction.options.getSubcommand() === 'create') {

NeutronCommandInteraction:

export interface NeutronCommandInteraction extends CommandInteraction {
    client: Neutron
}
copper jetty
scarlet tangle

code

const { MessageEmbed } = require('discord.js');
module.exports = {
  data: {
    name: 'help',
     description: "help how to use this bot",
    },
    execute(message, args, Discord, client){
      const exampleEmbed = new MessageEmbed()
        .setColor('#0099ff')
        .setTitle('Some title')
        .setURL('https://discord.js.org/')
        .setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
        .setDescription('Some description here')
    .setThumbnail('https://i.imgur.com/AfFp7pu.png')
    .addFields(
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )
    .addField('Inline field title', 'Some value here', true)
    .setImage('https://i.imgur.com/AfFp7pu.png')
    .setTimestamp()
    .setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });

channel.send({ embeds: [exampleEmbed] });
  }   
}
wicked nebula
scarlet tangle
velvet jasper
wicked nebula

Ahh I see

copper jetty
scarlet tangle

May i ask where is it PascalCased EmbedBuilder

copper jetty

Import it from discord.js library

scarlet tangle

How?

copper jetty

The same way you imported MessageEmbed

scarlet tangle
const { PascalCased EmbedBuilder } = require('discord.js');
scarlet tangle
wicked nebula
velvet jasper `isChatInputCommandInteraction()`

I added a condition with this method, it still doesn't take it:

if (interaction.isCommand()) {
            if (interaction.options.getSubcommand() === 'create') {

Exact error: Property 'getSubcommand' does not exist on type 'Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused" | "getMentionable" | "getRole" | "getAttachment" | ... 6 more ... | "getSubcommand">'.

copper jetty

It's just EmbedBuilder, PascalCase is a naming convention

scarlet tangle
velvet jasper
wicked nebula

Also if it's a normal slashcommand??

scarlet tangle
copper jetty It's just EmbedBuilder, PascalCase is a naming convention

Still error

const exampleEmbed = new MessageEmbed()
                           ^

TypeError: MessageEmbed is not a constructor
    at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:10:28)    at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)    
    at Client.emit (node:events:520:28)
    at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:520:28)
copper jetty
velvet jasper

a slash command is a chatinput command

scarlet tangle
const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
  data: {
    name: 'help',
     description: "help how to use this bot",
    },
    execute(message, args, Discord, client){
      const exampleEmbed = new MessageEmbed()
        .setColor('#0099ff')
        .setTitle('Some title')
        .setURL('https://discord.js.org/')
        .setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
        .setDescription('Some description here')
    .setThumbnail('https://i.imgur.com/AfFp7pu.png')
    .addFields(
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )
    .addField('Inline field title', 'Some value here', true)
    .setImage('https://i.imgur.com/AfFp7pu.png')
    .setTimestamp()
    .setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });

channel.send({ embeds: [exampleEmbed] });
  }   
}

Code

copper jetty
wicked nebula

Ah I thought it was something else considering isCommand was the more obvious one 😄

scarlet tangle
const exampleEmbed = new EmbedBuilder()
                           ^

TypeError: EmbedBuilder is not a constructor
    at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:10:28)    at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)    
    at Client.emit (node:events:520:28)
    at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:520:28)
const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
  data: {
    name: 'help',
     description: "help how to use this bot",
    },
    execute(message, args, Discord, client){
      const exampleEmbed = new EmbedBuilder()
        .setColor('#0099ff')
        .setTitle('Some title')
        .setURL('https://discord.js.org/')
        .setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
        .setDescription('Some description here')
    .setThumbnail('https://i.imgur.com/AfFp7pu.png')
    .addFields(
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )
    .addField('Inline field title', 'Some value here', true)
    .setImage('https://i.imgur.com/AfFp7pu.png')
    .setTimestamp()
    .setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });

channel.send({ embeds: [exampleEmbed] });
  }   
}

Code

copper jetty

What's your discord.js version

scarlet tangle

v14 dev

copper jetty

there's many v14 dev versions

scarlet tangle

how do i see the version i use

copper jetty

npm ls discord.js in your terminal

scarlet tangle

ok

shadow nacelle

why im getting this error, while building an embed?

scarlet tangle
copper jetty
scarlet tangle

my brain no work so good rn

copper jetty

npm install discord.js@dev

wicked nebula

(Karma for calling yourself @dev)

woeful pollen
scarlet tangle
shadow nacelle
copper jetty
scarlet tangle

ERROROROOROROOR

copper jetty
woeful pollen

the errors are self explanatory 🤨

scarlet tangle
 .setColor('#0099ff')
woeful pollen

.setColor expects a number, so .setColor(0x0099ff)

scarlet tangle

ERrrrrrrreeoeoeoeeoeoeeoeoeoorrororroor

        .addField('Inline field title', 'Some value here', true)
         ^

TypeError: (intermediate value).setColor(...).setTitle(...).setURL(...).setAuthor(...).setDescription(...).setThumbnail(...).addFields(...).addField is not a function    at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:23:3)
    at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)
    at Client.emit (node:events:520:28)
    at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)   
    at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:520:28)
woeful pollen

afaik .addField() was removed in favor of .addFields()

wicked nebula
woeful pollen

nothing wrong with my sentence, use .addFields()

scarlet tangle

How do i design a embed in discord.js@14.0.0-dev.1647259751.2297c2b

like any website to make it on?

woeful pollen

use the builder

and read the docs

tame gazelle
scarlet tangle

error

const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
  data: {
    name: 'help',
     description: "help how to use this bot",
    },
    execute(message, args, Discord, client){
      const exampleEmbed = new EmbedBuilder()
        .setColor(0x0099ff)
        .setTitle('Some title')
        .setURL('https://discord.js.org/')
        .setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
        .setDescription('Some description here')
    .setThumbnail('https://i.imgur.com/AfFp7pu.png')
    .addFields(
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )
    .addFields('Inline field title', 'Some value here', true)
    .setImages('https://i.imgur.com/AfFp7pu.png')
    .setTimestamp()
    .setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });

channel.send({ embeds: [exampleEmbed] });
  }   
}

code

silk topaz

remove the second addFields call

tame gazelle

also channel isn't defined

copper jetty

addFields takes objects

scarlet tangle
woeful pollen

message.channel

scarlet tangle
woeful pollen
plain roverBOT

Documentation suggestion for @scarlet tangle:
_ Object
The Object class represents one of JavaScript's data types. It is used to store various keyed collections and more complex entities. Objects can be created using the Object() constructor or the object initializer / literal syntax.

_ Object
The Object class represents one of JavaScript's data types. It is used to store various keyed collections and more complex entities. Objects can be created using the Object() constructor or the object initializer / literal syntax.

tame gazelle

too fast

scarlet tangle

this .js is like learning a launges that is super hard

gritty citrus

it isnt hard its the simplest language actually below python ofc

copper jetty

and scratch

gritty citrus

wot

wicked nebula

You seriously try to use an unstable version of a package while not knowing JavaScript waitWhat

scarlet tangle

YEssssss IT WORKS

copper jetty
scarlet tangle
gritty citrus
wicked nebula

Well you added @dev and next time I suggest not doing that if you don't know what you're doing.

scarlet tangle

SORRY FOR PING TO THE PERSON I PINGED

wicked nebula

Is there a PR for the bug where EmbedBuilder.from() can be sent in channels without @ts-expect-error

copper jetty
scarlet tangle

but my embed works it just sends to discord test embed and my help embed it sends 2 different embeds

const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
  data: {
    name: 'help',
     description: "help how to use this bot",
    },
    execute(message, args, Discord, client){
      const helpEmbed = new EmbedBuilder()
        .setColor(0x0099ff)
        .setTitle('Help')
        .setDescription('This command is help about this discord')
    .addFields(
        { name: 'Commands', value: '-help\n-about\n-roles' },
        { name: 'Admin Commands', value: '-kick\n-ban\n-purges' },
        { name: 'Owner Commands', value: '-nuke\n-killserver' },
    )
    .setTimestamp()

    message.channel.send({ embeds: [helpEmbed] });
  }   
}

Code ^^^^

oak raft
copper jetty
oak raft

it aint a language

wicked nebula

How to use the type ApplicationCommandOptionData? I used to have an array of it as options:

{ 
options: [{
        type: "SUB_COMMAND",
        name: "create",
        description: "Create sticky message in a channel",
        options: [{
            type: "CHANNEL",
            name: "channel",
            description: "Channel to create the sticky message in",
            required: true,
            channelTypes: ['GUILD_TEXT']
        }, {
            type: "STRING",
            name: "message",
            description: "What the sticky message will say",
            required: true
        }]
    },
    {
        type: "SUB_COMMAND",
        name: "remove",
        description: "Remove sticky message from discord",
        options: [{
            type: "STRING",
            name: "id",
            description: "ID of sticky message to remove",
            required: true
        }]
    }]
}

It returns a DiscordAPIError invalid form body now.

Here is the error:

DiscordAPIError[50035]: Invalid Form Body
1.options[0].options[0].type[NUMBER_TYPE_COERCE]: Value "CHANNEL" is not int.
1.options[0].type[NUMBER_TYPE_COERCE]: Value "SUB_COMMAND" is not int.
1.options[1].options[0].type[NUMBER_TYPE_COERCE]: Value "CHANNEL" is not int.
1.options[1].type[NUMBER_TYPE_COERCE]: Value "SUB_COMMAND" is not int.
1.options[2].type[NUMBER_TYPE_COERCE]: Value "SUB_COMMAND" is not int.
4.options[0].options[0].type[NUMBER_TYPE_COERCE]: Value "CHANNEL" is not int.
4.options[0].options[1].type[NUMBER_TYPE_COERCE]: Value "STRING" is not int.
4.options[0].type[NUMBER_TYPE_COERCE]: Value "SUB_COMMAND" is not int.
4.options[1].options[0].type[NUMBER_TYPE_COERCE]: Value "STRING" is not int.
4.options[1].type[NUMBER_TYPE_COERCE]: Value "SUB_COMMAND" is not int.
5.options[0].type[NUMBER_TYPE_COERCE]: Value "STRING" is not int.
5.options[1].type[NUMBER_TYPE_COERCE]: Value "BOOLEAN" is not int.
woeful pollen

replace the type with a number

copper jetty

use enums or numbers

wicked nebula

Ahh

dusty turret

how do i get the event when the submit button is clicked in a modal?
interactionCreate don't works

copper jetty

Listen to interactionCreate event or construct new InteractionCollector

scarlet tangle
woeful pollen
scarlet tangle

It only has to send 1 of the help I only used command 1 time

And yes ik there is a -nuke and -killserver

copper jetty

Check where in your code you send these embeds and remove it

scarlet tangle
woeful pollen

somewhere in your code ur sending the other embeds, or ur handling commands twice

scarlet tangle

No I am not it’s not saying kicked person 3 times

woeful pollen

I'm confused about what ur saying

copper jetty
copper jetty
scarlet tangle
woeful pollen

you regenerated the token, use the new token 🤨

lament wave

is v14 using api v10 now?

dull mulchBOT
wicked nebula

So does <Interaction>.showModal() not work with <Interaction>.deferReply()?

lament wave
woeful pollen
wicked nebula

Yikes, that sucks if you have a handler which defers every command.

fierce lantern
wicked nebula
copper jetty
wicked nebula

Which is what I'm doing now.

in my command handler, I slashed out my deferReply.

//interaction.deferReply({ ephemeral: (command.ephemeral ?? false) }).catch(console.error);

Oh I see

TypeScript compiler task crashed because WSL2 sucks.

woeful pollen
knotty plover

When you regen it, copy it

That's the only time you see it

dusty turret
woeful pollen

its known

wicked nebula

What version of @discordjs/builders do I install?

I believe I'm on an old version which does not support modals yet.

My version: @discordjs/builders@0.12.0

copper jetty

@discordjs/builders@dev

scarlet tangle
knotty plover

Yeah basically

Or a config file or whatever you use

wicked nebula

createComponent is supposed to be in discordjs/builders

(Doing some more tests)

Nope, it won't work confusedBecel

stoic hedge

Is this error TypeError: Cannot read properties of undefined (reading 'resolveColor') a bug in the latest @dev release?

outer bane

yes

dull mulchBOT
woeful pollen

@wicked nebula

wicked nebula

ahh

wicked nebula
outer bane

because it's a monorepo

wicked nebula

How do I add it then?

knotty plover

Don't, wait for it to merge

If the stuff we do merge has bugs you're at even more risk installing PRs

wicked nebula

That is true

scarlet tangle

V14 have a release date ?

cinder wraith

no

scarlet tangle

Estimated ?

cinder wraith

neither

scarlet tangle

Okip

scarlet tangle

Was the pull request for the modal fix merged

jaunty vault
scarlet tangle

Alright, good to hear.

scarlet tangle
brisk glen

how long do dev package update after the last commits?

knotty plover

It updates every 12 hours regardless

fiery junco
knotty plover

I'm on holiday

fiery junco

oh ok

willow garnet

refer to rule 6 also

we don't cater to demands

velvet tendon

Hey guys, can someone tell me how to get the number of servers from the Discord API v9?

split fulcrum

client.guilds.cache.size???

velvet tendon

I need to display in the React project -__-

split fulcrum

How do you mean

velvet tendon

You need to display the number of bot servers on the site. The site is written in ReactJS.

split fulcrum

Well

It's js

So just get client

velvet tendon

Something tells me that the request is invalid :D
https://discord.com/api/v9/guilds/577193003630854156/users/577152902280249346/guilds

split fulcrum

Hmmm

velvet tendon

idk :D

willow garnet

the support channels are specifically for djs

please keep them on topic

split fulcrum

look at discord api docs

If you want to know

velvet tendon

this?

split fulcrum

Yes

velvet tendon

oh, ok, i'm try

split fulcrum

Let me give you the url wait

velvet tendon

but there is no given information here or I'm blind

velvet tendon
split fulcrum

This is what you are looking for

scarlet tangle

what's the difference between the types CommandInteraction and ChatInputCommandInteraction now? is it only the options not being present?

scarlet tangle

but the CommandInteraction type still does exists and it works for checking basic properties such as commandName

copper jetty

CommandInteraction can be context menus or slash command

scarlet tangle

oh i get it now thanks

civic topaz

can anyone help me

Only dictionaries may be used in a ModelType (Emoji)

I used:

//xxx
 { 
type: 2,
label: "Xxx",
custom_id: "sss",
style: ButtonStyle.Primary,
emoji: "<emoji_id>"
}
dark light

emoji needs to be an object

so emoji: { id: ... }

civic topaz

this is so annoying

fiery anvil

i'm trying to deploy my bot on linux and this happens

Never happened on windows

knotty plover

Different lib version probably, known issue on latest dev

round bear

Please don't tell me we're gonna get forced to switch to v14 like we were for v13?

fiery anvil
knotty plover

Not currently

Unless you go back and pin an old commit

Latest dev has this issue though

fiery anvil

got it thank u

knotty plover

And you were never forced from v12, you still won't be forced for another month and that's Discords doing, not ours

round bear

I had to rewrite my bot with over 100 commands into v13. Pain in the butt