#djs-in-dev-version

35223 messages · Page 4 of 36

zenith vault

Nice

velvet jasper

Feel free to create an issue ticket for any bugs 🤗

urban belfry

okay @tame gazelle try installing builders and requiring SelectMenuComponent from that

urban belfry

i'll see how i can fix this on djs

@velvet jasper sorry to bother but do you have any idea what this is doing?

class SelectMenuComponent extends BuildersSelectMenuComponent {
  constructor(data) {
    super(Components.transformJSON(data));
  }
}
```?
velvet jasper

It’s transforming any camel case json to snake case

urban belfry

well it's causing the error we're talking about

TypeError: Cannot read properties of undefined (reading 'map')
    at null.UnsafeSelectMenuComponent (G:\Test\MasterBranch\node_modules\@discordjs\builders\src\components\selectMenu\UnsafeSelectMenu.ts:18:24)
    at null.SelectMenuComponent (G:\Test\MasterBranch\node_modules\@discordjs\builders\src\components\selectMenu\SelectMenu.ts:14:8)
    at new SelectMenuComponent (G:\Test\MasterBranch\node_modules\discord.js\src\structures\SelectMenuComponent.js:8:5)
    at Object.<anonymous> (G:\Test\MasterBranch\src\teest.js:26:9)
    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 Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47
forest elm

looks like they're using an outdated version of /builders
UnsafeSelectMenu.ts:18:24 is whitespace
SelectMenu.ts:14:8 is a method definition

urban belfry

no it's not, i did it myself
if i remove super(Components.transformJSON(data)); and just call super, it works

using djs, latest version

const {SelectMenuComponent} = require("discord.js")

console.log(new SelectMenuComponent())
```just this causes the error
forest elm

that method doesn't even exist anymore

urban belfry

what method?

forest elm

transformJSON

oh wait, that's on discord.js, i was looking at /builders

urban belfry

yes exactly

builders isn't the issue, if i import from builders, it doesn't error

urban belfry
forest elm

cannot replicate on the main branch

urban belfry

show your code and version

forest elm

replaced require('discord.js') with require('./packages/discord.js')

scratch that, can replicate now, but the error is slightly different

urban belfry

what is it?

forest elm

everything is minified

this and it had a big chunk of code above

urban belfry

fresh install
just that and error

forest elm
urban belfry
velvet jasper

It doesn’t accept camelcase

urban belfry

oh and djs does

velvet jasper

Yeah

urban belfry

well i'll look into it when i get back home in that case

forest elm

ok, after properly setting up the repo (yarn, yarn build, then run the demo.js file) it works

urban belfry

so what, it's fixed on main just not pushed yet?

forest elm

the error doesn't exactly make sense in the main branch as everything is using optional chaining, probably just a version mismatch on the dev release?

i guess so

urban belfry

exactly
i've read the compiled code, it's exactly the source just not using optional chaining

ah yes i see

it is using outdated code

forest elm

try installing @discordjs/builders@dev

limpid stratus

Why can you pass strings to allowedMentions.parse, but in all other places you need to pass a enum member?

knotty plover

Because the API expects strings there

It is not a numeric value and so an enum wouldnt make any sense

limpid stratus

A

Makes sense

cerulean bay

Any clue on this? New in v14

forest elm

something that is an array of objects, the first items value property should have been a string and you passed a number to it

cerulean bay

Which is weird because i haven't changed anything except updating the the version

forest elm

actually looks like its coming from <Embed>.addFields

knotty plover

Embed fields must be strings

lusty remnant

when this version release

velvet jasper
lusty remnant
velvet jasper
knotty plover

When its ready

lusty remnant
west fjord

how do you provide a hex code to setColor for embeds now?

velvet jasper
tame gazelle

0xFFF

west fjord

ohhh, im dumb. thanks!

wanton blade

can i ask a question here

velvet jasper
wanton blade

ive got no idea what that is

but basically i tinkered around with discord js when i was much younger

velvet jasper

Ok then probably the wrong place to ask

wanton blade

ok where can i ask

velvet jasper
wanton blade

thanks

placid stone

whats new in v14?

brisk path

check pins

what are modals?

knotty plover

popup forms

placid stone

are they pushed to v14 yet?

knotty plover

no

brisk path

anything else expected?

warm veldt

is it possible to get who created a channel in channelCreate event because I am having a hard time and there is no properties or method for that

knotty plover

No, fetch the audit logs

warm veldt
radiant lintel

yes the modals PR is open. praisethesun

shadow plume

it is since 4 months

loud bobcat

what is the best way to handle multi player responses?

radiant lintel
worn haven

Guys, can i somehow dont reply to select menu but also dont give interaction failed?

Or i should just make this like /config chatguard ignoredchannels: channel1ID, channel2ID.... (typing all channels ids you want to be ignored in string)

clear isle

Question: how build source to discordj.js dist ?

knotty plover

You don't?

thin folio

was this changed in latest version,

await interaction.editReply({
        embeds: [
            {
                title: "Help",
                color: 0x5865f2,
                description: "This is a sample description about help",
                image: {
                    url: "https://i.imgur.com/AfFp7pu.png",
                },
            },
        ],
        components: [
            new ActionRow().addComponents([
                new ButtonComponent()
                    .setStyle(ButtonStyle.Primary)
                    .setCustomId("fsdfds")
                    .setLabel("aa"),
            ]),
        ],
    });

This results in TypeError: t.toJSON is not a function

oh it's not an array anymore. thanks

do I have to specify the component type?

dire rover
grave helm

May I know why GuildChannelManager#create marked as deprecated?

jaunty vault
outer bane
grave helm
outer bane

you can safely ignore it for now, unless you were to create store channels

ebon warren

(node:5840) DeprecationWarning: Passing strings for MessageEmbed#setAuthor is deprecated. Pass a sole object instead.

plain roverBOT

<MessageEmbed>.setFooter() and <MessageEmbed>.setAuthor() now each take an object:

- embed.setAuthor('This is an example text', 'https://exampleicon.com', 'https://websiteofauthor.com')
+ embed.setAuthor({ name: 'This is an example text', url: 'https://websiteofauthor.com', iconURL: 'https://exampleicon.com' })

- embed.setFooter('This is an example text', 'https://exampleicon.com')
+ embed.setFooter({ text: 'This is an example text', iconURL: 'https://exampleicon.com' })
ebon warren

tysm

loud bobcat

am running a peace of code when the embed is done updating
this peace of code running successfuly , which mean the update process is also successed, but the image inside the embed is not changing ??? no errors have occured !!!!!!!!

slim wharf
loud bobcat

i attache a new image through the updating , so it'll overwrite the old one

grave helm
uncut kelp

Kindly keep your comments to yourself

thin folio

Are there any plans on only supporting ESM in the future?

uncut kelp

And alienating a large portion of our users? No

thin folio

Ah awesome. Got alienated by bunch of libs that's why I asked

velvet jasper
thin folio
velvet jasper

this is a bug, I'll submit a fix today

are you using exclusively builders?

what does your code look like?

the workaround for now is to not use json and use only builders

components: [new ActionRow().addComponents(button)]

hmm that should work

uncut kelp

What is your dev version

gloomy kayak

what

is that even a correct version

tame gazelle

how did you define Embed?

gloomy kayak

I mean, usually in the package.json is listed the specific version, not the tag so that you know what specific version are running

tall verge

hello and normal that the latest version of v14 comes out the error:
components[1].components[0].type[BASE_TYPE_REQUIRED]: This field is required.
discovering that this error gave with the buttons if they are used so:

