#djs-in-dev-version

35223 messages · Page 6 of 36

weak ridge

Or has he changed his name?

urban belfry

you can check the docs for this

weak ridge

I actually just found a variable that holds all events, but they say it's webhooksUpdate now

urban belfry
weak ridge

It's Discord.Events

But I was wrong, it's webhookUpdate NM_PepeHyped

pallid ice

I'm really struggling to understand the difference between 'Unsafe' builders and regular builders. for instance I have a help command that previously used a map function to create all the options for a selectmenu, based on the directory/category names of the commands.

however whenever I tried to use it I'd get an error about label and value being required (even though they weren't blank). I got around this by changing some stuff and using a forEach on the array and having a new SelectMenuOption in the function - giving it the label, value, description and emoji for each option:

.addOptions(categories.forEach(cmd => new SelectMenuOption({ label: cmd.directory, value: cmd.directory.toLowerCase(), description: `Everything in the ${cmd.directory} category.`, emoji: emojis[cmd.directory.toLowerCase()] })))

instead now I get a different error: components[0].components[0].options[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required

if I console log the ActionRow I can see that options instead shows as options: [ UnsafeSelectMenuOption { data: {} } ] - completely empty and marked as 'Unsafe'

I know this is a dev release and I don't expect things to work 100% but I can build it by making the object statically, so am I missing something or is this an actual bug with SelectMenus in v14 atm?

velvet jasper
pallid ice

of course I don’t mind, I was thinking I should but felt it better to check in here first in case

velvet jasper

No worries

uncut kelp

Doesn't .forEach() there return nothing? @velvet jasper

Iirc that's a void function

pallid ice

sweaty really?

velvet jasper

Yeah it is, maybe you wanted .map?

pallid ice

Oh you know what, that could work. I’ll try and find out what’s going on

uncut kelp

So what .forEach() does is execute your function on categories. Its return value is nothing, so you were ultimately doing .addOptions(undefined)

You definitely want a .map() there

pallid ice

HAHaa I’ve learned so much about JS in the last 18 months but seems I have some gaps that I shouldn’t have

uncut kelp

(X

velvet jasper

One more thing when you map the results of the map need to be spread for addOptions

plain roverBOT

_ Rest parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.

pallid ice

Ooo I see, thank you

pallid ice

well, good news is that I got the select menu to work however a new error when trying to set emojis but that may be because of a change that I don't understand yet

when giving a unicode emoji it gives the error:
components[0].components[0].options[0].emoji[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType

velvet jasper

Yeah it accepts an object not a string so { name: “emoji” }

pallid ice

ah, my bad. sorry for being a pest

and ty for your help

velvet jasper

No problem

wheat hearth

aaaaa

obtuse summit

got an odd issue - trying to disable a button based on page
.setDisabled(pageNum < 0? true : false)

however the button remains clickable

    buttons.push(new ButtonComponent()
    .setCustomId(`selfroles.$prev.${modifier}.${pageNum - 1}`)
    .setLabel(LABEL_PREV)
    .setStyle(ButtonStyle.Secondary)
    .setDisabled(pageNum < 0? true : false));
velvet jasper
uncut kelp

Or remove the ternary as it would be implied from the comparison

Can't immediately see anything amiss there... that looks okay? Maybe the problem isn't there?

obtuse summit

the buttons were originally inside if statements - so they would only show when valid

I fixed it by removing the ternary

dapper gull

Besides the GatewayIntentBits.DirectMessages intent, is there anything else I need to do to listen for messageCreate events to see DMs to the bot? Doesn't seem to be working and my brain is blank lol

knotty plover

You'll also need the channel partial

dapper gull
vague coyote

partials also wants enum values

You can import Partials

dapper gull

Oh dangit, thanks dude, let me try that 👍 - Worked, thank you 🙏

brisk glen

why do buttoncomponent don't accept a string?, what would you do if you want a unicode emoji to be shown

weak ridge

Hi! Does anyone know if we can no longer do client.api.interactions(...) in V14? Or has it changed?

dawn phoenix

gotta use Client#rest now

weak ridge

Ok

weak ridge
dawn phoenix

no

weak ridge

client.rest.interactions() ?

dawn phoenix
weak ridge

But what should I use?

vague coyote

Just out of curiosity, why do you need it

dawn phoenix

what do you mean "what should i use"? Client#rest returns a REST class instance
which has all the methods and attributes listed there
depending on what you want to do that varies heavily
most likely #get #post #patch etc. or #on #once to attach listeners, i guess

obtuse summit

a button interaction has a member callback right? trying to give a role to the user who clicked the button with
interaction.member.roles.add()

I guess I can pull it from the original event

steel lance

is CommandInteraction#options removed?

urban belfry
steel lance

oh

urban belfry

the type guard also changed
for specifically slashies, isChatInputCommand

steel lance

then what's the CommandInteraction class now

in v13 it was for slash commands on v14 what is it for?

urban belfry
steel lance

oh

ChatInputCommandInteraction is only for slash commands?

urban belfry

yep

steel lance

alr thanks

obtuse summit

any way to edit the message on collector end?

since collected is an array of elements, not sure if there is a callback

finite fog
urban belfry
obtuse summit

I am updating the message with clicks, would that affect it?

urban belfry

could you describe the process more please?

obtuse summit

its a self role menu and with every click I update it with

    await i.update({
      embeds: [newPage.embed],
      components: newPage.rows,
      // fetchReply: true,
    });
urban belfry

okay and what do you want to do? edit the message on the end event, right?

obtuse summit

correct, I need the user to know that its expired

urban belfry

yeah collected.first().message.edit would work

obtuse summit

thank you 🙏 you are a blessing

obtuse summit
    collected.first().message.edit("This operation has expired.").catch(err=>console.log(err));
    collected.last().message.edit("This operation has expired.").catch(err=>console.log(err));

they are epheral messages if that matters

urban belfry

are they deleted?

obtuse summit

not that I can tell, a user can only dismiss them - at that point it doesn't matter

urban belfry

oh wait they're ephemerals? yeah you can't do it using this, perhaps interaction.editReply would work

when does this "expire"? does it take longer than 15 minutes?

obtuse summit

10 minutes - 100 clicks - and I have a close button

urban belfry

10 minutes shouldn't be an issue

but what does this close button do?

obtuse summit

it triggers a function collector.stop("close")

urban belfry

ok, note that you can't delete ephemerals
now go with editReply

obtuse summit

i'll use update - editReply is spammy

urban belfry

how so?

obtuse summit

it gets a long list of ephemerals

urban belfry

also you can't use update, you already updated on collect

obtuse summit

not necessarily, I can edit the message on click, but its more when it expires that's the issue

urban belfry

i'm telling you to use editReply instead of interaction.message.edit on the end event

it should edit the message

obtuse summit

interesting, so it seems the reply must be deferred - not sure how I would do that for the pagination

the original ephemeral is deferred but the collector simply updates the contents

I set the limit to 1 click to force the end event

urban belfry

could you send me the entire process?
what happens after what?

obtuse summit

I'll water it down since its a big block

const paginate = async (event, client, state) =>{
await event.deferReply({ ephemeral: true });
const page = generatePage(roleOptions,currentPage)

  let xx = await event.editReply({
    embeds: [page.embed],
    components: page.rows,
    ephemeral: true,
    fetchReply: true,
  });

  const collector = xx.createMessageComponentCollector({
    componentType: ComponentType.Button,
    time: 1000 * 60 * 10,
     max: 1,
    fetchReply: true,
  });
collector.on('collect', async (i: ButtonInteraction) => {
if(i.customId == $close){
await i.update({content:"closed"});
collector.stop();
return;}

if(i.customId == ***)
const newPage = generatePage(roleOptions,currentPage)
    await i.update({
      content:message,
      embeds: [newPage.embed],
      components: newPage.rows,
    });
}

collector.on('end', (collected) => {
collected.first().editReply("This operation has expired.").catch(err=>console.log(err));
})
};```
slow storm
obtuse summit
urban belfry
slow storm

or check repliied||deferred if false then update else edit

urban belfry

okay here's the plan @obtuse summit
also remove the max:1, you should end the collector yourself

onCollect((i) => {
  i.update() // or whatever replies to this
  collector.stop() 
})
onEnd((col) => {
  col.first().editReply() // edit the reply which should be the original message
})
obtuse summit
regal mason

What is Auto complete ? (exactly)

urban belfry

yeah but you should remove max

obtuse summit

I removed max for now

urban belfry

now try running it

obtuse summit

interesting, the button works without it crashing

just need to test it when it times out now

urban belfry
obtuse summit

found a potential solution on an empty timeout

    const msg = collected.first()|| event;
    msg.editReply({```
urban belfry

what is event?

obtuse summit

the initial event object ie: client.on =>

urban belfry

will this be executed after 15 minutes?

obtuse summit

doubt it no, 10 minutes is my timeout of all things

urban belfry

then it should be ok

obtuse summit

ok, found some small errors if you interact with it at the same time it's closing - but other than that, its pretty good. thank you @urban belfry - life saver

urban belfry

read the pins

regal mason

How I can restrict the access to certain commands to certain users ? like in this image

plain roverBOT
steel lance

what does MessageAttachment#contentType return if it's a image?

vague coyote
steel lance

for jpeg and png what would it return

scarlet tangle
deft hedge

What changes are needed for v14 from v13?

urban belfry
deft hedge

Didnt explain it

urban belfry

there's a guide

deft hedge

Ah yeah

pallid ice

did Message#reference and Message#fetchReference() change in v14?

urban belfry
pallid ice

I have code that puts a button on certain command responses that lets the user close the response (if they want) and a listener for those button presses that works flawlessly in v13.6 without error but in current v14 it gives errors about unknown message and/or interaction already replied deferred errors - depending on how its feeling

const client = require('../main');

client.on('interactionCreate', async(interaction) => {
    if(interaction.isButton() && interaction.customId === 'botMessageClose') {
        if(interaction.message.reference) await interaction.message.fetchReference().then(m => m.delete())
        interaction.message.delete()
    }
})

it's only a minor issue because it still deletes everything that it's expected to. it's almost like it's running multiple times

urban belfry

then confirm if that's the case
log something, see if that logs multiple times

pallid ice

welp

well yeah that confirmed it, the gateway is seemingly emitting the same event twice

sometimes more than that

urban belfry
pallid ice

well that logs once, on bot load as expected

const client = require('../main');

console.log('banana')
client.on('interactionCreate', async(interaction) => {
    console.log('apples')
    if(interaction.isButton() && interaction.customId === 'botMessageClose') {
        console.log('cheese')
        if(interaction.message.reference) await interaction.message.fetchReference().then(m => m.delete())
        interaction.message.delete()
    }
})

for info, I load legacy command files, then event files and then slash commands hence why the 'banana' appearing in the middle of the console.logs in the console output

gonna try on a second device to rule out a client issue

nope, on mobile it still did it and actually sent the event three times instead of two

I think it's a gateway issue because I had noticed that I was seeing The reply to this interaction has already been sent or deferred. errors elsewhere in the code for slash commands as well as buttons and selectmenus

radiant lintel

when do you think modals will be done

pallid ice
radiant lintel

ik i have been following that

pallid ice

once that gets merged, they'll be in dev

steel lance

I found a bug where guildMemberAdd start's emitting before bot is ready.

im consoling the value of Client#isReady and as you can see it's false a.k.a bot isn't ready.

wary forge

is Djs v14 using experimental nodejs functions?

pallid ice

no, it requires 16.9 but the latest stable node.js is 16.14 anyway

wary forge

NodeJs warned about using experimental functions

velvet jasper

Oh yeah v14 is using experimental features

static loom

So does v14 have major changes to shift to from v13? like will it be lots of work to do it like how it was with v12 - v13?

static loom

i did

velvet jasper

Did u read the guide?

static loom

going to rn

static loom

ok... takes a bit of work but ok

ty...

pallid ice
wary forge

my bad, I didn't get anything like that when I run it and I assumed because it only requires a stable version

wary forge

oh

I got a "ZodError"

what is that

silk topaz
knotty plover

They suck and we're replacing them

dire rover

Is the modals pull request merged ?

knotty plover

No

dire rover
components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
components[0].components[0].options[0].value[BASE_TYPE_REQUIRED]: This field is required```
```js
            .addOptions([
              {
                label: 'Valorant',
                description: 'Select Me To View Valorant Commands',
                value: 'valorant',
              },
              {
                label: 'Fortnite',
                description: 'Select Me To View Valorant Commands',
                value: 'fortnite',
              },
            ]),```
I did put value and label but this error shows up
urban belfry
scarlet tangle

client.on("messageCreate", async (message) => {
  if (message.author.bot) return;
  if (!message.content.startsWith(prefix)) return;
  if (!message.guild) return;
  if (!message.member)
    message.member = await message.guild.fetchMember(message);
  const args = message.content.slice(prefix.length).trim().split(/ +/g);
  const cmd = args.shift().toLowerCase();
  if (cmd.length == 0) return;
  let command = client.commands.get(cmd);
  if (!command) command = client.commands.get(client.aliases.get(cmd));
  if (command) command.run(client, message, args);
});

no reply from bot?

const { Embed } = require("discord.js");
module.exports = {
  name: "ping",
  description: "Returns latency and API ping",
  run: async (client, message, args) => {
    const msg = await message.channel.send(`🏓 Pinging...`);
    const embed = new Embed()
      .setTitle("Pong!")
      .setDescription(
        `WebSocket ping is ${
          client.ws.ping
        }MS\nMessage edit ping is ${Math.floor(
          msg.createdAt - message.createdAt
        )}MS!`
      );
    await message.channel.send(embed);
    msg.delete();
  },
};
copper jetty

Send method takes a single object

scarlet tangle
copper jetty

Or string

young kindle

{ embeds: [embed] }?

did it change or-

scarlet tangle

nah while copy pasting

i pasted v12 code lol

young kindle

ah lmao

v12 🤢

scarlet tangle
copper jetty
scarlet tangle
const {
  Client,
  GatewayIntentBits,
  Partials,
  Collection,
} = require("discord.js");
const client = new Client({
  intents: [GatewayIntentBits.Guilds],
  partials: [Partials.Channel],
});```

Correct?

vague coyote

You are missing GuildMessages or similar, intellisense will help lul

scarlet tangle

  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],``` working in this
 msg.delete();```?

Zod Error?

copper jetty

Send the error

scarlet tangle

No its in .setColor("GREEN")

Any Chnage in that?

Yes, color don't take string anymore

plain roverBOT
scarlet tangle

uhh k

copper jetty
scarlet tangle

      .setColor("#00FF00");```

still eror

copper jetty

This is still a string

scarlet tangle

amm then

copper jetty

0x00FF00

scarlet tangle

will this work ?

 `.resolveColor("GREEN")`
past pumice

are voiceChannel works in djs 14?

like i tried to play something, the bot join the voiceChannel but no sound were play

scarlet tangle

.setColor(Util.resolveColor("GREEN"))

copper jetty

Import Util from discord.js, call resolveColor method on it and put your color string as option

scarlet tangle

uhh k ty

scarlet tangle
                                        ^

TypeError [COLOR_CONVERT]: Unable to convert color to a number.```

error

copper jetty

Its Green not GREEN

scarlet tangle

ty

steel lance

interactionCreate doesn't seem to emit when I use a slash command

steel lance

is there now a intent that you require to access interaction event? Because I don't seem to receive interaction event.

vague coyote

did you spell it right?

you dont need any intents to receive them

steel lance

file is called interactionCreate. I checked the raw event and when I use the slash command I don't see discord sending slash command request to the bot

scarlet tangle

Show code

@steel lance

steel lance
module.exports = class extends Event {

    /**
     *
     * @param {ChatInputCommandInteraction} interaction Interaction
     */
    // eslint-disable-next-line complexity
    async run(interaction) {
        console.log(interaction);
        const start = new Date();

        // if (!this.client.ready) return;

        if (!interaction.isChatInputCommand()) return;

        if (interaction.channel.type === ChannelType.DM) return;
// slash command handler code.
}
}

I tried consoling and it doesn't even emit the event

scarlet tangle

Huh

Who's handler u using?

I meant which basic or from yt or u made own

steel lance

custom handler I made for slash command

based on menudoc's handler but for slash commands instead of prefix commands and other events like 'ready', 'guildMemberAdd' all works. This used to work but suddenly it isn't working

scarlet tangle

Huhhh

steel lance

like interactionCreate event used to emit but now it doesn't I'll try see if the event emits without using my handler

scarlet tangle

Ahh maybe some faults in ur handler

steel lance

code:

client.on('raw', console.log);
client.on('interactionCreate', console.log);

not even raw or interactionCreate emitted.

for interaction related data

so uh it's probably a issue with v14?

fluid bronze

Are you using the right bot?

Not really

steel lance

the user id is same as the bot

vague coyote

what djs version are you on

npm ls discord.js

steel lance

@vague coyote i updated to the latest version 1 hour ago and tried so i think it's the latest dev version

vague coyote

cant reproduce

steel lance

Yes

Didn't work I don't know why it's not emitting

Even the raw event isn't sending any slash command data related to interaction although bot is online on the server

vague coyote

how are you starting the bot

steel lance
dawn phoenix

if that's a third party library please ask them for support

pallid ice
scarlet tangle No its in .setColor("GREEN")

you should read the change guide in pins as it'll help you understand what needs to change in v14. simply put, anywhere that used screaming snake case formatting now using pascal case and strings for things like colours and styles now use enums

pallid ice
dawn phoenix

every time i've had that issue before it turned out there was another process running on the same token

urban belfry
pallid ice

thats some simple code that deletes a message that a certain button is attached to and also deletes the replied to message as well (if one exists). confirmed only one process is running

I also noticed the same issue elsewhere in my code where I was getting 'already deferred or replied' errors where I don't get them in v13.6

fiery anvil

Guys any idea of when discord v14 is coming out

just askin

vague coyote

when its ready

we dont give eta's

fiery anvil

oh ok thx

steel lance
dawn phoenix

well, if you don't spell the event name right, that's quite clear

the capital C matters

steel lance
urban belfry

okay then what? your handler doesn't exist?

dawn phoenix

is the listener even ever attached? does this code run?

steel lance

my handler is fine here I just wanna know why interactionCreate isn't emitting

dawn phoenix

how did you make sure it does?

steel lance

I extended the class and aded those on statements on the file and then ran the start method on the main index.js file and when the bot is loaded the ready event emits so I presume the bot loaded

dawn phoenix

add console.log(this.eventNames()) after login

steel lance

alr

[
  'shardDisconnect',    'ready',
  'disconnect',         'reconnecting',
  'debug',              'interactionCreate',
  'guildCreate',        'guildDelete',
  'shardError',         'shardReady',
  'shardReconnecting',  'shardResume',
  'guildMemberAdd',     'messageCreate',
  'messageReactionAdd'
]

it did add it but it isn't emitting

scarlet tangle

feelsTenseMan brain too fucked up

dawn phoenix

daheck

does the ws one emit?

and messageCreate etc. emit? assuming "this" is client?

steel lance

let me check

actually messageCreate doesn't emit as well uh

urban belfry

could you show your event handler again?

dawn phoenix

are you sure this is actually the client?

log this, i guess?

steel lance

this returns the Bot which is just extended version of Client and just added extra values for like for me to access easily

like the config file etc

tall verge
steel lance

ignore that's just for vsc eslint so I don't have to open docs lol

pallid ice

interaction from a slash command is a ChatInputCommandInteraction. the parameter is correct as far as I can see

steel lance

ye

wary forge

how is the new embed design? because I have already put Author & Footer as objects

knotty plover

You're fine then

fiery anvil

ok how is the modal submit event named?

forest elm

interactionCreate

fiery anvil

oh that's a mythic comeback

no special name given like in third party libraries?

knotty plover

No

interaction.isModalSubmit

We don't make up fake events

regal mason

It is possible to have attachment options on slash commands with djs v14 ?

How ? :)

knotty plover

By adding an attachment option to your slash command

SlashCommandBuilder.addAttachmentOption I think

I dont use builders

regal mason

Oh okay thanks

I thougth it was not implemented yet

fiery anvil

modals aren't am i right?

For now atleast

knotty plover

not merged yet

tame gazelle

you are

fiery anvil
regal mason

What is the purpose of this method ?

(On SlashCommandAttachmentOption)

pallid ice
knotty plover
regal mason

How do I access the submitted attachment from an interaction ?

I'm not sure if this method works (I think not)

pallid ice
knotty plover

idk people always find more changes

knotty plover
hushed wind

Modals are dope, tested out some interaction chains seems promising.

regal mason

How to find the ID of a Command Interaction like in this example

forest elm

you mean the id of the command? you'd probably have to fetch all of them using <Guild>.commands.fetch()

pallid ice

unless I'm mistaken

forest elm

yeah but you have to fetch them like i said

pallid ice

if they're not in the cache, then yes you'd need to fetch them

forest elm

commands aren't cached by default

fading warren

I'm currently trying to reply to an interaction with an attachment. I already have a url for the attachment. From the docs I understand that I can simply put the url in the constructor as first parameter.

But this does not work:

interaction.reply({
  attachments: [new MessageAttachment(imageUrl)]
});
DiscordAPIError: Invalid Form Body
data.attachments[0].id: This field is required
forest elm

use files instead of attachments

fading warren

ok, will try

thx

works great 👍

obtuse summit

not sure if its v14 or not - but I have noticable lag with the user roles being set to the cache

I am paginating the results after the role assignment based on what roles the user has

it doesn't happen all the time

regal mason

How to cache guild application commands ?

jaunty vault
regal mason

thx

lethal trail

where is v14 changes html page?

jaunty vault
lethal trail

ty

regal mason

Why this happens, I removed the attachment option from the command

obtuse summit

I invited my bot to a new server and I got this error:

      if (this.guild.id !== data.guild_id) throw new Error('GUILD_CHANNEL_UNOWNED');
                                                 ^
Error [GUILD_CHANNEL_UNOWNED]: The fetched channel does not belong to this manager's guild.```

I am unsure how to fix it- I thought it was a permission but it has administrative permissions

! commands also worked before inviting it

dawn phoenix

sounds like you are trying to fetch a channel from a guild-based channel manager that's not on this guild

obtuse summit

I am responding to the message event with the guild from message.guild.id

dawn phoenix

<someGuild>.channels.fetch("someid") someid does not belong to someGuild

can you show the full stack trace?

obtuse summit

I think I know what the problem was

the original developer used cache.first() and it was throwing things off

split fulcrum

Does Numbers still work in the Slash Command Options Type?

like 1-12 or what it is

split fulcrum

okay

what does this error mean don't get it and it does not know where the problem is

urban belfry
split fulcrum
jaunty vault
split fulcrum

oh

what is it then?

jaunty vault
urban belfry

we know it'll be undefined, there's no point
search for where you call this function instead

split fulcrum

true let me check fast

velvet jasper
split fulcrum

Okay

velvet jasper

all permission strings are now PascalCase not SCREAMING_SNAKE_CASE

split fulcrum

Okay good to know

about the setActivity how does that work now?

did that change or

can't find anything in Guide

urban belfry

it did not change, the only thing there that did is that you now need to use the ActivityType enum

split fulcrum

So change the Type to ActivityType??

Like this?

urban belfry

no the property is still type

velvet jasper

no, set type to ActivityType.Streaming

split fulcrum

do i get the ActivityType from the const { ActivityType }?

velvet jasper

the enum, yes

thats fine

split fulcrum

So like this or did i understand it wrong?

velvet jasper

thats correct

split fulcrum

okay

Did any events change?

or is it just the ones with client.ws.on?

fluid bronze

ws isnt needed

split fulcrum

ik ik

tame gazelle
TypeError: (intermediate value).setAuthor(...).setColor(...).addField is not a function
    at Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\utility\userinfo.js:68:18)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\events\interactionCreate.js:33:17)
    at async Client.<anonymous> (H:\IdrisGaming\Discord Bot\ObitoInteractions\Structure\Client.js:47:25)
