#djs-in-dev-version

35223 messages · Page 11 of 36

small mica
warm spade

Where can I see all the new permission names

?

small mica

It's just like this:
MANAGE_GUILD => ManageGuild

warm spade

ModerateMembers ?

small mica

yeah

warm spade

ok thanks

small mica
small mica
forest elm

addOptions takes rest parameters, not an array. ...categories.map()

amber ocean

Hi, a question, why the error? I'm on version 14 of d.js

uncut kelp

That's basic JavaScript. Nothing to do with discord.js

novel oyster
south python

I am trying to use the new modal, but when i try to use <ModalBuilder>.addComponents(<ActionRowBuilder>) it gives me the error that it is an invalid input

scarlet tangle

This is not directly correlated with v14 but kinda is in a sense as I plan on using it.
I have a bot I plan on containerizing across multiple vms due to I can buy multiple cheaper vm's
and in the end gain more resources than one expensive vm.

Anyways I want to centralize all cache on one VM so it can be accessed
from all other containers. What better way to do this than redis.

However DJS's current cache implementation is synchronous redis is
asynchronous. So intercepting the makeCache will only break everything I presume.

Is there any "easy" "drag and drop" implementation for this, or should I just fork and modify to
my needs?

I apologize if this is not the correct place to put this, but I felt it may exceed normal help a bit.
If there is a more correct channel to place this in please point me there 🙏

scarlet tangle

I need help

warm spade

Is there another way to know if it is waiting or not with the "communicationDisabledUntilTimestamp" ??

plain roverBOT
warm spade

hm nop

forest elm

yep

hybrid jungle

When discord modals will be supported??

uncut kelp

It already is...?

forest spade

Probably means in stable release

knotty plover

When it's released then

tropic otter

What will the main changes in DJS v14 be?

forest elm

theres a wip updating guide in the pins

warm spade

If I use the .addAttachmentOption then how do I get it?

copper jetty

<ChatInputCommandInteraction>.options.getAttachment()

warm spade

Ok thanks

ionic wren

Is there any way to show modal in messageCreate listener without using any other component?

jaunty vault
knotty plover

Yeah because modals arent a component, theyre an interaction response type

forest ruin

How do I get the numeric values for SUB_COMMAND, STRING, INTEGER, etc.?

for the data in client.application?.commands.set(data) when specifying type

rain bramble
forest ruin

ah, thank you

sand geyser

would like to update my bots nickname every 30min using discord.js. My old technique was to set username every 30-ish min and that would automatically set the nickname along with it but it doesn't seem to be setting nickname automatically. Anyone have context on this? Btw, you can think of my code as running a loop of 'instantiate client then setUsername"

What's even weirder is that when I check the bot nickname on my iphone Discord app the nickname is correct. It's on my desktop that the nickname doesn't appear correct.

wanton path

I don't think it is related to djs@dev in any way

small mica

What shud I change?

nocturne kayak

then it's about how you set up your collector and handle interactions

small mica

I used to do the same thing in v13 and it worked. Idk what is wrong now

scarlet tangle

how to get the maximum upload limit for a guild?

tame gazelle

by checking the premium level ig

river harbor

Where do you access command options!? There is nothing on the docs to say that.

plain roverBOT
regal mason

Why does getString do not exists ????

It is literally defined in CommandInteractionResolver

tame gazelle

CommandInteraction is for Context Menu too

try to define it as ChatInputCommandInteraction

civic topaz

why latest discord.js prefix command not work

(Message Content Intent (in dsc dev app dashboard ) is enabled)

outer bane

you need to also add it to your client constructor

civic topaz

how to do?

outer bane

The same way you added the other intents

civic topaz

... (I want the text)

full text

civic topaz
carmine bridge

write

civic topaz
carmine bridge

MessageContent?

somber mirage

There is a way the edit the initial interaction if it's ephemeral?

For example:
ChatInputCommandInteraction reply with menu and I want to edit the ChatInputCommandInteraction reply

somber mirage
urban belfry
somber mirage

Oh

urban belfry
somber mirage

ty

somber mirage
knotty plover

Yeah there's no way to defer showing a modal

scarlet tangle

What does this mean?Can anyone explain

outer bane

have you read the linked articles?

scarlet tangle

But I understand, isn't it my bot.

Ohk

Thanks for explaining

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
  ],
  presence: {
    activities: [
      {
        name: '/help',
        type: 'LISTENING'
      }
    ]
  },
  restTimeOffset: 0,
  makeCache: Options.cacheWithLimits({
    GuildEmojiManager: { maxSize: 0 },
    GuildStickerManager: { maxSize: 0 }
  }),
  });

Why the status doesn't show up for my bot?

copper jetty

Use ActivityType enum instead of string

scarlet tangle

Ok thanks

fresh prawn

Has pr 7649 been merged yet?

urban belfry

you can check it yourself, it's publicly viewable
and no, it's not

small mica

Is dev branch broken?

Suddenly my bot stopped working even tho the v13 one works fine

uncut kelp

It's fine

small mica

Any idea why my bot suddenly stopped working then? It doesnt reply to prefix commands

uncut kelp

I have no information to answer that question

small mica

What do you want? messageCreate event is enuf?

urban belfry

do you have the privileged message content intent enabled?

small mica

yeah

uncut kelp

It means I can't tell you what's wrong with your code if you don't provide it

urban belfry

now in v10, it's required

small mica

no error also

urban belfry

no like enabled on the dev portal and on your code?

small mica
uncut kelp It means I can't tell you what's wrong with your code if you don't provide it
const client = require("../index");
const { EmbedBuilder, Util } = require("discord.js");
client.on("messageCreate", async (message) => {
  if (
    message.author.bot ||
    !message.guild ||
    !message.content.toLowerCase().startsWith(client.config.prefix)
  )
    return;

  const [cmd, ...args] = message.content
    .slice(client.config.prefix.length)
    .trim()
    .split(/ +/g);

  const command =
    client.commands.get(cmd.toLowerCase()) ||
    client.commands.find((c) => c.aliases?.includes(cmd.toLowerCase()));
  if (!command) return;
  try {
    await command.run(client, message, args);
  } catch (e) {
    const embed = new EmbedBuilder()
      .setTitle("An error has occured.")
      .setDescription(`\`\`\`js\n${e}\`\`\``)
      .setColor(Util.resolveColor("DarkPurple"));

    message.channel.send({ embeds: [embed] });
    client.channels.cache
      .get("954704896848986132")
      .send(
        `**An error has occured**\n**Server - ${message.guild.name}** \`(${
          message.guild.id
        })\`\n**Time -** <t:${~~(message.createdTimestamp / 1000)}:f> <t:${~~(
          message.createdTimestamp / 1000
        )}:R>\n\`\`\`js\n${e.stack}\`\`\``
      );
    return console.log(e);
  }
});

messageCreate event. None of the prefix commands work

small mica
urban belfry

show your client definition too

i don't think you quite understood what i said and confused with the other message intents

small mica

ill be back in 5 mins

lilac rune

Is there any migration guide?

nevermind

small mica
urban belfry

yeah no that doesn't include the new intent, right?

small mica

I just copy pasted some files from my v13 bot and tried to change it to v14, but it suddenly stopped working

small mica
urban belfry

and you don't need all of them, enable the ones you only need
the MessageContent intent

small mica
urban belfry

enable the ones you need, then you can just ad the intent to the array

small mica
urban belfry

if you want to read the content.. yes?

small mica

and idk how to make the ones I need in an array, I just know how to use the number thing

What is the number that also has the new intent?

velvet jasper

Use the Intents object instead of hardcoding numbers

small mica
velvet jasper

just like in the example:

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

My bot has not even reached 100 servers, so its already enabled on dev portal.

small mica
plain roverBOT

• Websocket intents limit events and decrease memory usage: learn more
• See what intents you need here

urban belfry

read up on the guide, see which ones you need