new ButtonComponent({ 
 custom_id: "test",
 style: 2,
 label: "hello"
})
//or 
new SelectMenuComponent()
      .setCustomId("cat")
      .setPlaceholder("Choose a category")
      .addOptions(...options.map((option) => new SelectMenuOption(option));```
uncut kelp

I believe that is pending a fix

tall verge

so it's a momentary error, right?

uncut kelp

Hopefully

tall verge

😅

velvet tendon

hey guys how do i work with SubCommandGroup?

queen mauve

Will djs v14 move to API v10?

There is

velvet tendon

subcommands count as separate commands or not?

thanks

uncut kelp

Why wouldn't we

queen mauve

I mean could be that it will happen with v15 idk

flint bough

yes because discord.js will release v14 and then v15 on april 30th

rigid haven

does djs v14 use api v10

oh wait someone just asked that

lol

uncut kelp

Surprisingly we don't use version 14 yet about 1 second after its announcement

rigid haven

i meant will you lol

queen mauve
lament wave

will api v10 be on djs v14?

rigid haven

lol ok everyone's asking the same question not just me

lament wave

ok the answer is yes ig

rigid haven

yeah

queen mauve

Yep

flint bough

pin this please or pin a diff one idc so not 300 people ask

Discord.js v14 will support/use api v10

dull mulchBOT

pr_open #7464 in discordjs/discord.js by suneettipirneni opened <t:1644852531:R> (review required)
fix: use case converter for json component serialization
📥 npm i suneettipirneni/discord.js#fix/json-component-serialization

lament wave

are PermissionBitField#Flags values PascalCased?

velvet jasper

yes

no, you don't need to change anything, you'll just have to wait for that PR to be merged

yeah every dev release is deprecated when a new one comes

it doesn't really matter

lament wave
        const fetchedLogs = await channel.guild.fetchAuditLogs({
            limit: 1,
            type: 'CHANNEL_CREATE',
        });

has the type been PascalCased? also how to get the bigint of the type?

velvet jasper

why

loud bobcat

am trying to upload my bot files to github repo
when i do so i get alerted from discord and they change my token
even tho i put my token within a .env file and ignore it with .gitignore
??

vague coyote
lament wave
    {
        name: 'Calculate',
        type: 'MESSAGE'
    },

i cant find Message in the ApplicationCommandOptionTypeEnumResolver, so wheres it?

uncut kelp
lament wave

so it just has to be Message?

uncut kelp

Let me rephrase

That type doesn't exist

lament wave

that is a context menu object

uncut kelp

New response: you're looking in the wrong place

It's not a command option type

ApplicationCommandType is what you're after, not ApplicationCommandOptionType

lament wave

ooh ok thx

lament wave
components[0].components[0].emoji[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType

what is this?

uncut kelp

It's an error from Discord

lament wave

...so? i just tried to set an emoji for a button

how to fix that?

loud bobcat

check the component you are trying to send

lament wave

btw fixed that, i had to turn the emoji string into an object, but i have another problem

    const e = {
    description: 'whatever',
    footer: {
     text: `Footer`,
     icon_url: message.author.displayAvatarURL()
  }
}

footer is not showing at all, why?

candid palm

Does anyone know if its possible to create a Modal collector?

like the same as a button/select menu collector

velvet jasper
candid palm

oh so its not added yet

candid palm
lament wave
        const e = {
            author: {
                name: message.author.tag,
                icon_url: message.author.displayAvatarURL()
            },
            title: 'Uptime',
            description: `I've been online, without disconnecting, since <t:${uptime}:R>, <t:${uptime}:F>`,
            footer: {
                text: 'Requested by ' + message.author.tag,
                icon_url: message.author.displayAvatarURL()
            },
            timestamp: new Date(),
            color: client.embColor
        }

everything is showing but footer is not

i also noticed that with embed builder the footer is showing. but copying the embed object produced by the builder and using that to define the object of the embed fails to show the footer, so what?1

radiant lintel
radiant lintel
vague coyote full error?
TypeError: Cannot read properties of undefined (reading 'name')
    at FormData._getContentDisposition (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\form-data\lib\form_data.js:227:40)
    at FormData._multiPartHeader (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\form-data\lib\form_data.js:178:33)
    at FormData.append (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\form-data\lib\form_data.js:71:21)
    at V.resolveRequest (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:7:3461)
    at V.queueRequest (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:7:2608)
    at Y.request (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:7:5510)
    at Y.patch (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:7:5429)
    at InteractionWebhook.editMessage (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\discord.js\src\structures\Webhook.js:319:38)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ChatInputCommandInteraction.editReply (C:\Users\User\Documents\PlanetEarthMC\PEMC\PEMC Master BOT\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:140:21)

i think its to do with edit reply maybe

radiant lintel
radiant lintel

?

lament wave

is there any enum resolver for the guild audit logs entry types?

lament wave
gloomy kayak

There's already a PR linked btw so it'll probably be fixed soon

lament wave
hollow steeple

Can i react to a slash command?
me: /test
bot: reacts 👀to /test

idle galleon

Slash commands don’t create a message until you reply

hollow steeple

i see, thx

copper pier

i've just migrated my bot over to d.js14 and i can't figure out why this is erroring

it was perfectly fine on 13 which is confusing me, am i using the wrong classes?

velvet jasper
copper pier

oh alright, thanks

lament wave
loud bobcat

am trying to send mentions inside the embed title but it just displays the mention syntax, why ?

knotty plover

Because embed titles dont support rendering mentions

loud bobcat

okey thanks
does fields support it ?

knotty plover

name no, value yes I think

trim sequoia
tame gazelle

is it better to install all dev version for discord.js submodules?

like @discordjs/builders@dev etc

lament wave

in v13 it worked

i will retry later today then ill open a github issue ig

dapper forum

To confirm, v14 will use the discord API v10, and v13 willl not be backported to use the discord API v10?

knotty plover

Correct

Switching to v10 is a breaking change

tame gazelle

v10 is available in the latest @discordjs/rest version?
if yes, is it better to put new REST({ version: '10' }) ?

uncut kelp

Better than?

tame gazelle

nothing, 'cuz now the default value is version 9

before it was v8 so version: '9'

urban belfry

v10 didn't release yet, did it?

tame gazelle

it's available but v9 is still the stable if I understand correctly

urban belfry

rest is literally just a way to send api requests
of course you can use it

tame gazelle

yes but is it better to use v9 or no?

since v14 will use (or actually does, dunno) I would say yes but not sure

10 is more elegant than 9, I agree

urban belfry

are you people literally comparing numbers and saying which one looks better?
do you know the changes to the api?

vague coyote

10 looks nicer indeed

tame gazelle

and no for the 2nd question

urban belfry

no one cares if you approve, that's wrong, everything does not work, there are breaking changes
don't randomly switch just because a number looks nicer

but you didn't test everything because you possibly couldn't have

woven grove

Read it again

but you didn't test everything because you possibly couldn't have

You can’t answer “yes” to that

Shitposting in help channels also makes you get nice mod actions walc

vagrant mortar

Hey have modals been merged yet? Or are they usable in any way?

vague coyote

checkpins

vagrant mortar

👍 👍

vague coyote

yes, they have.
At least CommandInteraction and every class that extends on that

pulsar mica

Hello, did ActionRows change in some way in v14? I'm getting an Invalid Form Body error while trying to port an action row response containing a select menu when porting my code from v13

radiant lintel

is the error of attatching files on edit fixed ?

tame gazelle

no

limpid stratus

Does .addComponents no longer exist on actionrows? I couldn't find it on the v13 -> v14 guide

uncut kelp

Only stuff that changed is in there. It's a migration guide

tame gazelle

it still exists

limpid stratus

I'm getting (typescript)

tame gazelle

it's a method no? ._.

limpid stratus
tame gazelle

it's a method not a property

vague coyote

show your code if you don't know what idris means