urban belfry

addField got removed 👍

tame gazelle

ah

split fulcrum

What does this mean ;-;

keen bobcat

you passed a string where it expects a number

split fulcrum

Hmm

urban belfry

setStyle too takes the enum ButtonStyle
this is covered in the guide

split fulcrum

if i'm right all permissions that has Big caps and _ in it will just be like EmbedLinks?

What about GUILD_STAGE_VOICE? is that just GuildStageVoice now or?

hardy wind

Hey guys, does embed.addFields() work the same as embed.addField() did or is it now essential to parse an array of fields to this method?
Thanks

urban belfry
plain roverBOT

_ Rest parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.

wicked nebula

Looks like modals are almost done POGGERS

If discord adds Permissions v2 within the next 1-2 months, is it going to make v14.x?

gritty citrus

no

urban belfry

there's no way of telling, we don't have etas
it comes out when it's ready ™️

abstract bison

Hey, I'm getting this error when I execute this code:

Code:

message.member.permissions.has(PermissionsBitField.Flags.manageMessages)
``` Error:
```Uncaught RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.``` It happens when a member who isn't administrator send a message
gloomy kayak

Should be ManageMessages iirc

abstract bison

Aah thx

and question: it's now impossible to get the createdTimestamp of an activity ?

I'm getting NaN

radiant lintel

modals is looking promising

austere grove

1 pending vlad

latent lion

What does this error mean?

uncut kelp

The provided emoji for your component was invalid

pallid ice
latent lion

ok

pallid ice

other options are id: and animated:

latent lion

thanks

pallid ice

no worries

weak ridge

Hi! Anyone have a list of badge names?

weak ridge

In V14

knotty plover

Badge's arent exposed in the bot API

The closest is the user flags, but they're pulled from discord-api-types

So I'd go with the discord docs for now

obtuse summit

I had an odd error last night -
"unknown interaction"

C:\bot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:487
                                throw new DiscordAPIError(data, 'code' in data ? data.code : data.error, res.status, method, url, bodyData);
          ^
DiscordAPIError[10062]: Unknown interaction
    at C.runRequest (C:\bot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:487:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at C.queueRequest (C:\bot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:200:11)
    at ButtonInteraction.update (C:\bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:215:5)    
    at InteractionCollector.<anonymous> (C:\bot\src\events\microfunctions\selfroles.ts:190:5)

the line in question failed here:

collector.on(
    const newPage = await generatePage(i, currentPage, catagory.roles, event.member.roles.cache);
> err >await i.update({
      content: message,
      components: newPage.rows,
      fetchReply: true,
    });
velvet jasper
forest elm

not a thing

velvet jasper

That’s not a version

Run npm ls discord.js

obtuse summit

^14.0.0-dev.1645661258.8203c5d

velvet jasper

I don’t think this is a djs issue it’s most likely an issue with your code. That error occurs when you try to interact with an expired interaction. Try deffering the interaction

obtuse summit

this happened just after I put the bot public, I added the self roles and within 2 minutes - it occured

velvet jasper

Keep in mind interactions only last 3 seconds by default

Make sure you’re responding in enough time

obtuse summit

it is deferred at the top, this is inside the collector

timeout set to 10 minutes

forest elm

are you creating the collector on a message or in a channel

obtuse summit

and at the end, it changes the messages to 'expired'

message:


  // reply
  let xx = await event.editReply({
    content: message,
    // embeds: [page.embed],
    components: page.rows,
    ephemeral: true,
    fetchReply: true,
  });

  // collector
  const collector = xx.createMessageComponentCollector({
    componentType: ComponentType.Button,
    time: 1000 * 60 * 10,
    fetchReply: true,
  });
velvet jasper

Have you deferred the interaction within the collector event

obtuse summit

no, should I?

velvet jasper

It’s worth a try because your error is basically saying the interaction wasn’t responded to in less than 3 seconds

obtuse summit

is there a way to check if it is already deferred? I believe an error is thrown if you try and defer twice

velvet jasper

Yeah interaction.deferred

obtuse summit

thanks, hopefully that solves it

pallid ice

I've had similar issues with interactions seemingly being emitted multiple times with v14

so it might not be just you

tame gazelle

any updates?

uncut kelp

Since no one made an issue... no

tame gazelle

._.

hushed wind

the "I" was suggesting you to make one

cerulean bay

As color hex isn't supported anymore for Embed Color, is there an easy way to convert #9100fb?

cerulean bay
velvet jasper

That is a number

It’s a hex number literal

forest elm
cerulean bay

Hoo, i see. Thanks!

Is there a class builder for that? In which i can pass a string and it returns a number?

forest elm

why? you can literally just use 0x<hex> instead of "#<hex>"

cerulean bay

Or just use Number()?

forest elm

e.g. setColor(0x9100fb)

cerulean bay

Yea but my 9100fb will be a string.

From the way i pull the data. I can always just cast it

austere grove

there is Util.resolveColor() if u really want to

plain roverBOT

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

cerulean bay

Perfect. Thanks

cerulean bay

I've made some researches but can't find where or how is this feature called.

cerulean bay

Thanks!

Is it in v14 yet?

Can't find it in the doc

copper jetty

no

stoic hedge

Has addField been removed?

cerulean bay

Gave me a lot of rework 😂

copper jetty

You just need to replace addField with addFields

cerulean bay

Not exactly

velvet jasper

why not

cerulean bay
.addField('name', 'value', true)```
As to be replaced by 
```js
.addFields({
    name: `name`,
    value: `value`,
    inline: true
  })

Just adding the s dosen't do the trick

velvet jasper

oh thats pre 13.6 I think

cerulean bay

Maybe.

forest elm

that's pre 14

stoic hedge
cerulean bay

Not sure what you mean but that's how it now works in v14

copper jetty
cerulean bay

It's still like this

forest elm

yeah, initially in v14 addField was changed to only accept an object, but then got removed as it was obsolete since addFields exists

cerulean bay

Hoo i understand

Alright!

cerulean bay
stoic hedge
velvet jasper

that's because the change occurred recently

cerulean bay

Can modals be used in any type of interaction? Can i return a modal for someone clicking on a button?

stoic hedge
forest elm
cerulean bay
velvet jasper
cerulean bay

That's nice. And can we have a select menu inside a modal?

velvet jasper

not yet

distant rampart

no, text only for now

forest elm

no, only text inputs

cerulean bay

Thanks guys xD

They only say between 1-5 components

velvet jasper

yeah at the moment you can only have 5 text input components

cerulean bay

Yea. It's only that they don't specify that it's only TextInput. They only say Components and refer to all 4 component types

cerulean bay

For AutoComplete Interactions, is there a limit of items we can return? I can't find the limit and wondering if Discord will accept to many items if i don't filter them?

dawn phoenix

20

forest elm

yeah no, its 25

dawn phoenix

close enough

was 20 selects, or is that 25 as well?

forest elm

also 25

i cant think of anything that has a limit of 20

dawn phoenix

then i have no idea where i got 20 from 02Shrug

cerulean bay

Alright, thanks!

austere grove

choices were up to 20 in the past, they then increased it to 25

maybe u confused with that

hushed wind
velvet jasper

Discord limitation

copper jetty

we don't know

dapper gull

The answer is always...

ETA: when it's ready™️

copper jetty

it's ready so it will be merged soon i think but idk

dapper gull

Yeah, it's looked like this several times during the process, that just denotes that current conversations and reviews are resolved, not that new ones aren't still happening or due. It could be merged 5 minutes from now or a month from now. Unfortunately, we don't know at this stage and we will just have to be patient.

velvet jasper

Please stay on topic

copper jetty

what

velvet jasper

<@&839912195994812420> off topic

knotty plover

It's ready when all of the core maintainers have approved it

And even then we might not merge it right away

austere grove

v14 merged YEEES

west fjord

for those wondering, the pr was just merged 🎉 (don't forget the 12 hour release cycle though)

austere grove

the dev release should be available in about 3 hours 👀

willow garnet

keep the channel on topic, both of you.

austere grove

oh, sorry
but if prs merging don't follow the topic then whoever asked if it will be merged is also not following it
gtg though

vague coyote

sounds very on topic shrug

this is a channel about the @ dev version, so why does that have to be problems only?
wouldn't make any sense

lament wave

are modals merged on v14 now?

stark valley
lament wave

noice

dull mulchBOT
small mica

permission flags changed in v14?

knotty plover

Please read the upgrade guide

String flags turned into enums

small mica

hmm okay!

velvet jasper

As of 16 minutes ago modals are now available in v14 dev

quasi kite

How do I blacklist a user from using any commands. Is there any way for the command to not work when that user uses the command?

split fulcrum

Where did the client.api go???

Did it get removed or

pallid ice

I believe you need to use client.rest now

west fjord
urban belfry
west fjord
tepid mauve

does djs 14 have types for errors?
like collector error.. etc

pallid ice

I'm a little confused about modals. I was under the impression that you could trigger a text input modal to appear on screen as a response to a ChatInput command but the brief example on the PR implies that it is itself a completely separate form of CommandInteraction. the PR shows how to handle the received data from the modal submit but not what would trigger the modal to be shown in the first place

tepid mauve
pallid ice

hmm I saw that but don't have .presentModal() as a method on a ChatInputCommandInteraction so thats why I was asking

tepid mauve
pallid ice

nope

tepid mauve

showModal, too?

pallid ice

no to both

tepid mauve
pallid ice

oh wait no I fatfingered it and typed showModel, not showModal lol

tepid mauve

lol ok

knotty plover

Yeah the example is outdated

pallid ice

do we know when typings will be done? for things like intellisense?

knotty plover

They are done

pallid ice

okie doke, I know its dev so I don't expect them until its pushed to stable. just curious

I did notice a maybe bug that I need to open an issue for related to events being emitted multiple times

I've basically had to change all my event listeners from client.on to client.once

knotty plover
urban belfry
urban belfry

odd, i'll have to test that out too then, what event are you listening to?
can you give more detail on this?

pallid ice

so the event that made me spot the issue was this one listening specifically for button presses with a certain customId

with it set to client.on I found that I would get interaction already replied to errors. using console logs I confirmed the event was being run multiple times

urban belfry

yeah perhaps try changing to the event handler in the guide

copper jetty
vague coyote

looking at that screenshot gives me the feeling thats not the only place in your bot where you have an interactionCreate listener lol

pallid ice
urban belfry

this file is being called by main.js in a way, and you also require main.js here too, not really something i'd recommend
instead i'd recommend the guide's handler

pallid ice

its not being called by main at all

but ok

urban belfry

no it must be, it can also be that main calls another file that calls this
i did say in a way

lament wave

can i use collectors to get modals submit interaction?

pallid ice

to clarify, there is nothing wrong with my handler as it's worked flawlessly since v13 first got pushed. this issue now only started happening when I moved to the v14 dev. as nothing in the current 13 > 14 guide mentions changes to client.on or client.once I have to assume it's a bug

pallid ice

in short, the file gets loaded once by the handler but ran multiple times with client.on even though the button it's listening for only gets pressed once

urban belfry
forest elm

if it was an actual issue with discord.js you'd be able to replicate it in a single file too, no need to be changing handlers. try creating a minimal reproducible example

pallid ice

tbh, I'd rather do that. because this handler has served me and hundreds of others well for over a year and I don't feel like changing it when it's clear I shouldn't need to.

I'll produce a small environment to demonstrate the issue clearer

knotty plover

Yes

split fulcrum

what does it mean with this?

dawn phoenix

making a request before the token is available / deleting the token

split fulcrum

Well i don't see any problem here ;-;

copper jetty
pallid ice
split fulcrum

So Button now then

pallid ice

I’m not at my PC to check, but if I recall correctly it’d be componentType: MessageComponentType.Button

split fulcrum

Okay

copper jetty

It's called ComponentType

pallid ice

Oh there we go

split fulcrum

so

ComponentType: MessageComponentType.Button

right?

copper jetty

componentType: ComponentType.Button

split fulcrum

ahh thanks

pallid ice

No, the option hasn’t changed

Yeah that

pallid ice
velvet jasper

The example is builders

pallid ice
urban belfry

nope

multiple choice objects ( rest parameter )

dawn phoenix

if things breaking surprises you, you should probably not run a development build - or pin it to a certain commit in your dependencies

velvet jasper

There’s still another large builder refactor to come mmLol

urban belfry

what is that? the zod errors being fixed?

copper jetty

whats wrong with zod errors

urban belfry

not really that descriptive
and unhelpful for narrowing down where the error came from in cases

velvet jasper
dull mulchBOT
urban belfry

makes sense so the zod issue's not being worked on?

velvet jasper

It is, but that change shouldn’t affect how you use builders

copper jetty

zod errors are veri clear to me

ornate laurel

why did you change SEND_MESSAGES to SendMessages? this makes it really hard to edit the way people wants ( i aint using it, just asking)

uncut kelp

Is it that hard? Lol

candid palm

is there a dev build for Attachment option on v13?

ornate laurel
uncut kelp

Attachments have been out for a few weeks

candid palm
uncut kelp

It's not in version 13

candid palm

only gonna be on v14?

uncut kelp
candid palm

ik but im just asking how can i use it on a dev build like the modals PR request

uncut kelp

You install it with npm install discord.js@dev

candid palm

is modals on that version aswell cus im still using the modal pr request

icy rover

Hi, i got this error starting my bot

uncut kelp

Yes

copper jetty
icy rover

okay

candid palm

awesome thanks and what is the type value for attachment?

uncut kelp

Use the enumerables

west fjord

apologies if this is off-topic, but do enums affect memory usage? what i mean is, rather than using type: 1, you import a class / enum, then get the value from the enum key you want. obvsiously we're probably talking bytes here so im not worried about running out of ram, just wondering if there's any negatives to using them for larger scale bots. fwiw, i'm not against enums lol (in fact i like the change)

ornate laurel

i prefer using raw json but that's just me

velvet jasper
west fjord

yeah im finding them a lot easier to use, saves having about 20 tabs of dapi docs with all the types fields lol

ornate laurel

everyone has preferences ¯_(ツ)_/¯

icy rover

How i can create a form?

ty

copper jetty

can you put true instead of 1 in the type?

urban belfry

what type?

copper jetty

slash commadn

forest elm

no

urban belfry

they specifically take numbers right? also it's needless, what will you do for 2, 3 , 4 and so on?

forest elm

you're not funny

name is displayed to the user

ornate laurel
urban belfry

the enums end up passing numbers in the end
is what i was referring to

icy rover

idk how to do it... im new on this

ornate laurel

its good for people that cant remember the types

try reading it

icy rover

yes but im so noob :(

i just started

velvet jasper
icy rover

ok...

forest elm
velvet jasper
lament wave

does discord.js@14.0.0-dev.1646395406.6f7a366 have modals?

velvet jasper

yes

lament wave

welp, then

    const m = new Modal()
    .setTitle('aaa')
    .setCustomId('a')
    .addComponents([
        new TextInputComponent()
        .setCustomId('texto')
        .setLabel('sera!')
        .setValue('boh!')
        .setStyle(1)
    ])
    await message.reply({content: 'a', components: [m]})

why this is returning components[0][COMPONENT_TYPE_INVALID]: The specified component type is invalid in this context?

velvet jasper

you have to use action rows in modals not text inputs directly

copper jetty

add text input to the action row and the action row to the modal

and addComponents doesn't take an array

tame gazelle
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width
    at C.runRequest (H:\IdrisGaming\Discord Bot\ObitoInteractions\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 (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:5:3049)
    at async ChatInputCommandInteraction.showModal (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
    at async Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\utility\modal.js:30:9)
    at async Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\events\interactionCreate.js:55:17)
    at async Client.<anonymous> (H:\IdrisGaming\Discord Bot\ObitoInteractions\Structure\Client.js:48:25)
copper jetty

I think ActionRow takes only one TextInput

solemn egret

Im feelin like going to dev build just for the modals what do you guys think

with my soon production bot

velvet jasper
tame gazelle

thanks guys

lament wave
copper jetty and addComponents doesn't take an array
    const m = new Modal()
    .setTitle('aaa')
    .setCustomId('a')
    .addComponents(
        new ActionRow()
        .addComponents(
        new TextInputComponent()
        .setCustomId('texto')
        .setLabel('sera!')
        .setValue('boh!')
        .setStyle(1)
    )
)

gives same error

lament wave
split fulcrum

Version 14.0.0-dev.1646395406.6f7a366

its just spamming that

stark zephyr

how can I set activity? I'm doing js const { GatewayIntentBits, Partials } = DiscordJS const client = new DiscordJS.Client({ partials: [ Partials.Channel, Partials.Message ], intents: [ GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages ], presence: { status: 'online', activities: [{ name: 'Roblox', type: 'PLAYING' }] } }) but it's not setting activity..

copper jetty
split fulcrum
stark zephyr

ff- tysm

copper jetty
stark zephyr
copper jetty

type: ActivityType.Playing

stark zephyr

I just wished they had docs for v14

stark zephyr
copper jetty
tame gazelle
TypeError: Cannot read properties of null (reading 'tag')
    at Object.execute (/root/ObitoInteractions/commands/utility/bot.js:47:85)
    at Object.execute (/root/ObitoInteractions/events/interactionCreate.js:55:31)
    at Client.<anonymous> (/root/ObitoInteractions/Structure/Client.js:48:37)
    at Client.emit (node:events:520:28)
    at InteractionCreateAction.handle (/root/ObitoInteractions/node_modules/discord.js/src/client/actions/InteractionCreate.js:76:12)
    at Object.module.exports [as INTERACTION_CREATE] (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketShard.js:304:10)
    at WebSocket.onMessage (/root/ObitoInteractions/node_modules/ws/lib/event-target.js:199:18)

interaction.client.application?.owner.tag

copper jetty

Fetch the application

solemn egret

hello folks, potential bug or am I being unsmart again?

it seems TS doesn't complain when I send a single element

tame gazelle
solemn egret

But a list of elements is an issue for setComponents function

deep jetty
solemn egret

didn work

did work

i tried it before but I did it wrong apparently cause it works now

lament wave

how to get modal submits with collectors? Message.createMessageComponentCollector isnt getting it

pallid ice

@urban belfry as per your advice earlier, rewrote my event handler using the official guide and can confirm that events that use client.on are still being emitted multiple times from a single file for a single interaction

knotty plover
solemn egret

Could it be a typing issue? I've lost some braincells over this

knotty plover

ActionRow<ModalActionRowComponent>

Try that

solemn egret

That seems to have worked, sorry, still new to TS!

snow acorn

Right now there is no modal collector in the dev branch right?

solemn egret

Legends say interactioncollector works

scarlet tangle

Hi for interaction options type 11
Im trying to get attachment url

const picture = interaction.options.getAttachments('avatar');		

Console log :
getAttachments is not a function

cerulean bay
solemn egret
dawn phoenix

pingBOYE why

copper jetty
cerulean bay
lament wave

oh nvm, found it

snow acorn

That does indeed work thank you very much

scarlet tangle
dawn phoenix

no, stop pinging

copper jetty
solemn egret

There seems to be a change with interaction.options

It no longer fetches options, I don't know how to get stuff from slash commands atm

uncut kelp

Lol

tame gazelle

did you even read what they said? ._.

solemn egret
copper jetty
solemn egret

Perhaps a simple casting will suffice, lemme try

copper jetty
urban belfry
solemn egret

Ahh I getcha

urban belfry

For now at least
Command interaction may include slashies and context menu commands

solemn egret

I think that would be a better resolution but the devs would know better

scarlet tangle

@copper jetty

copper jetty
scarlet tangle

interaction isn't ChatInputCommandInteraction or you're not using latest dev version

scarlet tangle

Djs vrs : 13.6.0 the latest

dawn phoenix

this is a channel for discord.js@dev

copper jetty

You can't use Attachment options in v13 yet, update to dev branch if you want to use it

scarlet tangle

Ok .

dawn phoenix

or... don't yet, if you are struggling with version updates

copper jetty

because you're using typescript

knotty plover

You need to type your ActionRow<ModalActionRowComponent>

solemn egret

Everyone seems to be killed by this xD

knotty plover

Then why are you getting a TS error?

forest elm

js intellisense is powered by ts

knotty plover

Can probably ignore it then

scarlet tangle
forest elm

pins

knotty plover

Bitfield flags changed in the upgrade, see pins

hushed wind

Idk why people are struggling with modals so much? Works fine, just wish discord would let you add Select components to them.

dawn phoenix

that's coming™️

they picked to release it with just text instead of waiting much longer, which i personally appreciate, but some people are upset about?

people are weird

forest elm
hushed wind

I'm using js for my project not having issues.

forest elm

its an issue with the typings, not the runtime behaviour

velvet jasper

The typings are intentional, you’re supposed to provide a generic parameter for action rows now

forest elm

sounds unnecessary

knotty plover

It isn't

I mean it's that or have two separate classes MessageActionRow and ModalActionRow

You'd still have to differentiate

velvet jasper

Which I want to avoid, and it’s a problem generics solve. Imagine having to have a new array class for each kind of element it holds

hushed wind

Sounds like an unsustainable maintenance nightmare

forest elm
velvet jasper

It can probably be removed iirc rodry added that. But you can’t enforce classes to provide generic parameters anyways

knotty plover

You can't? I thought without a generic default it would tell you it requires one

Like Collection does

velvet jasper

Collection doesn’t it’s perfectly valid to do new Collection()

forest elm

only on type annotations, its not actually required when you construct it

knotty plover

Right

forest elm

new Collection() is valid, but let thing: Collection is not

velvet jasper

Yeah…? Js doesn’t have generics

knotty plover

It doesn't matter in JS though

solemn egret

I'm not upset at all, I just can't wait for fully functional Modals

This will do for my bot atm

uncut kelp

What exactly isn't functional

solemn egret

Missing components

uncut kelp

There is only one though, I don't think we're missing any?

hushed wind

They're talking about the Soon™

solemn egret

Modals can take all kinds of components

From what I gather

uncut kelp

No, just one

solemn egret
uncut kelp No, just one

Ah, it was my confusion! Apologies, I thought the select menus for modals were a thing on discord api already

uncut kelp

Only text input at the moment

west fjord

(unsure if this is a djs-dev issue, sorry if it is). using ts-code to run if that makes a difference?

forest elm

probably have to install @discordjs/builders@dev too

west fjord

yeah that worked, thank you

scarlet tangle

Hi

Modals input texts are ready for v14-dev?

outer bane

yes

scarlet tangle

alr

Structure pro

fallow steppe

Any idea why ModalSubmitInteraction has no deferred or replied like other interactions?

uncut kelp

It's a bug

fallow steppe

Gotcha, cheers

quasi kite

require GatewayIntentBits from discord.js

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

A quick suggestion. Along with v14 of discord.js
It would be nice if you could add TypeScript code examples too. Like those tabs with TS and JS.

knotty plover

That's something we intend to do eventually

west fjord

do i need to check if member is a GuildMember before using this, or have i done it wrong?

umbral slate
fiery anvil

that's new

umbral slate
fiery anvil

oh

fiery anvil
umbral slate
fiery anvil
    at SlashCommand.run```