small mica
const { Client, Collection, GatewayIntentBits } = require("discord.js");
const client = new Client({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages],
});
module.exports = client;```
Is this enough for the latest dev version?
urban belfry

if those are what you use, then along with MessageContent, yes
why do you have some of the intents there twice though?

small mica

Omg tysm @urban belfry! My bot works now

Also how are you kept updated on the latest changes in dev version because I dont find anything related to this in the v14 docs

nocturne kayak

check out the recent pr

velvet tendon
const buffer = Buffer.from(request.data.split(',')[1], 'base64');
const attachment = new MessageAttachment(buffer, `${validURL}_screenshot.png`);
scarlet tangle

Can we make a http-interaction-bot using discord.js

urban belfry
scarlet tangle

Ok thanks

forest elm
south python

Whenever i try to add components to my modal with the ActionRowBuilder that contains the TextInputBuilder, i still get this error:

Argument of type 'ActionRowBuilder<TextInputBuilder | MessageActionRowComponentBuilder>' is not assignable to parameter of type 'ActionRowBuilder<TextInputBuilder> | APIActionRowComponent<APITextInputComponent>'.```
regal mason
urban belfry

api version 10

amber python

Hi there, was just wondering if there was any way to wait for the response of a modal?

copper jetty
amber python

alr

amber python
dawn phoenix

you respond to the interaction

amber python

how would i respond though

just interaction.reply()?

dawn phoenix

sure, or update original, if prompted from a button
depends on how that all works

amber python

wdym update original

gloomy kayak

If for example they clicked a button and then you presented the modal, then you can update the original message with the buttons iirc

umbral mango

but afaik modals don't work currently since a bug (that is fixed in PR #7649) makes it crash

amber python

I see, also I have another question, how would I make an interaction collector? I currently have a MessageComponentCollector but I'm pretty sure that won't work for a modal

plain roverBOT

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