limpid stratus
new ActionRow().addComponents({ name: 'e', value: 'e' })```
uncut kelp

I can't reproduce that, I get this error as expected

limpid stratus

Weird

this is the version if it helps ^14.0.0-dev.1644797187.0dfdb2c

uncut kelp

Try installing the dev release again?

There should be 1 new commit since that hash

Could be an installation issue

limpid stratus

k

uncut kelp

The only other explanation would be maybe you've imported "ActionRow" as something else that isn't an action row

vague coyote
uncut kelp
finite fog

Yes

uncut kelp

Nice embed

I'm totally testing this TypeScript issue in the discord.js codebase in a TypeScript file, btw

candid palm

Does anyone know if there is a way to hide the modal after submitting without having to reply/deferReply a new message?

uncut kelp

Acknowledging the modal is Discord's only way of knowing you replied to that interaction

So I would think not - there is no way to do that

Curious, what are you trying to do?

candid palm

basically what i do is create a message first with a button, then after you click the button it opens up the modal.

uncut kelp

Then what

I meant like, what is your use case where you don't want to reply when someone submits in your modal

candid palm

i want it to hide then edit the original message with the submitted info

velvet tendon
// ready
client.guilds.cache.forEach(guild => {
    guild.invites.fetch().then(invites => this.client.invites.set(guild.id, invites)).catch((error: Error) => { return });
})

const invitesCache = client.invites.get(member.guild.id);
const guildInvites = await member.guild.invites.fetch();
client.invites.set(member.guild.id, guildInvites);

const usedInvite = guildInvites.find(invite => invitesCache.get(invite.code).uses < invite.uses);

returned undefined. Help me, pls

gloomy kayak

Are you even returning, there's no context to this

uncut kelp
scarlet tangle

And why i started to get conver color error
in RANDOM, GOLD

velvet tendon

Random

candid palm
scarlet tangle

PascalCase ?

velvet tendon

or Gold
check docs

scarlet tangle
vague coyote

well it is documented, but not in the update guide

hex with 0x prefixed works too

scarlet tangle
vague coyote

well, that take that reply in regards to your color problem KEK

scarlet tangle

yes thank you

dull mulchBOT

pr_open #7431 in discordjs/discord.js by monbrey opened <t:1644395181:R> (review required)
feat(modals): modals, input text components and modal submits, v13 style
📥 npm i monbrey/discord.js#modals

candid palm

@scarlet tangle ^

thats for v13 btw

dull mulchBOT
candid palm

theres v14

gloomy kayak

You need to wait that that PR gets merged

Probably after requested changes are addressed

candid palm

you can install the PRs from the commands above ^ @scarlet tangle

7431 - v13
7023 - v14

gloomy kayak

As you can see above there are already open PRs to add modals. Attachment option is already merged iirc

vague coyote

what will be modified? both are already released and now the pr's just need to be merged

at least the modals pr has examples in the pr description

what do you mean by official structures

if you want to know how it looks like on the api side, look at the discord api docs

urban belfry

there are pending prs, they may or may not change, this is why we're recommending you wait till they get merged
after modals get merged you should be able to use it installing the dev branch, on v13, when 13.7 comes out

vague coyote

at least when the dev ci isn't failing anymore KEK

urban belfry

when they're ready, they'll be merged

vague coyote

they will be released in v13.7

merged whenever they are ready to be merged

its not a v14 feature

when its merged and the dev version updated, yes

vague coyote

good for you I guess?

crystal wasp

How long is v14 estamates to release?

vague coyote

at least 42 years

crystal wasp

Epic

gritty citrus

100 years of how many times people asked that question

keen bobcat

shitposting can go somewhere else

distant canopy
wary wharf

For the modal pr... is there documentation on how to use it?

velvet jasper

There is on the pr

wary wharf

where

knotty plover

The PRs that arent merged yet?

wary wharf

yeah

I cant see any documentation there unless im blind

velvet jasper
wary wharf

is that v13?

velvet jasper

no, bc this is a v14 channel

wary wharf

so where should I ask for v13 help with it?

velvet jasper

probably nowhere since it's not merged yet, but you can try #djs-help-v14

wary wharf

Is the plan for it to get merged or wait for v14

velvet jasper

both of the PRs will be merged at some point the v13 one isn't waiting for v14 to come out

wary wharf

kk thanks

knotty plover

Theres no documentation for something that isnt merged yet, correct

warm pawn

i was reading the guide but what do they mean by #isGroupDM when bots cannot join groups?

icy dew

bots can create groups and add ppl via ouath2 iirc

scarlet tangle
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
const config = require(`./botconfig/config.json`);
const settings = require(`./botconfig/settings.json`);

client.on('ready', () => {
  console.log(`Logged as ${client.user.tag}!`);
});

client.on('messageCreate', (message) => {
  if(message.content === 'ping') {
    message.reply('pong')
  }
})

//Start the Bot
client.login(config.token);

why when i write ping nothing happens?
no errors
"discord.js": "^14.0.0-dev.1644969977.c1b27f8",

vague coyote

you need the GUILD_MESSAGES intent

scarlet tangle

thx

tame gazelle

interaction.member.roles.highest.comparePositionTo(member.roles.highest) < 1
this only compare if the member is higher not equal right?

urban belfry
tame gazelle
urban belfry

no, > -1

tame gazelle

ah yeah

thanks

urban belfry

note, it checks if interaction.member's highest role is higher or equal to the member's highest role

tame gazelle

question or affirmation?

it means it's in builders dev version?

icy dew

not sure about builders, but i think it shld work using json objects

alright

vague coyote

it was merged 3 days ago, but the dev ci was failing, thats why its just now

icy dew

Ah alright.

willow garnet

keep chit chat out of support

midnight plume

Modals are supported in djs14 ?

scarlet tangle

is there a way to upload images to modals?

vague coyote

modals do not accept attachments

scarlet tangle

and how to upload attachments to slash commands?

vague coyote
velvet jasper

PR's merged should be fixed in the next dev release

tame gazelle
velvet jasper

wdym

scarlet tangle

does someone know why its saying that? :0

vague coyote

your bot never replied

scarlet tangle

I did

vague coyote

I doubt that

velvet jasper
scarlet tangle

oh yea..

vague coyote

:)

scarlet tangle

idk how to reply

vague coyote

<Interaction>.reply()

scarlet tangle

oh lol I tought its working with modal.send or smth ty

I'll just wait til its released

velvet jasper
scarlet tangle

im using some npm package cuz idk how to install the dev version

velvet jasper

sorry but we don't offer support for addons

vague coyote

You could however test the v13 one

tame gazelle
velvet jasper

ok but im pretty sure it's fixed

vague coyote

when was it fixed tho

or what pr did it

cuz the latest dev release was 3 hours ago, #7464 (which I think is that pr) was merged 2 hours ago

velvet jasper

I believe the getters PR, it uses options?.map which means the error in Ben's message should no longer be possible

vague coyote

oh, we talked about different things 🥶

velvet jasper
vague coyote

no

yes

velvet jasper

they're using a third party package

idk but it's not worth using it bc djs will have it soon anways which means you'll have to rewrite

scarlet tangle
velvet jasper

bc ur using a third-party package

scarlet tangle

I installed

velvet jasper

that command doesn't work

velvet jasper
scarlet tangle
scarlet tangle
velvet jasper

it's the base branch of the PR

velvet jasper
scarlet tangle

also this code is wrong, please look at the example in the PR description

velvet jasper

yes

loud bobcat

how do I specified the person who can see the message sent by my bot?

velvet jasper
loud bobcat

OK thanks

scarlet tangle

Cannot serialiaze component type
Whats this

velvet jasper
scarlet tangle
velvet jasper
scarlet tangle

Alr its in?

tame gazelle
scarlet tangle
scarlet tangle

how to install the dev version with modals? (and how to use modals?)

hoary fox

npm i discord.js@dev

velvet jasper

It’s not out on dev

scarlet tangle
velvet jasper
candid palm

@scarlet tangle

v13 - npm i monbrey/discord.js#modals
v14 - npm i suneettipirneni/discord.js#feat/text-input-interactions

velvet jasper
limpid stratus

How would I pass a default emoji to a .setEmoji now that we can't pass strings

outer bane

{ name: 'emoji' }

scarlet tangle
limpid stratus
sage sierra
const buttons = new ActionRow({
  components: new ButtonComponent({
    style: ButtonStyle.Primary,
    label: 'Previous',
    customId: 'previous'
  }, new ButtonComponent({
      style: ButtonStyle.Primary,
      label: 'Next',
      customId: 'next'
  }))
});

const curPage = await message.channel.send({ embeds: [pages[page].setFooter({ text: `Page ${page + 1} / ${pages.length}` })], components: buttons });

Returns TypeError: data?.components?.map is not a function

sage sierra

Ah

scarlet tangle
velvet jasper
scarlet tangle
velvet jasper

That’s v13 are you using v13?

Regardless for v13 there isn’t any docs yet

scarlet tangle

uhm yes?

tame gazelle

is there a PR about <SelectMenuComponent>#addOptions() ?

scarlet tangle

but I can update to V14, right?

sage sierra

const buttons = new ActionRow({
type: ComponentType.ActionRow,
components: [new ButtonComponent({
type: ComponentType.Button,
style: ButtonStyle.Primary,
label: 'Previous',
customId: 'previous'
}), new ButtonComponent({
type: ComponentType.Button,
style: ButtonStyle.Primary,
label: 'Next',
customId: 'next'
})]
});

scarlet tangle

@velvet jasper

velvet jasper

Whatever version you’re running is the version you install. I’m not going to continue giving advice for using this, I’ve explained multiple times what to do. If you’re unsure how to follow those steps wait for the prs to be merged

fresh void
sage sierra

Fixed that but I still get the same error

fresh void
sage sierra

apparently that was no longer an array

huh it works

Note to self: dont use the search function for answers

xd

candid palm
scarlet tangle

I tought its a function

scarlet tangle
forest elm
scarlet tangle

thanks man I'll try it 1 sec

tame gazelle
H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\zod\lib\types.js:175
        throw result.error;
        ^

ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [],
    "message": "Required"
  }
]
    at new ZodError (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\zod\lib\ZodError.js:80:28)
    at handleResult (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\zod\lib\types.js:115:21)
    at ZodString.ZodType.safeParse (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\zod\lib\types.js:191:16)
    at ZodString.ZodType.parse (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\zod\lib\types.js:172:27)
    at MixedClass.addChoice (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:10600)
    at H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\moderation\ban.js:22:14
    at MixedClass._sharedAddOptionMethod (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:14694)
    at MixedClass.addIntegerOption (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:14527)
    at Object.<anonymous> (H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\moderation\ban.js:18:10)
    at Module._compile (node:internal/modules/cjs/loader:1103:14) {
  issues: [
    {
      code: 'invalid_type',
      expected: 'string',
      received: 'undefined',
      path: [],
      message: 'Required'
    }
  ],
  format: [Function (anonymous)],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)],
  flatten: [Function (anonymous)]
}

I'm using the dev version of builders

dunno if it's an issue or something changed

urban belfry

addChoice, they now take an object

scarlet tangle
uncut kelp
scarlet tangle

but its says "invalid in this context"

urban belfry

wait what? what are you running? the modals pr didn't get merged yet, right?

woven grove

Nope

scarlet tangle

u can install it with npm i github:monbrey/discord.js#modals (ig)

urban belfry

then why not bug the pr author for it POGGERS

velvet jasper

They’re running v13 modals

scarlet tangle
tame gazelle
scarlet tangle

bruh

ok I'll just wait if it has so much bugs lol

nimble pulsar

hello, when i try to create an embed it gives me this error:

TypeError: Discord.MessageEmbed is not a constructor
urban belfry

Haha no, none of the addMultiples take areays now
Rest parameters

nimble pulsar
urban belfry

Yes

Read the guide for the changes
It's pinned

nimble pulsar
velvet jasper

btw adding select menu options will now accept objects instead of exclusively just classes

urban belfry

So both the class and the object?

velvet jasper

yes

urban belfry

Wait why?
Don't you have intellisense to help you

velvet jasper

honestly one of the main reasons I use typescript is so I don't have to memorize specific props/combinations kek

urban belfry

That's about the only reliable source now since the guides unfinished and the docs are wrong in places

rapid umbra
knotty plover
rapid umbra
rapid umbra
velvet jasper

wdym by several options? Like several text inputs?

knotty plover

You can have up to 5 in a modal

rapid umbra
nimble pulsar

someone can help me with this error:

[
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "string",
    "path": [],
    "message": "Expected number, received string"
  }
]
knotty plover

You passed a string to something that expects a number

urban belfry

node --stack-trace-limit=20 fileName putinW

urban belfry

Go higher then

rapid umbra
knotty plover

no

13.7 should have that but I dont know when we'll release

rapid umbra

Alright, you manage crazy anyway

nimble pulsar
urban belfry Go higher then

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

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

urban belfry

No you should see the line in the error
What i sent you would give you a bigger stack

If not show me the output of node --enable-source-map filename or whatever it was

nimble pulsar

mhh, it is on:
.setColor("#000c4a")

outer bane

setColor expects a number, use 0x000c4a instead

nimble pulsar
outer bane

what do you mean by "convert to it"? a hex string to a number? exchange # with 0x and drop the quotes

rapid umbra
knotty plover

No, not yet

Maybe one day but we have no information on it

rapid umbra

Okay, thanks

gentle coyote

Is it generally somewhat safe to use v14 yet? Or shall i wait longer to avoid major code breaks

knotty plover

Its never safe until it releases

velvet jasper
gentle coyote

Ahhh, i get that, also thanks, ill give it some time before i start updating my code base

knotty plover

no

slow phoenix

Spam…

jaunty vault

<@&839912195994812420>

slow phoenix

Ty

knotty plover

Has it been merged?

gloomy kayak
gloomy kayak

It's in the Dev version probably

tame gazelle

available in builders dev version

tame gazelle

it does

knotty plover

Intellisense isnt documentation

It's probably erroring because you haven't passed any options to it properly

There's a line under that too

I don't know what it would be expecting though

What does it think the error on the addAttachmentOption brackets is

Hmmmm wtf argument is it expecting

And this is on latest commit?

forest elm

setRequired() is used on options and not on the command

finite fog

This looks like a case of blobreadthedocs

tame gazelle

.setRequired() should be in .addAttachmentOption() no?
not outside

forest elm

intellisense is telling them they're doing stuff wrong but apparently its not enough ¯_(ツ)_/¯

knotty plover

Right of course yeah

I don't use builders

Good catch

scarlet tangle

ok tbh i was thinking v14 is a joke like you are not going to launch it but not i think its real so just tell me what changes has to be made ?

scarlet tangle

ok

velvet jasper

Yeah should be fixed in the lastest dev release

Whichever is the latest

tame gazelle
TypeError: t.toJSON is not a function
    at H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:6116
    at Array.map (<anonymous>)
    at SelectMenuComponent.toJSON (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:6107)
    at SelectMenuComponent.toJSON (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:6510)
    at H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:3616
    at Array.map (<anonymous>)
    at ActionRow.toJSON (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:3607)
    at H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\MessagePayload.js:135:30
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\MessagePayload.js:134:49)

is there a PR for this?

velvet jasper
urban belfry

also make sure you're using the up to date djs

tame gazelle
urban belfry

make sure you're updated because now it supports objects

tame gazelle

I've imported SelectMenuComponent from discord.js not @discordjs/builders

urban belfry

could you show the output from using node --enable-source-map fileName?

tame gazelle

fileName should be the command file or the main file?

urban belfry

the main file

tame gazelle
urban belfry

source-maps meguFace

tame gazelle

and now I run the command with the bad code?

urban belfry

yep

velvet jasper
tame gazelle
urban belfry

it doesn't? oh i must have misread, i thought they already do
but it's the plan, right?

dull mulchBOT
velvet jasper
tame gazelle
urban belfry yep
TypeError: t.toJSON is not a function
    at H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:6116
    at Array.map (<anonymous>)
    at SelectMenuComponent.toJSON (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:6107)
    at SelectMenuComponent.toJSON (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:6510)
    at H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:3616
    at Array.map (<anonymous>)
    at ActionRow.toJSON (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:3:3607)
    at H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\MessagePayload.js:135:30
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\MessagePayload.js:134:49)
urban belfry

well yeah it doesn't support objects yet
you'll need to pass SelectMenuOption class instances

also is making zod errors more descriptive being worked on?

uncut kelp

There are plans to replace Zod I believe

haughty shard

good morning, i'm trying to set up a simple discord bot at the moment, and this is my code so far: ```import { ApplicationId, BotToken, ClientId, GuildId, PublicKey } from '../config.json'