This changed too?

dawn phoenix

see pins

fiery anvil

i did, still not understanding what changed, im quite new to bot developing so go easy on me 😄

pallid ice

if you're trying to go from v13 to v14 dev without reading the migration guide in pins then you're in for a bad time, like others have said - read pins

fiery anvil

i read all the links right there except for that one

Sorry'

Thx for the help guys

tame gazelle

how many action rows can we put in a Modal?

in the <Modal>#addComponents() method

knotty plover

5

tame gazelle

thanks

pallid ice

someone ghost pinged me?

fiery anvil

do u guys have a quick example of command wrote in v14, so i can integrate faster the changes?

tame gazelle

all codes are different

read the guide, try to update
and if you got an error you can still ask here

fiery anvil

well that's the reason i asked for an example cuz i don't want to keep asking

tame gazelle

we don't even know what your bot does

fiery anvil

I know, i'm just asking for embed declaration, that's it cuz i keep gettin the zod error

the other things like action row and etc works like a charm

tame gazelle

MessageEmbed is now Embed
.addField() got removed
.setColor() now takes a number

that's all for embed iirc

fiery anvil

THANK U

the setColor got me the error

bruh

outer bane

Embed is re-exported from builders which has documentation too

fiery anvil
polar lantern

Hey there, i realised that message.author.ban() wasn't a thing, what would be the correct syntax please ?

