#djs-in-dev-version

35223 messages · Page 16 of 36

small mica
if (!args[0]) {
      const directories = [
        new Set(client.commands.map((cmd) => cmd.directory)),
      ];

      const formatString = (str) =>
        `${str[0].toUpperCase()}${str.slice(1).toLowerCase()}`;

https://shanara.host/i/v1ru99au

if I add the ... before new Set I am getting this error

CombinedError (2)
  Received one or more errors

  1 CombinedPropertyError (2)
  |   Received one or more errors
  |
  |   input.value
  |   | MissingPropertyError > value
  |   |   A required property is missing
  |
  |   input.label
  |   | MissingPropertyError > label
  |   |   A required property is missing

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  |
  |   Expected:
  |   | [class UnsafeSelectMenuOptionBuilder]
  |
  |   Received:
  |   | { '0': [Object],
  |   |   '1': [Object],
  |   |   '2': [Object],
  |   |   '3': [Object],
  |   |   '4': [Object],
  |   |   '5': [Object],
  |   |   '6': [Object],
  |   |   '7': [Object],
  |   |   '8': [Object],
  |   |   '9': [Object],
  |   |   '10': [Object],
  |   |   '11': [Object],
  |   |   '12': [Object],
  |   |   '13': [Object],
  |   |   '14': [Object],
  |   |   emoji: undefined }

anyone knows whats wrong?

knotty plover

It's a set of arrays though

I think ....

small mica
new Set[
          (client.commands.map((cmd) => cmd.directory))
        ],

shows not a constructor

idle galleon

It is quite strange to access a Set using an Array

small mica

yeah, so how can I do it?

idle galleon

You don’t

Set['["foo", "bar", "baz"]'] prob doesn't exist

small mica

https://srcb.in/bMOV7Cppga
this is my full help command code. How can I update it latest version if the latest dev version doesnt accept ...?

idle galleon

addFields takes an Array

small mica

so

.addFields([name: "test", value: "this is a test"])```
idle galleon

Or no, it says label, not name

small mica

so I can use the normal addFields itself, just change name to label?

idle galleon

While it prob is the case, it’s not the current issue

small mica

so I can continue using name as well?

urban belfry
small mica

ohok

idle galleon

Error is from select menu builder

small mica

so it means I can even use ```js
...new Set(client.commands.map((cmd) => cmd.directory)),

small mica
urban belfry

no, that's wrong
it's an array of objects, objects in an array

knotty plover

It doesnt take an array on stable yet

Youd have to be running builders dev

small mica

i uninstalled builders coz jiralite said its not needed

urban belfry

so what you're using djs' exported EmbedBuilder class?

small mica

yup

knotty plover

Yeah so if you're importing from djs, its not an array. Yet

small mica

oh

urban belfry

so a rest parameter, where each is a field object

small mica

but whats this error?

urban belfry

addOptions still takes a rest parameter then

spread that array on your addOptions

small mica

ok ill try

.addOptions(
            ...categories.map((cmd) => {
              return {
                label: cmd.directory,
                value: cmd.directory.toLocaleLowerCase(),
                description: `Commands from ${cmd.directory} category`,
              };
            })
          )

still same error

new error after I updated the code to spread the arrays

knotty plover

wait thats from line 55 though

Can you show your imports?

small mica
const {
  Message,
  Client,
  ButtonStyle,
  ActionRowBuilder,
  ButtonBuilder,
  EmbedBuilder,
  Util,
  SelectMenuBuilder,
  SelectMenuOptionBuilder,
  ComponentType,
} = require("discord.js");
urban belfry

is it because of the constructor?

small mica

constructor?

urban belfry

i don't see why that error would be there

small mica

ill just switch back to the dev version before this one that I used to use. Will update when I get a solution

cinder bane

is there any way to get the message content that is deleted in messageDelete event? since message.content is null

is it possible to fetch a deleted message?

small mica

what params did you use?

show code

cinder bane

message

urban belfry
cinder bane
async EventRun(message) {
        try {
            if (message.guild.available) {
                const { executor, target, extra } = (await message.guild.fetchAuditLogs({ type: AuditLogEvent.MessageDelete })).entries.first();

                console.log(message.content, extra.channel);

                if (message.id === extra.channel.lastMessageId) {
                    const AuditLogEmbed = new EmbedBuilder()
                        .setAuthor({ name: target.tag, iconURL: target.displayAvatarURL() })
                        .setColor('Aqua')
                        .setDescription(`*Message has been deleted in ${message.channel}*`)
                        .addFields(
                            { name: 'Sent By', value: `${target}`, inline: true },
                            { name: 'Sent On', value: `<t:${Math.floor(message.createdTimestamp / 1000)}>`, inline: true },
                            { name: 'Deleted By', value: `${executor}`, inline: true },
                            { name: 'Message Id', value: message.id, inline: true },
                            { name: 'Author Id', value: target.id, inline: true },
                            { name: 'Executor User Id', value: executor.id, inline: true }
                        )
                        .setFooter({ text: message.guild.name, iconURL: message.guild.iconURL() })
                        .setTimestamp();

                    this.bot.utils.auditSend(Channels.MessageLogId, [AuditLogEmbed], message.attachments.toJSON().map(({ url }) => url));
                };
            };
        } catch (error) {
            console.trace(error);
        };
    };
urban belfry

if the message was cached, there's a chance you could get the content, otherwise, no it's not possible, it's gone

small mica

message.content shud work then

cinder bane

message.content returns nothing in console

theres a space before undefined, thats the value of message.content

small mica

now whats this error?

cinder bane

idk

vague coyote

the color

it expects a number or rgb tuple

urban belfry

that shouldn't happen

cinder bane

yea

urban belfry

and i can't reproduce the error either

cinder bane

color string is supported by EmbedBuilder

vague coyote

Thonk

small mica

I can use util resolver or pascal case, both work

urban belfry

it's the djs exported builder chewie
it uses color resolvable

small mica

its from the fields

vague coyote

doesnt addFields take an array now, or is that not yet in dev release

cinder bane

you have 2

addFields

urban belfry

the version they're using, it takes a rest parameter

dev of builder does if not shortly will use arrays but the latest release uses rest

small mica
eb!eval message.channel.send({embeds: [new EmbedBuilder().setTitle("Hello").addFields({[name: "test", value: "A test"]})]})

Is this what you mean by array? Shows unexpected :

urban belfry

that's just invalid syntax

small mica
"discord.js": "^14.0.0-dev.1650586180-61a44c5",
urban belfry

again, objects in an array, not that it's relevant here right now

cinder bane
.addFields(
{},
{}
)```
small mica

oh like that

small mica
cinder bane

or ```js
.addFields(...[])

you had 2 .addFields ig

maybe that caused the error

small mica
urban belfry
small mica

doesnt seem like arrays is the error Thonk

urban belfry

but you know what it makes sense
you can pass upto 25 fields, thus the number 25, it's checking a length

small mica

yeah

urban belfry

you did it wrong, try passing an array of objects [{...}, {...}, {...}]
this is how, basic js

small mica

ok wait lemme try

urban belfry

i have no idea what mon was on about now

djs@dev uses builders v14-dev internally

small mica

Ah yes, arrays was the problem

thanks @urban belfry

vague coyote

told ya smug

urban belfry

mon confused me

small mica

yea

knotty plover

Oh it does? That's dumb lol

small mica

that sucks. Have to update all the code again 😢

urban belfry

it makes sense, the dev version of djs uses the dev version of the packages, some monorepo workspace blah blah

urban belfry
knotty plover

Means we need to change it before releasing stable

small mica
urban belfry

you know there will be more changes and reverting changes right? my suggestion would be to wait and do it after it releases after you get a complete guide

cinder bane

why does message.author return null for messageDelete event? shouldnt it atleast send the .author property?

urban belfry

what makes you say that?

these are all the api gives you, the only things guaranteed would be the channel, the id and the guild (if any exist of course) that's because they're always cached

in this event, the api doesn't give you the author id either, nor are the users always cached

other than everything i just mentioned, what you get purely depends on your cache

cinder bane

how do i cache the messages then

any sure way to cache the messages sent to a guild?

urban belfry

well if you don't limit the cache and enable the GUILD_MESSAGES intent, you should receive the messages

tame gazelle

by adding Message and User partials too no?

urban belfry

that would cache partial messages, which is the opposite of the point

cinder bane

i have Message and Reactions partials enabled so

ig ill remove them

urban belfry

you don't really need to remove them
you can check if something's partial by checking the .partial property

cinder bane

oh yea right

urban belfry

disabling would mean the event doesn't get emitted for the events, judging by wherever you have already used it, it might not be the best idea to disable it

cinder bane

yea

cinder bane
urban belfry

i have not worked with djs in a while, i don't know if there's a default for the message cache, probably was 200 the last time i saw
you can try looking around the docs and see if you find anything

cinder bane

okay thanks

urban belfry

fields.fields?

copper jetty
urban belfry

use the ChannelType enum

plain roverBOT
wintry bear

tho ```js
let forwardButt = ApplicationRow.components.find(component => component.customId === 'application_forward')
forwardButt.setDisabled(true)````TypeError: Cannot read properties of undefined (reading 'setDisabled')`
changed?

urban belfry

are you sure that row even has that component with that matching id?

wintry bear

i mean it did work before updating so yea

urban belfry

no i don't think that changed

copper jetty

Console log ApplicationRow.components

wintry bear
copper jetty Console log ApplicationRow.components
[
  ButtonBuilder {
    data: {
      type: 2,
      emoji: [Object],
      custom_id: 'application_back',
      label: 'Previous Question',
      style: 1,
      disabled: true
    }
  },
  ButtonBuilder {
    data: {
      type: 2,
      emoji: [Object],
      custom_id: 'application_forward',
      label: 'Next Question',
      style: 1,
      disabled: true
    }
  }
]```
forest elm

builders don't have getters for their data

use component.data.custom_id instead

wintry bear

yep

copper jetty
wintry bear

its fixed now

ok um this confusing

msg.embeds[0].setFooter({text: `App Progress: ${appType === 'veteran' ? (((question + 1) / vetaranQuestions.length) * 100) : (((question + 1) / normalQuestions.length) * 100)}%`})
````setFooter is not a function`
urban belfry
wintry bear

.from?

forest elm

yes

copper jetty

from( data here )

urban belfry

yeah you can't really modify the received embed data, you can create a modify-able clone using the method

wintry bear
Discord.EmbedBuilder.from(msg.embeds[0]).then(embed => {
embed.setFooter()
})```?
urban belfry

it deosn't return a promise, does it?

vague coyote

it doesnt

urban belfry

well then there you go
the from should return an embedBuilder which you can call the modifying methods on

wintry bear
               let toModify = Discord.EmbedBuilder.from(msg.embeds[0])
               toModify.setFooter({text: `App Progress: ${appType === 'veteran' ? (((question + 1) / vetaranQuestions.length) * 100) : (((question + 1) / normalQuestions.length) * 100)}%`})
                msg.edit({
                    embeds: [toModify]
                })```something wrong huh?
urban belfry
wintry bear
wintry bear

nvm fixed it by using setFields

small mica

Will the dev version be removed when the official one releases or can I continue to use it if I don't get time to update to official one after it released?

urban belfry
small mica

Will I still be able to use this version -
"discord.js": "^14.0.0-dev.1648339713-520f471",?

uncut kelp

But why

short tapir

Ok question, which is meant to be right

.addComponents(b1,b2,b3)
.addComponents([b1,b2,b3])

First one (which I used fine in v13) is Found non-callable @@iterator
Second one (which searching here has told me is correct) gives me component.toJSON is not a function

urban belfry
short tapir

Making them directly in

So

.addComponents([new ButtonBuilder.setName('etc'), new ButtonBuilder.setName('etc2')])

Okay nethermind about that issue now, just gotta fix the fields

wintry bear
TypeError: Discord.Util.splitMessage is not a function``` huh
jaunty vault
wintry bear

e

small kettle
const Discord = require("discord.js");
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');

[...]

const modal = new Discord.ModalBuilder()
            .setCustomId("testmodal")
            .setTitle("Test Modal")

        const favoriteColorInput = new Discord.TextInputBuilder()
            .setCustomId('favoriteColorInput')
            .setLabel("What's your favorite color?")
            .setStyle(TextInputStyle.Short);

        const hobbiesInput = new Discord.TextInputBuilder()
            .setCustomId('hobbiesInput')
            .setLabel("What's some of your favorite hobbies?")
            .setStyle(TextInputStyle.Paragraph);
        
        const firstActionRow = new Discord.ActionRowBuilder().addComponents(favoriteColorInput);
        const secondActionRow = new Discord.ActionRowBuilder().addComponents(hobbiesInput);

        modal.addComponents(firstActionRow, secondActionRow);

        await interaction.showModal(modal);

[...]

Here is the Error;

    this.components.push(...components);
                            ^

TypeError: Found non-callable @@iterator
    at ActionRowBuilder.addComponents (E:\Modals Test Bot\node_modules\@discordjs\builders\dist\index.js:526:21)
    at Object.execute (E:\Modals Test Bot\ApplicationCommands\Slash\PUT_COMMANDS_HERE\exampleSlash.js:39:63)
    at Client.<anonymous> (E:\Modals Test Bot\events\interactionCreate.js:25:13)
    at Client.emit (node:events:390:28)
    at InteractionCreateAction.handle (E:\Modals Test Bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at Object.module.exports [as INTERACTION_CREATE] (E:\Modals Test Bot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (E:\Modals Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (E:\Modals Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (E:\Modals Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
    at WebSocket.onMessage (E:\Modals Test Bot\node_modules\ws\lib\event-target.js:199:18)

Node.js v17.3.0
[nodemon] app crashed - waiting for file changes before starting...```
any idea?
urban belfry
gloomy kayak

Pinned message

small kettle
urban belfry

show your updated code in that case

small kettle

same thing but

modal.addComponents([firstActionRow, secondActionRow]);
urban belfry

now is that the only addComponents in your code?

small kettle

works now... i had 2 more with just one value
thanks

kindred kite

bot doesnt start after switching and changing

no errors

const {
    Client,
    Intents,
    MessageEmbed,
    ActionRowBuilder,
    ButtonBuilder,
    SelectMenuBuilder,
    Interaction,
GatewayIntentBits,
Partials
} = require("discord.js");


const Bot = new Client({
    intents: [
        GatewayIntentBits.Guilds,
       GatewayIntentBits.GuildIntegrations,
       GatewayIntentBits.GuildVoiceStates,
       GatewayIntentBits.GuildMessages,
        GatewayIntentBits.DirectMessages,
    ],
    //shards: Cluster.data.SHARD_LIST, // An array of shards that will get spawned
    //shardCount: Cluster.data.TOTAL_SHARDS, // Total number of shards
    partials: [Partials.Channel],
});

could it be due to this

undone yew

I made a statistics command and added a refresh button below, it edits the message, but the messages in it remain the same, how do I fix it?

kindred moss

the typings seem to be completely messed up in the latest version, is that known?

uncut kelp

That is literally so unhelpful

idle galleon

Could you give an example?

kindred moss
node_modules/discord.js/typings/index.d.ts(599,19): error TS2416: Property 'addOptions' in type 'SelectMenuBuilder' is not assignable to the same property in base type 'SelectMenuBuilder'.
  Type '(...options: (APISelectMenuOption | SelectMenuComponentOptionData | UnsafeSelectMenuOptionBuilder)[]) => this' is not assignable to type '(options: (APISelectMenuOption | UnsafeSelectMenuOptionBuilder)[]) => this'.
    Types of parameters 'options' and 'options' are incompatible.
      Type '(APISelectMenuOption | UnsafeSelectMenuOptionBuilder)[]' is not assignable to type 'APISelectMenuOption | SelectMenuComponentOptionData | UnsafeSelectMenuOptionBuilder'.
node_modules/discord.js/typings/index.d.ts(602,19): error TS2416: Property 'setOptions' in type 'SelectMenuBuilder' is not assignable to the same property in base type 'SelectMenuBuilder'.
  Type '(...options: (APISelectMenuOption | SelectMenuComponentOptionData | UnsafeSelectMenuOptionBuilder)[]) => this' is not assignable to type '(options: (APISelectMenuOption | UnsafeSelectMenuOptionBuilder)[]) => this'.
    Types of parameters 'options' and 'options' are incompatible.
      Type '(APISelectMenuOption | UnsafeSelectMenuOptionBuilder)[]' is not assignable to type 'APISelectMenuOption | SelectMenuComponentOptionData | UnsafeSelectMenuOptionBuilder'.
urban belfry

use an array

kindred moss

also Type 'SelectMenuBuilder' does not satisfy the constraint 'AnyComponentBuilder'., which isn't inside of the typings themselves (and thus could be an intended change) but doesn't make sense to me.

urban belfry

it got updated, all the setX and addX methods now take in arrays, not rest parameters

kindred moss

those are errors within the typings themselves though, at least according to the path.

urban belfry

try installing builders@dev

kindred moss
urban belfry

now?

kindred moss

no packages were updated/changed, the errors are still there :P

undone yew
idle galleon
kindred moss
kindred kite

line of code ``` .addFields({name:Need help?, value:Support Server: https://discord.gg/bigben})

idle galleon
kindred moss

Update ur discord-api-types or remove it from ur package.json

kindred kite
kindred moss
idle galleon

Oh, it’s from rest

Was d.js not updated to conform to the change in builders? Thinkeng

kindred kite

fine no one wants to help me :(

uncut kelp
kindred moss

You should remove this dependency btw. This comes with discord.js installed

idle galleon

Oh, there was a fix for that pushed 2 hrs ago

kindred moss
kindred moss
uncut kelp

Yea, it'll be at midnight

dull mulchBOT
kindred kite
  .addFields({name:`Need help?`, value:`Support Server: https://discord.gg/bigben`})
kindred kite
idle galleon

Yea…

kindred kite

well im on v14

so why isnt mine working

idle galleon

That was thrown out just recently

urban belfry

the guide isn't complete, neither is v14, everything is currently in development

idle galleon

In dev/master means breaking changes can happen at any time

kindred kite
idle galleon

You could just revoke use application commands in voice text channels

kindred kite
idle galleon

It’s a permission

kindred kite

the bot has sent, so that wouldnt fix my problem

kindred kite
idle galleon It’s a permission

why is this not working

  var row = new ActionRowBuilder()
                .addComponents(
                      new ButtonBuilder()
                        .setCustomId('editsettings')
                        .setLabel('Edit Settings')
                        .setStyle(ButtonStyle.Primary)
                        .setDisabled(disableadminbutton)

                )

idle galleon

addComponents prob takes an Array too

kindred kite

why such usless changes omg

idle galleon

Anything that was a rest param is now Array

kindred kite

breaking everything

idle galleon

It’s mainly affect addX and setXs (setX but X is plural) methods

Prob why some ppl opt to just use raw objects + discord-api-types interfaces for typings

kindred kite

like rn people are rating my bot on top.gg 1 star cuz of this

idle galleon

Bc it crashes?

kindred kite

and beucz its not working rn

urban belfry

why're you using the dev version for your bot?

idle galleon

Bc ppl are crashing his bot w/ buttons in voice text

kindred kite
idle galleon

It’s a public bot

urban belfry

haha that's just mean

kindred kite
urban belfry

is it fixed in v13.7.0?

idle galleon

Oh yea, you could've just updated to the v13 branch on gh

urban belfry

yeah exactly

idle galleon

It’d pretty much the v13 dev

urban belfry

but it's much much closer to v13

kindred kite
urban belfry

it's in dev too

idle galleon

It’s the v13 branch on gh

urban belfry

but is it fixed already tho kinect?

idle galleon

Idk if it was pushed yet

urban belfry

this is bad, imo there should be an emergency patch version release just to fix this if that's possible

dull mulchBOT

pr_open #6921 in discordjs/discord.js by SpaceEEC opened <t:1635539041:R> (review required)
feat(VoiceChannel): add support for text in voice
📥 npm i SpaceEEC/discord.js#feat/text_in_voice

idle galleon

Still awaiting reviews

urban belfry

also why did a new builders version get released?

kindred kite

how to use FooterOptions

ahhhhhh

urban belfry

doesn't stable djs use builders v0.11 internally?
wouldn't users installing 0.13 now cause discrepancies internally?

idle galleon

They shouldn’t be installing builder manually. If they do, they should make sure it’s the same version

urban belfry

wait what? the guide recommends it btw?

and it doesn't mention that it should install the version their djs version has installed

kindred kite

like this right? setFooter({text:"Question: " + messageContent});

idle galleon

Yea

kindred kite

due to my bots status not showing

urban belfry

you'd use the enums

idle galleon

No more magic string/numbers

urban belfry

i think the guide mentions it
the ActivityType enum

kindred kite
urban belfry

it takes in an array

idle galleon

Is there an error w/ that?

kindred kite
urban belfry

what the fuck
and so this one wants rest?

idle galleon

¯_(ツ)_/¯

kindred kite

so what do i do

urban belfry

🤦‍♂️
let me check

velvet jasper

Is that a select menu?

kindred kite
idle galleon

Yea

velvet jasper

If so the change for array params got merged two hours ago there hasn’t been a release since

For now use rest and tonight you can switch them over

urban belfry

oh all of them weren't changed at once?

velvet jasper

No there were some oversights

kindred kite

bruh ahhhhhhhh, this is just sucky ngl whenver theres an error people think its my fault and the bot is bugged

idle galleon

But now ur bot is popular for it

kindred kite

why coudlnt they have released the fix for v13 yet

kindred kite

ok how to fix the options thing

velvet jasper
idle galleon

Remove the Array

kindred kite

they are pressing discord buttons my bot sent in a voice text channel

urban belfry

wait can't you like modify your code to just not send a button there?

kindred kite
urban belfry

ah rip lol xD

kindred kite

and they are clicking the ones that were sent

idle galleon

It’s a public bot, so he can’t control the servers either

kindred kite

AHHH

urban belfry

yeah okay mb, that's bad

wait it's fixed on v14?

which pr was it?

idle galleon

Oh, the one I pulled up apparently

urban belfry

that wasn't for 13.7???

so there's just no version that's safe right now, got it

dull mulchBOT
idle galleon

I think this PR patched it

velvet jasper
urban belfry

ah so it's fixed on v14, at least there's that

idle galleon

So it is fixed in v13 dev?

velvet jasper

Yeah

idle galleon

Couldn’t they just do npm i discordjs/discord.js#v13 then?

urban belfry

yeah it doesn't use monorepo there

velvet jasper

Maybe? I haven’t tried tbh

kindred kite

AHHHHHHHHHHHH

idle galleon

Is there an error?

urban belfry

remember, it's v13, the code you used to convert to v14 should be discarded

kindred kite

no as i said the button stuff doesnt have an error

idle galleon

It should have an error

velvet jasper
kindred kite
idle galleon
kindred kite

after it starts up lol, cuz i set it so when i disconnect the bot it sets it to invisible but then when it restarts its supposed to set to online but for some reason it was setting it to inviisble, fixed.xd

idle galleon

Why invisible?

Just call client.destroy()

kindred kite

that the bot is offline

idle galleon

Call client.destroy() then

It’ll disconnect properly

kindred kite

or should i keep it from.

uncut kelp

I think I just updated the migration guide. I hope I haven't missed anything

kindred kite

and stuff

uncut kelp

Huh, I don't understand your reply

kindred kite

makes it look like my bot is broken

in vc texts

uncut kelp

I just updated a migration guide

kindred kite
uncut kelp

Version 13 doesn't have text-in-voice channel support

Until that is added, interactions will not be received

velvet jasper

But it won’t crash

kindred kite
kindred kite
uncut kelp

Shrugs

wraith oyster

Im getting this error when i try create embed with EmbedBuilder

ExpectedConstraintError > s.number.le
  Invalid number value

  Expected: expected <= 25

  Received:
  | NaN

    at Object.run (C:\Users\developer\Desktop\Sorogl\node_modules\@sapphire\shapeshift\dist\index.js:703:72)
    at C:\Users\developer\Desktop\Sorogl\node_modules\@sapphire\shapeshift\dist\index.js:114:66
    at Array.reduce (<anonymous>)
    at NumberValidator.parse (C:\Users\developer\Desktop\Sorogl\node_modules\@sapphire\shapeshift\dist\index.js:114:29)
    at validateFieldLength (C:\Users\developer\Desktop\Sorogl\node_modules\discord.js\node_modules\@discordjs\builders\dist\index.js:133:24)
    at EmbedBuilder.addFields (C:\Users\developer\Desktop\Sorogl\node_modules\discord.js\node_modules\@discordjs\builders\dist\index.js:243:5)
    at Object.execute (file:///C:/Users/developer/Desktop/Sorogl/commands/Bot/bot-info.js:43:10)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
vague coyote

addFields() now wants an array

wraith oyster

uh

thanks, but why?

vague coyote

idk

wraith oyster

:/

vague coyote

should be explained in the pr

void abyss

I'm trying to host my bot on Ubuntu ARM server. On Windows it works just fine. Is this problem with architecture?

cyan jewel

Why is interaction.member.voice not null after someone leaves a voice channel? Is this a bug or intended behavior?

If I restart my bot, then it is null. Maybe a caching problem?

knotty plover

Do you have the GUILD_VOICE_STATES intent?

cyan jewel

Son of a... intents should be the first place I check when this kind of thing happens. 😅

Heh, that was it. Thanks! Maybe that's my cue to take a break and workout. lol

copper jetty
copper jetty
copper jetty no reason

nvm the reason is that people have errors related to the change that hasn't been documented anywhere

bronze plover

any idea why this is happenning, v13 branch

hacked my way out of this with a bunch of ts ignore, but that aint the way to go

uncut kelp
bronze plover
small mica
uncut kelp But why

Because my exams will start in some months and I wont have time to recode the bot to v14, which is why I started re-writing in dev version. Now if I dont get time to make the necessary changes, can I continue using the "discord.js": "^14.0.0-dev.1648339713-520f471", version?

knotty plover

yep

Once youve installed it, even if we deprecate it, its still there to use

small mica

okay thanks!

haughty lava

now we can create application commands like this right?
await client.application.commands.create(/*data*/);

forest elm

since v13, yes

haughty lava

👍🏽

void abyss

ah okay sorry I forgot about []

copper jetty

Ok

I use rest anyway

rain swan

hi, please help me solve this problem

urban belfry

update nodejs

rain swan
urban belfry

doubt
but oh well i'm going to sleep

ember pagoda

The v14 is the current dev version, but is it stable enough to use it now for my bot?

chilly zephyr

What does "not stable"/"in development" mean here?
\✅ Use the build without crashing everything (probably)
\❌ Finalized API
\❌ Free of bugs
\❌ Consistent API (Things may change drastically from one commit to the next)
\❌ Refactor a large code base that a lot of people depend on to use this build

urban belfry

my suggestion, for the new features, wait for 13.7 to release

ember pagoda

Thanks!

kindred moss

this has been reported before (^), but the current typings prevent you from initialising ModalBuilders with components (i.e. without using ModalBuilder#setComponents()). should I create an issue on GH for this? I can't find any existing issues or PRs.

shy birch

Se eu abrir um modal, preencher os dados, cancelar e abrir um novo modal com todos os dados preenchidos e enviar, o meu sistema tenta criar 2 canais, por conta desses 2 modals, como eu posso impedir isso?

cyan widget

are uh message commands gonna go in djs v14?

chilly zephyr

Message commands?

cyan widget

yes

chilly zephyr

Elaborate please

cyan widget

like >warn

chilly zephyr
chilly zephyr

And even then should you be moving over to slash commands

cyan widget

for public bots?

mines a private one

chilly zephyr

Any bot over 100 servers

cyan widget

ok yea i should be fine

chilly zephyr

You do whatever you want with your private bot. You can make message commands without v14

shy birch
chilly zephyr

You should show code

shy birch

It's too long, split between files

  const filterModal = (interaction) => interaction.customId === 'ticketConfigModal';
  const collector = new InteractionCollector(client, { filter: filterModal, max: 1, time: 120 * 1000, guild: interaction.guild, interactionType: InteractionType.ModalSubmit })

const closeTicketButton = new ButtonBuilder({
    "style": ButtonStyle.Danger,
    "label": `Fechar`,
    "custom_id": `closeTicketButton`,
    "disabled": false,
    "emoji": {
      "id": null,
      "name": `🔒`
    },
  })
  const row = new ActionRowBuilder().addComponents(closeTicketButton)

  collector.on('collect', modelInteraction => {
    modelInteraction.update({})

    const mainEmbed = new EmbedBuilder({
      "title": `Canal de suporte criado`,
      "description": `Olá ${modelInteraction.user}, você criou um novo ticket, basta aguardar para receber o suporte.\n\n🌟 **Assunto:**\n:pontoArchio: ${modelInteraction.fields.getTextInputValue('ticketSubject')}\n\n`,
      "color": 0x5865f2,
    })

    modelInteraction.guild.channels.create('ticket', { // futuramente mudar
      type: ChannelType.GuildText,
      parent: '965105073174745139', // pegar no banco de dados
      permissionOverwrites: [
        {
          id: modelInteraction.guild.id,
          deny: [PermissionFlagsBits.ManageChannels, PermissionFlagsBits.ViewChannel],
        },
        {
          id: modelInteraction.user.id,
          allow: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel],
        }
      ]
    }).then(channel => channel.send({
      content: modelInteraction.user.toString(),
      embeds: [
        mainEmbed
      ],
      components: [
        row
      ]
    }))

@chilly zephyr

Very long

chilly zephyr

Not sure but your error indicates you're trying to use <Interaction>.reply twice

shy birch

Ok

I'll check

chilly zephyr

1 of these are invalid/undefined but I can't figure out which one it is

const client = new Client({
    intents: [GatewayIntentBits.GuildsGuilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildWebhooks, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.DirectMessages],
    partials: [Partials.GuildMember, Partials.Message, Partials.Channel, Partials.Reaction]
});```
cyan widget

wtf

chilly zephyr

KEK

That makes sense yeah

cyan widget

ok

chilly zephyr

My bad thank you

sterile hemlock
cyan widget

i feel bad for the typescripters

sterile hemlock
copper jetty
nocturne kayak

have no problem with using djs + typescript
much more readable code really
anyway off topic

copper jetty
nocturne kayak

mmLol

dawn phoenix

stop

velvet jasper
copper jetty
velvet jasper
sharp pine
for(var i = 0; i < results.length; i++){
                    console.log(`deleted ${results[i].key}`)
                }
              let dekey = results[i].key
                          
                          //console.log(`Status: ${res.status}`)

                          connection.query("DELETE FROM `keys` WHERE `key`=?", [dekey], (err, results, fields) => {
                            if (err) return console.log(err);
                            if (!results || results.length <= 0) {
              
                              const noLicense = new EmbedBuilder()
                              .setDescription(`You have no license registered in the old database.`)
                              .setColor(stormColor);
              
                              return interaction.reply({ embeds: [noLicense], ephemeral: true })
                          } else {
                              console.log('deleted ' + results[i].key)
                          }
                        })
                        // console.log(results)
            }
          })

this doesn't work but how would i fix it (cause it can't read at the last console (.key)

how would i fix that it deletes (dekey, which can be 1 or 2 or 3 et cetera) delete this ones and not 1000x times

forest elm
scarlet tangle

How to fix?

tame gazelle
scarlet tangle
tame gazelle
scarlet tangle
tame gazelle
scarlet tangle
forest elm

client will be the first parameter

plain roverBOT

The order of function parameters must match between definition and function call.

function execute(client, message, args) { ... };
execute(message, client, args);

• mismatch! you pass a Message where the client is expected
• mismatch! you pass the Client where a Message is expected

scarlet tangle

What does this mean?

cyan widget
jaunty vault
scarlet tangle
jaunty vault U have to call toJSON() on the builder
name: 'market',
    type: ApplicationCommandType.ChatInput,
    options: [
      {
        name: 'add',
        description: 'Add a pokémon to the market',
        type: ApplicationCommandOptionType.SubCommand,
        options: [{
          name: 'pokémon',
          description: 'Specify the id of the pokémon which you want to add.',
          type: ApplicationCommandOptionType.Number,
          required: true,
          min_value: 1
         }]
        },
    ],
  }```

that's the json data.

median junco

i have this code and i get a typescript error. why can't i add the select menu to the action row?

rain bramble
median junco

and what can i do about this?

outer bane

pass it in an array

the type has a [] at the end for a reason

median junco

oh yes...
i read the message that in the next update they will only accept arrays

median junco

If i pass my actionRow to the command i get the following error.
CODE: ```const selectMenuBuilder = new SelectMenuBuilder()
.addOptions([{
label: "test",
value: "test"
}])

    const actionRow = new ActionRowBuilder<SelectMenuBuilder>()
    actionRow.addComponents([selectMenuBuilder])


    return await command.reply({
        ephemeral: true,
        content: "content",
        components: [actionRow]
    })
outer bane

you need a customId

median junco

if i have defined a customId for a SelectMenuBuilder. how can i get the customId back?

sharp pine

how would i send a dm to the person i specify in here?

vague coyote

interaction.options.getUser('user')
and call .send() on it

sharp pine

whut it didn't work some secs ago, but thanks tho

uncut kelp

It'll fail for a variety of reasons... such as if they have DMs closed

sharp pine

i know

why does this not work? (like it still says connected to database) but it doesnt reply or anything

sterile vortex

Hi, I was wondering if there is a way to respond to a modalSubmitInteraction without sending a reply or an deferred reply ?

Just to confirm the reception

dawn phoenix

send an ephemeral message to confirm the reception

no idea where all of this "acknowledge without response" comes from
honestly, UX wise you should always let het user know if something worked
(granted, the preferred way would probably be toasts, but since those are not available to use at the moment, ephemerals is the next best thing)

sterile vortex
dawn phoenix

if the embed updates then the updating itself is the response and notion of completion firT

sterile vortex

Yes, but it is not possible to update the message from the interaction received from the modal 🥲

dawn phoenix

update original as a response to a modal originating from a button press will update the message the button was pressed on that prompted the modal

sterile vortex

So I have to use the interaction of the button? And it will respond to interaction of the modal?

dawn phoenix

you respond to the button press with a modal
you respond to the modal submit with update
=> updates the message the button was pressed on, yes

sterile vortex

I dont have "update" with the modal interaction

Just reply et editReply

plain roverBOT
sterile vortex

Hmmm, maybe i need to update my package ^^'

Weird...

sharp pine

why is my embeds not replying anymore after i ran one command?

cause it says connected to db but it doesnt do anything anymore

devout narwhal

Is it possible to get the title of a modal on submission? I can't seem to find anything in interaction

velvet jasper
dull mango

what changed when it comes to slash command permissions?

vague coyote

except the types, nothing really?

dull mango
permissions[0].type[NUMBER_TYPE_COERCE]: Value "ROLE" is not int.

before it worked fine

sharp pine

how do i check if players dm's are off before doing anything?

dawn phoenix

you cannot
attempt to dm, catch the rejection
and don't dm many people at once/within a short time frame

sharp pine

damn

sharp pine

well

i need to check it before deleting something from db

vague coyote

dont know from where to import it tho

plain roverBOT
dawn phoenix

potatodetective should be listed here, somewhere

PermissionFlagBits

vague coyote

but thats only the permissions

not the type

dawn phoenix

PermissionFlagBits is the type

knotty plover

But for User/Role?

Wouldnt that be ApplicationCommandPermissionType from discord-api-types

dull mango
knotty plover

o

dawn phoenix

oh, right, that, shit, i was thinking permission flags, ignore me

vague coyote

ah ApplicationCommandPermissionType, can import from djs

dull mango

thx, works now

sharp pine

what is the best way in my case to check if the person his dm is off BEFORE deleting something from the database?

vague coyote

like souji said, send a dm and catch the rejection

sharp pine

in a for i loop?

vague coyote

never said its a good idea KEK

sharp pine

^^

vague coyote

there is no other way tho

sharp pine

but there is no other way for me?

yea i can't check from a function, which i maked to only run 1 time to do .catch(() => { });

or is that possible?

vague coyote

dont see how that would be any different than doing it in the for loop?

sharp pine

idk man

my brain is so dead now

i can't solve this problem after 5 hours

so how would i do it?

cause i need to retrieve the deleted data from the db

vague coyote

attempt to dm, catch the rejection
and don't dm many people at once/within a short time frame

sharp pine

wait

sharp pine

this doesnt work

or persoon.send(func here, {})

if sucess

buoyant pecan

Hello öh so i used Slash Command Builder but i cant find out what to use in the new Version

tame gazelle
sharp pine

which promises

tame gazelle

.send

sharp pine

cause it console.logs the error, but not the embed

acoustic temple

How can I use local image in embed image?

copper jetty

new Attachment("file path")

and pass it into files option and in setImage pass attachment://name.png

acoustic temple
copper jetty

reinstall discord.js@dev

or use MessageAttachment

because im pretty sure your using old version

acoustic temple

I'm in dev version

^14.0.0-dev.1649937833-b01f414

vague coyote

Its MessageAttachment not Attachment

plain roverBOT
vague coyote

Oh its so far down on mobile rip

acoustic temple

It's strange, because here only shows MessageAttachment, but no Attachment, I'm installing again

copper jetty

for example MessageAttachment Is Attachment or MessageButton is ButtonComponent

acoustic temple

@copper jetty I'm making this, but not work 😦

Image isn't in embed

copper jetty

attachment://Vantagens.png

acoustic temple

worked, thanks

acoustic temple

What is this error?

the code

copper jetty

addFields takes an array

acoustic temple

now it takes an array?

copper jetty

yes

acoustic temple

omg

copper jetty

everything takes an array now xD

acoustic temple

It fucked me 🤣

noble kernel

ae modals working with dev? if so, is there a guide on how to use them?

nocturne kayak

yes

noble kernel

alr thx

noble kernel

anyone able to help?

copper jetty

You passed rest parameters instead of an array probably

noble kernel

im guessing it's the way i did my embeds

can you give an example of how im supposed to make an embed?

copper jetty

new EmbedBuilder()

noble kernel

from discord.js?

copper jetty

And then call methods you want on it

copper jetty
noble kernel

how do i add a field?

like can u give an example pls

copper jetty

<EmbedBuilder>.addFields([{ name, value}])

noble kernel

wait that's so stupid

copper jetty

I know

noble kernel

it was better when we could just use .addField("", "") bruh

sterile hemlock

Well addField is removed in v14 because it's useless when you have addFields. The syntax makes more sense the more you use it

green plume

Will server owner will also receive this message if he doesn't have higher role than the bot?

if (ctx.interaction.member.roles.highest.position <= ctx.interaction.guild.me.roles.highest.position) return ctx.interaction.reply({ content: `${process.env.FAILURE_EMOJI} | You must be higher than me to use this command`, ephemeral: true });
green plume
cinder bane

what is TextInput component type?

foggy osprey

can som1 help me

knotty plover

ask a question and sure

rain swan

help plz

knotty plover

You dont have applications.commands scope in that guild

rain swan

how to get access?

knotty plover

Its an invite scope

You need to invite the bot with it

cinder bane
let components = [{
    type: ComponentType.ActionRow,
    components: [
            //overview,
            ...options.map(({ data }) => data)
        ]
   }];

it shows the error cannot serialize component type but im using an Enum of Component Type?

knotty plover

Whats the point of that map

looks like theres something undefined in there

cinder bane
UserEmbedComponents = SelectMenuBuilder.from(UserEmbedComponents.components[0]).options;

let [overview, ...options] = UserEmbedComponents;

overview.data.default = true;
components.options = [
  overview,
  ...options.map(({ data }) => new SelectMenuOptionBuilder)
];

this is the whole code

i need to set the first option to default and the pass the other options as they are

knotty plover

Yeah I have no idea what this is, but overview.data.default isnt a valid option

Try overview.data?

Since that appears to be the actual properties

cinder bane

okay 1min

overview.data

it contains this and im changing the default value to true, since it may sometimes be set to false or undefined

rain swan

help
DiscordAPIError[50001]: Missing Access
at SequentialHandler.runRequest (/home/jan/Загрузки/FoxBot/node_modules/@discordjs/rest/dist/index.js:708:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/jan/Загрузки/FoxBot/node_modules/@discordjs/rest/dist/index.js:511:14) {
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'put',
url: 'https://discord.com/api/v9/applications/967677012909117440/guilds/957302288937001031/commands',
requestBody: { files: undefined, json: [ [Object], [Object], [Object] ] }
}

knotty plover

When you invite your bot

You need to tick the applications.commands scope

rain swan

АА

cinder bane

go to the OAuth2 URL Generator that is in the applications page of developer portal and generate an invite by ticking to applications.commands scope and the bot scope as well

then copy the generated url and use it to invite the bot

ruby dagger

how do I install v14? and what's the v14 doc?

oh got it nvm

rain swan

Help
node:internal/fs/utils:345
throw err;
^

Error: ENOENT: no such file or directory, scandir './commands'
at Object.readdirSync (node:fs:1406:3)
at Object.<anonymous> (/home/jan/Загрузки/FoxBot/index.js:8:25)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153: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:77:12)
at node:internal/main/run_main_module:17:47 {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: './commands'
}

Node.js v17.9.0

tough egret

Not related at library, but not exists directory 'commands'

scarlet tangle

Subcommand Enum doesn't work

outer bane

what do you mean by "doesn't work"?

buoyant pecan
const message = await interaction.reply({
            embeds: [Embed],
            components: [Select],
            fetchReply: true,
        });
        const collector1 = await message.createMessageComponentCollector({ componentType: 'SELECT_MENU', time: 60000, max: 1 });
        console.log(collector1);

        collector1.on('collect', async i => {
            console.log(i);
            if (i.user.id === interaction.user.id) {
                if (i.customId === 'extensions') {
                    await collector1.stop();
                    const step1 = require('./setup/step1.js');
                    step1.run(interaction, client, locale, db_servers, i, Embed, message);
                }
            }
        });

i upgraded but now my collector doesnt collect anymore

it creates an collector but regardless of what i do it doesnt catch it

urban belfry
buoyant pecan

ohhhhh

DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
components[0].components[1].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji

ohhh what does that mean

i wanted to use a custom emoji so i put the id of it in .setEmoji("here");

urban belfry

however if you import ButtonBuilder from discord.js then you can use strings with setEmoji

buoyant pecan

i did

urban belfry

show me your import

buoyant pecan
buoyant pecan
hazy light

Idk why but today my event who work last time doesn't work anymore and give me this error that i don't understand

  Overload 1 of 2, '(event: "interactionCreate", listener: (interaction: Interaction<CacheType>) => Awaitable<void>): Client<boolean>', gave the following error.
    Argument of type '(interaction: Interaction<CacheType>) => Promise<InteractionResponse<boolean> | undefined>' is not assignable to parameter of type '(interaction: Interaction<CacheType>) => Awaitable<void>'.```
buoyant pecan

Soooo how can i check if a guild member has administrator rights?

knotty plover
frigid sleet

Hey, i have a qustion, i try to send a file in a message, but in v14 MessageAttachment doesn't work
what do I have to take instead?

message.channel.send({content: 'Content' files: [new MessageAttachment(Buffer.from(`${require('util').inspect(guilds)}`), 'all_guilds.txt')]})
frigid sleet

thanks

hazy light
wind seal

I don't know if it is the place to but I have a suggestion for the update
We know that with masked links we can do like hypertext by doing this click me but we can not use the mailto: mode, maybe it can be useful !

uncut kelp

You should tell Discord that

buoyant pecan

Hi when i look in the discord docs theres written that you can use select menus in modals

hooowwww

uncut kelp

Where?

buoyant pecan

bruh sorry i was lost

oh no

huh

i was not wrong sorry KEKW

"components array of components between 1 and 5 (inclusive) components that make up the modal"

forest elm

read the yellow box above that

buoyant pecan

crycat

hmmm

                        .addChoice('Aktivieren', 'on')
                         ^

TypeError: option.setName(...).setDescription(...).setRequired(...).addChoice is not a function

ehhhhmmm Thonk

.addChoices({ name: 'Aktivieren', value: 'on' }),

doggo

forest elm

addChoices takes an array

nocturne kayak

all kinds of .addX or setX takes an array now

buoyant pecan
buoyant pecan
hoary fox

yea

pallid ice

I asked this in #djs-help-v14 but got referred here even though I'm not convinced its an issue with v14, but anyway;

it's rare I need to ask for help but I'm asking today for a weird one. I've written countless bots in JS using discord.js and never really had any issues I couldn't work out or resolve on my own. but I'm now delving into TS for a bit of fun and having an issue with commands not appearing at all.

I've narrowed it down to the defaultPermission option in the command. if this option is set, the command will not appear at all on any client (desktop, mobile or web). when I console log the guild.commands I see that it exists on the API and I've set permissions appropriately as also confirmed with a fetch of client.application.commands.permissions.fetch({ guild: 'the guild id' }). am I missing something obvious?

to clarify a few things when I asked this in #djs-help-v14 that came up, all other commands appear. the command(s) that have defaultPermission set are not greyed out, they just don't appear at all as if they don't exist. even though a fetch confirms they most definitely do on the API, along with their corresponding permissions as set by me

dawn phoenix

@silent hedge sounds a bit like yours, doesn't it?

silent hedge

yeah, can you repro this on mobile as well? @pallid ice

I talked with

pallid ice
silent hedge

oh

pallid ice

but a fetch confirms it does

silent hedge

yeah I could also repro this and after talking with like.. 2 discord engineers someone reset the guild for me - after that the commands were showing but only on desktop (both stable and canary) the permissions for just default_permission: false were ignored, so no one could run those commands - they were grayed out

this has yet to be fixed as I reported the issue on friday and its the weekend

the issue is tied to a guild experiment labeled backend v2 that redoes how slash commands are handled

pallid ice

see if the command was greyed out, I'd assume I hadn't set perms correctly. but as it just doesn't appear at all it leaves me super confused

dawn phoenix

backend v2 includes hiding of commands you don't have perms to use, as does infix based command search

silent hedge

yeah I can still repro the issue - they work fine on android, API reports proper perms but no one can run em on desktop

and before the guild reset they didnt show at all

best advice I can give is to reach out to someone on monday once they're in office if they don't roll out a fix by then

i.e. via ddevs

im still waiting for it to be fixed myself

pallid ice

hmm ok, thanks for the help and input. I'll see what I can do tomorrow

silent hedge

its a very odd issue, lol

sharp pine

how would i delete a message (interaction) from a person's dm?

(bot his message)

hoary fox

or <message>.delete()

frigid sleet
.addSubcommand(subcommand => subcommand.setName('test').setDescription('This is a description').addChoices([
      { name: 'Aktivieren', value: 'on' },
      { name: 'Deaktivieren', value: 'off' },
    ])
  ),

why this dont work?

.addSubcommand(subcommand => subcommand.setName('test').setDescription('This is a description').addChoices([
                                                                                                  ^

TypeError: subcommand.setName(...).setDescription(...).addChoices is not a function
urban belfry
frigid sleet

oh wait
no, I thought that would be an option, I'm so lost

tiny mural

is there a roadmap from discord oficially what they plan to do for bots in the next realeases?

dawn phoenix
tall verge

hello, i saw the guide of permissions on slash commands, i get the same error: [GLOBAL_COMMAND_PERMISSIONS]: Permissions for global commands can only be retrieved or changed by providing a GuildResolvable or from the guild application's command manager. is there any way to fix this problem?

Is it mandatory to put the guild id?

dawn phoenix

yes

permissions are always guild level, even for global commands

buoyant pecan

is it possible to edit the server avatar of a bot?

urban belfry

yeah, client.user.setAvatar
you can probably do it on the dev portal too

buoyant pecan

client.user

hmmmm bot does it really set the avatar only in the current server

Thonk

.setAvatar(avatar)

Sets the avatar of the logged in client.

dawn phoenix

bots cannot have guild avatars

buoyant pecan

yeah i just rad in the discord docs

sad

void burrow

is there such as a modal component to create modals? or is it just pure json

void burrow
dusky agate

is there any way to know if an account exists with just the account id?

forest elm

client.users.fetch('user id'), if the promise rejects the user doesn't exist

dusky agate

would that work if the user does not share any server with the bot?

forest elm

yes

dusky agate

ok thx

wraith oyster
CombinedError (2)
  Received one or more errors

  1 CombinedPropertyError (2)
  |   Received one or more errors
  |
  |   input.value
  |   | MissingPropertyError > value
  |   |   A required property is missing
  |
  |   input.label
  |   | MissingPropertyError > label
  |   |   A required property is missing

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  |
  |   Expected:
  |   | [class UnsafeSelectMenuOptionBuilder]
  |
  |   Received:
  |   | { setLabel: 'Teknik Destek',
  |   |   setDescription: 'Hizmetiniz için teknik destek alabileceginiz kategori
!',
  |   |   emoji: undefined }

im getting this error on SelectMenuBuilder

forest elm

show how you're using it

wraith oyster
     const categoryMenu = new ActionRowBuilder()
        .addComponents(
            new SelectMenuBuilder()
                .setPlaceholder("Lütfen bir kategori seçiniz")
                .setCustomId('selectmenu-main')
                .addOptions([
                    {
                        setLabel: "Teknik Destek",
                        setDescription: "Hizmetiniz için teknik destek alabileceğiniz kategori!",
                    },
                    {
                        setLabel: "Satış Öncesi Destek",
                        setDescription: "Alacağınız hizmet için satış öncesi destek alabileceğiniz kategori!",
                    }
                ])
        )
forest elm

the options are label and description (on the addOptions method)

wraith oyster
forest elm the options are label and description (on the addOptions method)
CombinedError (2)
  Received one or more errors

  1 CombinedPropertyError (1)
  |   Received one or more errors
  |
  |   input.value
  |   | MissingPropertyError > value
  |   |   A required property is missing

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  |
  |   Expected:
  |   | [class UnsafeSelectMenuOptionBuilder]
  |
  |   Received:
  |   | { label: 'Teknik Destek',
  |   |   description: 'Hizmetiniz için teknik destek alabileceginiz kategori!',

  |   |   emoji: undefined }
     const categoryMenu = new ActionRowBuilder()
        .addComponents(
            new SelectMenuBuilder()
                .setPlaceholder("Lütfen bir kategori seçiniz")
                .setCustomId('selectmenu-main')
                .addOptions([
                    {
                        label: "Teknik Destek",
                        description: "Hizmetiniz için teknik destek alabileceğiniz kategori!",
                    },
                    {
                        label: "Satış Öncesi Destek",
                        description: "Alacağınız hizmet için satış öncesi destek alabileceğiniz kategori!",
                    }
                ])
        )
forest elm

and the options are missing the value

scarlet tangle

Can I pay somome here for a discord bot

forest elm
wraith oyster
tawdry mist

Can someone please tell me wtf this error is?
TypeError: discord_js_1.Intents is not a constructor
I'm trying to use the latest dev version of Discord.js.
This is my code:

const SparkV = new Client({
    intents: [
        GatewayIntentBits.DirectMessages,
        GatewayIntentBits.Guilds,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildMessageReactions,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.GuildBans
    ],
    partials: [Partials.MESSAGE, Partials.REACTION]
});
forest elm

are you using Intents anywhere else in your code?

tawdry mist

I'll check.

That worked, thanks.

Nvm, the error is still there.

Oh, I see the source of the error is coming from DisTube.

wraith oyster

TypeError: Found non-callable @@iterator

what is that

thx

kind pulsar

How can i fix this?

forest elm

addComponents takes an array

kind pulsar

again?

was now supposed to use rest parameters

buoyant pecan

How do i get all Channels of A Guild

vague coyote

<Guild>.channels.cache

fallow flicker

Hi, I'm trying to spawn a Modal using an interaction from a command, but I'm getting this error

ExpectedConstraintError > s.array(T).lengthGe
  Invalid Array length

  Expected: expected.length >= 1

  Received:
  | []

This is all my code does

async function execute(interaction) {
  const modal = new ModalBuilder().setCustomId("myModal").setTitle("My Modal");
  await interaction.showModal(modal);
}
forest elm

you need to add components to it

fallow flicker

Oh, right. Sorry 😂

Sorry to bother you. I copypasted this code from the documentation

const modal = new ModalBuilder()
  .setCustomId('myModal')
    .setTitle('My Modal');

// Add components to modal

// Create the text input components
const favoriteColorInput = new TextInputBuilder()
    .setCustomId('favoriteColorInput')
    // The label is the prompt the user sees for this input
    .setLabel("What's your favorite color?")
    // Short means only a single line of text
    .setStyle(TextInputStyle.Short);

const hobbiesInput = new TextInputBuilder()
    .setCustomId('hobbiesInput')
    .setLabel("What's some of your favorite hobbies?")
    // Paragraph means multiple lines of text.
    .setStyle(TextInputStyle.Paragraph);

// An action row only holds one text input,
// so you need one action row per text input.
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);

// Add inputs to the modal
modal.addComponents(firstActionRow, secondActionRow);

// Show the modal to the user
await interaction.showModal(modal);

But I get this error

TypeError: Found non-callable @@iterator
urban belfry
urban belfry

it's a WIP

fallow flicker
urban belfry

it's not the finished guide, it's just outdated
yes we know

velvet jasper

It is wrong I’ll try to fix it tonight if I forget just ping me

urban belfry

that seems easy enough, let me just do it right now, done

fallow flicker
fallow flicker

I was trying to use messageCreate event handler, but content is empty no matter what I type

{
    channelId: '966699710679232582',
    guildId: '315884215701078016',
    id: '967836101551198268',
    createdTimestamp: 1650820508135,
    type: 0,
    system: false,
    content: '',
    author: User {
      id: '209473799991590912',
      bot: false,
      system: false,
      flags: UserFlagsBitField { bitfield: 64 },
      username: 'SaltySpag',
      discriminator: '2578',
      avatar: 'cf88d75f5d77c80f2b350a72cae4834e',
      banner: undefined,
      accentColor: undefined
    },
    pinned: false,
    tts: false,
    nonce: '967836086740975616',
    embeds: [],
    components: [],
    attachments: Collection(0) [Map] {},
    stickers: Collection(0) [Map] {},
    editedTimestamp: null,
    reactions: ReactionManager { message: [Circular *1] },
    mentions: MessageMentions {
      everyone: false,
      users: Collection(0) [Map] {},
      roles: Collection(0) [Map] {},
      _members: null,
      _channels: null,
      crosspostedChannels: Collection(0) [Map] {},
      repliedUser: null
    },
    webhookId: null,
    groupActivityApplication: null,
    applicationId: null,
    activity: null,
    flags: MessageFlagsBitField { bitfield: 0 },
    reference: null,
    interaction: null
}
urban belfry
fallow flicker

Is a new Intent?

urban belfry

yea, it's an intent

fallow flicker
urban belfry

add it on your code and on your dev portal

fallow flicker

I can't find it under GatewayIntentBits enum

urban belfry

what are you looking at? the pinned link? that's outdated

i mean that's for v9, djs now uses v10, i notified souji
but yes that does indeed exist

fallow flicker

Oh, I'm using v9, lol

urban belfry

whaa
if you're using the up to date djs@dev, it would be using v10

fallow flicker

Ok let me try

Nice, it works. Thanks

void burrow

MessageEmbed is not a constructor?

new MessageEmbed

djs 14 dev

vague coyote

see pinned guide

EmbedBuilder

void burrow
woeful pollen

yes

buoyant pecan

Hello, Im currently workin with modals but i have a problem:

        const Buttons = new ActionRowBuilder()
            .addComponents([
                new ButtonBuilder()
                    .setCustomId('back')
                    .setStyle(EnumResolvers.resolveButtonStyle('DANGER'))
                    .setEmoji({ id: locale.commands.extensions.setup.buttons.back }),
                new ButtonBuilder()
                    .setCustomId('reopen')
                    .setStyle(EnumResolvers.resolveButtonStyle('PRIMARY'))
                    .setLabel(locale.commands.extensions.setup.buttons.reopen),
                new ButtonBuilder()
                    .setCustomId('next')
                    .setStyle(EnumResolvers.resolveButtonStyle('SUCCESS'))
                    .setEmoji({ id: locale.commands.extensions.setup.buttons.next }),
            ]);
...........................

        const Modal = new ModalBuilder()
...................................................
        Modal.addComponents([FirstInput, SecondInput]);

        await i2.showModal(Modal);

this is my code and i want the modal to reopen when clicking on:

                new ButtonBuilder()
                    .setCustomId('reopen')
                    .setStyle(EnumResolvers.resolveButtonStyle('PRIMARY'))
                    .setLabel(locale.commands.extensions.setup.buttons.reopen),

but it gives me an already replied error

void burrow

TypeError: Found non-callable @@iterator

modals

urban belfry
buoyant pecan

array 😉

urban belfry

the builders' setX and addX methods now take in arrays

void burrow

ah

urban belfry

the guide will be updated soon
just updated 👍

velvet jasper

Modals guide is updated now

pallid ice
buoyant pecan

why

i only want to know how to show a modal twice

pallid ice

so I can try and help you?

oh

I didn't see the text inbetween your code blocks

buoyant pecan

np KEKW

copper jetty
buoyant pecan

sad

copper latch

if i wanna update to v14 do i need to change anything?

tame gazelle

yes

copper latch

f

alote?

tame gazelle

see the guide in pins

depends on your code

copper latch

hmm leme see the guide

urban belfry

note that the guide is also a WIP

copper latch

wdym????????

is it important to change to djs v14?

vague coyote

this is an in dev version, so now definitely not

copper latch
urban belfry
copper latch is it important to change to djs v14?

FYI, v13 will still get updates after this, most of the new big features like modals are also featured in v13.7
no it's absolutely not necessary, i suggest you wait for 13.7 and use that for production when it's out, use this version for testing if you like

copper latch

ok ty

copper latch
urban belfry

probably, not immediately but surely

vague coyote

well yes, sooner or later support for v13 will be dropped

copper latch

fuck

urban belfry

at this point you're just waiting to hear that and cry, chill
v13 will probably get updates in the future and in the maybe distant future it'll die, just like how v14 will
now if you don't have any questions and still want to try out v14, check the pins

short tapir

Have these changed?

For message component collectors

Do I need to use the enums now instead

urban belfry
vague coyote
urban belfry
short tapir

Oh

What would they be found under

ComponentType.Button ?

kind pulsar

How can I check if a channel is nsfw or not?

vague coyote
short tapir

Alright

short tapir
kind pulsar
forest elm

use the typeguards, i.e. !channel.isDM() && message.channel.nsfw

vague coyote

channel.isText() is what you want

kind pulsar

thanks!

marsh gyro

idk if this is the right place to ask, but i am using discord.js#pull/7581/head and im trying to use showModal on an interaction ive already replied to but im getting The reply to this interaction has already been sent or deferred. any ideas of a workaround to just show a modal?

forest elm

showModal() has to be the initial reply

and you cant defer it either

marsh gyro

i see that, is there any way to show a modal after an interaction? nothing like followUpModal?

you have to basically make them click a button or something

forest elm

or you can just use showModal() right away, as i just said

marsh gyro

yeah, ok thanks

fringe axle
fluid summit
interaction.guild.me
.permissionsIn(currentChannel)
.has([PermissionFlagsBits.SendMessages])

This is returning false but my bot is clearly responding in currentChannel. What am I missing here? If I switch SendMessages to ViewChannel I return true

marsh matrix
fluid summit
marsh matrix
fluid summit
marsh matrix

👍

fluid summit
marsh matrix 👍

One more questions. Is PermissionsFlagsBits.SendMessages preferred to 'SendMessages'? Both seem to work

marsh matrix
fluid summit

🙏

marsh matrix

Well, I can't speak for the library, but that would definitely be my choice

copper jetty
urban belfry

but for preferred, we prefer you use the enums and not just strings

small mica
copper jetty
small mica

Theres no reply in my code

small mica

I just set it to edit the message, not reply

dawn phoenix

you respond to the interaction twice, don't do that

small mica

How did I respond two times? The message edits itself and then the select menu becomes disabled after a certain time that I have set in the collector.

dawn phoenix

i don't know why you overcomplicate this so much anyways
if someone chooses a category, just interaction#update, which edits the message the select menu is on
that should be the only response you need here

each selection/button press is it's own interaction instance

dawn phoenix
small mica
copper jetty

Why you deferUpdate but never edit the defer

And you deferUpdate every interaction

small mica

I defer the update because all the menus will be updated if I dont. If I type help 2 times, both will get updated

copper jetty

So you have to editReply every interaction and it will cause an error if you use a command

small mica

also it will show interaction failed even tho it doesnt

copper jetty

You deferUpdate every interaction so this error can happen anywhere where you reply to an interaction

small mica

how do I fix it? I cant remove the defer update as it will edit all embeds then

dawn phoenix

on a more meta level this all looks like a giant bandaid you stick onto things to not have to use slash commands, which would make that entire thing largely obsolete

small mica

If I don't defer, and I have two help menus (if 2 people use the help command), both the embeds are getting edited

dawn phoenix

pardon?

knotty plover

That's a really annoying way to share screenshots

small mica

But... is there anything I am doing wrong?

knotty plover

Sounds like your collectors and/or custom ids aren't sufficiently unique

So they listen to interactions from both

small mica

I just noticed even without deferUpdate all embeds are getting edited wtf

vague coyote

well yes, you dont update nor reply, so that defer is useless

small mica

How to only edit the embed of which the category was chosen from?

vague coyote

use a proper filter that only returns true if the message id is equal with the embed one

and consider using interaction.update()

knotty plover

I just make my customIds unique

So I know exactly what I'm listening for

small mica

How do I make it so each embed has different customids?

vague coyote

again, you dont need that. You have the initial message object, so just compare message ids in the filter

small mica
vague coyote
small mica

tysm @vague coyote hat worked :)

how can I fix this? It works but still..

nocturne kayak

either call deferUpdate() or update() the message instead (it's the same as edit interaction.message)

small mica
const schema = require("../../Database/custom-commands");
const { EmbedBuilder, Util } = require("discord.js");

module.exports = {
  name: "cc-list",
  run: async (client, message, args) => {
    const data = await schema.find({ Guild: message.guild.id });
    if (data.length <= 0) {
      const noEmbed = new EmbedBuilder()
        .setTitle("No data")
        .setDescription("There are no custom commands in this server")
        .setColor(Util.resolveColor("DarkPurple"));
      return message.channel.send({ embeds: [noEmbed] });
    } else {
      const embed = new EmbedBuilder()
        .setColor(Util.resolveColor("DarkPurple"))
        .setTitle(`A list of custom commands in ${message.guild.name}`)
        .setDescription(`There a total of ${data.length} custom commands in this server!\n ${data.map((cmd, i) => `\`\`\`fix\n${cmd.Command}\`\`\``).join(", ")}`);
      message.channel.send({ embeds: [embed] });
    }
  },
};

why does it show like this?

If I remove the codeblocks part it works fine

I want it like this

vague coyote

use `text` then

new codeblock -> new line

or put all in one codeblock

small mica

how do I put all in one cb?

ok wait i'll try

vague coyote

wrap it around the whole thing and not in .map()

small mica

ah yes that worked thanks

copper latch

how can i save my stuff in a object?

scarlet tangle
copper latch

leme get the cmd

wait

copper latch
scarlet tangle How is it djs related?

i have ```js
client.on('messageCreate', async message => {
const prefix = 'm-';
let party = []
if(message.content === prefix + 'join'){
if(party.length === 0){
party.push({
name: ${message.author.username},
type: 'Party leader'
})

} else {
  party.push({
    name: `${message.author.username}`,
    type: 'Player'
  })
}

await message.channel.send({ content: ${party[0].name} joined and he is ${party[0].type} })
console.log(party)
}
})``` the user who join is not getting saved in the object

knotty plover

Your let party = [] is inside the messageCreate event

That means it gets reset every single message

copper latch

ahhh

copper latch

i think

knotty plover

I dont see what this has to do with discord.js v14 though

copper latch

leme try

knotty plover

This is the v14 channel and this is a basic JS scoping issue

scarlet tangle
copper latch
knotty plover

np

copper jetty
copper latch

ty @knotty plover and @copper jetty

@knotty plover like i said the object is not saving the stuff

knotty plover

where are you declaring it?

copper latch

nvm ty it is fixed

brazen knoll

can bots not set guild vanities?

forest elm
brazen knoll

whats the request path

brazen knoll

thank you

main basin

how i fix it?

ohh

i fix

copper jetty

intents are PascalCased

somber mirage

Hi i'm trying to send the user few menus but I have this problem:

with this code:

            const res = [];
            let currentMenu = new SelectMenuBuilder()
            .setCustomId("value")
            .setPlaceholder("Select a value.");

            for(let i = 0; i < arr.size; i++) {
                console.log(i);
                if(i % 25 == 0 && i != 0) {
                    console.log("New Menu");
                    res.push(new ActionRowBuilder().setComponents(
                        currentMenu
                    ));

                    currentMenu = new SelectMenuBuilder()
                    .setCustomId("value")
                    .setPlaceholder("Select a value.");
                }

                const currentOption = arr.at(i);

                console.log(currentOption.name);
                currentMenu.addOptions({
                    label: prefix + currentOption.name,
                    value: currentOption.id
                });
            }

            if(currentMenu.options.length > 0) {
                res.push(new ActionRowBuilder().setComponents(
                    currentMenu
                ));
            }

            interaction.reply({content: "f", components: res});
tame gazelle

.setComponents and .addOptions now take an Array

somber mirage

I want to kill myself now.

somber mirage
urban belfry
somber mirage
            const res = [];
            let currentMenu = new SelectMenuBuilder()
            .setCustomId("value")
            .setPlaceholder("Select a value.");

            for(let i = 0; i < arr.size; i++) {
                if(i % 25 == 0 && i != 0) {
                    res.push(new ActionRowBuilder().setComponents([
                        currentMenu
                    ]));

                    currentMenu = new SelectMenuBuilder()
                    .setCustomId("value")
                    .setPlaceholder("Select a value.");
                }

                const currentOption = arr.at(i);

                currentMenu.addOptions([
                    {
                        label: prefix + currentOption.name,
                        value: currentOption.id
                    }
                ]);
            }

            if(currentMenu.options.length > 0) {
                res.push(new ActionRowBuilder().setComponents([
                    currentMenu
                ]));
            }

            interaction.reply({content: "f", components: res})
tame gazelle

.addOptions([{ label, value }])

somber mirage

I updated the code and It's still not working

urban belfry

check the stack then

heavy pasture

i am using modals
error: DiscordAPIError: Invalid Form Body
data.components[0]: The specified component type is invalid in this context

copper jetty
heavy pasture
copper jetty You used modal in wrong context

its wrong?

new Modal()
  .setCustomId('REQUEST_VIP_TAG')
  .setTitle('❗» REQUEST VIP TAG')
  .setComponents(
    new TextInputComponent()
      .setCustomId('EVIDENCE')
      .setLabel('EVIDENCE')
      .setStyle('SHORT')
      .setMinLength(10)
      .setMaxLength(100)
      .setPlaceholder('LINK')
      .setRequired(true)
  )```
urban belfry

setComponents would take in an array

copper jetty

Yes Modal takes action rows

urban belfry

and it would be ModalBuilder?

copper jetty

and TextInputBuilder unless you use old version

heavy pasture

thx

with actionRow it worked

dusky agate

is there any way to know the people who have entered through an invitation or which invitation a person entered with?

copper jetty
dusky agate

ok

short tapir

I assume MessageAttachment has changed to Attachment

urban belfry

indeed

copper jetty

Their removing Message from every class name

short tapir

Ah

At one point I wondered if it would be AttachmentBuilder

urban belfry

still a pr

short tapir

No, maybe not yet 😂

urban belfry

why?

not yet potentially, it's still a pr

copper jetty

Attachment don't have any builder methods like setName so its kinda useless

copper jetty

nvm it has builder methods ive never seen anyone using it

short tapir

Did setting a presence/status change at all?

urban belfry
short tapir

Ah, cheers

Im glad enums exist now lmao

copper jetty

Same

heavy pasture

DiscordAPIError: Invalid Form Body
data.components[0].components[1]: The specified component exceeds the maximum width
data.components[0].components[2]: The specified component exceeds the maximum width
data.components[0].components[3]: The specified component exceeds the maximum width

new Modal()
  .setCustomId('REPORT_PLAYER_MODAL')
  .setTitle('❗» Denúnciar jogador')
  .setComponents(
    new MessageActionRow().addComponents([
      new TextInputComponent()
        .setCustomId('PLAYER_NAME')
        .setLabel('Nome do jogador')
        .setStyle('SHORT')
        .setMinLength(1)
        .setMaxLength(16)
        .setPlaceholder('Insira o nome do jogador que deseja denúnciar.')
        .setRequired(true),        
      new TextInputComponent()
        .setCustomId('REASON')
        .setLabel('Motivo')
        .setStyle('PARAGRAPH')
        .setMinLength(50)
        .setMaxLength(500)
        .setPlaceholder('Insira o motivo pelo qual está denúnciando este jogador.')
        .setRequired(true),
      new TextInputComponent()
        .setCustomId('SERVER')
        .setLabel('Servidor')
        .setStyle('SHORT')
        .setMinLength(1)
        .setMaxLength(16)
        .setPlaceholder('Insira o nome do servidor em que ocorreu esta denúncia.')
        .setRequired(true),
      new TextInputComponent()
        .setCustomId('EVIDENCE')
        .setLabel('Prova')
        .setStyle('SHORT')
        .setMinLength(10)
        .setMaxLength(100)
        .setPlaceholder('Insira um link de uma imagem que comprove esta denúncia.')
        .setRequired(true)```
vague coyote

you can only have one textinput per row, 5 rows per modal

urban belfry

how come... what version is this? aren't these suffixed with Builder now?

vague coyote

yes, they probably just didnt update

heavy pasture

13.06.0

urban belfry

whaaaa

vague coyote

I'm not familiar with a version like that?

urban belfry

are you using djs v13.6.0 with builders 0.13?

i wouldn't recommend that, see djs 13.6 uses builders 0.11 internally, so it's probably not the best idea to mash different versions and stick with the version djs uses internally

heavy pasture

i am installed by repo

npm i discordjs/discord.js#v13

urban belfry

ah okay

i really think we should have a channel for v13-dev to avoid confusions like these
especially since it'll get more updates

heavy pasture
heavy pasture
urban belfry

on every actionrow, you can have up to 1 text input

and as usual, up to 5 rows on a modal

copper jetty
heavy pasture

yes i fixed it