import { SlashCommandBuilder } from '@discordjs/builders'
import { REST } from '@discordjs/rest'
import { Routes } from 'discord-api-types/v9'
import { Client, Intents } from 'discord.js'
require('dotenv').config()

// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] })

const commands = [
new SlashCommandBuilder().setName('ping').setDescription('Replies with pong!'),
new SlashCommandBuilder().setName('server').setDescription('Replies with server info!'),
new SlashCommandBuilder().setName('user').setDescription('Replies with user info!'),
].map(c => c.toJSON())

const rest = new REST({ version: '9' }).setToken(BotToken)

rest.put(Routes.applicationGuildCommands(ClientId, GuildId), { body: commands })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error)

// Login to Discord with your client's token
client.login(BotToken)```

however, i am receiving the following error: S[50001]: Missing Access at Q.runRequest (C:\Users\shivn\Desktop\discord-bot\node_modules\@discordjs\rest\dist\index.js:7:581) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Q.queueRequest (C:\Users\shivn\Desktop\discord-bot\node_modules\@discordjs\rest\dist\index.js:5:2942) { rawError: { message: 'Missing Access', code: 50001 }, code: 50001, status: 403, method: 'put', url: 'https://discord.com/api/v9/applications/{APPLICATIONID}/guilds/{GUILDID}/commands', requestBody: { files: undefined, json: [ [Object], [Object], [Object] ] } }

tame gazelle
urban belfry

this doesn't look like v14, if you're using v13, #djs-help-v14
if you are using v14, check the pins

haughty shard

ah okay

radiant lintel

are modals done because the only conversation left in PR is outdated
and all checks passed

velvet jasper
tame gazelle

the URL provided by message.attachments.first()?.url can be destroyed if the message get deleted
if I do new MessageAttachment(message.attachments.first()?.url) will it create a new attachment that will not get deleted if the message command is deleted?

quasi kite

Also I don't understand what is the "?" For

fluid bronze

Optional chaining

quasi kite

Huh could you explain

plain roverBOT

_ Optional chaining (?.)
The optional chaining operator (?.) enables you to read the value of a property located deep within a chain of connected objects without having to check that each reference in the chain is valid.

candid palm

Hey guys so for the <Interaction>.awaitModalSubmit() collector is there a way to only collect the data from the specific message it was submitted from.

uncut kelp

I don't think so

Maybe it should?

forest elm

considering the method is called on an interaction, definitely

velvet jasper

yeah making a message collector for this isn't bad either since modals can be spawned from them

uncut kelp

I left a review comment anyhow on the 13 backport one

fallow iris

I get this error when trying to use the code example from the modal pr. Anyone knows whats wrong?

uncut kelp

Well, did you import it?

candid palm

its "SHORT" and "PARAGRAPH" on v13 not sure about v14

velvet jasper

they have the syntax correct for v14

candid palm

Oh ok i just thought maybe it could be the same for v14

fallow iris
uncut kelp Well, did you import it?
const {
    ActionRow,
    TextInputComponent,
    TextInputStyle,
    Modal,
    ModalActionRowComponent,
  } = require('discord.js')
  
// Create the modal
const modal = new Modal()
.setTitle('My Awesome Form')
.setCustomId('AwesomeForm');
  
// Create text input fields
  
const haikuInputComponent = new TextInputComponent()
.setCustomId('haikuField')
.setLabel('Write down your favorite haiku')
.setStyle(TextInputStyle.Paragraph);
  
const rows = [haikuInputComponent].map((component) =>
    new ActionRow.ModalActionRowComponent.addComponents(component)
);
  
// Add action rows to form
modal.addComponents(...rows);

await interaction.showModal(modal);

Yes its imported

velvet jasper

you cloned a local copy of the repo right?

fallow iris
velvet jasper

that won't work in v14

fallow iris

i used npm i github:monbrey/discord.js#modals

velvet jasper

oh ok then yeah it will work since it's v13

candid palm

yeah thats for v13

fallow iris

yeah I am still on v13

velvet jasper

the v14 PR docs aren't written for v13

fallow iris

oh

uncut kelp

This channel is for v14 additionally :P

fallow iris

really?

velvet jasper

yeah

fallow iris

ohhhh I am blind.. sorry 😅

obtuse knoll

does discord.js v14 dev works or not

scarlet tangle

Is there any date for stable version?

tame gazelle

the URL provided by message.attachments.first()?.url can be destroyed if the message get deleted
if I do new MessageAttachment(message.attachments.first()?.url) will it create a new attachment that will not get deleted if the message command is deleted?

obtuse knoll
tame gazelle

nice answer

I don’t use prefix command anymore

and I have to wait some weeks that the URL get deleted ._.

for knowing

it doesn’t answer to my question ._.

urban belfry

how does that help

gloomy kayak
scarlet tangle

what is this?

vague coyote
scarlet tangle

yeah I just checked it but what’s different?

fluid bronze

Did you read it? Thonk

scarlet tangle

“Some pleasant refactors…”

i don’t know what that means lol

scarlet tangle

I am asking day/month/year

Then dont answer ?

velvet jasper
scarlet tangle

OK then

knotty plover

Yeah we dont do ETAs

gloomy kayak

Why

knotty plover

Can you be more specific? Changed how?

regal mason

C:\Users\Administrator\Desktop****\Dev\Melon\server.js:16
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_INVITES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_VOICE_STATES],
^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
at Object.<anonymous> (C:\Users\Administrator\Desktop****\Dev\Melon\server.js:16: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 Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

knotty plover

Intents is now IntentsBitfield

regal mason

So I have to write IntentsBitField.FLAGS.GUILDS ?

velvet jasper
regal mason

Oh, much simple

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

Weird

velvet jasper

did u import it properly

regal mason

Idk

Oh okay I forgor the uppercase

💀

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

ZodError: [
  {
    "code": "invalid_type",
    "expected": "object",
    "received": "array",
    "path": [
      0
    ],
    "message": "Expected object, received array"
  }
]
    at new ZodError (C:\Users\Administrator\Desktop\Ryan\Dev\Melon\node_modules\zod\lib\ZodError.js:80:28)
    at handleResult (C:\Users\Administrator\Desktop\Ryan\Dev\Melon\node_modules\zod\lib\types.js:115:21)
    at ZodArray.ZodType.safeParse (C:\Users\Administrator\Desktop\Ryan\Dev\Melon\node_modules\zod\lib\types.js:191:16)
    at ZodArray.ZodType.parse (C:\Users\Administrator\Desktop\Ryan\Dev\Melon\node_modules\zod\lib\types.js:172:27)
    at MixedClass.addChoices (C:\Users\Administrator\Desktop\Ryan\Dev\Melon\node_modules\@discordjs\builders\dist\index.js:3:10853)
    at C:\Users\Administrator\Desktop\Ryan\Dev\Melon\commands\activity.js:9:10
    at MixedClass._sharedAddOptionMethod (C:\Users\Administrator\Desktop\Ryan\Dev\Melon\node_modules\@discordjs\builders\dist\index.js:3:14694)
    at MixedClass.addStringOption (C:\Users\Administrator\Desktop\Ryan\Dev\Melon\node_modules\@discordjs\builders\dist\index.js:3:14467)
    at Object.<anonymous> (C:\Users\Administrator\Desktop\Ryan\Dev\Melon\commands\activity.js:6:6)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:251:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21) {
  issues: [
    {
      code: 'invalid_type',
      expected: 'object',
      received: 'array',
      path: [ 0 ],
      message: 'Expected object, received array'
    }
  ],
  format: [Function (anonymous)],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)],
  flatten: [Function (anonymous)]
}
const slashData = new SlashCommandBuilder()
    .setName('activity')
    .setDescription("Démarre une activité Discord en vocal !")
    .addStringOption(option => option
        .setName('activity')
        .setDescription("Choisi l'activitée que tu veux lancer, tu dois être dans un vocal pour utiliser cette commande !")
        .addChoices([
            ['Youtube Together', 'youtube'],
            ['Youtube Together (Dev)', 'youtubedev'],
            ['Word Snacks', 'wordsnack'],
            ['Awkword', 'awkword'],
            ['Betrayal.io', 'betrayal'],
            ['Chess', 'chess'],
            ['Chess (Dev)', 'chessdev'],
            ['Doodle Crew', 'doodlecrew'],
            ['Fishington', 'fishing'],
            ['Letter Tile', 'lettertile'],
            ['SpellCast', 'spellcast'],
            ['Poker Night', 'poker']
        ])
    )

The error starts at .addChoices()

It expect an object but idk how to transpose the array to an object lol

velvet jasper
regal mason

lmao

uncut kelp

Fixed?

velvet jasper

oh yeah, nvm u have to use the SelectMenuChoice for now

uncut kelp

o,o

forest elm

im fairly certain its not a bug

uncut kelp

It's not nah

velvet jasper

not it should, but if you do that rn it crashes bc it hasn't been updated to support that

forest elm

i dont think siris understood what you were trying to say oqa[...]

regal mason

MessageButton is not a constructor 😔

forest elm
velvet jasper

it's going to be exactly like it is now but you have the choice of using a class or an object

they omitted the rest of ur username

regal mason
velvet jasper

also you need to use the SelectMenuOption class

regal mason

in the front of what ?

velvet jasper

in front of any array you pass into .addChoices

regal mason
velvet jasper

yes

regal mason
forest elm

you need to map the array into an array of SelectMenuOption classes instead of array of arrays

regal mason

I'm using an array with objects

forest elm

use the class instead of a plain object

regal mason

I don't unstand

Oh okay I'm tired lol

Choice not Option

forest elm

no its my fault, i said option

velvet jasper

@scarlet tangle you can actually use objects now the latest dev release includes support for it

oh wait nvm it doesn't have it, it just missed the deadline

wait maybe it did, idk you'll have to test

well it has the commit hash in the version so it did

forest elm

it wont, you just have to use rest parameters

cold moon

hello... I have the intents activated... can you help me?

oak raft

when the

spare fiber

ignore

oak raft

ye ik

limpid stratus

I think you went to the wrong site, it’s discordjs.guide, not discordjs-guide

Ah ok

regal mason

(My IDE do not reconize it)

shadow plume

just cuz your ide doesnt recognize it doesnt mean its non existent

regal mason

Yeah that's annoying

quasi kite

What are the current bugs with djs 14

also how do i install the dev version

tame gazelle

npm i discord.js@dev

quasi kite

will that give the latset github version

instead of having a resolver for each enum, you can create a common enum resolver like

EnumResolver.resolveEnum("STRING_ENUM")```
forest willow
const exampleEmbed = new Embed()
      .setColor("#0099ff")
      .setTitle("UTILY's Help Menu")
      .setAuthor({
        name: "somename",
        iconURL:
          "somelink",
        url: "yetanotherlink",
      })
      .setDescription("A list of commands and their descriptions.")
      .addFields(
        { name: "Categories:", value: "fun | info | mod" },
        { name: "\u200B", value: "\u200B" },
        { name: "fun", value: "count", inline: true },
        { name: "info", value: "help | ping", inline: true },
        { name: "mod", value: "purge", inline: false }
      )
      .addField("Example:", "`/helpfun categoryfun count`")
      .setThumbnail(interaction.client.user.displayAvatarURL({ format: "png" }))
      .setTimestamp()
      .setFooter({
        text: `REQUESTED BY ${interaction.member.user.tag}`,
        iconURL: interaction.user.displayAvatarURL({ format: "png" }),
      });```

can someone please edit this one embed according to the norms then i will know the changes

daring coyote
forest willow
forest elm

why are you using addFields() and addField() in the same place
replace "#0099ff" with 0x0099ff (without quotes)

daring coyote
const { Util } = require('discord.js')
.setColor(Util.resolveColor('#0099ff'))
forest elm

just use 0x0099ff instead of that

scarlet tangle
const { MessageEmbed} = require("discord.js"),
config = require("./../botconfig/config.json");

module.exports.send = async function(message, embed){
    let newEmbed = new MessageEmbed()
    .setFooter(config.footer)
    .setColor(config.color)
    embed = {... newEmbed, ... embed}

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

};

module.exports.usage = async function(message, data){
    let cmd = data.cmd;
    let usageDesc = await cmd.usage.join("\n").replace(/{prefix}/g, data.guild.prefix);

    let newEmbed = new MessageEmbed()
    .setFooter(config.footer)
    .setColor("RED")
    .setDescription("Missing arguments for command. Please provide the valid inputs.")
    .addField("__Usage__", usageDesc);

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

};

how can i repair it? TypeError: MessageEmbed is not a constructor

broken falcon

what's new in v14?

scarlet tangle

i was reading this two times and i didn t see this xD

austere vapor
uncut kelp

Shoooooooooow codeeeeeeeeeeeeeeeeee

austere vapor

interaction.options.getNumber('amount');

uncut kelp

Yea but what is the interaction

austere vapor
plain roverBOT
uncut kelp

Yes (: Chat input commands are for chat input commands. Command interactions are the base for context menu commands and chat input commands

forest willow

i saw cant figure out

and i am not telling like write my code, i just cant figure out so someone can help, if you cant please refrain

forest elm

you have plenty of fields already, just move the one you have on addField() alone into the addFields above it

forest elm
forest willow

ah missed it sorry

forest willow
dark zephyr

v14 is out already??? wut r the changes

plush monolith

read pins

forest elm

@scarlet tangle

latent lion

This error is occurring when I make my avatar context menu command.

Here's the code:

const {
  Client,
  ContextMenuCommandInteraction,
} = require('discord.js');

module.exports = {
  name: 'Get Avatar',
  type: 2,

  /**
   * @param {Client} client
   * @param {ContextMenuCommandInteraction} interaction
   */

  run: async (client, interaction) => {
    let member = interaction.guild.members.cache
      .get(interaction.targetId);

    let embedAvatar = {
      image: member.user.displayAvatarURL({
        size: 4096,
        format: 'png',
      }),
    };

    await interaction.editReply({ embeds: [embedAvatar] });
  },
};

discord.js: version 14.0.0-dev.1643889786.04502ce

forest elm
latent lion

oh thanks

topaz sinew

Is there anyway to work with modals in v14 ?

tame gazelle

is there a thing like this:
member.bannableBy(member2)
and it checks if member2 can ban or not member

tame gazelle

you can just do .setImage(att.url)

plain roverBOT

Tag suggestion for @scarlet tangle from @forest elm:
MessageEmbed#attachFiles has been removed. Files should be attached via the message option object instead:

  const attachment = new MessageAttachment('./image.png', 'image1.png');
  const embed = new MessageEmbed()
-   .attachFiles([attachment])
    .setTitle('Attachments')
    .setImage(`attachment://${attachment.name}`);