tame gazelle

message.member

polar lantern
tame gazelle

didn't get

polar lantern

I mean, the point of it is to ban the author, so message.member is the author of the message ?

tame gazelle

as a GuildMember and not a User, yes

polar lantern

Oooh i see

tame gazelle

because you cannot ban a User

polar lantern

Thank you !

tame gazelle

no prob

urban belfry

a small clarification, you can ban a user, just that the method can't be called on a user object

solemn egret

Embed zod error also rises if you dont specify the type of textfields

solemn egret

The short vs paragraph

Im not at home cant reproduce but I can if needed

velvet jasper
solemn egret
velvet jasper

Yeah? Why wouldn’t it, it’s required

cold lotus

addField removed? How can I add fields in the embed?

tame gazelle

.addFields()

cold lotus

Oh bruh

I forgot that

haughty sequoia

Why's addField going away 🤔

I've read the pins and the links don't seem to mention anything about it

vague coyote

cuz its work in progress?

haughty sequoia

so there's no reason for it yet?

vague coyote

wdym, sure there is a reason, I was talking about it missing in the guide

haughty sequoia

Oh, I'm just wondering why it's going away, since I just Refactored a fuckton of my embeds to use sole objects and now I hear this 😂 🥲

dull mulchBOT
velvet jasper

