#djs-in-dev-version

1 messages · Page 34 of 1

brittle robin
#

mhm

manic lynx
#

How do I fix this?

#

    const Buttons = new ActionRowBuilder()
      .addComponents([
        new ButtonBuilder()
          .setCustomId('suggest-accept')
          .setLabel('Accept')
          .setStyle(ButtonStyle.Success)
      ])
      .addComponents([
        new ButtonBuilder()
          .setCustomId('suggest-decline')
          .setLabel('Decline')
          .setStyle(ButtonStyle.Danger)
      ])```
white nebula
manic lynx
inland rose
#

I even tried:

let panels = new client.discord.ActionRowBuilder().addComponents(new client.discord.SelectMenuBuilder()
        .setCustomId("panels")
        .setPlaceholder("Select a panel to edit...")
        .setMaxValues(1)
    )

    for (let p of foundPanels) {
        panels.components[0].toJSON().options.push({
            label: p.name,
            description: "",
            value: `${p.id}`,
        });
    };

But panels.components[0].toJSON().options stiill returns an empty Array.

nocturne kayak
#

just use .addOptions() instead of this hacky stuff

inland rose
#

Nope!

for (let p of foundPanels) {
        panels.components[0].addOptions({
            label: p.name,
            description: "",
            value: `${p.id}`,
        });
    };
nocturne kayak
#

look like it takes an array

inland rose
#
let options = []

    let panels = new client.discord.ActionRowBuilder().addComponents(new client.discord.SelectMenuBuilder()
        .setCustomId("panels")
        .setPlaceholder("Select a panel to edit...")
        .setMaxValues(1)
    )

   

    for (let p of foundPanels) {
        options.push({
            label: p.name,
            value: `${p.id}`,
        })
    };

    if(options.length) {
        panels.components[0].addOptions(options)
    }
sturdy flicker
#

are there v14 events that are similar to v13's apiRequest and apiResponse events?

idle galleon
#

I believe it’s in the rest package

steel haven
#

There is response event in REST, but no request event afaik

#

only invalidRequestWarning

#

And restDebug

idle galleon
#

There’s also response

scarlet tangle
#

How could I covert PermissionsBitField to readable array of permissions strings?

plain roverBOT
uncut kelp
#

Are you using version 14

fluid pond
uncut kelp
#

Are you using version 14 too

#

Read the update guide pinned. Lots of it is old

west cobalt
#

I got the intent sooo x)

vague coyote
hasty gorge
#

hey, does the Embed.setDescription etc. still exist in dev version?

urban belfry
hasty gorge
forest elm
#

Embed only holds received api data

#

to construct an embed you have to use EmbedBuilder

hasty gorge
regal mason
#

Why .voice doesn't exists ?

forest elm
#

typeguard the interaction

urban belfry
plain roverBOT
regal mason
#

I see, thanks

scarlet tangle
#

how I can get styles for textinputbuilder?

forest elm
#

you can import TextInputStyle from discord.js

#

what discord.js are you using? npm ls discord.js

scarlet tangle
#

Already working...
webstorm just did't display it from autocomplete
thnks

merry bane
#

I'm about to lose my mind, anybody wanna help out

#
/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350
      throw new DiscordAPIError(data, res.status, request);
            ^
DiscordAPIError: Invalid Form Body
embeds[0].description: This field is required
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async Client.<anonymous> (/home/container/index.js:112:9) {
  method: 'post',
  path: '/channels/992756088376147989/messages',
  code: 50035,
  httpStatus: 400,
  requestData: {
    json: {
      content: null,
      allowed_mentions: { parse: [], repliedUser: true },
      flags: null,
      embeds: [
        MessageEmbed {
          type: 'rich',
          title: null,
          description: '',
          url: null,
          color: null,
          timestamp: null,
          fields: [],
          thumbnail: null,
          image: null,
          video: null,
          author: null,
          provider: null,
          footer: null
        }
      ]
    },
    files: []
  }
}```
#
 if(message.channelId === "992756088376147989") {
    let log = client.channels.cache.get("992542980261032006");

    await log.send("```Nápad od " + message.author.tag + " (" + message.author.id + ') "' + message.content + '" bol úspešne vytvorený!```')

        var embed = new MessageEmbed()
        embed.setDescription(message.content)
        await message.channel.send({ embeds: [embed] }).then(function (message) {
            message.react('✅');
            message.react('❌');

           message.startThread({
                name: message.content + " - Diskusia",
                autoArchiveDuration: 4320, 
        });
        });

        message.delete();
 }
steel haven
merry bane
#

Strangely enough the embed sends and the description is there

#

the thread however, is only the second part

steel haven
#

Then the error stems from another place

merry bane
#

but what could it be

steel haven
forest elm
#

different messages

merry bane
forest elm
merry bane
#

that's the correct channel

forest elm
#

it tried sending an embed with an empty string as the description

merry bane
#

I'm gonna show you what it does

forest elm
#

are you 100% sure the error is coming from that code?

steel haven
merry bane
#

This is what happens. The second reaction doesn't get added. After this it just crashes. The embed used to be created with just " - Diskusia" but it does nothing now.

forest elm
#

are you ignoring messages sent by the bot?

merry bane
steel haven
merry bane
merry bane
forest elm
#

is that in a messageCreate event?

merry bane
#

Yes

forest elm
#

and are you ignoring messages sent by bots

#

something like if (message.author.bot) return

merry bane
#

Wait a moment

#

Well I am now.

forest elm
#

that doesnt stop the message.channel.send()

merry bane
#

Still the same error tho, except the thread gets created in a half assed way

merry bane
forest elm
#

it tried sending an embed with an empty string as the description

the bots message does not have content

#

and you're not ignoring it

merry bane
#

and how the hell do I do that

#

god the new API is so overdefined

merry bane
#

I like to check just for the single bot due to level up messages

forest elm
#

unless you're cropping something after the if condition, no its not

forest elm
forest elm
#

because the problem is in message.channel.send()

merry bane
#

Ok

#

so what do I do? You lost me a bit

forest elm
#
  • your bot sends a message with an embed containing the content of a message
  • your bot will receive the message it just sent, which does not have content, just the embed
  • it tries creating a new embed with the content that doesnt exist, and sends another message, and fails
merry bane
#

Ohhhhhhhhhhhhhhhhhhh

#

That makes a lot of sense

#

well shit

#

Thanks man. Would've never thought of that lol

#

Although the thread name is still a bit wacky

forest elm
#

that's another story, i was solely trying to tell you why you got that first error

merry bane
#

And what's the story about

forest elm
#

show the updated code

merry bane
#

here you are mate

if(message.channelId === "992756088376147989") {
     if(message.author.id === client.user.id) return;
     
    let log = client.channels.cache.get("992542980261032006");

    await log.send("```Nápad od " + message.author.tag + " (" + message.author.id + ') "' + message.content + '" bol úspešne vytvorený!```')

        var embed = new MessageEmbed()
        embed.setDescription(message.content)
        await message.channel.send({ embeds: [embed] }).then(function (message) {
            message.react('✅');
            message.react('❌');

           message.startThread({
                name: message.content + " - Diskusia",
                autoArchiveDuration: 4320, 
        });
        });

     message.delete();
 }    
steel haven
#

Async nature of node. The second react and thread creation happen while the second message gets handled, so all only happened half when the bot crashes

merry bane
#

It doesn't crash anymore, but message.content seems to be non-existent in the thread

#

Oh nevermind, I see it now

forest elm
#

no content, again

steel haven
merry bane
#

I see, nevermind

prisma kiln
#

what's the cache meaning inInteraction<cache>

urban belfry
#

if it wasn't cached, you'd have raw data like the raw guild member object instead of a GuildMember

prisma kiln
idle galleon
paper sparrow
#

Like when we paste a large text in discord chat it suggests us to send the text as an attachment, how todo it in bot?

#

guide/ docs?

vague coyote
paper sparrow
#

and whats new name of messageAttachments?

paper sparrow
#

found it, AttachmentBuilder

dawn phoenix
#

@paper sparrow "temporary file" as in "in your file system"?
there's no need for that, you can send buffers as attachments

paper sparrow
dawn phoenix
#

Buffer.from("text here") and keeping in mind that newlines are best \r\n in files

paper sparrow
#

Hmmm Thanks for letting me know!

dawn phoenix
paper sparrow
#

now how will i reply to interaction? .reply({attachments:[attach]})?

forest elm
#

files, not attachments

#

but yes

paper sparrow
#

alright!

tame mortar
#

When is it releasing?

velvet jasper
#

Idk