scarlet tangle
const prev = new ButtonBuilder()
          .setEmoji('◀️')
          .setCustomId('previous')
          .setStyle('SECONDARY')
      ```
How to fix this?
copper jetty
scarlet tangle

It's not mentioned anywhere

😑

woeful pollen

the docs

plain roverBOT
copper jetty

and i think you can find it in main branch commits on github

scarlet tangle
regal mason

How do I set a character limit in a string option ?

merry sigil

When I'm building an embed with EmbedBuilder, how would I now go about accessing the length getter? With MessageEmbed / Embed there used to be this useful util getter length that returned the combined length of the embed with all of its fields etc, but this property doesn't exist on the builder anymore. I thought about doing something like (new Embed(embed.toJSON()).length (where embed is an embed builder), but that just gives a TypeError as Embed has a private constructor (and even then that just seems like a very unpretty workaround). Is there a way of accessing it still or will I have to compute it manually?

velvet jasper

It’s a called embedLength(embed)

merry sigil

Where can I access that method? On 14.0.0-dev.1648339713-520f471 it doesn't appear to be exported directly nor be on the Util class

velvet jasper

Hmm I think it’s exported by builders, probably should be re-exported from djs as well

I might just add .length back to the builders. Mainly bc it’s more of a utility method rather than an actual embed property.

merry sigil

Alright, thanks for the help :)

dim moss

hi modals and attachment are out in djs@dev?

copper jetty

yes

velvet jasper

Yes

dim moss

is there any guide 👀

tame gazelle

pins 👀

dim moss

oh okay and also modals is only available in v14 or its our for v13 too ?

copper jetty

modals will be in v13.7

dim moss

okay tnx

forest ruin

Getting TypeError: createComponent is not a function when trying to submit a modal, am I doing anything wrong?

dull mulchBOT
copper jetty

dude 16 days ago

forest ruin
copper jetty

you can't install prs because its monorepo

forest ruin

ah, so ill have to wait for it to be merged with main?

copper jetty

yes

forest ruin

any timeline for that or no?

gloomy kayak

Nop

knotty plover

16 days is nothing

green geyser

🙏

bronze plover

getting this on the modals pr

Is this pr related in any way?

bronze plover
river harbor

What's the intent for guild messages?

I can't find it anywhere in the docs.

river harbor

Thanks!

Why isn't my bot reading message content?

(i have the intent enabled from the portal)

scarlet tangle
umbral mango

Was someone able to use the changes from PR #7649 and can tell us how to do it ourselves? I don’t want to ask for eta or whatever but I am really excited to start building with modals and therefore would be willing to jump through some loops to make it work pepesweat

carmine bridge

editReply not work

why

split fulcrum

Use fetchReply at first reply

carmine bridge

this?

split fulcrum

No

carmine bridge

this?

split fulcrum

Like this interaction.reply({embeds: [embed1], fetchReply: true})

carmine bridge

ok

carmine bridge

still no response

why i not see error in this and not edit

carmine bridge

idk why

iron bobcat
hardy wind

With the latest two development snapshots my bot is unable to read message content, even with the intent enabled.
Is this a known issue?
Thanks

Ok, thanks for your prompt response.

Is the GuildMessages intent still a thing?

copper jetty

YES

hardy wind
radiant gate

without Message Intent music request channel will work ?

copper jetty

Yes if the bot dont need to receive messages

radiant gate

my bot in 99 servers

copper jetty
radiant gate

ok thanks i will apply for Message Intent

radiant gate
vague coyote

Without the privileged intent you only receive message content if your bot was mentioned.

radiant gate

like i disabled message intent in discord portal and i enabled intent in discord client
then it working

after idk after bot verify it will work or noot

copper jetty

Theres no message intent in dev portal its message content intent

radiant gate
marsh matrix
vague coyote

They probably work exactly the same like the messageCreate event

No intent, no content

Wouldnt make any sense otherwise lol

scarlet tangle

why is this happening?

Code:

client.on('interactionCreate', async i => {
    if(i.isCommand()) {
        if(i.commandName === "obfuscate") {
            // await i.deferReply();
            const file = i.options.get('file').attachment;
            const { data: fileBuffer } = await axios.get(file.url, { responseType: 'arraybuffer' });
            const ObfuscatedCode = obfuscate.js(fileBuffer);
            const Attachment = new Discord.MessageAttachment(Buffer.from(ObfuscatedCode), file.name);

            const Embed = new Discord.EmbedBuilder()
            .setTitle('This File Have Been Obfuscated Successfully.')
            .setColor("DarkGreen")
            .setThumbnail(i.guild.iconURL({ forceStatic: true }))
            .setFooter({ text: `Requested By: ${i.user.tag}`, iconURL: i.user.displayAvatarURL({ forceStatic: true }) })
            .setTimestamp(new Date(Date.now()));


            await i.reply({ ephemeral: true, embeds: [Embed], files: [Attachment] });
        }
    }
})
dull mulchBOT
scarlet tangle
slow storm
scarlet tangle

this is V14

anyone got a solution?

idle galleon

Then edit reply

scarlet tangle

it is not because of the code i think

idle galleon

Then use some console.logs to see where the code stops running

scarlet tangle

i can't log the whole event

client.on('interactionCreate', async i => {
console.log(i)

that doesn't log anything

idle galleon

Log above the event to make sure it's being registered

scarlet tangle

when i created the command it logs the command, so the command is ok

but i can't handle the interaction

idle galleon

But is the listener actually getting registered?

scarlet tangle

btw, i changed the bot user to check if this is a user problem but i got no progress

scarlet tangle
scarlet tangle

like, ```js
console.log('hi')
client.on('interactionCreate', async i => {

?

idle galleon

Yes

scarlet tangle

it logs

idle galleon

Can you log new Error().stack above the event?

scarlet tangle

ok

Error: 
    at Object.<anonymous> (c:\Users\mmgam\OneDrive\Desktop\ismmTeamBot\ismm.js:48:13)
    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
idle galleon

Do you have a ready event listener?

scarlet tangle
idle galleon

Does it run?

scarlet tangle

yeah

idle galleon

Can you show the code for it?

scarlet tangle
client.on('ready', async () => {
    console.log(`Logged in as ${client.user.tag}!`);
    await client.guilds.fetch();
    client.guilds.cache.forEach(async guild => {
        await guild.commands.set([])
        for(const _command in commands) {
            const command = await guild.commands.create(commands[_command]);
            for(const perm of ismmConfig.Settings.Perms) {
                command.permissions.add({
                    permissions: [
                        {
                            id: perm,
                            permission: true,
                            type: 1
                        }
                    ]
                })
            }
            console.log(command)
        }
    })
});
idle galleon

That's an easy way to hit the rate limit for creating new commands

scarlet tangle

;-;

idle galleon

Deploy globally instead in an isolated script (not in the ready event)

scarlet tangle

how?

idle galleon

The permissions stuff is fine, given the current sucky system we’re stuck w/ for the time being

Deleting all commands then creating it isn't

plain roverBOT
idle galleon

You only get 200 new command creations per day. The rate limit is only counted toward commands that are added (identified by its name). Note that deleting then creating also counts toward this ratelimit. However, updating the description of a command doesn’t count.

scarlet tangle

ok now my command register is this:

;(async () => {
    try {
        const guild_id = "", clientId = "";
        await rest.put(
            Routes.applicationGuildCommands(clientId, guild_id),
            { body: _commands }
        );

        console.log("Successfully registered commands!");
    } catch(e) {
        console.log("Failed to register commands!");
        console.error(e)
    }
})()

now i have the same error

drifting glade

Are Embeds broken on ~dev?

scarlet tangle

what can i do?

@idle galleon

drifting glade

on ~dev, what is the new way to make embeds

is it js new Embed().setTitle()
?

outer bane

EmbedBuilder

drifting glade

Oh

umbral mango

How did you do it? When manually pulling the pr version I get husky error messages.
Maybe you can roughly tell me what you did?

Huh?

Which version did you install? Pr or discord.js@dev and manually do the pr changes?

umbral mango

lol that was too easy. Thank you!

Next question though.... How can we reply after receiving the modal submission?
await interaction.reply({ embeds: [lbEmbed], ephemeral: true });
throws
Uncaught DiscordAPIError DiscordAPIError[10062]: Unknown interaction

in the guide i can only find how to extract the modal data, but not how to interact with the user based on this.

copper jetty
copper jetty
umbral mango

peperope

you are right. My debugger killed it. Sorry.

abstract token

Hey

Do I have to add slash commands compulsory

copper jetty

no

hot bone

Are permission names changed?

gloomy kayak

They're CamelCase now

pallid ice

no they're not, they're PascalCase. not camelCase

scarlet tangle

How to fix?

haughty lava

btw discordjs's Embed SlashCommand and all those builders typings are missing

they don't who up in VScode's intellisense

pallid ice
haughty lava

no

one sec

import { Embed } from "discord.js";

new Embed(). //this part
pallid ice

yeah, in the latest v14 dev all builders now have the Builder suffix. so EmbedBuilder, ActionRowBuilder etc

haughty lava

hmmm okay thanks

cause it still shows Embed

pallid ice

Embed is still a thing, but if you're trying to build an embed then you need to use EmbedBuilder

haughty lava

but Embed still works

rain bramble
haughty lava

just the intellisense

pallid ice

because those methods aren't on Embed anymore

unless you're on an earlier version of the dev, in which case I have no idea what the issue is and I probably can't help

haughty lava

latest@dev version

pallid ice

what do you see when you do npm ls discord.js

haughty lava

text

pallid ice

...

yes, and what version does it show

haughty lava

bro i am not too dumb, I just deleted the package and reinstalled it

pallid ice

okie doke

I'm not sure why you don't have EmbedBuilder then

haughty lava

i have it

but nvm, i got it

pallid ice

oh, I thought you were saying you didn't have it. are you saying that you can't set the properties on EmbedBuilder?

haughty lava

bro, VScode intellisense don't show the props

pallid ice

for EmbedBuilder

scarlet tangle
wise wigeon

I also had this same error when I was converting my js code to ts code.

node_modules/discord.js/typings/index.d.ts:1572:42 - error TS2344: Type 'MappedInteractionTypes<Cached>[T]' does not satisfy the constraint 'MessageComponentInteraction<CacheType>'.```
Putting `"strict": true,` in the *compilerOptions* of `tsconfig.json`, fixed it for me.
drifting glade

Might need to be changed to createComponentBuilder()

urban belfry
drifting glade

I fixed it, just needed to change a line of code in the DJS package

bronze plover
scarlet tangle

Hello, are the voice channel text chats included in dev branch at the moment ?

uncut kelp

It's not documented by Discord yet

scarlet tangle

Sadness, thanks you

radiant lintel
radiant lintel

turns out it was color again

passed a hex string

umbral mango

How can i make new ButtonBuilder().setEmoji() work with custom emojis?

new ButtonBuilder().setEmoji({id: "customID"}) crashes with components[0].components[1].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji

south python

Where can i find the docs/guide of how the modals work?

woeful pollen

pins

south python

Oh i see

scarlet tangle

can i add modals more than 5 ?

dawn phoenix

no

limit is 5 rows and a row can only hold 1 text input component

scarlet tangle

whats the role data property hoist thing does?

dawn phoenix

can you rephrase that?

scarlet tangle
dawn phoenix

in modals? no, though pagination is something that has been requested a lot and discord has on their radar of possible extensions for the feature

dawn phoenix

i do not see how that matters

river harbor

e.g. select menus

dawn phoenix
meager crest

hi! what changes brings djs 14?

idle galleon
tame gazelle

<@&839912195994812420>

dawn phoenix

hm

tame gazelle

you prefer this tick? ._.

vagrant dome

What does "When it's ready" mean - a few weeks, months, or half a year? I'd like to update soon, but I don't want to run for months on unstable code.

idle galleon

v14 is no where near becoming stable and is bound to change drastically before it does

final relic

What is another way to get modal submits? Cause I know with buttons you can use .createMessageComponentCollector instead of using the interactionCreate event, but I was wondering if there is a such thing with modals too yet?

knotty plover

There's the InteractionCollector

final relic
bronze plover
pallid ice
final relic
pallid ice

thats a message component collector, I again suggest you look at the docs

const collector = new InteractionCollector(client, options)

options is an object

final relic

When I submit my modal, it throws this error: TypeError: createComponent is not a function from discord.js\src\structures\ModalSubmitInteraction.js:43:54 ?

fallow steppe
const client = new Client({
  intents: ['DirectMessages', 'Guilds', 'GuildMembers', 'GuildMessages'],
  rest: { version: '9' },
});

client.on('messageCreate', (message) => {
  console.log(message.content);
});

Should this not work, on @dev, to view message content until the 30th?

idle galleon
fallow steppe

Oh. Damn. Cheers

uncut kelp

Should this not work, on @dev, to view message content until the 30th?
Version 14 uses API version 10. This is already in effect

fallow steppe

Alright, it looks like I'm gonna have to use 13 for this small project. Thanks guys. 😛

knotty plover

Or just enable the intent?

Didn't we also drop string intents

fallow steppe
knotty plover Or just enable the intent?

IIRC, v10 of the API enforces the priviledged intent already. So if I specify it, without having it, it will not connect.

It's a unique case and we don't need anything super fancy. We own a large bot and have recently acquired the company that happens to own the bot that was our competition. We've merged all features from both bots onto our own and plan to discontinue theirs (now ours).

We've asked Discord to transfer all priviledged intents and they have. Their bot still uses standard !commands, and no longer has message intents, so we're going to respond to these commands, until message content intents are enforced, encouraging them to migrate to the other bot.

civic topaz

Why my bot never ready? (Include client.login & Using replit)

plain roverBOT

Tag suggestion for @civic topaz:
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.

client
    .on("debug", console.log)
    .on("warn", console.log)

• Note: if you initialize your Client as bot or other identifiers you need to use these instead of client
• If the output is too long to post consider using a bin instead: gist | hasteb.in | sourceb.in | hastebin

river harbor
knotty plover

Because one more reviewer is pending

Therefore, no it is not ready

nocturne kayak

is there a limit for how many actionrow can be present in a modal?

knotty plover

5

north cobalt
SHOW_MODAL_ERROR: An error occurred when showing a modal. DiscordAPIError: Interaction has already been acknowledged.
    at RequestHandler.execute (C:\Users\ubanp\Desktop\Root\Coding\.Development\Rato\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\Users\ubanp\Desktop\Root\Coding\.Development\Rato\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
    at async showModal (C:\Users\ubanp\Desktop\Root\Coding\.Development\Rato\node_modules\discord-modals\src\structures\ShowModal.js:49:9) {
  method: 'post',
  path: '/interactions/958639816730357760/aW50ZXJhY3Rpb246OTU4NjM5ODE2NzMwMzU3NzYwOnBpUzRnSHlhUGFxaDQ1RlRIU2FNVTZNOTJFT3U3OFBvMlNaQ216QzNYVDFSVkZnR0E2NFloQjVFN2laeVdVRDhZZXd0SW1GMHZDa1QxbUViNEF6QlJrdWNtNENvU0JQZWtmN3FrV29wQ0RJQ1JrTXBRaURrYW1qRm9uWDlrZ3BY/callback',
  code: 40060,
  httpStatus: 400,
  requestData: { json: { type: 9, data: [Object] }, files: [] }
}``` help?
river harbor
north cobalt

Ellaboration?

I mean, could you kindly ellaborate cause I usually get this and don't know how to fix it.

sweet briar

The one iv add isnt working

vague coyote

we dont write code for you, no.
We can help you fix your code tho, if you provide enough information

sweet briar

Yh pls do

vague coyote

Either provide information about the problem you are facing, or not.

lethal zephyr
const { ActivityType } = require("discord.js");

await client.user
    .setActivity(`Your Status`, { type: ActivityType.SomeType })
sweet briar

Ty

lethal zephyr
message.reply({
            embeds: [embedMessage("Select an activity from the following:")],
            components: [
                new ActionRowBuilder().setComponents([
                    new ButtonBuilder().setCustomId("something").setEmoji({ id: "an id" }).setLabel("Label").setStyle(ButtonStyle.Primary)
                ])
            ]
        })
UNHANDLED TypeError: component.toJSON is not a function
    at /root/shoukaku/node_modules/@discordjs/builders/dist/index.js:537:64
    at Array.map (<anonymous>)
    at ActionRowBuilder.toJSON (/root/shoukaku/node_modules/@discordjs/builders/dist/index.js:537:35)
    at /root/shoukaku/node_modules/discord.js/src/structures/MessagePayload.js:135:30
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (/root/shoukaku/node_modules/discord.js/src/structures/MessagePayload.js:134:49)
    at ChatInputCommandInteraction.reply (/root/shoukaku/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:106:56)
    at Object.execute (/root/shoukaku/src/commands/activities/activities.js:8:17)
    at handleNewInteraction (/root/shoukaku/src/handlers/interaction.js:23:35)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.<anonymous> (/root/shoukaku/src/bot/bot.js:81:7)

it should be working tho

outer bane

setComponents takes rest parameters, not an array

lethal zephyr
outer bane

the format of the buttons doesn't matter, it's about how you pass them to setComponents. Currently you are wrapping them in an array, all you have to do is omit the brackets

lethal zephyr

ahh, okay thank you!

ohhh, i misunderstood the rest parameters part 😅

ionic wren

Has the bug been reported?

/mnt/c/Users/Kay/Desktop/KayBotTypeScriptJDA/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:43
    this.components = data.data.components?.map(c => createComponent(c)) ?? [];
                                            ^
TypeError: createComponent is not a function

🤔

nocturne kayak
sharp rampart

Hey, I'm getting the following error. Why is this?

Argument of type 'ActionRowBuilder<TextInputBuilder | MessageActionRowComponentBuilder>' is not assignable to parameter of type 'ActionRowBuilder<TextInputBuilder> | APIActionRowComponent<APITextInputComponent>'
const modal = new ModalBuilder()
    .setTitle('Suggestions')
    .addComponents(
        new ActionRowBuilder()
            .addComponents(
                new TextInputBuilder()
                    .setLabel('Title')
                    .setPlaceholder('Testing')
                    .setMaxLength(256),
            ),
        new ActionRowBuilder()
            .addComponents(
                new TextInputBuilder()
                    .setStyle(TextInputStyle.Paragraph)
                    .setLabel('Suggestion')
                    .setPlaceholder('Testing')
                    .setMaxLength(2000),
            ),
    );
hallow violet

how do i add a random color for embedbuilder? can't find it in Colors.

tame gazelle
sonic kiln

i am just waiting for modals to be released as soon as possibe :D

wispy coral

will v14 have http interactions?

forest elm

so far it doesnt, but who knows. imo it doesnt fit in the discord.js package

hallow violet

what parameter should i put in .setEmoji for buttonbuilder? it says object

hallow violet
pallid ice

so a custom emoji would be something like { name: 'custom_kek', id: 'emoji ID here', animated: true/false }

plucky yew

whys this happening

outer bane

see pins, builder classes got renamed

fading atlas

I updated discord.js and now it's giving these errors, is it a bug? I used yarn remove discord.js and then I used yarn add discord.js@dev...

outer bane

what exactly are the errors?

fading atlas

I was already using the development version, but I went to update and this happened

fading atlas
outer bane

if you are sure you are on the Dev version restart the TS server, typings are cached

fading atlas

Yes, i'm on dev

I restarted the complete vscode, because only the tsserver didn't solve, now it worked, thanks!

brazen knoll

im getting very weird ratelimits from d.js

Discord Client was RateLimited 
Timeout: undefined
Limit: 5
Method: get
Path: undefined
Route: /channels/:id/messages/:id
gritty citrus

dk what's weird about that..

do not fetch messages multiple times.

brazen knoll

im not fetching anything, the bot is running on idle

gritty citrus

clearly there is a ratelimit logged. It won't magically log a ratelimit if u aren't limited.

brazen knoll

why is path undefined

wait did they change the ratelimit log, lemme look it up

also im not receiving message content anymore, except in dms and when the bot is pinged

yes i have message content enabled on the bot page

vague coyote
brazen knoll

thank you

frozen warren

is there any way I can access the AuditLogEntryTarget type

crystal valve
  const restartEmbed = new Embed()
    .setDescription(
      `**Slash Commands:** :check: **|** Deployed
**MongoDB:** :check: **|** Connected
> **Node Information:** ${process.version}
> **Platform Information:** ${process.platform} ${process.arch}
> **Memory:** ${(process.memoryUsage().rss / 1024 / 1024).toFixed(
        2
      )} MB RSS + ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(
        2
      )} Heap
> **discordJS version:** v${discordjsVersion}
**Time:** <t:${(new Date() / 1000).toFixed(0)}:R> (<t:${(
        new Date() / 1000
      ).toFixed(0)}>)
> Loaded in ${ms(
        ms(Math.round(process.uptime() - client.uptime / 1000) + "s")
      )}`
    )```
`TypeError: (intermediate value).setDescription is not a function`

am I supposed to do `.addDescription`?
plain roverBOT
crystal valve

oh it's EmbedBuilder not Embed?

makes more sense tbh

acoustic temple

How can I add fields to embed?

This show that is an array, but I got error

copper jetty

It takes rest parameters

woeful pollen

rest parameter

acoustic temple
.addFields([{ name: 'Canal', value: `${oldChannel}` }])

I'm doing this

woeful pollen

it takes multiple objects instead of an array

acoustic temple
.addFields({ name: 'Canal', value: `${oldChannel}` }, { name: 'Object 2', value: 'The Value' })

Like this?

woeful pollen

yes

kindred kite

How can I get the attachment from a interaction

knotty plover

interaction.options.getAttachment('name')

plain roverBOT
kindred kite

How do I switch to v14 and is there any major differences that might affect my code

vague coyote

Check the pins

kindred kite

Oh and last question

Discord says on their API embeds have a. Video type but embedding a video never works

knotty plover

Yeah its only for receiving

eg when a youtube link embeds

kindred kite

no way possible?

knotty plover

You can send youtube links

You just cant manually construct video embeds

kindred kite
kindred kite
knotty plover

Theres only one and youd put that intent

kindred kite

ye but i want intents for everything

i dont know eht enumber

knotty plover

Neither do I, using a single number is a really dumb approach

kindred kite

u have to add the numbers or smth

knotty plover

nope

Just use the IntentsBitfield

plain roverBOT
kindred kite
vague coyote

Whatever you called that option

kindred kite

"MessageEmbed"

as it no work anymore

vague coyote

Yes, see guide in pins

kindred kite

on my main discord bot which is verified i am not gonna switch to discordf js 14 its a pain, they make so many little painful changes every update for some dumb reason

it breaks all code until the person fixes it or just sticks to an older version

vague coyote

Well, what do expect by installing an unstable dev version of the next major release

dapper gull

Yeah I feel like you've missed the whole point of a development build 🤷‍♂️

dapper gull
.addChoices([
  ['Choice 1', 'choice_1'],
  ['Choice 2', 'choice_2'],
  ['Choice 3', 'choice_3']
])

When I add choices to the SlashCommandBuilder as above, I'm getting the below error, now I'm confused what an array even is anymore 😭

uncaughtException: [
  {
    "code": "invalid_type",
    "expected": "object",
    "received": "array",
    "path": [
      0
    ],
    "message": "Expected object, received array"
  }
]
vague coyote
dapper gull

Wait, it's the other way lol, it wants an object

haha yeah sorry I just read the error message properly

rocky vessel

Hi, do already have a base template for discord.js v14 to take a look and practice the new changes?

vague coyote

No, there is not that many changes to the basic layout of a bot. Most important change is the use of enums now, as described in the pinned guide.

rocky vessel

Got it

thanks you

long narwhal

alright, i tried, and i tried enough.

ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [],
    "message": "Required"
  }
]
const { SlashCommandBuilder, ModalBuilder, TextInputBuilder, ActionRowBuilder } = require('@discordjs/builders');
const { TextInputStyle } = require('discord.js');

const StaffAppsModal = require('../Components/Modals/Staff Application.js');

module.exports = {
    slashCommand: {
        name: "apply",
        builder: new SlashCommandBuilder()
            .setName('apply')
            .setDescription('Apply with our forms!')
            .addSubcommand(s => s
                .setName('staff')
                .setDescription('Apply for our Staff Team with this command!')   
            )
            .setDefaultPermission(true)
        ,

        on: async(client, i) => {
            const sub = i.options.getSubcommand();
            if(sub === "staff") {
                i.showModal(StaffAppsModal);
            }
        }
    }
}

then modal builder:
https://srcb.in/Bi7n4nxuMP

vague coyote

First of all, addComponents takes multiple objects and not an array of objects

long narwhal

noted

vague coyote

Secondly I'm pretty sure 5 actionrows are the maximum

But I have no idea what exactly triggers that error. Can you show the full error please

long narwhal

sobbing rn, but alright, and i think i figured it out

fluid bronze

.addComponents doesnt take an array im dum 🐌

long narwhal

Yeah that was pointed out already lmao
edit: all this just to be unable to use modals atelo_sob

exotic nexus

since I code my bot mainly for enjoyment, should I update to v14 right now to save myself future headache?
it doesn't look like there are any massive changes as of right now, so it should be better to prepare early for when they do drop, right?

vague coyote

Thats fully up to you, the dev version can break at any point, if its not already broken
cough modals cough

small mica
const c = message.mentions.channels.first()

How to check if the channel is voice or text?

plain roverBOT
small mica
if (channel.isCategory)
      return message.channel.send({
        embeds: [
          new EmbedBuilder()
            .setTitle("Invalid channel")
            .setDescription("Please mention a **text** channel")
            .setColor("DarkPurple"),
        ],
      });```
This sends the embed even if the channel is text channel
vague coyote

channel.isCategory isn't a thing

small mica

so I shud add ()?

exotic nexus
small mica

Thanks @vague coyote that worked

exotic nexus

(these)

vague coyote

how to check if channel is voice or text

  • checks for category channel
small mica

Its all similar, I just wanted how to check for them

vague coyote

linked above

lethal zephyr

well discord's docs mentions that this is indeed a flag

vague coyote

Good for discord, we use enums now tho, as well as PascalCase

see pinned guide

lethal zephyr

well yes im reading that guide xqct

vague coyote

see PermissionBitField

lethal zephyr

ah, the PermissionFlagsBits class

trail dawn
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_VOICE_STATES] });
                                              ^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
    at Object.<anonymous> (G:\Test Bot\bot.js:10:47)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Node.js v17.1.0