- channel.send(embed)
+ channel.send({
+   embeds: [embed],
+   files: [attachment]
+ });
forest elm
tame gazelle

is there a thing like this:
member.bannableBy(member2)
and it checks if member2 can ban or not member

forest elm

no there is not

tame gazelle

and is it technically possible to know if a member can ban another one or not?

outer bane

sure, take a look at the code of e.g. GuildMember#bannable and adapt it for another user than your client

velvet jasper
keen lion

oh sorry my bad.

cerulean bay

Should i report typings errors after updating or should i just wait for a future merge? Just updated and getting 13 typings error from djs

cerulean bay
urban belfry

Might be that one of the packages are outdated
Make sure all of the packages are up to date

cerulean bay

That is not the question i asked but thanks anyway!

urban belfry

And I'm telling you that shouldn't happen and gave you a possible reason as to why

cerulean bay

Most of the time, those are just not merged yet. This is why i'm asking if i should report them or just wait for them to be merged.

latent lion

Timestamps are not showing up

velvet jasper
forest willow

Is VIEW_CHANNEL bitfield renamed?

velvet jasper
forest willow
await interaction.guild.channels.create('utily-logs', {
                type: 'text',
                permissionOverwrites: [
                    {
                        id: interaction.guild.id,
                        deny: ['VIEW_CHANNEL'],
                    },
                    {
                        id: interaction.user.id,
                        allow: ['VIEW_CHANNEL'],
                    },
                ],
            }).catch(e =>{ return interaction.reply("An error ocurred:"+e)})```

I meant here
jaunty vault
forest willow

k thanks

An error ocurred:RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: VIEW_CHANNEL.

what about perms?

forest willow

btw it says GuildText is not defined?

oo i fixed it, the type is BaseGuildTextChannel

jaunty vault
forest willow

ok

forest willow

embed.setFooter(`:thumbsup: ${memeUpvotes} :speech_balloon: ${memeNumComments}`);

why is this not working?

plain roverBOT

<MessageEmbed>.setFooter() and <MessageEmbed>.setAuthor() now each take an object:

- embed.setAuthor('This is an example text', 'https://exampleicon.com', 'https://websiteofauthor.com')
+ embed.setAuthor({ name: 'This is an example text', url: 'https://websiteofauthor.com', iconURL: 'https://exampleicon.com' })

- embed.setFooter('This is an example text', 'https://exampleicon.com')
+ embed.setFooter({ text: 'This is an example text', iconURL: 'https://exampleicon.com' })
onyx cove

@forest willow

forest willow

thanks

quasi kite
forest willow

i fixed it already thanks for helping though

quasi kite

Oh no it's PermissionFlagsBits.ViewChannel

forest willow

if (channel.type === "GuildText") this isnt working

tame gazelle

import ChannelType from discord.js

forest willow

Like channel.type === ChannelTypes.GuildText

tame gazelle

yes

or just do channel.isText() ._.

idle galleon

That limits to any TextBasedChannel tho, not just TextChannel

tame gazelle
idle galleon

Nice

limpid stratus

Why does

GuildChannelManager.fetch``` return `Promise<NonThreadGuildBasedChannel | null>`?
I thought it'd throw an error if it couldn't find a channel
young kindle