uncut kelp
#

Same

tame mortar
#

Relatable

tawdry mist
#

Does anyone know the full list of user flags?

#

These are the only ones I know atm.

const badges = [
    "HypeSquadOnlineHouse1",
    "HypeSquadOnlineHouse2",
    "HypeSquadOnlineHouse3",
    "CertifiedModerator"
];
tawdry mist
#

Thanks.

scarlet tangle
#
EmbedBuilder.from(embed).spliceFields(embed.fields.length - 2, 1, [
            { name: 'Reason', value: reasons[1], inline: true }
          ])
#

Did you manage to fix this? I'm stuck on the same thing

lofty blaze
scarlet tangle
scarlet tangle
#

this is valid code

scarlet tangle
#

np

stark lintel
#

I'm new to discord.js

#

I'm a python pro but a js noob

#

Anyone can point me in the correct direction to get started with JS?

#

Thanks!

stark lintel
#

Thank you

mental inlet
#

how do you check if a user has a certain UserFlag? like, is there an interaction.user.flags or something?

plain roverBOT
#

Documentation suggestion for @mental inlet:
property User#flags
The flags for this user

mental inlet
#

ah ty

#

i'm probably being so dumb right now..

vague coyote
#

what... exactly are you trying to do

mental inlet
#

i'm trying to loop through the user's flags and see what UserFlags they have

#

so i'm converting it into an array

copper jetty
#

You can do as any

vague coyote
#

why

#

just use user.flags.toArray()

mental inlet
#

WOW ok i'm dumb, thank you lol

mental inlet
#

probably should've checked the methods..