have discord.js removed flags?

vague coyote

See pins

trail dawn
willow garnet

see pins

trail dawn

iam gonna read the changes

its now GatewayIntentBits instead of Intents.FLAGS

vague coyote

kyuclap

trail dawn

thanks for helping

still acorn

is it required for non verified bots to use slash commands?

vague coyote

it is not "required"

crude valley

Im trying to set permissions for my slash commands, I get this output for my fullPermissions logging, no error but it doesnt set the permissions. Here is my code: https://sourceb.in/gbfZfh4Me2

This exact code works for me in v13, but not in dev version

trail dawn

.setEmoji('📃')
sends this error when trying to add it to a button

ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "null",
    "path": [
      "id"
    ],
    "message": "Expected string, received null"
  }
]
    at new ZodError (G:\Test Bot\node_modules\zod\lib\ZodError.js:80:28)
    at handleResult (G:\Test Bot\node_modules\zod\lib\types.js:115:21)
    at ZodObject.ZodType.safeParse (G:\Test Bot\node_modules\zod\lib\types.js:191:16)
    at ZodObject.ZodType.parse (G:\Test Bot\node_modules\zod\lib\types.js:172:27)
    at ButtonBuilder.setEmoji (G:\Test Bot\node_modules\discord.js\node_modules\@discordjs\builders\dist\index.js:593:42)
    at ButtonBuilder.setEmoji (G:\Test Bot\node_modules\discord.js\src\structures\ButtonBuilder.js:19:20)
    at Object.execute (G:\Test Bot\commands\btickets.js:16:7)
    at Client.<anonymous> (G:\Test Bot\bot.js:313:18)
    at Client.emit (node:events:402:35)
    at InteractionCreateAction.handle (G:\Test Bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:76:12) {
  issues: [
    {
      code: 'invalid_type',
      expected: 'string',
      received: 'null',
      path: [Array],
      message: 'Expected string, received null'
    }
  ],
  format: [Function (anonymous)],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)],
  flatten: [Function (anonymous)]
}
spare fiber