@haughty sequoia ^

haughty sequoia
vague coyote

Yes, of course

haughty sequoia

might be worth editing ¯\_(ツ)_/¯

scarlet tangle

Hi, so after installing the master branch, I began experiencing this issue.

haughty sequoia

check pins, Intents part

scarlet tangle

I'm getting this error when I create my client.

velvet jasper

Please provide your code with the error

scarlet tangle
const { MessageActionRow, MessageButton, Client, Collection, GatewayIntentBits, Partials } = require('discord.js');

const client = new Client({ partials: [Partials.Message, Partials.Reaction], intents: [GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMembers, GatewayIntentBits.Guilds, GatewayIntentBits.DirectMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessages] });
forest elm
onyx plume

How can I see the changed features in v14 version?

forest elm

pins

sterile vortex

Hi, I was wondering if some kind of "interaction.channel.awaitModalSubmit()" was coming or was planned?

copper jetty
sterile vortex
sacred cradle
const { ActionRow, TextInputComponent, TextInputStyle, Modal, ModalActionRowComponent } = require("discord.js");
// command handler stuff....
        const modal = new Modal()
            .setTitle("Test Modal")
            .setCustomId("test");

        const textInput = new TextInputComponent()
            .setCustomId("text")
            .setLabel("Test input")
            .setStyle(TextInputStyle.Short);

        const rows = [textInput].map(
            (component) =>
                new ActionRow<ModalActionRowComponent>().addComponents(component)
        );
        modal.addComponents(...rows);
        await interaction.showModal(modal);