oh wait you just said it, hmmm idk THONK

limpid stratus

Yeah weird

young kindle

wait no you didn't say it's a forced fetch, yeah it should throw an error if no channel was found but it's a forced fetch

limpid stratus

A, so if I set force: true, it will error instead of returning null?

young kindle

yeah

limpid stratus

Ah ok thx

tame gazelle

before when the user doesn't have any flags and we did user.flags.toArray() there was 'None' in the array
did you remove it definitively or it's a "bug" ?

finite fog

I think that was removed.

tame gazelle

👍

brisk glen

how do you now install d.js dev?

tame gazelle

npm i discord.js@dev

brisk glen

how about with specific commit?

forest willow

(client.channels.cache.get('id')).send(`message`);

Error:
(client.channels.cache.get('id')).send(`text`);
^

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

tame gazelle

why you added brackets?

tame gazelle
gloomy kayak
brisk glen

do the MessageButton in v14 be required on discord builders?

and is now button component?

tame gazelle

nope you can still import from discord.js

and yes now it's ButtonComponent

forest willow
brisk glen

what is the difference if you import it from d.js?

forest willow
brisk glen

did v14 change perm checks as well to not receive a string?

regal mason
brisk glen

then why?

tame gazelle

now it's PascalCase

so ViewChannel