pretty sure its now sole object

crude valley
dusky portal

/when

xd

drifting glade

Is there a ephemeral component collector?

knotty notch

Hi guys !

I do develop a web application, in this, new users need to be members of our Official Discord Server. Therefor, I'd like to get my guild members list, to verify if the user's Discord input exists in this list. I do not want to create a complete bot for that, only asking the A.P.I but I am a bit lost tbh...

Technologies that I use : Angular/NestJS

nocturne kayak
drifting glade

How would one set one up? via channel or await the reply then spawn a collector on the reply

nocturne kayak

not different at all as what you normally do with normal replies
no code change needed

drifting glade

I normally use the message, can I do that?

vague coyote
nocturne kayak
drifting glade
let msg = await ctx.interaction.reply({
...
})```
 returns undefined
nocturne kayak

fetchReply: true on your reply option

drifting glade

aight

trail dawn
drifting glade

still undefined

trail dawn

hello i get this error when pressing submit in a modal

G:\Test Bot\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43
    this.components = data.data.components?.map(c => createComponent(c)) ?? [];
                                                     ^

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

Node.js v17.1.0
trail dawn

apparently i have fixed it

The ModalSubmitInteraction.js was in structures

and Components.js was in utils

if anyone want to fix modals

vague coyote
trail dawn

also can anyone help me with this, iam trying to update channel perms```
G:\Test Bot\node_modules\discord.js\src\util\BitField.js:168
throw new RangeError('BITFIELD_INVALID', bit);
^

RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: VIEW_CHANNEL.
at Function.resolve (G:\Test Bot\node_modules\discord.js\src\util\BitField.js:168:11)
at PermissionsBitField.remove (G:\Test Bot\node_modules\discord.js\src\util\BitField.js:105:33)
at Function.resolveOverwriteOptions (G:\Test Bot\node_modules\discord.js\src\structures\PermissionOverwrites.js:130:15)
at PermissionOverwriteManager.upsert (G:\Test Bot\node_modules\discord.js\src\managers\PermissionOverwriteManager.js:100:50)
at PermissionOverwriteManager.create (G:\Test Bot\node_modules\discord.js\src\managers\PermissionOverwriteManager.js:124:17)
at G:\Test Bot\bot.js:192:39
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'BITFIELD_INVALID'
}

Node.js v17.1.0

jaunty vault
trail dawn
hallow violet

how do i make changes to the Modals? i tried .reply and nothing happens

hallow violet

so the ModalSubmitInteraction refers to the interaction where the modal was submitted? then if i do .update, the command response (for example) should change?

worn gyro

TypeError: interaction.channel.createReactionCollector is not a function