(as specified in the PR) - why is it returning an unexpected token ) in the new ActionRow<> part?

discord.js version: discord.js@14.0.0-dev.1646395406.6f7a366
Node.js version: 17.6.0

tame gazelle

remove the <ModalActionRowComponent>

sacred cradle

Bot turns on now, let me try the command now

sacred cradle
radiant lintel

any docs / guide on modals atm?

uncut kelp

It is on the main branch for documentation at the moment

radiant lintel

is js const rows = [ignname, previousexperiance].map( (component) => new ActionRow().addComponents(component) );best way to add components?

is their a yes / no Text Input Style

knotty plover

Uhh I guess that way works to add them

I don't know what you mean by yes/no text input

They do not restrict what text you can input

sacred cradle

he means multiple choice

knotty plover

Well that wouldn't be a text input

radiant lintel

does it exist?

knotty plover

No

Modals only support text input right now

radiant lintel

ok

hope they add more soon

sterile vortex

The pin method seems not to work in the discord.js@14.0.0-dev.1646395406.6f7a366 version. I'm posting in case it's a bug 🤷

interaction.channel?.send('Test').then(message => {
   message.pin()
})
DiscordAPIError[0]: 405: Method Not Allowed
    at C.runRequest (C:\Users\...\Bot\node_modules\@discordjs\rest\dist\index.js:7:581)      
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async C.queueRequest (C:\Users\...\Bot\node_modules\@discordjs\rest\dist\index.js:5:3049)
    at async MessageManager.pin (C:\Users\...\Bot\node_modules\discord.js\src\managers\MessageManager.js:167:5)
    at async Message.pin (C:\Users\...\Bot\node_modules\discord.js\src\structures\Message.js:694:5) {
  rawError: { message: '405: Method Not Allowed', code: 0 },
  code: 0,
  status: 405,
  method: 'put',
  url: 'https://discord.com/api/v9/channels/949781425413058611/pins',
  requestBody: { files: undefined, json: undefined }
}
outer bane