west cobalt
#
DiscordAPIError[50035]: Invalid Form Body
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
    at SequentialHandler.runRequest (/home/remi/Documents/mavis/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:475:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.queueRequest (/home/remi/Documents/mavis/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:201:11)
    at async REST.request (/home/remi/Documents/mavis/node_modules/@discordjs/rest/src/lib/REST.ts:319:20)
    at async TextChannel.send (/home/remi/Documents/mavis/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15)
    at async Context.sendEmbed (/home/remi/Documents/mavis/src/Context.ts:23:68)
    at async StatsCommand.run (/home/remi/Documents/mavis/src/commands/stats.ts:7:3)
    at async Context.runCommand (/home/remi/Documents/mavis/src/Context.ts:51:3)
    at async Context.parse (/home/remi/Documents/mavis/src/Context.ts:30:3)
    at async Client.onMessage (/home/remi/Documents/mavis/src/Mavis.ts:81:10)

What is that error ? List item values ?

forest elm
#

show Context.ts:23

west cobalt
#

async sendEmbed(embed: Partial<Embed>): Promise<Message> { return await this.msg.channel.send({ embeds: [Object.assign(new EmbedBuilder(), embed)] }); }

#

In v13 I had this async sendEmbed(embed: Partial<MessageEmbed>): Promise<Message> { return await this.msg.channel.send({ embeds: [Object.assign(new MessageEmbed(), embed)] }); } and it was working

forest elm
#

i dont understand the purpose of that Object.assign()

#

on both cases

#

why can't you just pass embed to embeds?

west cobalt
#

That was maybe when I was passing objects I needed to do that.. It's true that it should work without that

#

Yeah it works

#

That was a weird error anyway

crystal valve
#
    const filter = (i) => i.user.id === interaction.user.id;
    const collector = interaction.channel.createMessageComponentCollector({
      filter,
      componentType: "SELECT_MENU",
      time: 18000,
    });
console.log('after interaction')
    collector.on("collect", (interaction) => {
  console.log('after collection')```
so I use the interaction, and it logs `after interaction` but not `after collection`...
i'm using interactions not messages in channels btw
not sure if this is enough information, lmk if I should send more of the code
uncut kelp
#

The component type is a number

crystal valve
#

ah

#
    | CombinedPropertyError (2)
    |   Received one or more errors
    | 
    |   input.value
    |   | [MissingPropertyError: value]
    | 
    |   input.name
    |   | [MissingPropertyError: name]```
```js
const components = (state) => [
      new ActionRowBuilder().addComponents(
        new SelectMenuBuilder()
          .setCustomId("help-menu")
          .setPlaceholder("Select a category...")
          .setDisabled(state)
          .addOptions(
            {
              label: "Information",
              value: "information",
            },
          )
      ),
    ];

    const initialMessage = await interaction.reply({
      embeds: [embed2],
      components: components(false),
    });```
steel haven
steel haven
crystal valve
#

sorry for the late reply

steel haven
#

The code you sent was how you sent the SelectMenu, not the collect event where you handle the interaction… the error seems to be in there.

young kindle
#

hi, is there like a class that contains all the enums?

steel haven
crystal valve
young kindle
steel haven
steel haven
forest elm
crystal valve
# steel haven The error was talking about missing name/value though…

so I set my client.commands like this

        const commandFiles = await globPromise(`${__dirname}/../SlashCommands/**/*.js`);

        commandFiles.map((value) => {
            /**
             * @type {Command}
             */
            const file = require(value);
            const splitted = value.split("/");
            const directory = splitted[splitted.length - 2];

            if (file.name) {
                const properties = { directory, ...file };
                this.client.commands.set(file.name, properties);
            }
        });```
#

so everything has a name and value (name and description)

steel haven
crystal valve
#

oh alright

#

what would you suggest I do then?

#

basically trying to get a help command that automatically updates for slash commands

steel haven
#

Did you ever show/look through the full error stack? Because I don’t remember seeing it. There’s usually more information telling you about the source of your error than what you provided up until now

crystal valve
#
  Received one or more errors

  input[0]
  | CombinedPropertyError (2)
  |   Received one or more errors
  | 
  |   input.value
  |   | MissingPropertyError > value
  |   |   A required property is missing
  | 
  |   input.name
  |   | MissingPropertyError > name
  |   |   A required property is missing

    at ArrayValidator.handle (/home/runner/v14/node_modules/@sapphire/shapeshift/dist/index.js:400:70)
    at ArrayValidator.parse (/home/runner/v14/node_modules/@sapphire/shapeshift/dist/index.js:114:88)
    at EmbedBuilder.addFields (/home/runner/v14/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:244:57)
    at InteractionCollector.<anonymous> (/home/runner/v14/SlashCommands/Information/help.js:87:10)
    at InteractionCollector.emit (node:events:402:35)
    at InteractionCollector.emit (node:domain:475:12)
    at InteractionCollector.handleCollect (/home/runner/v14/node_modules/discord.js/src/structures/interfaces/Collector.js:109:12) Promise {
  <rejected> CombinedPropertyError (1)
    Received one or more errors
  
    input[0]
    | CombinedPropertyError (2)
    |   Received one or more errors
    | 
    |   input.value
    |   | [MissingPropertyError: value]
    | 
    |   input.name
    |   | [MissingPropertyError: name]
  
      at ArrayValidator.handle (/home/runner/v14/node_modules/@sapphire/shapeshift/dist/index.js:400:70)
      at ArrayValidator.parse (/home/runner/v14/node_modules/@sapphire/shapeshift/dist/index.js:114:88)
      at EmbedBuilder.addFields (/home/runner/v14/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:244:57)
      at InteractionCollector.<anonymous> (/home/runner/v14/SlashCommands/Information/help.js:87:10)
      at InteractionCollector.emit (node:events:402:35)
      at InteractionCollector.emit (node:domain:475:12)
      at InteractionCollector.handleCollect (/home/runner/v14/node_modules/discord.js/src/structures/interfaces/Collector.js:109:12)
}```
#

there's the full error

crystal valve
#
const categoryEmbed = new EmbedBuilder() //86
        .addFields( //87
          category.commands.map((cmd) => { //88
            return { //89
              name: `**${cmd.name}**`, //90
              value: `![green](https://cdn.discordapp.com/emojis/925389347631534090.webp?size=128 "green") ${cmd.description}`, //91
              inline: false, //92
            }; //93
          }) //94
        ) //95```
steel haven
#

And then fix whatever you‘ll find that doesn’t do what you expect it to do

crystal valve
#

alr

crystal valve
#

that's what it logged

#

I presume it shouldn't have [ ] but not sure

forest elm
#

it can, in the latest-ish version

crystal valve
#

oh

steel haven
#

Which version are you on though?

crystal valve
#

"discord.js": "^14.0.0-dev.1656860905-cdd9214",

dull mulchBOT
crystal valve
#

oh I got it to work

#

this happens every time I run the code

—————————————————————————————————
resolve Promise {
  {
    url: 'wss://gateway.discord.gg',
    shards: 1,
    session_start_limit: {
      total: 1000,
      remaining: 937,
      reset_after: 12481008,
      max_concurrency: 1
    }
  }
} undefined```
jaunty comet
#

/gateway/bot

#

Interesting

crystal valve
crystal valve
#

@forest elm

crystal valve
#

I'm getting this on every slash command resolve Promise { Uint8Array(0) [] } undefined

didn't have this issue before I updated to newest v14...

forest elm
#

i dont see any error

crystal valve
#

oh alright.. I thought it would be an error

knotty plover
#

I have no idea what AntiCrash is

crystal valve
#

oh that's just for process.on("multipleResolves", (type, promise, reason) => {

knotty plover
#

Okay then this is just expected output

crystal valve
crystal valve
# knotty plover Okay then this is just expected output

and I'm not sure if this is a djs question but I'm getting (node:5329) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time every like 5 runs of my code, not sure what it means (it's just a discord bot, not using stream or web)

#

node 16.9

boreal kraken
#

is there still the client.on('ratelimit') within discord.js@dev ?

#

or an way to detect it

dawn phoenix
#

rateLimited on rest as emitter

dawn phoenix
#

the PR is merged but the docs haven't deployed since

bitter schooner
#

where did my message content gone?

#

i enabled the intent and specified that number in intents

#
const client = new Client<true>({
    intents: [
        'GuildMembers',
        'GuildMessages',
        1 << 15,
        32767 // message content intent
    ]
})
#

without 32767, messageCreate dont even work

jaunty vault
#

you need the Guilds intent

urban belfry
#

32767 isn't the message content intent, is it?
add Guilds and add MessageContent

bitter schooner
#

thanks guys :)

#

it works now

dawn phoenix
#

32768 is message content and does not influence messageCreate apart from the content being empty

bitter schooner
#

oh

neat pier
#

Better not to use magic numbers

crystal valve
#
new ActionRowBuilder()
        .addComponents(
            new ButtonBuilder()
            .setStyle(ButtonStyle.Link)
            .setLabel('Invite')
            .setURL('https://discord.com/api/oauth2/authorize?client_id=id&permissions=8&scope=bot%20applications.commands')
        )```
`data.components[0].components[BASE_TYPE_REQUIRED]: This field is required`
split fulcrum
#

you forgot the []

new ActionRowBuilder().addComponents([ new ButtonBuilder().setStyle(ButtonStyle.Link).setLabel('Invite').setURL('https://discord.com/api/oauth2/authorize?client_id=id&permissions=8&scope=bot%20applications.commands')])
outer bane
#

you don't need to wrap in inside an array, addComponents takes rest params or an array

split fulcrum
#

oh :/

outer bane
#

it went back and forth and now simply takes both

split fulcrum
#

Ok

pallid ice
#

as per the error, name is required

copper jetty
latent lion
#

This error is keep happening, TypeError: Cannot destructure property 'components' of 'undefined' as it is undefined. Can you help?

latent lion
steel haven
latent lion
#

Oh ok

latent lion
#

This is where the error is coming from

copper jetty
#

Your setting custom id twice

digital roost
#

How can i make Embed !?

scarlet tangle
#

any experts with node js pls ping me

vague coyote
vague coyote
digital roost
#

thank you ✨

plain roverBOT
brisk path
dawn phoenix
#

it was a builder all along, the builder has been moved to the (new) builders package

brisk path
#

Oh lol

limpid stratus
#

Message<true> is a message in a cached guild right?

uncut kelp
#

Yes

rain reef
plain roverBOT
#

Suggestion for @meager crag:
guide Interactions: Slash command permissions
read more

vague coyote
#

that but with @ dev stuff

vague coyote
#

show code

#

select menus dont have labels

#

they have a placeholder

plain roverBOT
vague coyote
#

interaction.values

forest elm
#

its not a selectmenuinteraction

vague coyote
#

whatever interaction is, is either undefined or not a SelectMenuInteraction

steel haven
#

That’s only doable by guild owners/admins

#

How to do it as guild owner?

#

In server settings->Integrations->your bot

forest elm
#

select menus are not supported in modals

#

read the warning in the beginning of that section

steel haven
crystal valve
#
    const components = (state) => [
      new ActionRowBuilder().addComponents(
        new SelectMenuBuilder()
          .setCustomId("help-menu")
          .setPlaceholder("Select a category...")
          .setDisabled(state)
          .addOptions(
            {
              label: "Information",
              value: "information",
            },
            {
              label: "Requests",
              value: "requests",
            },
            {
              label: "Dank Memer",
              value: "mankdemer",
            },
            {
              label: "Configuration",
              value: "serverconfiguration",
            },
            {
              label: "Statistics",
              value: "statistics",
            },
            {
              label: "User Specific",
              value: "user_specific",
            }
          )
      ),
      new ActionRowBuilder().addComponents([
        new ButtonBuilder()
          .setStyle(ButtonStyle.Link)
          .setLabel("Invite")
          .setURL(
            "https://discord.com/api/oauth2/authorize?client_id=id&permissions=8&scope=bot%20applications.commands"
          )
      ]),
    ];

    const initialMessage = await interaction.reply({
      embeds: [embed2],
      components: [components(false)],
    });```
`DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[BASE_TYPE_REQUIRED]: This field is required`
steel haven
crystal valve
#

oh alr

crystal valve
# steel haven You have a level of array too many. Your function returns an array of ActionRow ...

so how come ```js
const components = (state) => [
new ActionRowBuilder().addComponents(
new SelectMenuBuilder()
.setCustomId("help-menu")
.setPlaceholder("Select a category...")
.setDisabled(state)
.addOptions(
{
label: "Information",
value: "information",
},
{
label: "Requests",
value: "requests",
},
{
label: "Dank Memer",
value: "mankdemer",
},
{
label: "Configuration",
value: "serverconfiguration",
},
{
label: "Statistics",
value: "statistics",
},
{
label: "User Specific",
value: "user_specific",
}
)
),
];

    let component2 = new ActionRowBuilder().addComponents(
    new ButtonBuilder()
      .setStyle(ButtonStyle.Link)
      .setLabel("Invite")
      .setURL(
        "https://discord.com/api/oauth2/authorize?client_id=958848741790609468&permissions=8&scope=bot%20applications.commands"
      )
  );

const initialMessage = await interaction.reply({
  embeds: [embed2],
  components: [components(false), component2],
});```

doesn't work either? if I remove the button row it works fine...

steel haven
steel haven
crystal valve
undone yew
#

how to fix?

hot bone
#

How to access interaction's command ?

steel haven
hot bone
#

message*

#

Sorry

#

@steel haven

mental inlet
#

where'd AnyInteraction go?
ver 14.0.0-dev.1656936300-f6db285 btw

steel haven
hot bone
#

.message do not exists, you are funny

steel haven
hot bone
#

ChatInput

steel haven
steel haven
mental inlet
#

probably being really dumb right now

forest elm
#

typeguard interaction

plain roverBOT
mental inlet
#

nvm

#

fixed, ty!

#

sorry if i'm asking too many questions but

uncut kelp
#

That error tells you it does exist

#

How would it know to check a non-existent type

mental inlet
#

ill remove that part in the message i guess, thanks for the clarification because i'm absolutely braindead lol

mental inlet
arctic mirage
#

is there a way to leave the bot typing in the chat in message.reply();?

plain roverBOT
kind pulsar
#

How can i fix this?

white nebula
white nebula
#

Make it return true or false, or use a function like forEach(...) if you're not trying to filter the collection

kind pulsar
#

ah

#

okay, thanks

dawn phoenix
#

this should probably really be coll.filter(predicate).size

forest elm
#

Looks like you have different versions of discord-api-types

#

Than the one used by /builders

#

But the builders version isn't

#

Builders aren't using the latest discord-api-types

#

Discord.js does

#

Downgrade your version or override the /builders version

hybrid folio
#

hi, i tried to use discord.js@dev version. But the messageCreate event dont fire unless I tag the bot. I already turn intents on.

This is my intents list on the bot

import { GatewayIntentBits } from 'discord.js';

export default [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildBans,
    GatewayIntentBits.GuildEmojisAndStickers,
    GatewayIntentBits.GuildIntegrations,
    GatewayIntentBits.GuildWebhooks,
    GatewayIntentBits.GuildInvites,
    GatewayIntentBits.GuildVoiceStates,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.GuildMessageReactions,
    GatewayIntentBits.GuildMessageTyping,
    GatewayIntentBits.DirectMessages,
    GatewayIntentBits.DirectMessageReactions,
    GatewayIntentBits.DirectMessageTyping,
];
outer bane
#

the event does fire, you just don't get any content without the MessageContent intent if your bot isn't mentioned

hybrid folio
#

oh

#

thank you very much

knotty plover
#

How are you creating your commands?

#

It doesnt accept a bigint there?

#

Which say what, string?

#

Yeah so its just the bitfield bigint

#

But in a string

#

toString()

#

What is it typed as and how are you deploying it?

#

Okay, so using the djs manager

#

To me, looks like it should be working fine

#

It accepts bigint

#

Yeah can try that but it should be the same as FlagsBits I would have thought...

#

Can also try it in an array

#

I'll take a look at the source though

#

Whats your dev version?

#

It serialises it to string Thonk

#

Are you sure this is where the error is coming from

#

Oh you're deploying with REST though?

#

I misread the code snippet earlier then, yeah that only shows me where you load them into event handling

#

Yeah if you're doing a REST deployment its default_member_permissions for one, gotta use the raw API snake case

#

And it definitely needs to be made a string yourself

#

I mean its probably just the wrong type

#

I don't use builders myself but also haven't updated to the new permissions yet. Builders would be handling the serialisation for you, yes

#

You could import Permissions from discord.js to handle it

#

new Permissions(Flags).bitfield.toString()

#

But also could just toString() whatever flag it is

#

its definitely a class lol

#

with a constructor

#

or did we rename that lmao

#

PermissionsBitfield maybe?

#

yeah that one, my bad

#

Uhh not aware of that issue

#

I'd expect the versions to be brought in line before a stable release

knotty plover
#

Label is probably too long

pallid ice
#

any idea why channelTypes: [ChannelType.GuildNews, ChannelType.GuildText] isn't working? the option is showing all channels

this wasn't an issue before

pallid ice
#

just checked older commands I set up months ago that also use channelTypes, they are also now showing all channels like categories and voice etc on both stable and canary

idle galleon
pallid ice
#

I've redeployed to be sure

idle galleon
#

You should be using channel_types then

pallid ice
#

oh? when did that change?

idle galleon
#

channelTypes is a d.js thing

#

It changes the casing for you. Discord api doesn’t do that

pallid ice
#

oh wait maybe I misunderstood your question

#

I create my commands as export objects

idle galleon
#

I’m asking what you are using to deploy the commands

pallid ice
#

ah

idle galleon
#

Either the @discordjs/rest package or just d.js

pallid ice
#

I use restbut I now see the issue

#

I'll revert to client.application.commands.set

idle galleon
#

You can only call that when the client is ready

pallid ice
#

I know. it's how I used to deploy my commands but I was advised by someone to use REST instead

#

in hindsight, I should've just left it unchanged. if it ain't broke, don't fix it

idle galleon
#

You prob could’ve just find all and replace

pallid ice
#

I could, but I've very recently tried getting more done with typescript and the typings are suited for d.js formatting

#

if that makes sense, it does in my head

idle galleon
#

You don’t use the provided typings?

pallid ice
#

I do

jaunty vault
#

🤔

pallid ice
#

which show channelTypes, not channel_types

#

and defaultMemberPermissions as opposed to default_member_permissions as two examples

idle galleon
#

Ur prob using ApplicationCommandData

pallid ice
#

I am

idle galleon
#

APIApplicationCommand should have the correct props

pallid ice
#

ah ok thanks

idle galleon
#

Magic strings for permissions are not valid in v14 anymore

#

Use PermissionsBitField.Flags.ManageMessages instead

#

That is code?

#

Oh right, not all caps

knotty plover
#

*.Flags.ManageMessages

idle galleon
#

You use that in lieu of magic string

plain roverBOT
knotty plover
#

Thats not it at all

idle galleon
#

That’s the v13 way

#

V14 uses PermissionsBitField.Flags.ManageMessages

#

How did you define PermissionsBitField?

knotty plover
#

(didnt)

nocturne kayak
#

it's PermissionsBitfield in v14
check out other changes in pins

knotty plover
#

Flags

unreal cedar
#

How can I detect which subcommand has been ran in my slash command?

plain roverBOT
unreal cedar
#

Doesn't appear for me

nocturne kayak
#

use interaction.isChatInputCommand() typeguard

unreal cedar
#

Oh ok

#

thank you for your help!

green plume
#

role.managed shows all managed role which a bot creates during server join also the server booster role. is it possible to see only only the roles which bot created not the server booster role?

plain roverBOT
plucky mirage
#

Anyone knows how to get a string of a Command Interacion Options?

outer bane
#

you need a ChatInputCommandInteraction

plucky mirage
#

Thanks! <3

radiant lintel
#

was isAutocomplete removed?

steel haven
hoary tree
#

How could i put the embed color on RANDOM?

velvet jasper
#

“Random”

nimble relic
#

does anyone know how to edit the embed when the person clicks the button

undone yew
#

I'm using discord js in typescript, but I couldn't solve the error, can you help? how to fix?

uncut kelp
#

Wouldn't it just mean message is not a Message

forest elm
#

show how you're passing the parameters to that event

plucky mirage
#

i have this intents and partials but GuildMemberManager#cache does not have all the members of the server, as in the v13. Any solution?

forest elm
#

fetch the members, <Guild>.members.fetch()

plucky mirage
forest elm
forest elm
#

members that join/are updated will be cached, but thats it

#

you only have to fetch them once if you're not using sweepers/limiting the cache

plucky mirage
#

okay, ty 👍

undone yew
#

how to fix my issue?

forest elm
#

show the actual code, not the ts interfaces

#

but your issue has nothing to do with discord.js anyway, you're just not passing a message to the run method in your event listener

undone yew
#

so can i fix this?

forest elm
#

do the opposite of what i just said

#

i.e. pass the message from messageCreate to the run method in your event listener

tall verge
#

Is it normal that when I click the submit button of the modal, it doesn't close automatically?

vague coyote
#

it closes when you reply to it

#

with the bot

hot bone
#

I don't get it

forest elm
#

{ name: 'that' }

hot bone
#

Ah yes I forgor

#

thanks

stuck solstice
#

Since
interaction#isAutocomplete()
and
interaction#isModalSubmit()
have been removed, what do I replace em with?

#

typeof?

jolly birch
#

check the type

hoary tree
#
DiscordAPIError[50035]: Invalid Form Body
4.options[0].type[NUMBER_TYPE_COERCE]: Value "STRING" is not int.
4.type[NUMBER_TYPE_COERCE]: Value "CHAT_INPUT" is not int.
    at SequentialHandler.runRequest (D:\Sapphire\sapphiredev\node_modules\@discordjs\rest\dist\index.js:743:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.queueRequest (D:\Sapphire\sapphiredev\node_modules\@discordjs\rest\dist\index.js:555:14)
    at async REST.request (D:\Sapphire\sapphiredev\node_modules\@discordjs\rest\dist\index.js:989:22)
    at async D:\Sapphire\sapphiredev\handlers\slashCommand.js:46:5 {
  rawError: {
    code: 50035,
    errors: { '4': [Object] },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'PUT',
  url: 'https://discord.com/api/v9/applications/992880300327719033/guilds/992878975615504466/commands',
  requestBody: {
    files: undefined,
    json: [ [Object], [Object], [Object], [Object], [Object], [Object] ]
  }
}
vague coyote
#

use the enum or the type number instead of the string

hoary tree
#

type: 'CHAT_INPUT' should be what?

hoary tree
#

ty

#

still not working

#

same error

#

nwm i forgot to remove ''

vague coyote
#

you also need to change it in your option

#

oh

hoary tree
#
D:\Sapphire\sapphiredev\commands\misc\screenshot.js:8
    type: ApplicationCommandType.ChatInput,
          ^

ReferenceError: ApplicationCommandType is not defined
    at Object.<anonymous> (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:8:11)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at D:\Sapphire\sapphiredev\handlers\slashCommand.js:23:26
    at Array.forEach (<anonymous>)
    at module.exports (D:\Sapphire\sapphiredev\handlers\slashCommand.js:19:32)

Node.js v18.3.0
jolly birch
#

Then define it.

hoary tree
#

it is

#

nwm put a dot instead of a comma

jolly birch
vague coyote
#

type check it to make sure ctx.member is a GuildMember and not an APIGuildMember

#

ctx.inCachedGuild() typeguard should be enough

knotty plover
#

you shouldnt return anything from the event listener

#

you're still returning something

#

A message or promise<message>

hoary tree
#
D:\Sapphire\sapphiredev\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176
    if (!this.deferred && !this.replied) return Promise.reject(new Error(ErrorCodes.InteractionNotReplied));
                                                               ^

Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
    at ChatInputCommandInteraction.followUp (D:\Sapphire\sapphiredev\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176:64)
    at Object.run (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:42:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Client.<anonymous> (D:\Sapphire\sapphiredev\events\interactionCreate.js:58:6) {
  [Symbol(code)]: 91
}

Node.js v18.3.0
knotty plover
#

You're using followUp before deferring or replying to the interaction

#

error says you are

#

You're checking if they do have Administrator

hoary tree
#
CombinedError (2)
  Received one or more errors

  1 ValidationError > s.nullish
  |   Expected undefined or null
  |
  |   Received:
  |   | PassThrough {
  |   |   _readableState: [ReadableState],
  |   |   _events: [Object: null prototype],
  |   |   _eventsCount: 5,
  |   |   _maxListeners: undefined,
  |   |   _writableState: [WritableState],
  |   |   allowHalfOpen: true,
  |   |   [Symbol(kCapture)]: false,
  |   |   [Symbol(kCallback)]: null }

  2 ValidationError > s.string
  |   Expected a string primitive
  |
  |   Received:
  |   | PassThrough {
  |   |   _readableState: [ReadableState],
  |   |   _events: [Object: null prototype],
  |   |   _eventsCount: 5,
  |   |   _maxListeners: undefined,
  |   |   _writableState: [WritableState],
  |   |   allowHalfOpen: true,
  |   |   [Symbol(kCapture)]: false,
  |   |   [Symbol(kCallback)]: null }

    at UnionValidator.handle (D:\Sapphire\sapphiredev\node_modules\@sapphire\shapeshift\dist\index.js:1061:23)
    at UnionValidator.parse (D:\Sapphire\sapphiredev\node_modules\@sapphire\shapeshift\dist\index.js:137:88)
    at EmbedBuilder.setThumbnail (D:\Sapphire\sapphiredev\node_modules\@discordjs\builders\dist\index.js:292:49)
    at Object.run (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:34:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Client.<anonymous> (D:\Sapphire\sapphiredev\events\interactionCreate.js:58:6)
small light
hoary tree
#
TypeError: body.arrayBuffer is not a function
    at Object.run (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:29:50)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Client.<anonymous> (D:\Sapphire\sapphiredev\events\interactionCreate.js:58:6)
small light
#

idk sorry

steel haven
#

Hi, i test 32768 intents but it no work, the messageCreate no work thinkMan

knotty plover
#

iirc 32768 is only the MESSAGE_CONTENT intent and nothing else

#

Which is why you should use actual separated intents and not a magic number

velvet jasper
#

Mon pulled out the bit calculator for that one

knotty plover
#

No actually lol

#

32767 was the old all-intents and therefore 32768 is the singular next intent

#

1 << 15

velvet jasper
knotty plover
#

Because permissions are bigints

#

1n << 40n might work

#

Needs to be a string

#

Thats probably coming from your @discordjs/rest deployment of commands

steel haven
#

It normal ? thinkMan

knotty plover
#

The JSON payload for /rest needs it to be a string, since JSON.stringify doesn't parse bigints

knotty plover
#

BigInt.toString() if its available

#

I cant remember lol

scarlet tangle
#

Getting this, how to fix

dawn phoenix
#

there's more info below that

#

oh, screenshots are flipped, there's still more info below that

  • what's your relevant code?
scarlet tangle
#

Code :

const options =  res.tracks.slice(0, 25).map((track, index) => {
              return {
                label: `${track.title} [${ms(track.duration, {
                  colonNotation: true,
                  showMilliseconds: false,
                })}]`,
                value: index + 1,
              };
            }),
       
     const menu = new SelectMenuBuilder()
          .addOptions(options)
          .setCustomId('search')
          .setPlaceholder('Make a selection');
dawn phoenix
#

potatodetective reads like it expects a string, but got a number

#

yep, value has to be a string

scarlet tangle
#

anyone know if timeouts will be a feature in the v14?

jolly birch
#

Timeouts are already a feature?

scarlet tangle
#

in v13?

formal kernel
#

yes?..

scarlet tangle
#

since when-

#

oh damn thats new

#

thanks for alerting me of this

formal kernel
#

its really not new tbh

#

timeouts have been in v13 for ages

green plume
idle galleon
#

Means you either replied twice or took too long to reply

idle galleon
green plume
#

tmr?

idle galleon
#

Too many requests

#

The log doesn’t include the url, so idk what the request was

green plume
#

I just rename my index.js file to bot.js and created a new index.js file with this content

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

const manager = new ShardingManager('./bot.js', { token: process.env.TOKEN });

manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));

manager.spawn();
idle galleon
#

How did you obtain the Response?

green plume
#

while running on the bot using node .

idle galleon
#

What code did you use to get the Response object?

green plume
#
"main": "bot.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "node bot.js"
  }
idle galleon
#

So that’s a no?

green plume
#

emm, didn't got what u told

idle galleon
#

What code inside of the bot (specifically a js file) did you add to get the shown log?

green plume
#
const Component = require("../../Structures/Core/Component");
const Rolex = require("../../..");
const { inspect } = require("util");

module.exports = new Component({
    name: "unhandledRejection",
    /** 
     * @param {Rolex} client
     */
    run: async (client, reason, p) => {
        console.log('——————————[Unhandled Rejection/Catch]——————————\n', reason, p)
    }
})
#

nvm I got it

digital sequoia
#

Hey guy does the function how to send images in embeds got changed cuz my embeds looks like this: https://sean.does-co.de/9vxYhnEr

The Image should be in the Embed.

Code:

// embed
.setThumbnail(`attachment://color.png`)

// files reply
files: [await makeFile()]

I can't show you the code exactly but I can tell u it worked in v13...

hoary fox
digital sequoia
#

it dont...

#

I have the same problem with setImage....

#

Thats a other cmd with setImage

nocturne kayak
#

make sure makeFile returns an AttachmentBuilder with 'color.png' name

digital sequoia
#

and yes this works too fine in v13

digital sequoia
#

Wait you guys changed how to create attachments

#

it now only takes a object.... Cry

hoary tree
digital sequoia
#

"image.png" => {name: "image.png"}

hoary tree
#

so

.setImage{( name: "screenshot.png"  )}
steel haven
unreal cedar
#

Will the subcommand name recieved by interaction.options.getSubcommand() be influenced by locales?

#

Or is it always the original name

steel haven
unreal cedar
#

Thank god lol

steel haven
#

Everything else would make no sense

unreal cedar
#

True

#

But I asked just to be sure

#

Anyways thanks for the help

acoustic temple
#

Why this error occurred?

#

I'm using .delete() there, if deletable is true

vague coyote
#

You need to pass fetchReply: true in the options of followUp() to get a message object back.

acoustic temple
#

@vague coyote Same error 😔

steel haven
acoustic temple
#

The followUp message isn't ephemeral

steel haven
#

Was the message deleted by some other bot before you did maybe? Or your own bot somewhere else?

#

If not show your updated code

acoustic temple
#

I'm deleting message before timeout complete, in timeout callback I want to prevent this error using msg.deletable

steel haven
acoustic temple
#

So, how can I check if that message still exists?

#

using msg.fetch()?

steel haven
acoustic temple
#

good

scarlet tangle
#

how do i get if there is a subcommand in the options, and, in that case, the subcommand?

vague coyote
vague coyote
#

you need to typecheck that its a ChatInputCommandInteraction

hybrid folio
#

um i think MessageAttachment is removed, is there any function to replace it ?

vague coyote
hybrid folio
#

oh

#

ty

floral prism
#

Hello, I had this code in v13 for permission handling, like for the interactionCreate event,

if (command.UserPerms) if (!member.permissions.has(command.UserPerms)) return

and in the command file,

module.exports = {
    name: "ban",
    description: "Permanently bans a member from the server",
    UserPerms: "BAN_MEMBERS",.....

But in djs v14 this isn't working, I checked the new PermissionsBitField but still got no solution, any help?

#

I used "BanMembers" instead but still no

hoary fox
#

also look at pins

floral prism
#

Ok

shrewd sparrow
#

How do you get the options passed in the command interaction?

hoary fox
plain roverBOT
#

guide Interactions: Replying to slash commands - Parsing options
read more

shrewd sparrow
hoary tree
#

my code how would i fix this error

D:\Sapphire\sapphiredev\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176
    if (!this.deferred && !this.replied) return Promise.reject(new Error(ErrorCodes.InteractionNotReplied));
                                                               ^

Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
    at ChatInputCommandInteraction.followUp (D:\Sapphire\sapphiredev\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176:64)
    at Object.run (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:49:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Client.<anonymous> (D:\Sapphire\sapphiredev\events\interactionCreate.js:58:6) {
  [Symbol(code)]: 91
}

Node.js v18.3.0
plain roverBOT
#

DiscordAPIError: Interaction has already been acknowledged
[INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.

You have already replied to the interaction.
• Use <Interaction>.followUp() to send a new message
• If you deferred reply it's better to use <Interaction>.editReply()
• Responding to slash commands / buttons / select menus

hoary tree
#

This is not my error

hoary fox
hoary tree
#

wdym

hoary fox
#

followUp is "continuation" of reply so before.it u must reply to it

formal kernel
hoary tree
formal kernel
#

nevermind

hoary fox
#

yea mb

hoary tree
#

or wait i don't understand what you mean kahm

formal kernel
#

little off topic but whats that theme FLOOSH

hoary fox
hoary fox
#

and change first followUp to reply

formal kernel
hoary fox
hoary tree
shrewd sparrow
steel haven
shrewd sparrow
#

oh

#

yeah

#

that must be it

hoary tree
forest elm
#

it takes objects, { name: 'name', value: 'value' }

hoary tree
#

like dis?

forest elm
#

sure

hoary tree
#

not djs related but you know how the site would display in that [The site]

#

and is value required by default?

plain roverBOT
#

Tag suggestion for @hoary tree:
You can use markdown syntax to display clickable links in embeds, webhook messages and interaction responses without showing the url:

"[text](url)"
'[text](url "optional hovertext")'
"[text](url 'optional hovertext')"

• Embeds only support this in description and field values

unreal cedar
#

what am I doing wrong?

#
[Error] DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].style[BASE_TYPE_REQUIRED]: This field is required
components[0].components[1].style[BASE_TYPE_REQUIRED]: This field is required
components[0].components[2].style[BASE_TYPE_REQUIRED]: This field is required
components[0].components[3].style[BASE_TYPE_REQUIRED]: This field is required

I always get this error

shrewd sparrow
#

Quick question, when you use GuildMember.createDM() will that throw an error if there's already a DMChannel between the bot and the user or not?

uncut kelp
#

I don't think so, no. There isn't a way to fetch DMs either

shrewd sparrow
#

Alr, I guess I'll try and see

unreal cedar
hoary tree
#

How could i put an image into an embed?

shrewd sparrow
unreal cedar
#

How do I do it then

steel haven
unreal cedar
#

ooh

neat pier
umbral slate
#

I started getting this error on the dev versions, not the latest but I can check which one I'm running on

#

seems to be 14.0.0-dev.1655640259-358c3f4

#

does anyone know what can cause this? This happened after my bot had been running for a few hours

obtuse crater
#

Iirc this is fixed in latest dev

fierce lily
#

Is there a current changelog for v13 -> v14?

dawn phoenix
#

pins, is what we have and update, not accurate at all times, since at/dev ist still udner development

fierce lily
#

pogs

small totem
#

i wish modals had more options like role selection

steel haven
hot bone
#

What's wrong with my addFields() ?

small totem
#

i think needs to be array?

outer bane
#

not anymore

small totem
#

oh

steel haven
hot bone
steel haven
# hot bone

The error message is above and/or below that

hot bone
#

This is the error

#

There's nothing above or below

outer bane
#

catch and console.log it

steel haven
# hot bone

npm ls @discordjs/builders please. You might have incompatible builders version

steel haven
# hot bone

Okay. Then it’s probable that one of your two things you pass into name/value isn’t a string

hot bone
#

That is impossible

#

both are strings

vague coyote
#

and possibly undefined

hot bone
#

I found the error

#

Too much characters

hot bone
outer bane
#

catch and console.log it

hot bone
#

Catch embed builder 😔

outer bane
#

yes? try catch

hot bone
#

No

#

UI is not defined

outer bane
#

then use an ide that can show you additional error properties

hot bone
#

After try catch + the command is already try catched by the handler

copper nymph
#

Trying to add an image to my message but I don't know how to create the attachment.

plain roverBOT
scarlet tangle
copper nymph
#

That doesn't help as I cannot create the attachment using canvas from what I read there.

knotty plover
#

why not?

#

Oh sorry

plain roverBOT
knotty plover
#

This one

copper nymph
#

Thanks

copper nymph
knotty plover
#

Not sure what canvas.create is

copper nymph
#

its part of canvas...

#

but I am not sure why I get nothing for attach

knotty plover
#

no idea

copper nymph
#

it has made the buffer, so not sure why setFile isnt working. I see no error.

#

Ok to add attachments its .send({content: 'blah', attachment: file}) correct?

knotty plover
#

files: [attach]

copper nymph
#

yep found it thanks.

torpid willow
#

This code const res = new ModalSubmitFieldsResolver(interaction.components)gives this error:
TypeError: ModalSubmitFieldsResolver is not a constructor
Is there a dev build that fixes this. I am on
14.0.0-dev.1657109083-8198da5

outer bane
#

you don't have to instantiate that class yourself, use ModalSubmitInteraction#fields

jagged marsh
#

is there a reason why <GuildAuditLogsEntry>.action returns an AuditLogAction (string form) instead of an AuditLogEvent (number)? seeing as most other things use enums rather than string representations now. if not I'll open a PR and change it, personally think that makes more sense

uncut kelp
#

Think it's just leftover code

#

It looks a lil' weird internally in that file

fair oxide
#

What is the problem

idle galleon
#

Not all interactions have a commandName

fair oxide
idle galleon
#

It depends on the context

#

You can either change the Interaction type to a sub class of the one ur actually using, or you can just check the .type

fair oxide
#

oh

#

thanks you!

plain roverBOT
flat ice
scarlet tangle
#

How can I deny a role permission? Not channel overwrites, but a role.

plain roverBOT
steel haven
#

That‘s the right one

restive crypt
#

Sorry.

scarlet tangle
#

@steel haven Doesn't that overwrite the current permissions with the PermissionResolvable that's passed into the permissions parameter?

steel haven
scarlet tangle
#

Hm, alright.

#

Thanks!

crude valley
#

How can I pass in embedjson in the embeds option from editReply? Do I need to use EmbedBuilder.from() or anything?

vague coyote
#

you can just pass it in embeds: []

#

it accepts json

crude valley
#

Aight thanks

crude valley
# vague coyote you can just pass it in embeds: []

Im getting this error now

[ERROR] • unhandledRejection
DiscordAPIError[50035]: Invalid Form Body
embeds[0][MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
     at SequentialHandler.runRequest (/Users/nikan/Ultimates/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:475:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/Users/nikan/Ultimates/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:201:11)
    at async REST.request (/Users/nikan/Ultimates/node_modules/@discordjs/rest/src/lib/REST.ts:319:20)
    at async InteractionWebhook.editMessage (/Users/nikan/Ultimates/node_modules/discord.js/src/structures/Webhook.js:316:15)
    at async UserContextMenuCommandInteraction.editReply (/Users/nikan/Ultimates/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:150:21)
willow garnet
#

needs to be in an array

crude valley
#

It is in an array

steel haven
crude valley
buoyant ingot
#

is djs v14 guide there?

vague coyote
#

pins

buoyant ingot
vague coyote
somber mirage
#

How much time it takes to the command permissions to update?

nocturne kayak
#

instant just like how you deploy your cmd

somber mirage
#

ty

paper sparrow
#

can bot send message to a channel despite having no message intents

paper sparrow
#

Cool thx

forest elm
#

not discord.js

fair oxide
faint pollen
#

Anybody else experiencing issues with app permissions (v10 gateway)?
Got a test application (using the latest v14 build) which fails to change it's own nickname.
Invited the app with bot and app-commands scope, permissions: 67193856 (includes change own nickname).
Double checked the permissions on the server integration and roles menu.
The API does always throws a missing permissions error:

  rawError: { message: 'Missing Permissions', code: 50013 },
  code: 50013,
  status: 403,
  method: 'PATCH',
  url: 'https://discord.com/api/v10/guilds/xxx/members/xxx',
  requestBody: {
    files: undefined,
    json: {
      nick: 'my new nickname',
      communication_disabled_until: undefined
    }
  }

The action is triggered by a ModalSubmitInteraction
The app permissions in the object are appPermissions: PermissionsBitField { bitfield: 1071832878657n }
Those also include the permission to change the nickname.
Method being called within the interaction interaction.guild.members.me.setNickname(...);

Kicked the bot; reinvited; left guild; created 2nd test guild; etc.

The API always throws that error. Idk why, doesn't happen on the v9 gateway (djs v13.8.1)

obtuse crater
#

Changing client's nickname is bugged right now

dawn phoenix
#

looks like it is also sending the timeout key communication_disabled_until , wouldn't be surprised if that's the missing perm

uncut kelp
#

Yeah that's a bug right now in dev

#

The current major PR fixes it but it's still pending

faint pollen
#

oh, it's not an API issue?

uncut kelp
#

Nah

faint pollen
#

sometimes permissions in guilds are fucked up, i was always wondering

dawn phoenix
#

nah, the api just checks against all changed keys in the payload

faint pollen
#

is there already a known issue about this? couldn't find one

dawn phoenix
#

"sometimes permissions in guilds are fucked up" that is a very blanket and unverifiable statement

faint pollen
#

removing and reinvited users usually fixes that

dawn phoenix
#

well that is just wrong on so many levels

faint pollen
#

well, doesn't change the fact this issue is happening quite a lot

#

at least on small test guilds, for some reason

#

anyways if changing the nickname is bugged, I got my answer

#

so thanks for that

dawn phoenix
#

if there was an issue with perms updating and reinviting things would fix it, the platform at large would have some major problems
i have never, in my 4 years in bot development and discord meta heard about that, apart from simultaneous role updates that get packed into one in the backend

faint pollen
#

well, must be just me then experiencing this sort of issues (quite often)

dawn phoenix
#

what sort of issue?

#

under what circumstance does what happen?

faint pollen
#

that assigned permissions to an app, for example via. editing it's roles are not up-to-date with the permissions the API returns for this app on any interaction

#

interaction might be the wrong word here

dawn phoenix
#

then what is the right word? what are you doing to get wrong permissions?

faint pollen
#

in this context it means, the permissions I receive for the guild member are wrong in any possible case, in the message & interaction event etc.

#

any time I log the permissions they're, what I called fucked up, which means they're not up-to-date with the actual permissions set in the guild

#

only reinviting does fix

#

editing/removing permissions doesn't for some reason

dawn phoenix
#

how do you check perms? where do you get them from?

faint pollen
#

well depends on where I log them of course, in the case of a message event, I log the current permissions for that member in the channel

#

for interactions I'm logging the memberPermissions property

#

appPermissions as of now

craggy vigil
#

Would it make more sense if <Client>.login(<TOKEN>) returned Promise<Client> instead of Promise<TOKEN>?

lusty cairn
#

I want to ask to add emojis to the server, right here there must be const { Util } = require("discord.js") Util.parseEmoji(rawEmoji). I tried that in v14, it doesn't work, maybe someone knows if there's something new

velvet jasper
#

It’s a top level export now, so it’s const { parseEmoji } = require(“discord.js”);

gloomy kayak
hasty gorge
#

how can I know if an interaction is an autocomplete

jaunty vault
hasty gorge
# jaunty vault check interaction.type

okay thanks that worked, do you know how to know the name of the option from the interaction? so for example i have an equip command with autocomplete option backpack, how do i know from the interaction that they're looking for backpack option

plain roverBOT
hasty gorge
jaunty vault
#

What

hasty gorge
#

ok ok wait

hasty gorge
# jaunty vault What

basically interaction.commandName is equip, but the autocomplete option is for the option backpack, how do i get "backpack"

#

like get the name of the option

hasty gorge
jaunty vault
hasty gorge
#

thanks!

jaunty vault
#

👍

umbral slate
#

I seem to be doing something wrong with this type but I'm not sure how to do it properly, any tips?

forest elm
#

use Extract<> instead of Pick<>

radiant lintel
#

how do i use the new AttachmentBuilder

hoary fox
#

look at changes in v14 ( pins )

umbral slate
molten ginkgo
#

with v14 how do you do addFields i get this

ExpectedConstraintError > s.number.le
  Invalid number value

  Expected: expected <= 25

  Received:
  | NaN

    at Object.run (/mnt/sd/Projects/LampV2/node_modules/@sapphire/shapeshift/dist/index.js:702:72)
    at /mnt/sd/Projects/LampV2/node_modules/@sapphire/shapeshift/dist/index.js:113:66
    at Array.reduce (<anonymous>)
    at NumberValidator.parse (/mnt/sd/Projects/LampV2/node_modules/@sapphire/shapeshift/dist/index.js:113:29)
    at validateFieldLength (/mnt/sd/Projects/LampV2/node_modules/@discordjs/builders/dist/index.js:133:24)
    at EmbedBuilder.addFields (/mnt/sd/Projects/LampV2/node_modules/@discordjs/builders/dist/index.js:243:5)
    at module.exports.execute (/mnt/sd/Projects/LampV2/commands/help.js:11:10)
    at module.exports (/mnt/sd/Projects/LampV2/events/interactionCreate.js:38:17)
    at Client.emit (node:events:537:28)
    at InteractionCreateAction.handle (/mnt/sd/Projects/LampV2/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12)
molten ginkgo
#

i thought i had latest but ok

umbral slate
#

le swagcat_french

somber mirage
#

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

dawn phoenix
#

no

somber mirage
#

Yes

velvet jasper
#

no

somber mirage
#

Yes

vague coyote
#

no

molten ginkgo
#

Hey for some reason .setauthor aint working ```js
const embed = new Discord.EmbedBuilder()
.setTitle("Command's")
.setDescription(Heyyy, Heard You Needed Help Using Me. Here Are My Command's)
.setColor('#AD1457')
.addFields(
{ name: 'My Commands', value: ${commands}, inline: true },
{ name: Webpage Command's, value: 'Coming Soon', inline: true },
)
.setAuthor('NeroGizmo')
return interaction.reply({ embeds: [embed]});

error:
ValidationError > s.object(T)
Expected the value to be an object, but received string instead

Received:
| 'NeroGizmo'

at ObjectValidator.handle (/mnt/sd/Projects/LampV2/node_modules/@sapphire/shapeshift/dist/index.js:1158:25)
Im using  discord.js@14.0.0-dev.1657152699-10ba008
vague coyote
#

setAuthor takes an object

plain roverBOT
molten ginkgo
#

lol im doing this all other memorie and i havent done this in a while

uncut kelp
#

It's lacking some core stuff that'll make discord.js crash on launch / crash eventually

umbral slate
#

If I have a message with 2 select menus and I get an interaction from one of them will interaction.values include the values in both menus or only the one that was interacted with?

hoary fox
#

probably from selected menu

#

but u can check it

umbral slate
#

it's hard for me to check atm, how would I see the overall values?

uncut kelp
#

It'd only be the select menu from which the interaction was sent by

#

And the values would be an array of all the selected options

#

So if previously, 5 options were selected and you deselected them all, you'd receive an empty array as the values, as nothing was selected

spring isle
#

i am trying to make a bot that plays a certain song when a user joins the call now the bot joins the call successfully but the music for some reason doesnt play i have installed sodium and ffmpeg

umbral slate
uncut kelp
#

Interactions are sent one after the other o_O

#

Multiple select menus in a message doesn't change that

umbral slate
#

well yeah but is there a way to know what the other select menu has selected when one is interacted with

hoary fox
uncut kelp
#

Not sure if you can look in the message's components and see if it has their default options changed... but if that doesn't work, I don't think so

umbral slate
#

hm alright, thanks

spring isle
somber mirage
#

There is a way to resize discord default image for example I have this link: https://cdn.discordapp.com/embed/avatars/4.png that I got from User.displayAvatarURL()
I tried to add object with size in it but it didn't work

uncut kelp
#

They cannot be resized

somber mirage
#

Yeah I saw it now on the docs anyway thank you

uncut kelp
#

No problem

distant relic
#

Hello!

#

resolve undefined Promise {
  {
    url: 'wss://gateway.discord.gg',
    shards: 1,
    session_start_limit: {
      total: 1000,
      remaining: 968,
      reset_after: 29827236,
      max_concurrency: 1
    }```
#

Now, whenever I turn on the bot, this error appears.

knotty plover
#

thats not an error

austere vapor
uncut kelp
molten ginkgo
#

hey don't know if im doing this correct but i get this when doing array.join CombinedPropertyError (1)
Received one or more errors

input[0]
| CombinedPropertyError (1)
| Received one or more errors
|
| input.value
| | ExpectedConstraintError > s.string.lengthGreaterThanOrEqual
| | Invalid string length
| |
| | Expected: expected.length >= 1
| |
| | Received:
| | | ''
my version is discord.js@14.0.0-dev.1657152699-10ba008

knotty plover
#

Seems there was nothing in the array

#

And you're joining nothing into an empty ring

molten ginkgo
#

there is

#

when i use array without .join

knotty plover
#

Show code?

molten ginkgo
#

it works and shows the stuff in array

knotty plover
#

Because it received an empty string

molten ginkgo
knotty plover
#

It's empty when you define space though

#

So yeah

#

Empty

molten ginkgo
#

strange

knotty plover
#

Not really. You join the array before you put anything in the array

#

Variables aren't dynamic

molten ginkgo
#

ohhhh

#

i didnt relise it was before stuff was placed in it

umbral slate
#

Getting this error even though ROLE_ICONS is a valid guild feature, any ideas?

forest elm
#

use the GuildFeature enum

umbral slate
#

no that's dumb, using a string should work

#

if it doesn't it's a bug

forest elm
#

dont think so

#

thats just how string enums work

umbral slate
#

it comes straight from discord with no modification, so what im doing is correct

#

the types should be fixed instead

steel haven
#

The types reflect what exactly can and can not be sent by discord in there. So they are indeed correct in this case

distant relic
#

im trying create a voice channel, but:

type[NUMBER_TYPE_COERCE]: Value "VoiceChannel" is not int.```
dawn phoenix
#

that is correct, that is indeed not an int

#

use the enum

distant relic
#

enum?

#

what is enum?

steel haven
#

ChannelType

distant relic
dawn phoenix
#

not as key, as value

#

-ev Discord.ChannelType

forest geyserBOT
# dawn phoenix -ev Discord.ChannelType
{
  '0': 'GuildText',
  '1': 'DM',
  '2': 'GuildVoice',
  '3': 'GroupDM',
  '4': 'GuildCategory',
  '5': 'GuildNews',
  '10': 'GuildNewsThread',
  '11': 'GuildPublicThread',
  '12': 'GuildPrivateThread',
  '13': 'GuildStageVoice',
  '14': 'GuildDirectory',
  '15': 'GuildForum',
  GuildText: 0,
  DM: 1,
  GuildVoice: 2,
  GroupDM: 3,
  GuildCategory: 4,
  GuildNews: 5,
  GuildNewsThread: 10,
  GuildPublicThread: 11,
  GuildPrivateThread: 12,
  GuildStageVoice: 13,
  GuildDirectory: 14,
  GuildForum: 15
}```• d.js `14.0.0-dev.1656677097-741b3c8` • Type: `object` • time taken: `0.110528ms`
distant relic
#

tks!

dawn phoenix
#

an enum(eration) is a mapping from property keys to values (numbers here) and the other way around

distant relic
#

Whats the error?

dawn phoenix
#

i think you misunderstood

distant relic
#

ow :/

dawn phoenix
#

i printed the mappig for you

#

the error told you it expects a number

#

the mapping is ChannelType.GuildVoice > 2

#

that way you can supply the number but still know what it means

#

if you don't care about that verbosity you can also just supply 2

#

you do still supply it under the type option key

ebon tiger
#
        collector.on('end', collected => {
          menumsg.edit({ embeds: [menumsg.embeds[0].setDescription(`~~${menumsg.embeds[0].description}~~`)], components: [] })
        });

Error

TypeError: menumsg.embeds[0].setDescription is not a function
jaunty vault
#

what is menumsg

velvet jasper
#

EmbedBuilder.from

forest elm
#

<Message>.embeds is now an array with readonly embeds

you have to use EmbedBuilder.from() on the embeds to be able to edit them

umbral slate
knotty plover
#

On main, the type is pointing to discord-api-types where it appears to be a string enum. In TS though I would think that it doesn't know that string literal is of the enum type?

#

The generic string type isn't strict enough for TS to accept it as a string enum type I would have thought

late venture
#

Hi, so I am trying to specify a type as to what payload is but, I have no clue on what to specify it as. Does anyone know what I should specify it as?

late venture
young kindle
#

ohhh ok

plain roverBOT
late venture
#

yea, the payload for the interaction, sorry I should have clarified!

#

Ah, thanks!

young kindle
#

👍

radiant lintel
#
  Received one or more errors
  input[1]
  | CombinedPropertyError (1)
  |   Received one or more errors
  | 
  |   input.value
  |   | ExpectedConstraintError > s.string.lengthGreaterThanOrEqual
  |   |   Invalid string length
  |   | 
  |   |   Expected: expected.length >= 1
  |   | 
  |   |   Received:
  |   |   | ''
    at ArrayValidator.handle (/home/container/node_modules/@sapphire/shapeshift/dist/index.js:439:70)
    at ArrayValidator.parse (/home/container/node_modules/@sapphire/shapeshift/dist/index.js:137:88)
    at EmbedBuilder.addFields (/home/container/node_modules/@discordjs/builders/dist/index.js:262:57)
    at logging (/home/container/functions/logging.js:14:23)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)```
Whats this mean
steel haven
radiant lintel
#

line 14 is if (fields) embed.addFields(...fields)

steel haven
west cobalt
#

console.log(await msg.guild.roles.fetch("123")) -> null
console.log(await msg.guild.members.fetch("123")) -> DiscordAPIError[10013]: Unknown User

Isn't it supposed to throw an error like unknown role ?

steel haven
floral prism
#
const filter = (i) => i.author.id === user.id
  const collector = await channel.createMessageCollector({ filter, time: ms("29m")})

I made this message collector in v14, and when I'm collecting with

collector.on("end", async collected => {
  collected.forEach(x => console.log(x.content))
.....

It's returning empty contents

#

Anybody help? It was working fine in v13

steel haven
west cobalt
#

Oh okay.. So I'm supposed to see if the result is null and throw an error accordingly

steel haven
west cobalt
#

I have a custom CommandError and every time it throws that, the error is caught and displayed in a nice embed x)
Anyway thanks

floral prism
#

Do I need to pass anything in bot code?

steel haven
floral prism
steel haven
floral prism
steel haven
floral prism
#

So I manually add the array?

steel haven
#

Yes. And only add the intents you actually use

floral prism
#

Ok

floral prism
gloomy kayak
#

am I missing something or the limit was like 50?

small light
#

TypeError: interaction.isCommand is not a function

gloomy kayak
#

It was removed - if you want to check if the interaction is from an application command use interaction.type === InteractionType.ApplicationCommand

uncut kelp
gloomy kayak
#

I mean, I really don't think I have 50 commands lol, I may have 20 but surely not 50 😂

outer bane
#

iirc there's a limit of 5 for each type of context menu commands

forest elm
#

yep

#

they use the same error code (and message) for all command types

uncut kelp
#

Makes better sense

gloomy kayak
gloomy kayak
#

Sorry, I'm here again 😄
I'm using an attachment option for my command and my question is: if I need that file sent, should I fetch it using the url or the proxy url?

hybrid folio
#

hi, is there a way to set the text in voice channel for only who join in a VC can chat/see inside ?

#

hi, according to this message, the ratelimit is only for channel name/topic edit. Permission editing is not affected by this rate limit. I'm I right?

dawn phoenix
#

yes, but afaik it's hard or impossible to discern these, so once you are ratelimited for the naming other changes are under it as well

#

cc @uncut kelp , maybe? if not imma bonk vlad

uncut kelp
#

Yeah permission overwrites are unaffected by that name/topic rate limit

scarlet tangle
#
TypeError [ColorConvert]: Unable to convert color to a number.

I wonder what caused this error, I just upgraded to v14 dev version, I don't know

dawn phoenix
#

well, what do you supply as color(s)?

scarlet tangle
#

#2f3136

dawn phoenix
#

and in what context?

scarlet tangle
velvet jasper
dawn phoenix
#

it's the not main lib one isn't it, but the builders one, which doesn't resolve

scarlet tangle
dawn phoenix
#

huh. that is weird, because

#

-ev new Discord.EmbedBuilder().setColor("#2f3136")

forest geyserBOT
dawn phoenix
#

what version (commit) are you on?

scarlet tangle
#

^14.0.0-dev.1657325401-33ae7df

dull mulchBOT
dawn phoenix
#

oh, that is newer than... sec

uncut kelp
#

Unsafe builders recently got removed

velvet jasper
#

That shouldn’t affect the color validation since djs extends the regular builders

dawn phoenix
#

cannot repro on 33ae7df

uncut kelp
#

Cannot reproduce on discord.js@14.0.0-dev.1657325401-33ae7df

scarlet tangle
velvet jasper
#

The latest

dawn phoenix
velvet jasper
#

Also do you have your full code sample

scarlet tangle
#

this is the full code and error

scarlet tangle