brisk glen

even with the intents?

tame gazelle

yes

brisk glen

I mean, the partials?

vague coyote

everything

regal mason
tame gazelle
brisk glen

is there a list of breaking changes compiled right now?

tame gazelle

check pins

brisk glen

ZkkBore sighs, as expected, major version bump takes a lot away from my sanity. thanks for the help though

fleet fossil

When is Discord.js v14 coming out?

vague coyote

ETA: When its ready™️

brisk glen

I dont understand this error

DiscordAPIError[50035]: Invalid Form Body
          embeds[0].description[BASE_TYPE_REQUIRED]: This field is required
              at C.runRequest (D:\Dev Works\Chip\main\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:7:581)
              at processTicksAndRejections (node:internal/process/task_queues:96:5)
              at async C.queueRequest (D:\Dev Works\Chip\main\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:5:3049)
              at async TextChannel.send (D:\Dev Works\Chip\main\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15)
              at async NormalReplies.send (file:///D:/Dev%20Works/Chip/main/src/structures/NormalReplies.js:61:20)
              at async Player.interactiveNowPlaying (file:///D:/Dev%20Works/Chip/main/src/music/Player.js:216:24)
              at async Player.start (file:///D:/Dev%20Works/Chip/main/src/music/Events.js:9:13)

Base type required?

finite fog

Looks like you sent an empty embed.
(That error is indeed not too good)

brisk glen

this is the embed data

[
   {
      "data":{
         "author":{
            "name":"Now Playing",
            "url":{
               
            },
            "icon_url":"https://cdn.discordapp.com/avatars/325231623262044162/cf10d9dd76495b274cc3fae26bdda5d6.webp"
         },
         "description":"[Yagate Kimi Ni Naru - Hectopascal (ED)](https://soundcloud.com/isabella-strange/yagate-kimi-ni-naru-hectopascal-ed) [04:28]",
         "color":16741120
      }
   }
]

clearly my description is not null so it should not throw

finite fog

I don't recall embeds being nested under data, I'd suspect that being the culprit.

brisk glen

how did it get nested, though I'm using the dev version right now

finite fog

How did you get that json?

brisk glen

stack trace

velvet jasper

Can you show your code?

brisk glen
async send(color, input, buttons) {
    // check if options is a string or message embed
    let options;
    if (typeof input === 'string') {
        const components = [];
        if (buttons?.length)
            components.push(new ActionRow().addComponents(buttons));
        const embed = new Embed()
            .setColor(color)
            .setAuthor({
                name: formatText(input),
                iconURL: this.interactable.interaction.user.displayAvatarURL()
            });
        options = {
            embeds: [embed],
            components
        };
    } else if (input instanceof Embed) {
        const components = [];
        if (buttons?.length)
            components.push(new ActionRow().addComponents(buttons));
        // color setter
        if (!input.color) input.setColor(color);
        if (input.author?.name) input.author.name = formatText(input.author.name);
        options = {
            embeds: [input],
            components
        };
    }
    // manual input
    else
        options = Object.assign({}, input);
    // check if the message is replied or deffered before sending
    if (this.interactable.interaction.replied)
        return await this.interactable.interaction.followUp(options);
    else if (this.interactable.interaction.deferred)
        return await this.interactable.interaction.editReply(options);
    else {
        if (!this.interactable.repliable) return;
        return await this.interactable.interaction.reply(options);
    }
}

I also get

    err: {
      "type": "TypeError",
      "message": "t.toJSON is not a function",
      "stack":
          TypeError: t.toJSON is not a function
              at file:///D:/Dev%20Works/Chip/main/node_modules/@discordjs/builders/dist/index.mjs:3:3580
              at Array.map (<anonymous>)
              at T.toJSON (file:///D:/Dev%20Works/Chip/main/node_modules/@discordjs/builders/dist/index.mjs:3:3571)
              at D:\Dev Works\Chip\main\node_modules\discord.js\src\structures\MessagePayload.js:135:30
              at Array.map (<anonymous>)
              at MessagePayload.resolveBody (D:\Dev Works\Chip\main\node_modules\discord.js\src\structures\MessagePayload.js:134:49)
              at TextChannel.send (D:\Dev Works\Chip\main\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:171:61)
              at NormalReplies.send (file:///D:/Dev%20Works/Chip/main/src/structures/NormalReplies.js:59:39)
              at NormalReplies.normal (file:///D:/Dev%20Works/Chip/main/src/structures/NormalReplies.js:12:21)
              at Player.interactiveNowPlaying (file:///D:/Dev%20Works/Chip/main/src/music/Player.js:216:43)
    }

when adding buttons which I also don't understand since components should be an array with actionrow inside it doesnt it

velvet jasper

Also just to verify are you on the latest dev version

brisk glen

here are the versions

installed via npm i discord.js@dev

upbeat mica
  {
    "code": "invalid_type",
    "expected": "object",
    "received": "string",
    "path": [
      0
    ],
    "message": "Expected object, received string"
  }
]
    at new ZodError (C:\Users\aleks\Desktop\Nodejs\v14\node_modules\zod\lib\ZodError.js:80:28)
    at handleResult (C:\Users\aleks\Desktop\Nodejs\v14\node_modules\zod\lib\types.js:115:21)
    at ZodArray.ZodType.safeParse (C:\Users\aleks\Desktop\Nodejs\v14\node_modules\zod\lib\types.js:191:16)
    at ZodArray.ZodType.parse (C:\Users\aleks\Desktop\Nodejs\v14\node_modules\zod\lib\types.js:172:27)
    at Embed.addFields (C:\Users\aleks\Desktop\Nodejs\v14\node_modules\@discordjs\builders\dist\index.js:1:6204)
    at Embed.addField (C:\Users\aleks\Desktop\Nodejs\v14\node_modules\@discordjs\builders\dist\index.js:1:4695)
    at Object.execute (C:\Users\aleks\Desktop\Nodejs\v14\commands\eval.js:33:14)
    at Object.execute (C:\Users\aleks\Desktop\Nodejs\v14\events\messageCreate.js:16:21)
    at Client.<anonymous> (C:\Users\aleks\Desktop\Nodejs\v14\index.js:40:44)
    at Client.emit (node:events:390:28) {
  issues: [
    {
      code: 'invalid_type',
      expected: 'object',
      received: 'string',
      path: [Array],
      message: 'Expected object, received string'
    }
  ],
  format: [Function (anonymous)],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)],
  flatten: [Function (anonymous)]
}```

what this error means?

finite fog

What the message says, stacktrace points to eval.js line 33.

upbeat mica

bruuuh

addfield usage changed?

finite fog

It has indeed

fleet fossil
dawn phoenix

ó.O

forest elm

yes, but why

where did you put that piece of code, and what intents are you using

go on, that wasn't the only thing i asked

brisk glen

I found a weird case, where in instanceof returns false on same instance of embed, (1st picture)
on the resolveBody of message payload (2nd picture)
which actually causes the issue in
#djs-in-dev-version message

forest elm

show the embed you're creating

brisk glen
import { COLORS, formatText } from '../utils/ChipUtils.js';
import { Embed, ActionRow } from '@discordjs/builders';

class InteractableReplies {
    constructor(interactable) {
        this.interactable = interactable;
    }
    async send(color, input, buttons) {
        // check if options is a string or message embed
        let options;
        if (typeof input === 'string') {
            const components = [];
            if (buttons?.length)
                components.push(new ActionRow().addComponents(buttons));
            const embed = new Embed()
                .setColor(color)
                .setAuthor({ name: formatText(input), iconURL: this.interactable.interaction.user.displayAvatarURL() });
            options = { embeds: [ embed ], components };
        }
        else
            options = Object.assign({}, input);
        // check if the message is replied or deffered before sending
        if (this.interactable.interaction.replied)
            return await this.interactable.interaction.followUp(options);
        else if (this.interactable.interaction.deferred)
            return await this.interactable.interaction.editReply(options);
        else {
            if (!this.interactable.repliable) return;
            return await this.interactable.interaction.reply(options);
        }
    }
}

export default InteractableReplies;
forest elm

what would input be if not a string

brisk glen

original spec on textchannel.send()

but in this case, thats not what i'm using

I'm using a string

since I know its a string, I know it creates an embed, which is passed through the interaction.reply(), or follow up, or edit reply

so instanceof should return true, but it returns false Confused

forest elm

run yarn why @discordjs/builders or npm list @discordjs/builders

forest elm

although there is a version mismatch there

forest willow

client.user.setActivity() doesnt work in v14?

forest elm

whats the issue you're having

brisk glen
forest willow
karmic tartan

How do i download djs v13 main branch instead stable?

gritty citrus

it's literally in the channel topic..

karmic tartan

Im dumb

dawn phoenix

will see when it releases

forest elm

for now yes

forest willow
forest elm

you're missing GuildMembers

forest elm
forest willow
client.user.setStatus("idle");
    var activities = [ `${client.guilds.cache.size} servers`, `${client.users.cache.size} users!`, `v0.0.0 [pre-release]`, 'preparing magic potions!' ], i = 0;
    setInterval(() => client.user.setActivity(`\/help help | ${activities[i++ % activities.length]}`, { type: "PLAYING" }),5000)```

.setStatus() works however
forest elm

that's not a valid value for type, however you can just get rid of it as it defaults to Playing already

forest willow

ok but this same code works in v13

forest elm

are you using v13?

forest willow

no ik i was just saying

so "Playing" will be a valid type, right?

forest elm

no, you need to use the ActivityType enum

forest willow

oo

const { EnumResolvers } = require('discord.js'); const act = EnumResolvers.resolveActivityType("PLAYING");

tried but isn't valid

velvet jasper

Try ActivityType.Playing

forest elm

there is no resolver for activity types

forest willow
karmic tartan

Is djs main branch the djs v14 or gonna be merged at v13 stable?

karmic tartan

feelsWoahMan

Why not merge .getAttachment at v13?

forest elm

it already is

just not released

karmic tartan

Oh.. Oky then

mighty edge
karmic tartan

donutCat

v13 stable branch is much different than main?

devout bison
south python

How does the SelectMenuComponent().setOptions() function work?

Like what should the input be of the function

latent lion

timestamp: new Date() I did this

forest elm
velvet jasper

or just do Date.now()

latent lion

let me try

velvet jasper
sudden bobcat

I'm trying i.message.embeds[0].footer.text = 'blah' but it says cannot read text of undefined

gloomy kayak

Then that embed doesn't have any footer

You can use an optional chaining operator: i.message.embeds[0].footer?.text = "blah"

Oh no wait

You're assigning that property

Then you could do something like:

const [embed] = i.message.embeds;
embed.footer = { ...embed.footer, text: "blah" };

This is not related to djs however

obtuse knoll

is discord.js v14 stabled or not

vague coyote

its mid dev, so no Thonk

subtle lion

Is there any documentation already available?

Or installing v14?

vague coyote

checkpins

novel notch
latent lion

You are showing the name that you have in replit, they can get the code and the token if the token of your bot is not in an .env

dawn phoenix

you should care

keeping that thing safe is your top priority as a dev

novel notch

I only said to prevent them from using your bot for raid or to steal code but if you don't care anymore you

dark moon
latent lion Idc and stop going off-topic

late to the party, but just to emphasize why this matters- even it is a "bot that controls nothing", bot tokens can generate the owner's user token thanks to the client credentials oauth2 grant

dark moon
scarlet tangle

how to use the client.user.setActivity

type: Discord.ActivityType.Custom

spare fiber

you cant use custom on bots

crude valley

How can I set a custom Color for an embed's .setColor()?
I mean I don't want to have the inbuilt ones like Colors.Red, I want to give out a custom hex code

outer bane

use either Util.resolveColor with a hex string or directly provide a hex number e.g. 0x12A786

brisk glen
  rawError: {
    code: 50035,
    errors: {
      name: {
        _errors: [
          {
            code: 'STRING_TYPE_REGEX',
            message: 'String value did not match validation regex.'
          }
        ]
      }
    },
    message: 'Invalid Form Body'
  }

What do this error means?

scarlet tangle

as is

hardy bone

did modals release in dev?

limpid stratus

What's the enum called that you pass to 'type' in Guild.fetchAuditLogs

urban belfry
tame gazelle

like MEMBER_ADD will be MemberAdd

dawn phoenix
limpid stratus
limpid stratus
urban belfry

then go with what souji said

urban belfry
undone yew

How can I get the user's name on the server in v14?

tame gazelle

same as v13 no?

it’s still <GuildMember>#displayName

undone yew

Thanks for help

scarlet tangle
forest elm

whats menu

scarlet tangle
gloomy kayak

Use .addComponents instead

forest elm

or use .toJSON()

scarlet tangle

And buttons works but why i get error in select menus

forest elm

because you're using raw buttons

scarlet tangle

I need some rest i think lol

cerulean elk
outer bane

works fine for me

cerulean elk

oh it worked in chrome
didnt work in vivaldi

tough egret
c.permissionOverwrites.set([
                        {
                            id: server.id,
                            deny: [Permissions.FLAGS.VIEW_CHANNEL]
                        }
                    ])

Returns: TypeError: Cannot read properties of undefined (reading 'FLAGS')

copper jetty
tough egret

And how it works in v14?

strange knoll

.Flags.viewChannel

tough egret

Then now i must import it as PermissionsBitField and call as for example: Permissions.Flags.viewChannel?

copper jetty

PermissionsBitField.Flags.ViewChannel

tough egret

Ty! 😄

scarlet tangle

what happened to interaction.isButton

outer bane

nothing

scarlet tangle

Why itsnt working then

outer bane

make sure that line of code is reached

scarlet tangle

Why a button also trigger chatInputCommand ?

vague coyote

It shouldn't, sounds like your code logic has some issues

scarlet tangle

Nwm i forgot brackets end of chatInputCommand

dusky gust

is v14 for this year?

gloomy kayak

Maybe

fallow steppe

Am I doing something wrong or is @dev filled with type errors?

outer bane

not for me at least

outer bane

do you have multiple versions of discord-api-types installed?

npm why discord-api-types

cerulean bay

I guess that yes?

fallow steppe