that is indeed a bug

dull mulchBOT
shy arch

how can I add descriptions to my modals?

forest elm

modals don't have descriptions

sacred cradle

What is the correct way to 'close' a modal after it has been submitted?

gritty citrus

u need to reply to the modal

fiery anvil

so the MessageButton() method changed to only Button()?

forest elm

ButtonComponent

fiery anvil

Thx

scarlet tangle

TextChannel#awaitMessageComponent does not accept modal submit event. I tried to specify componentType. What's wrong?

outer bane

it's not a component. you can use an InteractionCollector instead

scarlet tangle
dapper forum

what codeblock is used for this magic???

scarlet tangle
dawn phoenix

close enough, ansi

past gulch

Nklz_2

golden shell

yo

does @dev have docs?

shit i didnt mean to ping

rocky parrot
golden shell

oh cool thanks

rocky parrot

Everything is in the pins as per the topic

golden shell

ight

dawn phoenix

include the escape character



scarlet tangle

it also simply doesn't works on android or ios yet

stiff pivot

Hi guys

I've an error```
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required

        const selector = new SelectMenuComponent()
            .setMaxValues(3)
            .setCustomId("roles_bm")
            .setPlaceholder("Choisissez vos rôles (en tant que Blade Master)")
            .addOptions([
                {
                    label: "DPS",
                    value: "dps"
                },
                {
                    label: "Tank",
                    value: "tank"
                },
                {
                    label: "Support",
                    value: "support"
                }
            ])

Anyone can help me pls ?

urban belfry

try updating to the latest commit, add passing multiple parameters instead of an array on addOptions

stiff pivot
urban belfry
addOptions({...}, {...}, {...})
```instead of an array
stiff pivot

like thi

.addOptions(
                {
                    label: "DPS",
                    value: "dps"
                },
                {
                    label: "Tank",
                    value: "tank"
                },
                {
                    label: "Support",
                    value: "support"
                }
            )

this*

urban belfry

yes

stiff pivot

yeah it's working

thank's u

sacred cradle

How do I use the APIMessageComponentEmoji type in my buttons? I want to use ✅ and ❌

urban belfry
sacred cradle

Got it. thank you

stiff pivot

Any doc for modal / text input (discord.js) ?

plain roverBOT
stiff pivot

thx bro

stiff pivot

Can i add button on modal ?

or select menu

gloomy kayak

no, actually only text inputs are supported by discord