collector.on('end', async ended => {
            const areuSure = await interaction.followUp("**هل أنت متأكد حيال ذلك ؟**", { fetchReply: true });
            await areuSure.react("✅");
            await areuSure.react("❌");
            const filter = (reaction, user) => reaction.emoji.name === '✅' && user.id === interaction.user.id;            
            const collector = interaction.channel.createReactionCollector({ filter });
            collector.on('collect', (reaction, user) => {
                collector.stop()
            });

            collector.on('end', async collected => {
                interaction.followUp("انت متأكد نايس")
            })
        });
rapid fable

Did you import/require it?

fading atlas

The createComponent bug has been fixed?

south python

Whenever i try to add a component to my modal, this error pops up. Is there a fix for this?

nocturne kayak

typescript? you gotta specify what component type an action row contains
like ActionRowBuilder<TextInputBuilder>

south python

Ooh like that alright

woeful pollen
lethal zephyr

it works sometimes, it doesn't sometimes, this interaction is a button btw

woeful pollen

you need to reply to the interaction within 3 seconds

lethal zephyr

yes

but it doesn't defer the reply

even within a second

and that's the exact reason i even included the line on top

fading atlas

Thx

lethal zephyr

btw this works on a smaller bot, on the bigger bot i used to test it, it gives me this error

is it because i'm sharding?
while the shards are spawning this error occurs more usually than when all its shards are online

valid ledge
client.on("messageCreate", async message => {
  console.log(message)
})``` Any idea why the bot doesn't see the message in dm ?I use the Intent (GatewayIntentBits.DirectMessages) and I don't see a direct message intent
tame gazelle

you need the Channel partial

valid ledge

thx

crude valley

Why do I get this error, Im. using ActionRowBuilder from @discord.js/builders@dev

small mica

What is the diff between Embed and EmbedBuilder? Also ActionRow and ActionRowBuilder?

small mica

okie

amber python

Anyone have any clue why this is happening and how to fix it?

I was told that to make that error go away I should reply to the modal, one method of which being editing the message the modal is for, but that's what I'm doing and I'm still having this error.

copper jetty
amber python

so defer the modal and when I edit the message the modal will go away?

dawn phoenix

no, you cannot defer modals

clicking submit sends a new interaction, that one you need to respond to

copper jetty
dawn phoenix

the submit button yes, the modal itself, no

amber python

I'm trying to use modals for an interaction menu, so I want to edit the original message every time.

dawn phoenix

well, then do that?

plain roverBOT
amber python

oh

ty lmao

dawn phoenix

button press -> immediate modal (cannot defer this)
submit press -> update message button was pressed on to prompt the modal (this can be deferred)

modern cipher

um, what is wrong?

woeful pollen

restart typescript server maybe

balmy violet

If not try to add the title and the id to the modal instance

const Modal = new ModalBuilder()
(...)
.setTitle('modal Title')
.setCustomId('modal_id')

Also I noticed this bit:

 new TextInputBuilder()
                    .setLabel("test")
                    .setValue("test")
                    .setCustomId("test")
                    .setMaxLength(2)
                    .setMinLength(1)
                    .setPlaceholder("13")
                    .setRequired(true)
                    .setStyle(TextInputStyle.Short)

In your TextInputBuilder - this will throw an error since your set value 'test' exceeds the maximum allowed length.
Try changing it to 4 or more, or adapting the value 🙂

modern cipher
modern cipher

ok fixed it

don't even know how lmao

can i still use hex color (string) in EmbedBuilder?

trail dawn

i think there is a bug in discord.js v14 the content of a message is always empty

<ref *1> Message {
  channelId: 'CHANNELID',
  guildId: 'GUILDID',
  id: 'MESSAGEID',
  createdTimestamp: 1648755666293,
  type: 0,
  system: false,
  content: '',
  author: User {
    id: '588670754233516032',
    bot: false,
    system: false,
    flags: UserFlagsBitField { bitfield: 256 },
    username: 'xKingDark',
    discriminator: '8923',
    avatar: '9308dec2f48695f5182964e47908d9bc',
    banner: undefined,
    accentColor: undefined
  }
}
woeful pollen

e.g 0xff0000

idle galleon
modern cipher
trail dawn
idle galleon
trail dawn

there is GuildMessages

trail dawn
idle galleon There is
G:\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:254
        throw new Error(GatewayCloseCodes[error.code]);
              ^

Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
    at WebSocketManager.createShards (G:\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:254:15)
    at async Client.login (G:\Test Bot\node_modules\discord.js\src\client\Client.js:231:7) {
  [Symbol(code)]: 'DisallowedIntents'
}

Node.js v17.1.0
idle galleon
trail dawn
final relic

Hey! I'm trynna send a message once my modal has been submitted, but as soon as I show my modal with await interaction.showModal(modal), I get this error: TypeError: Cannot read properties of undefined (reading 'channels') from this line: const collector = new InteractionCollector(), but I don't know why?

copper jetty
final relic
copper jetty

yes

gentle bane

aw what's that

final relic
copper jetty

no

gentle bane
final relic

Thanks! How do I respond to a modal submit then? Cause I tried interaction.reply() but I'm getting an error: TypeError: createComponent is not a function?

final relic

Well apparently someone found a fix (xKingDark) so it works now. I have one more question; You get the text input value with i.fields.getTextInputValue(), but how do I get the modal title and how do I get the modal labels? Nvm i found out, needed .data

balmy violet

You could just check the customId of the interaction in the collector

collector.on('collect', (i) => {
                if(i.user.id !== interaction.user.id) return;
                if(i.customId !== 'test_modal') return;
                doStuff();
            });
long narwhal
sharp rampart

Can I get the slash command ID that invoked the modal submission?

copper jetty

no

kindred kite

lol

sharp rampart

Does that get the ID of the slash command and not the message with the buttons?

<ModalSubmitInteraction>.message does not exist for me, though

Property 'message' does not exist on type 'ModalSubmitInteraction<CacheType>'

dapper gull
sharp rampart

Modals also can be triggered by slash commands...?

It seems that the typings are missing the message property altogether

kindred kite

also how to get sponsor

role i am sponsoring

dapper gull
copper jetty

I think you can use showModal() on slash commands

dapper gull

Oh, yep sorry that one

sharp rampart

Aha, wait

copper jetty

ok

sharp rampart
if (interaction.inCachedGuild() && interaction.isFromMessage()) {
    return;
}

// Still does not exist...
interaction.message

That's odd

Oops

Still the same when fixed

copper jetty
sharp rampart

Yep, my bad. But are there any plans to add isFromCommand?

If that's even possible

copper jetty

if it isn't from a message then its from command

sharp rampart

Not necessarily. There's also select menu interactions

I'm not sure if those can open modals, though

But it'd also be great if we could get the original command same as the original message

copper jetty

Select menus are message components so its from message

sharp rampart

Yeah, but they have their own interaction class, right?

Alright, I see! That clears up my questions

Appreciate it

noble kernel

.setThumbnail is not a function ..?

copper jetty
noble kernel

ok well how are embeds made?

copper jetty

new EmbedBuilder()

noble kernel
copper jetty

yes

warm spade

The Subcommand doesn't work for me, I'm looking at the guide and it's supposed to go but it doesn't

warm spade

help?

runic obsidian

Guys, how can i send a message in another channel based on a command?

i tried to use

const board = await interaction.client.channels.fetch('channel_id');
board.send(`<@${interaction.user.id}> published a mission!`);

but it is complaining about

Property 'send' does not exist on type 'AnyChannel'.
  Property 'send' does not exist on type 'CategoryChannel'.ts(2339)

ow forget it, i use a // @ts-ignore and it worked, but i think it should be typed right?

its a normal channel, it should be like a TextChannel?

ooo nice

thnx

carmine bridge

what is v14 message.guild.verificationLevel

plain roverBOT
dim moss

hi

in V13
i require intents like this:

global.client = new Client({ intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_BANS', 'GUILD_EMOJIS_AND_STICKERS', 'GUILD_VOICE_STATES', 'GUILD_MESSAGES', 'DIRECT_MESSAGES'], partials: ['CHANNEL'] });

and dont use Intents.FLAGS.GUILDS in v14 can i do it or what ? (i read the doc but didnt seen any part about global.client)

carmine bridge

GatewayIntentBits

intents: Object.values(GatewayIntentBits).filter(e => typeof e === "string"),

you can use this

this is all intents

sacred eagle
dim moss

i read it but you didnt understand my question !!

in V13 we have 2 way to define intents
1.

const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
const { Client } = require('discord.js');
const global.client = new Client({ intents: [GUILDS] });

now in dev version which one should i use?
1.

const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
const { Client } = require('discord.js');
const global.client = new Client({ intents: [Guilds] });

i know 1 is correct but i want to know can i use 2 or no?

knotty plover

no

sacred eagle
knotty plover

Also no idea how "global" is relevant to the method

Its just an unrelated bad practice

dim moss

so i need to use this

tnx <3

and also can i use 32767 in intents array?

sacred eagle

Probably, but you shouldn't and it doesn't include all the intents now either way

dim moss

i dont want to use it, i just want to know it tnx <3

to send a message with webhook am i need GuildWebhooks intent??

sacred eagle

Nope

dim moss

tnx

sacred eagle

You need the intent for the webhook events, anything else I am not aware of
But I know it isn't needed to execute the webhook

dim moss

okay tnx

can i use Discord.ButtonStyle.Primary ?

sacred eagle

If you feel like you want to explore on your own, you can take a look at the route djs is using for a method, from that go to discord's developer docs and then see if it mentions anything on intents

sacred eagle
dim moss

okay tnx

hexed tapir
knotty plover

No

Still needs to be the bitfield

hexed tapir
crude valley

Is the Embed problem gonna be fixed in the released v14 or do we have to use builders?

dawn phoenix

what embed problem?

vague coyote
crude valley
copper jetty

You can't construct it Embed is what you receive from the api

vague coyote
crude valley
vague coyote

It has everything just like before Thinkeng

Except addField

crude valley
sacred eagle
crude valley
vague coyote

Not even one minute to read reallyFckingCuteCatCrying

crude valley

ye sorry but I only get setColor ;_;

vague coyote

How'd you define EmbedBuilder?

Or rather import

And on what djs version are you exactly

crude valley

dev

sacred eagle

And what version of builders do you have installed?

dawn phoenix
crude valley

it works like this tho?

copper jetty
crude valley
crude valley
sacred eagle

It could be that there's an older version of builders installed

crude valley

ok now Im getting this error on dev version 14.0.0-dev.1648515273-ac4bc3a

sacred eagle

You're using your own variables and functions, show their types

crude valley
sacred eagle

toSend as well

crude valley
sacred eagle

It seems like the type for your ActionRow is the issue here, the TextInput part of the type specifically

crude valley

hm any fix?

sacred eagle

Well you wouldn't pass the TextInput type to the ActionRow type or cast it as specifically the row to the non-textinput-type later on
Also if I may ask, why even make these methods? Why not just use the builders themselves? This is just complicating it more

crude valley
sacred eagle

If you're using vscode, there is search and replace,

crude valley

yes but I dont know im more comfortable like this sweat_smile_AE

sacred eagle

Can't argue with that I guess
I don't know how you'd get out of it exactly, maybe you can make the actionRow function a generic that passes on either TextInputComponentData or MessageActionRowComponentData to the type

crude valley

The error is coming from the builder

not the type of client.util.actionRow()

um aight ig

sacred eagle

Yes, right
That's not what's happening
the toSend expects only an ActionRow that has the components type, I don't know what terms I should here but basically anything other than an ActionRow where the TextMenu type wasn't used
And your function returns an actionrow that includes the type of textmenus and the components

small mica

Is ButtonComponent still a thing?

copper jetty

no

small mica

ButtonBuilder right?

sacred eagle
small mica

hmm

what is SelectMenuOption renamed to?

sacred eagle

Short explanation: The ButtonComponent is the type for data you receive from the API. The builder is for the type that lets you create your own one.

copper jetty

SelectMenuOptionBuilder

dawn phoenix

see the update guide preview in pins

warm spade

The Subcommand doesn't work for me, I'm looking at the guide and it's supposed to go but it doesn't

dawn phoenix

your subcommand has no type

index 22 commands, index 0 option

warm spade

solution?

willow garnet

add a type?

balmy violet

Is it no possible to put selectmenus inside a modal?

tame gazelle

no

only text input

balmy violet

ah too bad

thanks for the info

vague coyote

do you have the message content intent

yes

sacred eagle

It's privileged, so both on the dev portal and on your Client

vague coyote

You are still missing MessageContent

copper jetty

you need message content intent

vague coyote

no, thats for receiving messages on guilds, I'm talking about MessageContent
if you cant find it, its probably not in the import you are using, you have to import from discord-api-types v10

lethal zephyr

I get this for the message content intent although it hasn't been enforced yet

plain roverBOT

Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.

If you are using the GUILD_MEMBERS or GUILD_PRESENCES intents, you need to enable them in the developer portal:
Developer Portal > Your app > Bot > Privileged Gateway Intents

lethal zephyr

I've obviously checked that,

MESSAGE CONTENT INTENT
This intent will not be enforced until after April 30, 2022.
vague coyote

will be enforced doesn't mean its not usable

lethal zephyr

It works normally on the older versions though

vague coyote

you still have to check that one if you want message content

older versions dont use api v10 ;)

lethal zephyr

Ah, alright.

warm spade
outer bane

do you call toJSON on the builder when passing it to the api call?

warm spade

Anyway no one answered me

outer bane

why would you use a magic number when discord.js resolves an array of flags?

hot yacht

Is slash command localization already in discord@dev?

vague coyote

why dont you just a_snowsgiving_sparkles google Emoji_Sparkles

and no, that pr wasnt merged afaik

limpid stratus

I installed the latest djs (dev) version. I already knew MessageActionRow was changed to ActionRowBuilder, but I'm getting Property 'addComponents' does not exist on type 'ActionRowBuilder<any>'.

vague coyote

"any" is definitely not one of them

limpid stratus

And where can I find the types?

willow garnet

If you have to ask you probably should not be using TS

limpid stratus

and no... my ide isn't helping me

latent olive

hey guys, i have a doubt.. im using modals with select menu, how do i defer the select menu? when i'm defering the select menu using await interaction.deferUpdate(); the modal is throwing an error This interaction is already deferred or repleid to.

outer bane

modals are an initial reply, you cannot defer and show a modal

latent olive

but the select menu is show as Interaction Failed

outer bane

not if you show a modal within 3 seconds

latent olive

i see, does modals also have defer? like deferReply

outer bane

you can defer a ModalSubmitInteraction, yes

latent olive

alright ty

jaunty vault

Modal typings seem off

sacred eagle
jaunty vault
limpid stratus

I could be wrong but I think there was a pr which made it so that stuff like that should return non-builders meaning they're immutable, if you want to modify it you have to do something like js TextInputBuilder.from(interaction.components[0].components[0])

limpid stratus

oh

sorry read it wrong

sacred eagle

I'll have to test it myself, could you show a code snippet that reproduces this real quick?

jaunty vault
sacred eagle

what type was interaction?

jaunty vault
sacred eagle

It should not log a TextInputBuilder
I was asking for reproduceable code to make it faster for me to check

jaunty vault

my code is spread out through files

maybe it's the fact that I changed the createComponent thing to createComponentBuilder? I forgot to mention that. Is that the problem maybe? Did I do it wrong?

@sacred eagle

outer bane

yes, that would explain why you get builders in received data

jaunty vault
glacial island

How do you update to v14

vague coyote

pins

glacial island

And is there docs or anything for it yet?

vague coyote

pins

glacial island

I dont see the changes

vague coyote

then you must look closer, there is a big ass guide preview pinned

glacial island

Why do you got to be so hasty

vague coyote

if we would explain that to everyone who asks, we would not be able to do anything else

brave mulch

what happened to

Embed.setDescription()```
vague coyote

EmbedBuilder

steel lance

hello for some reason message content is empty

vague coyote

you need the MessageContent intent

yall forgot about that? dead

steel lance

i have it enabled

vague coyote

enabling is just half of it

you also need to have it in your client constructor

steel lance

i have GuildMessages enabled

vague coyote

Again, MessageContent

steel lance

oh

vague coyote

which you need to import from discord-api-types but v10 instead of v9

steel lance

alr ty

glacial island

does anyone know what would be cuasing this problem?

    this.components = data.data.components?.map(c => createComponent(c)) ?? [];
                                                     ^

TypeError: createComponent is not a function
vague coyote
glacial island

wdym pr

dark light

pull request on github

woeful pollen

pull request

glacial island

o

is there any known time when it will be fixed?

woeful pollen

when the pr is merged

long narwhal
glacial island

so it has been fixed just not merged yet?

long narwhal

it isn't really "fixed", it just has an open solution

glacial island

oh ok

sharp rampart

Is there any reason why my component only has these two attributes?

uncut kelp

a component. From that screenshot, there is no information to narrow anything down

sharp rampart
async execute(interaction: ButtonInteraction): Promise<void> {
    if (!interaction.client.user || !interaction.client.application || !interaction.guild || !interaction.channel) {
        return;
    }

    // Does not show label property but logs the following:
    console.log(interaction.message.components[0].components[0]);
},
{
  custom_id: "upvote|2",
  emoji: { id: "959512287130042418", name: "24" },
  label: "0",
  style: 1,
  type: 2
}
idle galleon

It doesn't know that the component is a SelectMenu ig

knotty plover

Doesn't interaction.component exist

That should know the correct typing

kindred kite

how woudl i get all vcs my bot is in?

next gull

``` throw new Error(Found unknown component type: ${data.type});
^

Error: Found unknown component type: 4```

knotty plover

That suggests you're not actually on the dev release because it's erroring on a text input

latent lion

Why is message.content a empty string

idle galleon

Most likely bc you didn't enable the MessageContent intent in the code

latent lion

How do you enable

I have 32767 intent

fallow steppe

Is it possible to get all members of a guild? AFAIK, with WS you can .members.fetch(). How is this done with REST? Is REST limited to 1,000 at a time?

plain roverBOT
idle galleon

@fallow steppe

idle galleon

The number you used doesn't include the MessageContent intent

It's why prefer to just the enums instead of magic literals

fallow steppe

I run a very large scam list (it's a gaming bot) that periodically scans an entire members list and compares it to the scam list to notify the admins

IDK if this is the best approach, but made a recursive function for it. 🤷

async function getGuildMembersAll(
  guildId: Snowflake,
  after?: Snowflake,
): Promise<RESTGetAPIGuildMembersResult> {
  const apiGuildMembers = await rest.get(
    Routes.guildMembers(guildId),
    {
      query: new URLSearchParams({
        ...after !== undefined ? { after } : {},
        limit: '1000',
      }),
    },
  ) as RESTGetAPIGuildMembersResult;

  return apiGuildMembers.length === 1_000
    ? [
      ...apiGuildMembers,
      ...await getGuildMembersAll(guildId, apiGuildMembers.at(-1)!.user!.id),
    ]
    : apiGuildMembers;
}
spare fiber

use ws if you want more than 1000, or if in djs manager GuildMemberManager#fetch()

fallow steppe

Unfortunately, with the size of my bots and their general purpose - responding to slash commands/context menus with dynamic images - using DJS' WS is just a waste of resources — even after all of the custom cache features.

Since switching to Fastify/HTTPS interactions only, and using REST, I can now nicely serve a couple hundred K servers with less RAM and resources than my laptop is using RN for the Discord client - currently a small 96MB RAM, for example.

This is the only situation thus far where WS would be beneficial.

knotty plover

I have to like, hugely disagree there

If one of its jobs is scanning an entire member list that's far better served with caching and gateway, not http interactions

Monitor guildMemberAdd and you don't even have to fetch and scan periodically

tardy charm

In previous version we can fetch the message and get it's embed then only edit certain part of the embed but it's not possible in dev version

Do i really need to recreate whole embed again

pallid ice

you can recreate the embed using the data of the API embed

with whatever changes you need to make to it

tardy charm

in ImageUrlOptions dynamic: true is not working

while the interface has dynamic

extension and size is working just fine

idle galleon
tardy charm

I see.

then why interface still has it

idle galleon

Enable forceStatic to override this

Idk, looking at old code?

Or prob looking at the wrong rest package version

tardy charm

yeah i think i need to restart my IDE

fallow steppe
dark crest

hi

how can i send a video with a text?

with MessageAttachment?

knotty plover

Yep, attach the video

dark crest

ohh thx

ripe hollow

Hello,
I have a error,

const { Client, Intents, MessageEmbed, MessageActionRow, MessageSelectMenu, MessageButton, MessageAttachment } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS] });
const client = new Client({ intents: [Intents.Flags.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS] });
                                              ^

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

IntentsBitfield

ripe hollow

?

nocturne kayak

Intents => IntentsBitfield

ripe hollow

Like that ?

const { Client, IntentsBitfield, MessageEmbed, MessageActionRow, MessageSelectMenu, MessageButton, MessageAttachment } = require('discord.js');
const client = new Client({ intents: [IntentsBitfield.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS] });

nocturne kayak

ofc you have to change all occurrences of Intents to IntentsBitfield

ripe hollow
const client = new Client({ intents: [IntentsBitfield.FLAGS.GUILDS, IntentsBitfield.FLAGS.GUILD_MESSAGES, IntentsBitfield.FLAGS.GUILD_MEMBERS, IntentsBitfield.FLAGS.GUILD_VOICE_STATES, IntentsBitfield.FLAGS.GUILD_MESSAGE_REACTIONS] });  
                                                      ^

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

IntentsBitField
sorry

ripe hollow

Ok ok
But I have a new error kek

const client = new Client({ intents: [IntentsBitField.FLAGS.GUILDS, IntentsBitField.FLAGS.GUILD_MESSAGES, IntentsBitField.FLAGS.GUILD_MEMBERS, IntentsBitField.FLAGS.GUILD_VOICE_STATES, IntentsBitField.FLAGS.GUILD_MESSAGE_REACTIONS] });  
                                                            ^

TypeError: Cannot read properties of undefined (reading 'GUILDS'
plain roverBOT
pallid ice
small mica
options: [
    {
        name: 'create',
        description: "Create a custom slash command!",
        type: ApplicationCommandOptionType.Subcommand,
        options: [
            {
                name: "name",
                description: "Name of the custom slash command",
                type: 'STRING',
                required: true,
            },
            {
                name: "response",
                description: "Response of the custom slash command",
                type: 'STRING',
                required: true,
            }
        ],
    }, 
     
    
  ],```
This is my slash command options structure. In `type: 'STRING',` what shud it be? `ApplicationCommandOptionType` only?
knotty plover

Yeah, enums only

hexed tapir
knotty plover

You could but bad practice, that's why enums exist

small mica

Why isn't getString shown?

Is it renamed or something?

knotty plover

No

tropic raven

trying typing it manually

knotty plover

Intellisense isnt documentation

tropic raven

yeah intelisense does that a lot to me, and then when i fully type it out then it starts working. its like it hasn't cached it or smth

knotty plover

You haven't typeguarded the interaction either

small mica

typegaurded?

oh yes

well that still doesn't show getString

knotty plover

Just type it out

small mica

Yeah I did that but I thought it was removed so it isn't shown. Thanks

hexed tapir
knotty plover

Because magic numbers mean nothing to the developer in code. And if Discord ever changes the numbers (they probably wouldn't) it would break, but we can update the enum and you don't have to change your code

scarlet tangle

why is this change?? EnumResolvers.resolveButtonStyle('PRIMARY'); this is just bloating the code, long lines for no reason

or we need to include billion type exports just to get basic values

terrible

outer bane

known bug

knotty plover

There's nothing wrong with imports

scarlet tangle

"PRIMARY" is enum and clearly I cant use it

knotty plover

No that's a string

Not an enum

scarlet tangle

string representating enum

scarlet tangle
tame gazelle

just import ButtonStyle

tame gazelle
scarlet tangle

ah overlooked

knotty plover
scarlet tangle

there is no such thing as enum in js either its "just" an object

knotty plover

It serves the same purpose, replacing magic strings and numbers

scarlet tangle

strings are descriptive, its not magic string. anyway i wont argue with you. How can I set "RANDOM" embed color? Colors "enum" doesnt have Random || the worst, most annoying to use version so far||

😦 why there is no EmbedBuilder.addField(...) again making stuff complicated

outer bane

because addFields can also take a single field