#djs-in-dev-version

35223 messages · Page 15 of 36

knotty plover

stricter typings

You havent shown a collector

fluid summit

Looks like this example could be improved to clarify scope. The multi scope interaction variables is confusing

knotty plover

but looks like the same thing

return something when it expects void

So basically

The methods expect you to return void

Which something like interaction.reply also used to return, so it was fine

But it doesnt anymore, so you cant return it from a collector function

You cant really other than looking at commits

we dont document every change between dev versions

forest elm
sharp pine

how would i make a embed

like { Embed } from discord?

cause don't know if the name got changed

forest elm

its in the guide

knotty plover

EmbedBuilder

sharp pine

got it!

what is the thing now called to add fields?

cant find the docu of .addFields()

plain roverBOT
tame gazelle

it works the same as v13

sharp pine

so .addFields('1', '2') would work?

tame gazelle

this was addField and it has been removed

sharp pine

well thats how i used fields in v13

tame gazelle

.addFields({ name, value, inline })

same as v13

sharp pine

alr thought that

tyyy btw sorry if i ask much, new to v14

sharp pine

why does the number log perfectly fine when doing it in a field, but not when i log it?

knotty plover

uhh not sure what you mean tbh, what does it log as

sharp pine

undefined

knotty plover

because of a typo

sharp pine

wym

knotty plover

there is a typo in the const build line

sharp pine

wait

lemme just do this console.log(out3.vars.sv_enforeGameBuild)

knotty plover

nope that still has the typo

sharp pine

huh

do i need toString it?

knotty plover

you need to spell it properly

sharp pine
knotty plover

Rin even told you the typo

sharp pine

this.build = out3.vars.sv_enforeGameBuild ?

knotty plover

monbreyFacepalm

sharp pine

I AM SO FK SORRY

yes i am aware of that

the help i get from google is

idle galleon

That's some ancient ES5 code

sharp pine

const build = []

build = out3.vars.sv_enforeGameBuild ?

knotty plover

I have no idea what that has to do with anythinng

dude

You spelt enforce wrong

sharp pine

BLAME MY FK GOOGLE

knotty plover

That is the only problem

sharp pine

where tf do you see enforce

knotty plover

In the field

vague coyote

how about you copy the right name and paste it, so you dont misspell it

knotty plover

Where you spelt it enforce

And it worked

Unlike the line where you did NOT spell it enforce

sharp pine

MY FK GAWD I AM SO BLIND

knotty plover

And it does NOT work

sharp pine

SORRY!

i see it now but i am so sorry

its like 2 am for me

knotty plover

Like.... it literally feels like you ignored every answer you were given

Thats not an acceptable way to seek support

tame gazelle
sharp pine

i already thought like enforcing?

I didn't know you guys were talking about my code, but more the basics of javascript. (just thought huh enforcing)

thats why i came with stupid ss's but i am so sorry

sharp pine

I'm going to sleep, thanks for your help and I'm going to sleep and if one of you is going to do that too then good night or have a nice day! ❤️

knotty plover

Uhh you're mixing collector with promise

It does reject when the end event is emitted if the end reason is time

Otherwise when it ends it returns the one collected ModalSubmitInteraction

last wigeon

for some reason the site will not load for me. how can I fix this?

sullen cove

I think it’s down, I was trying to get to it too with no luck

last wigeon

okay thanks.
Its working for my other friends, maybe they have the data saved from the website, because on my firefox its configured that it clears cookies when the browser is closed. idk

wicked tusk

yea same for me

@knotty plover @dawn phoenix can you help here?

knotty plover

You shouldnt ping mods

wicked tusk
solar canyon

Yeah, thanks!!

And also, which channel should I use?

dapper gull
solar canyon

right

thanks, and sorry

copper jetty

it's typescript error

idle galleon

Either move return below the followUp or add void like return void interaction.followUp(…)

Pretty sure d.js expects the callback to return void

wicked tusk

even if i leave the event empty it shows the error so idk what im supposed to put in there or change

knotty plover

The problem is CommandInteraction when thats not correct, it could be any type of interaction

wicked tusk

so the type should just be set to Interaction?

nocturne kayak

or dont cast its type as djs already defined event typings

zealous badge

How do you get files sent in a slash command?

narrow wagon

How can I set the avatar to png in v14?

white nebula
plain roverBOT
zealous badge

thanks

narrow wagon

@white nebula

white nebula

this is what it should be loading

narrow wagon
white nebula

oh, you said to set the avatar
displayAvatarURL had its dynamic option removed, and you now use extension instead of format but it works the same

white nebula

FutabaUpthumb

fluid summit

Does cancelling a modal emit any event? When I have a modal collector running and the user cancels, if that user executes a new modal my first collector will catch it.

knotty plover

nope

You should use unique customIds so they dont overlap

fluid summit
knotty plover

yeah, because theyre from different interactions

fluid summit
stiff mantle

got this error when using emoji in ButtonBuilder

Cannot destructure property 'emoji' of 'undefined' as it is undefined.
nocturne kayak

pass an empty obj to builder constructor
example ButtonBuilder({})
{ options: [] } if it's a selectmenu

stiff mantle

ok

civic topaz

why this happens?

Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://discordapp.com/api/guilds/935821346494091304/members/822623402849206283',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 1
  }
}

Code:

let data = await fetch(`http://discordapp.com/api/guilds/935821346494091304/members/${req.user.id}`, {
      method: `PUT`,
      access_token: "Bearer "+req.user.accessToken,
      headers: {
        Authorization: `Bot OTUy********************************`,
        "Content-Type": "application/json"
      }
    }).then(console.log).catch(console.log);
civic topaz

oh

Ik now, is in discord.js

<Guild>.members.add(<UserId>, {accessToken: <UserOauth2AccessToken>})

scarlet tangle

btw you need to specify access_token in the body

civic topaz

I use my alt to login and I have /api/@me endpoint

scarlet tangle
civic topaz
dawn phoenix

this is an oauth2 request

civic topaz

yes

dawn phoenix

not sure why you don't use the library you are in the support server for, though

civic topaz

I make this:

scarlet tangle

oh i misunderstood, sorry

civic topaz
app.get('/api/@me', (req, res) => {
res.send(req.user || 'Not login')
})

I use this

plain roverBOT
civic topaz

so I can see the access token

lament wave
TypeError: Cannot read properties of null (reading 'id')
    at InteractionCollector._handleMessageDeletion (/home/clauz/snake/main/node_modules/discord.js/src/structu>
    at Client.emit (node:events:539:35)
    at MessageDeleteAction.handle (/home/clauz/snake/main/node_modules/discord.js/src/client/actions/MessageDe>
    at Object.module.exports [as MESSAGE_DELETE] (/home/clauz/snake/main/node_modules/discord.js/src/client/we>
    at WebSocketManager.handlePacket (/home/clauz/snake/main/node_modules/discord.js/src/client/websocket/WebS>
    at WebSocketShard.onPacket (/home/clauz/snake/main/node_modules/discord.js/src/client/websocket/WebSocketS>
    at WebSocketShard.onMessage (/home/clauz/snake/main/node_modules/discord.js/src/client/websocket/WebSocket>
    at WebSocket.onMessage (/home/clauz/snake/main/node_modules/ws/lib/event-target.js:199:18)
    at WebSocket.emit (node:events:527:28)
    at Receiver.receiverOnMessage (/home/clauz/snake/main/node_modules/ws/lib/websocket.js:1137:20)

this error is hardcrashing me and happens casually when i delete a message, what is this?

dapper gull
tepid gust
lament wave
dapper gull
tame gazelle

this is fixed in 14.0.0-dev.1650240532-9ef7ffd ?

frigid sleet

Hi
I'm trying to set up my Slash Command in such a way that you can only use it if you have admin rights. However, I would also like to do that because I can always use the command, even if I have no admin perms on the server

if(!interaction.memberPermissions.has('Administrator') || interaction.member.id !== '863453422632173568')

I would also have tried it like this

 if(!interaction.memberPermissions.has('Administrator') || !interaction.member.id == '863453422632173568')
 if(!interaction.memberPermissions.has('Administrator') || !interaction.member.id === '863453422632173568')

but this dont works

Exactly, on the grounds that I'm the developer

dawn phoenix

not possible <> probably a bad idea
those two things are very, very different

the logic is off here, try to read it to yourself and you should see what's off

first code block: if member doesn't have administrator or the id is not x
second code block (both): if member doesn't have administrator or not the id (false) is equal to x (string)

frigid sleet

ok, thx

dawn phoenix

point still stands, though
depending on what that command does maybe you having an override for it in any place is a tremendously bad idea (maybe even abuse of privilege)

nova sonnet

🙂 why do i get these error

tame gazelle
nova sonnet
knotty plover

That kinda seems like you're not on v14?

I'm not sure

forest elm

use MessageCollectorOptionsParams<ComponentType.Button> instead

nova sonnet

how do i set permission on v14?

example?

i am too lazy can u give the direct link of it ?? 😜

plain roverBOT

Suggestion for @nova sonnet:
_ Interactions: Slash command permissions
read more

nova sonnet

thnks

why my slash commands are not getting registered?

i just made a command it didnt got registered

copper jetty

did you run the deploying code

nova sonnet

module.exports ={
    name: "timeout",
    description: "Timeout A Member",
    options: [
        {
            name: "user",
            description: "Select The User To Give Timeout",
            type: "user",
            required: "true"
        },
        {
            name: "reason",
            description: "A Specific Reason For Timeout",
            type: "STRING",
            required: "flase"
        },
        {
            name: "time",
            description: "A Specific Time For Timeout",
            type: "user",
            required: "true"
        },
    ],

    run: async (client, interaction, args) => {
        
        const user = interaction.options.getUser('user')
        const reason = interaction.options.getString('resaon') || null
        const time = ms(interaction.options.getString('time'))

        if(!time) return interaction.followUp({ content: "Time Is Not Valid Try Again!"})
        const response = await user.timeout(time, reason)

        if(!response) return interaction.followUp({ content:`${user} has been timeout for ${ms(time, { long: true})}`})
    }
}``` here is my code

@copper jetty

woeful pollen

required is a boolean, not a string

nova sonnet
woeful pollen

ur options

vague coyote

also you misspelled false

nova sonnet

oh yes

vague coyote

and you misspelled reason when getting the string option as well

copper jetty

and you can't timeout users btw

forest elm
copper jetty

btw /timeout is default discord command so you could just delete it

scarlet tangle

Hey guys, I don't know if this is a djs problem, but when im trying to get message content it returns nothing
code that i used:

    console.log(msg)
})```

returned message:
```<ref *1> Message {
  channelId: '-deleted-',
  guildId: '-deleted-',
  id: '965580514914357258',
  createdTimestamp: 1650282734374,
  type: 0,
  system: false,
  content: '',
  author: User {
    id: '-deleted-',
    bot: false,
    system: false,
    flags: UserFlagsBitField { bitfield: 256 },
    username: '-deleted-',
    discriminator: '-deleted-',
    avatar: '-deleted-',
    banner: undefined,
    accentColor: undefined
  },
  pinned: false,
  tts: false,
  nonce: '-deleted-',
  embeds: [],
  components: [],
  attachments: Collection(0) [Map] {},
  stickers: Collection(0) [Map] {},
  editedTimestamp: null,
  reactions: ReactionManager { message: [Circular *1] },
  mentions: MessageMentions {
    everyone: false,
    users: Collection(0) [Map] {},
    roles: Collection(0) [Map] {},
    _members: null,
    _channels: null,
    crosspostedChannels: Collection(0) [Map] {},
    repliedUser: null
  },
  webhookId: null,
  groupActivityApplication: null,
  applicationId: null,
  activity: null,
  flags: MessageFlagsBitField { bitfield: 0 },
  reference: null,
  interaction: null
}```
velvet jasper

It seems like unintended behavior

scarlet tangle

oh thx

copper jetty

it's usable for me, update to latest dev version

i think its only bugged in typescript

woeful pollen

what

cinder bane

is isCommand() and ChatInput same?

whats the difference between ChatInput and Command?

outer bane

CommandInteractions are the base for ChatInput (slash) and context menu commands

v13 CommandIntearction is the v14 ChatInputCommandInteraction

cinder bane

okay thanks

radiant gate

message cmd not working in djs v14 dev

bot can't read message content i enabled message intent but still

outer bane

you need the MessageContent intent in your client constructor as well

radiant gate
outer bane you need the MessageContent intent in your client constructor as well
const client = new Client({
  messageCacheLifetime: 60,
  fetchAllMembers: false,
  messageCacheMaxSize: 10,
  restTimeOffset: 0,
  restWsBridgetimeout: 100,
  shards: "auto",
  allowedMentions: {
    parse: ["roles", "users", "everyone"],
    repliedUser: false,
  },
  partials: [
    Partials.Message,
    Partials.Channel,
    Partials.GuildMember,
    Partials.Reaction,
    Partials.GuildScheduledEvent,
    Partials.User,
    Partials.ThreadMember,
  ],
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildBans,
    GatewayIntentBits.GuildEmojisAndStickers,
    GatewayIntentBits.GuildIntegrations,
    GatewayIntentBits.GuildWebhooks,
    GatewayIntentBits.GuildInvites,
    GatewayIntentBits.GuildVoiceStates,
    GatewayIntentBits.GuildPresences,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.GuildMessageReactions,
    GatewayIntentBits.GuildMessageTyping,
    GatewayIntentBits.DirectMessages,
    GatewayIntentBits.DirectMessageReactions,
    GatewayIntentBits.DirectMessageTyping,
  ],
});````

this is fine ?
outer bane

MessageContent

you don't have this intent

v14 uses api v10

radiant gate

discord don't provide in non verified bots ?

outer bane

you can enable the intent for non-verified bots, you just have to also add it to your intents array

hollow plinth

I updated my BOT to the dev version and I modified the Intents and Partials, but my BOT doesn't work (event undetected). Have I anything else to do ?

outer bane

doesn't work is not enough information to help you

outer bane
radiant gate how i ?

GatewayIntentBits.MessageContent, the same way you added the others. also don't add all intents, you most certainly don't need them

hollow plinth

No error but the BOT don't react to anything

outer bane

to what should it react?

hollow plinth

Commands, events,.....

My BOT works perfectly in v13

outer bane

what kind of commands? is it turning online?

hollow plinth

Yep, it is turning online

For example !help or !ping command

outer bane

so you mean message commands? read the conversation above, you need the MessageContent intent

kindred moss

so this function is in the types now, but it still doesn't work as intended:
StartThreadOptions.autoArchiveDuration expects a value of the ThreadAutoArchiveDuration enum but Util.resolveAutoArchiveMaxLimit returns a number.

noble kernel
let embed = new require("@discordjs/builders").EmbedBuilder

TypeError: (intermediate value).EmbedBuilder.setThumbnail is not a function help pls?

noble kernel

@outer bane u able to help me?

outer bane

you need () after the constructor. also no need to import from /builders, d.js re-exports everything now

noble kernel

would you mind giving me an example please 🙏

outer bane

what is below that line in your code?

noble kernel

.setThumbnail(bot.user.displayAvatarURL())

kindred moss
outer bane

from what I can see in the source code you shouldn't have to call the util method, it gets called internally when you pass 'MAX'. the latter not being in certain typing interfaces seems like a bug though

kindred moss

alright, I guess I'll just use @ts-expect-error and 'MAX' for now.
Util.resolveAutoArchiveMaxLimit should still return 60 | 1440 | 4320 | 10080 instead of number though from what I can tell.

outer bane

StartThreadOptions and ThreadEditData need | 'MAX'

typings for resolveAutoArchiveMaxLimit can also be made more strict, sure

^ cc @uncut kelp since you made the changes and I don't work with threads

noble kernel

@outer bane new require("discord.js").EmbedBuilder() returns Received one or more errors ;/

outer bane

a shapeshift error? can you show the full error?

noble kernel
outer bane

can you catch and console.log it? should show a bit more useful information

noble kernel
uncut kelp
outer bane

yes

uncut kelp

Yes!

noble kernel

this was working a few days ago and i updated today

and im getting all these errors

outer bane

what's the code generating these errors?

outer bane

the constructor alone wouldn't throw it

99.5% sure

noble kernel

well it's erroring as soon as i restart the bot

and embeds load on restart of the bot

outer bane

then what is below the constructor, which methods do you call on the instance?

noble kernel

at EmbedBuilder.setColor (/root/bots/palm-creations/node_modules/discord.js/src/structures/EmbedBuilder.js:22:18)

i see this in the error?

bot.builder = require("discord.js");

let embed = new bot.builder.EmbedBuilder()
      .setThumbnail(bot.user.displayAvatarURL())
      .setFooter({ text: "Updates every 30 seconds | Last updated:" })
      .setTimestamp()
outer bane

what is at updateLeaderboard line 86?

noble kernel

.setColor(embed.color)

outer bane

and what is embed.color?

noble kernel

let me print it

changed to .setColor(require("discord.js").Util.resolveColor(process.env["themeColor"]))

same error

outer bane

and what is process.env["themeColor"]?

noble kernel

75b424

OH WAIT
hold on im sorry

ok that error has gone now, that was mb

now im getting embed.addField is not a function

outer bane

addFields

noble kernel

oh..

how would something like this look with addFields?

outer bane

exactly the same but with an "s"

noble kernel

alr

YESS it's all fixed, tysm bro

tidal haven

I am unable to install the dev package, this is what I face while installing:

code ERESOLVE
ERESOLVE could not resolve

While resolving: distube@3.1.0
Found: discord.js@14.0.0-dev.1650240532-9ef7ffd
gloomy kayak

You're using a third party package which has a discordjs version that has conflicts with your version installed at root, nothing related to disord.js we can help with really

scarlet tangle

any idea why the interactions values are not logging?

outer bane

why is the client.on part also in eval.js?

scarlet tangle

i make separate emitters for the ones i really think that i need it for formating the code better

outer bane

well, right now you are attaching a listener each time the command is being run, and the first time probably doesn't have any listener yet

scarlet tangle
outer bane

if you want to use the client event move the listener outside of the code you execute each time the command is being run. alternatively you can use a collector

scarlet tangle

i see alright thanks

TypeError: interaction.isModalSubmit is not a function

thats painful

outer bane

make sure you are on the latest dev release

scarlet tangle

^14.0.0-dev.1645661258.8203c5d

thats the current version

outer bane

pretty sure it's not

scarlet tangle

should i try re-installing or smth?

outer bane

that version is 2 months old according to npm

scarlet tangle

let me update it then

@outer bane thank you very much it works now :)

tidal haven
tame gazelle
tidal haven
tame gazelle

with the same message error?

tidal haven

yes

scarlet tangle

whats new in v14

tame gazelle
tame gazelle
tidal haven

found it

forgot that it has another 2 packages related

rip now I can't run my music

narrow wagon

TypeError: Cannot destructure property 'emoji' of 'undefined' as it is undefined.

the line where the error occurs = const boton = new Discord.ButtonBuilder()
__ 👌

outer bane

update, that bug has been fixed

narrow wagon
narrow wagon
outer bane
small spear

what am I doing wrong?

median junco

how many text inputs fit in one modal?

forest elm
median junco
cerulean bay

This error crashed the library. Any clue? js TypeError: Cannot read properties of null (reading 'id') at InteractionCollector._handleMessageDeletion (/root/Mael/node_modules/discord.js/src/structures/InteractionCollector.js:214:29) at Client.emit (node:events:402:35) at MessageDeleteAction.handle (/root/Mael/node_modules/discord.js/src/client/actions/MessageDelete.js:22:16) at Object.module.exports [as MESSAGE_DELETE] (/root/Mael/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_DELETE.js:4:32) at WebSocketManager.handlePacket (/root/Mael/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31) at WebSocketShard.onPacket (/root/Mael/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:22) at WebSocketShard.onMessage (/root/Mael/node_modules/discord.js/src/client/websocket/WebSocketShard.js:304:10) at WebSocket.onMessage (/root/Mael/node_modules/ws/lib/event-target.js:199:18) at WebSocket.emit (node:events:390:28) at Receiver.receiverOnMessage (/root/Mael/node_modules/ws/lib/websocket.js:1137:20)

Running on this version

normal siren

Code

    let rock = '🪨'
    let paper = '📰'
    let scissor = '✂️'

        await interaction.editReply({
            content: 'message',
            components: [
                {
                    type: djs$ComponentType.ActionRow,
                    components: [
                        {
                            type: djs$ComponentType.Button,
                            style: djs$ButtonStyle.Primary,
                            emoji: rock,
                            customId: rock
                        }
                    ]
                }
            ]
        })

Error

DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].emoji[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType

Version: "discord.js": "^14.0.0-dev.1650240532-9ef7ffd" (In v13 this error not hapends)

idle galleon

Emoji has to be an object

{ name: "unicode emoji" }

normal siren

ok, ty

idle galleon

Or { name: "custom name", id: "…" } for guild emojis

steel lance

is modals addeed yet

copper jetty

yws

steel lance

oh

upper girder
vague coyote
upper girder

hm

upper girder
outer bane

it's a known internal bug caused by component interactions from messages which were not interaction replies

amber sleet

Someone knows why this error shows to me after the bot leaves a server where it has permissions to the audit logs

knotty plover

after the bot leaves a server
Because it left?

amber sleet

And when leaving the server, no one changes nickname for bot

knotty plover

well it might fire the event anyway

amber sleet
knotty plover

You can check for the type of change using if

amber sleet

hmmm okey thanks

noble kernel

does ActionRow allow .addComponents()? if not, how do i add components?

outer bane

you need an ActionRowBuilder, ActionRow is the received component which is read-only

noble kernel

and is ButtonComponent now ButtonComponentBuilder()?

woeful pollen

ButtonBuilder

noble kernel

tyy

scarlet tangle

how can I after confirmation send an 'ok', without saying that there was an error?

knotty plover

interaction.reply("Okay")

scarlet tangle

oh :o

thx

upper girder

setNameLocalizations at slash commands are working?

knotty plover

as far as I know yes

Its still an experimental feature in the Discord Client though

upper girder

I set it but the name for me keeps the main name.

knotty plover

Its still an experimental feature in the Discord Client though

upper girder

uh

so what i need to make it work

for me atleast

wicked tusk

can i make like a slash command which only specific person can see and use like normal users can't even see the command ?

knotty plover

no, only greyed out

and will reject if they manually type it

kind pulsar

Anyone can help me with this?

knotty plover

data is not a builder

pass ButtonBuilder in the generic

kind pulsar

Oh, i'm so stupid

Thanks

tiny obsidian

i get this error whenever a message with an interaction collector gets deleted

cinder bane

My bot doesnt trigger any events after i start it in the terminal does anyone know the reasons for why a bot wont trigger events

I dont get any errors

nocturne kayak

missing intents probably
or something wrong with you creating listeners

cinder bane
const { Client, Collection, IntentsBitField, Partials } = require('discord.js');
const Util = require('./Util.js');

module.exports = class SkyR6M extends Client {
    constructor(options = {}) {
        super({
            partials: [Partials.Message, Partials.Reaction],
            presence: {
                status: 'idle',
                activities: [
                    { name: 'Sky', type: 'WATCHING' }
                ]
            },
            intents: [IntentsBitField.Flags.Guilds, IntentsBitField.Flags.GuildMembers, IntentsBitField.Flags.GuildMessages, IntentsBitField.Flags.GuildVoiceStates]
        });

        this.validate(options);

        this.commands = new Collection();
        this.events = new Collection();
        this.utils = new Util(this);
        this.mongoose = require('./mongoose.js');
    };

    validate(options) {
        if (typeof options !== 'object') throw new TypeError('Options should be a type of Object.');

        if (!options.TOKEN) throw new Error('You must pass the token for the bot.');
        this.token = options.TOKEN;
    };

    async start(token = this.token) {
        this.utils.loadCommands();
        this.utils.loadEvents();
        this.mongoose.init();
        super.login(token);
    };
};

Is this the right way to add Intents?

the bot gets online when i run node . but i cant trigger the ready event for some reason

nocturne kayak

then you got a problem with creating listeners

cinder bane

okay

frigid sleet

In v14 it looks like this not work


if(message.author.bot) return; 

Can anyone tell me why? Or what do I have to change?

knotty plover
frigid sleet

Hmm, ok but how doesn't my bot return if the message is from another bot? 🤔


client.on("messageCreate", async (message) => {
    if(message.author.bot) return;
    })
knotty plover

No idea, looks fine to me

forest elm
cinder bane

will .isRepliable() return false if the interaction is deferred?

or it will only return false if the interaction is replied or editReplied

outer bane

it will only return false for interactions that don't have a reply, deferReply, ... method, it doesn't depend on the replied state of the interaction

cinder bane

ohhh i see

outer bane

the name is a bit misleading and it might be removed all together

cinder bane

okay, got it thanks

frigid sleet
forest elm

And how do you know that is not ignoring bots

frigid sleet

I tested it and another one who tested my bot independently of me also says that

knotty plover

Going to need to see a bit more of the continuing code I think

Not if it really does close again on the next line lol

cinder bane

if i try to fetch a member from a guild like this

const member = await interaction.guild.members.fetch('id');

will it result in error if the member isnt in the guild or will it return null

tame gazelle

an error

the Promise will be rejected

cinder bane

okay

cinder bane

is it possible to bypass a permission of a role to a command by allowing an user to access the command?

[
   { id: '965522235467116544', type: ApplicationCommandPermissionType.Role, permission: false },
   ...Owners.map(({ id }) => ({ id, type: ApplicationCommandPermissionType.User, permission: true }))
]

so basically a role is denied from accessing the command but a user having the same role is allowed to access it

will it work?

knotty plover

try it, I think it should

icy panther

when will discord.js v14 release

knotty plover

When it's ready

icy panther

is that soon or not

vague coyote

When it's ready

tepid mauve

hey, seems that I have some issues with modals, which didn't come out before updating. any Ideas? (or some clues that I can figure out what's wrong)

outer bane
tepid mauve https://sourceb.in/

the ModalBuilder does not support using raw action rows with builder components in it. either pass pure objects or ActionRow instances. that said, why do you even use the constructor? builders are meant to be used via their methods

ripe scaffold

probably the camel case to snake case converter

tepid mauve
outer bane

why do you even use the builder? you don't have to, you can use raw objects too

outer bane
ripe scaffold probably the camel case to snake case converter
class ModalBuilder extends BuildersModal {
  constructor({ components, ...data } = {}) {
    super({
      ...Transformers.toSnakeCase(data),
      components: components?.map(c => (c instanceof ComponentBuilder ? c : Transformers.toSnakeCase(c))),
    });
  }

it's this part only checking for components

tepid mauve
outer bane

djs will call the jsontransformer internally for raw objects

tepid mauve
outer bane

yes

tepid mauve

Oh, alright. Good to know. Thanks again !

tepid mauve

I just found out that Util.splitMessage is no longer available in v14, is there an alternative?

outer bane

no, you have to implement that yourself. you can just copy/paste the old removed code, though it had issues with regex splits

frigid sleet

hey, i'm trying to create something here that will link in the GuildCreate event to the server where the bot was added, but i'm getting stuck at one point
${guild.invites.create()} I don't know how to fill the brackets when creating

storm knoll

Error: Argument of type 'TextInputBuilder' is not assignable to parameter of type 'Partial<ActionRowData<ActionRowComponentData | ActionRowComponentBuilder> | APIActionRowComponent<APITextInputComponent | APIMessageActionRowComponent>> | undefined'.

Code: ```js
import { ActionRowBuilder, ModalActionRowComponentBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } from 'discord.js';

const feedbackModal = new ModalBuilder()
.setTitle('Feedback')
.setCustomId('feedbackModal')
.addComponents(
new ActionRowBuilder<ModalActionRowComponentBuilder>(
new TextInputBuilder()
.setCustomId('feedbackInput')
.setLabel('...')
.setMinLength(50)
.setStyle(TextInputStyle.Paragraph)
)
);```

Build: 14.0.0-dev.1650240532-9ef7ffd

outer bane

use addComponents on the actionrow, don't pass it in the constructor

storm knoll

oh wow how did i not see that

thank you

dull spruce

Why this is not working? Did I forget to change something? It was working on v13

const guild = client.guilds.cache.get(guildId);

guild.commands.set(commandsData);

var permissions = [{
  type: ApplicationCommandPermissionType.User,
  id: myId,
  permission: true
}];

await guild.commands.cache.map(command => {
  command.permissions.set({
    permissions
  });
});

I won't get permissions for commands with defaultPermission = false

outer bane

the cache won't be populated unless manually fetched. that said, you can set all those permissions with one api call, by providing fullPermissions to <Guild>.commands.permissions.set. to get the command ids use the return value from <Guild>.commands.set

cinder bane
console.log(roleId, Roles.RegisteredId);
await member.roles.add([Roles.RegisterId, roleId]);

the Ids arent undefined

whats going wrong here?

dull spruce
cinder bane

ill fix that later

but why does it show undefined

I tried to console.log() roles received by the add method and the same roles in my own code

this is what im getting in my console

okay nvm

I didnt see the typo

💀

sharp pine

why would this not work?

options*

nocturne kayak

it should be an array of object
and you wrote options: [name: 'test1']

sharp pine
jaunty vault
nocturne kayak

i mean
i didnt tell you that's correct mmLol

sharp pine

iknow

but is it something with my handler?

jaunty vault
nocturne kayak

no
simply add braces
[{ name: 'test1' }]

sharp pine
urban belfry

yeah well how are you registering?

sharp pine

yea not, thats why i asked is there something wrong with my handler?

urban belfry

huh? i asked to see how you were registering the command
and you didn't show a handler

also confirm your discord.js version first, npm ls discord.js

sharp pine
outer bane

pretty sure you would get an error trying to register that option since its type is not a number

jaunty vault

setComponents takes a rest parameter

sharp pine

well i can do number there

outer bane

remove the []

sharp pine

people told me to

jaunty vault

that was for application command options... this is action row

fickle fox

Hi, I am trying to make a event that will send an embed in a server and to the owner of the server when it is added to that server.
Here is my guildCreate.js file => https://srcshare.io/?id=625ee5db5f04b85b24f2253f
Here is my index.js file => https://srcshare.io/?id=625ee5f75f04b89c95f22540

Here is the error => https://srcshare.io/?id=625ee6305f04b8d890f22541

What I am assuming the issue is is that it is not passing through guild properly (Or it doesn't have access to that). However I am unsure on how to fix this error myself. Any help is appreciated SMILE (This was copied over from the Worn Off Keys discord server as I was told to come here)

sharp pine

since i always used it between []?

jaunty vault
sharp pine

done

what now?

jaunty vault
sharp pine

no

everyone uses it with []?

is there something wrong with my handler then for not specifing options?

jaunty vault
outer bane
jaunty vault

oh wait

2 people loll I didn't notice

sharp pine
outer bane

can't say anything else without seeing the part of your code which registers the command(s)

sharp pine

this right?

outer bane

look at line \d*4

you don't add options to the commands you register

fickle fox
tame gazelle

yep

sharp pine
outer bane

then you wouldn't register any commands anymore

fickle fox

Thanks

tame gazelle

no prob

sharp pine
outer bane

the same way you added name, description and type

sharp pine

yes so as i already thought

but it will be then

options: slashCommands.options?

outer bane

seems correct

sharp pine
outer bane

wait that's not the part where you deploy the commands

you are just adding them to a collection there

sharp pine

wait

huh i do?

outer bane

where in your code do you have either <REST>.put, <Client>.application.commands.set or <Guild>.commands.set

forest elm

its at the bottom

sharp pine
forest elm

you cropped it out

sharp pine

yea i know

outer bane

show that part

sharp pine
forest elm

:|

outer bane

client.slashCommands is a custom collection, there's no deploying happening

(at least I hope there isn't)

forest elm

the deploying is at the bottom, and thats what nameless asked for, why would you remove it from the screenshot

sharp pine

so i would need to use just slashCommands.set?

outer bane

ok, one last time. please show the part with rest.put

sharp pine
sharp pine
outer bane

yes, "or", but you don't have the other versions, only the first one

that's not the issue

it's a typo in the push

remove the "s" from ...s.options

sharp pine

at the push right?

outer bane

yes

sharp pine
outer bane

did the console.log below the put part show?

do you have a guild id env var set?

sharp pine

well it works now

but the thing is, when i save for example the options type

it doesnt update inside discord

outer bane

do you have a guild id env var set?

sharp pine

jup

but the thing is, when i save for example the options type
it doesnt update inside discord

you know why this happends?

outer bane

did the console.log below the put part show?
can you log the (resolved) return value from rest.put?

sharp pine
outer bane

(resolved)

sharp pine
outer bane

that is not the return value from said function

sharp pine

this? i am sorry i just dont understand it

outer bane

yes, this is correct

sharp pine

great

outer bane

there is no "ping" command though

sharp pine

changed it to generate

outer bane

can you log the options array from the command?

sharp pine

doesnt log anything?

only the one of undefined logs undefined

outer bane

it's an array of objects though according to your screenshot which should show up when logging

tame gazelle

you misspelled it

sharp pine

excuse

fiery widget

Hey, for some reason the messageUpdate event wont fire after a msg edit, is there something new in v14 or am i missing something?
using the GuildMessages intent.

sharp pine
  • is there an way to limit the number input to max 10?
outer bane

max_value

tame gazelle
fiery widget
tame gazelle try adding the `MessageContent` one

already did :/
These are my intents:

        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildPresences,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildMessageTyping,
        GatewayIntentBits.GuildInvites,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.DirectMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMessageReactions
    ]```
tame gazelle

try adding the Message partial

fiery widget

worked, thanks!

tame gazelle

no prob

sharp pine
sharp pine

how would i use message.author.send in a slashcommand?

like idk how i would send a message to the author since you cant use message in slash

dawn phoenix

you don't get a message, so yeah, that won't do
but the interaction has a .user and .member accessor, which is the user/member executing the command

sharp pine

which one do you prefer?

scarlet tangle

How do I send emoji in a button?

urban belfry

afaik, they take in an object with a name, id and animated property

scarlet tangle

Mind providing an example? For some reason it is not accepting string.

urban belfry

because as i said it doesn't take a string, it takes an object
for custom emojis setEmoji({"id": "id"}), twemojis setEmoji({"name": "🙂"})

scarlet tangle

Oh cool

fiery widget

Hey, im trying to make a voice channel with the bot, and got a few questions.
since i cant use type: voice, how i can make the channel a voice channel?
and what can i do instead of using permissionOverwrites? ```permissionOverwrites: [
{
id: userr.id,
allow: ['MANAGE_CHANNELS', 'CONNECT', 'MANAGE_ROLES'],
},
{
deny: ['CONNECT', 'VIEW_CHANNEL'],
id: newMember.guild.id,
},
{
allow: 'VIEW_CHANNEL',
id: '779498352210477076',
}

            ],```, i mean, what else can be used in order to change the room permissions?

thanks.

Value "GUILD_VOICE" is not int.
xD

woeful pollen

for the channel type use the ChannelType enum from discord-api-types, so ChannelType.GuildVoice

fiery widget

thanks!

woeful pollen

and for permissions, use PermissionFlagsBits

brazen knoll

if a guild is unavailable, will it still be cached? (just with id and name) or will i have no trace of it at all

plain roverBOT

property Guild#available
Whether the guild is available to access. If it is not available, it indicates a server outage

vague coyote

it should be cached and the property above should be false

brazen knoll

ah sick, thanks

narrow lagoon

will v14 include the new permission system?

woeful pollen

isnt only the client being updated for permissions v2

sharp pine

how do i check if the user id who is executing the command his id is in a json? so not deny access
i forgot how it would work

knotty plover

@woeful pollen no, the APIs will change too

@narrow lagoon if the permissions system is released before v14, then yes

narrow lagoon

Perfect

woeful pollen

good to know

tame gazelle

the warning comes from the source code of d.js

sharp pine

mine?

tame gazelle

source code of d.js

sharp pine

no i thought of my picture, you could talk about someone else

but did i find a bug or?...

tame gazelle

it isn’t really a bug, it’s just a warning
and I believe they are aware of it

sharp pine

how would i fix it?

not right?

tame gazelle

you can’t

brittle robin

a nodejs warning, woo

scarlet tangle

For some reason my code exits/hangs. It runs in an environment which gets rate limited very often(shared hosting). Someone has faced this before?

idle galleon

You can blame the person that got the node/machine ip banned

scarlet tangle

Why does it exit though?

djs handles ratelimits right?

idle galleon

Ur not allowed to login if it's ip banned

scarlet tangle

It hangs in between

It exits on start so I get that

idle galleon

Slow connection then?

scarlet tangle

Idts

It works fine when I redeploy

plain roverBOT

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

scarlet tangle

Okay cool

Thank you

idle galleon

If you hit rate limit (429) on /gateway/bot, then it means someone got the machine ip banned

scarlet tangle

Bot comes online but it just hangs

Doesn't reply to any commands (slash/message)

idle galleon

Is it receiving the event on time?

scarlet tangle

Not logging that will setup logs rn.

vast mirage

TypeError: Cannot read properties of undefined (reading 'interactions')
has this been removed?

idle galleon

What is that?

knotty plover

I don't think anything called interactions ever existed, though the error says of undefined so its the class you're trying to access it on thats missing

vast mirage

client.api.interactions

woeful pollen

yes, dev uses @discordjs/rest instead of the client.api proxy stuff

scarlet tangle
idle galleon
scarlet tangle

Is that a bug with djs?

idle galleon

No, that’s the intended behavior

All requests are handled sequentially

knotty plover
cerulean bay
TypeError: Cannot read properties of null (reading 'id')
    at InteractionCollector._handleMessageDeletion (/root/Caprice/node_modules/discord.js/src/structures/InteractionCollector.js:214:29)
    at Client.emit (node:events:402:35)
    at MessageDeleteAction.handle (/root/Caprice/node_modules/discord.js/src/client/actions/MessageDelete.js:22:16)
    at Object.module.exports [as MESSAGE_DELETE] (/root/Caprice/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_DELETE.js:4:32)
    at WebSocketManager.handlePacket (/root/Caprice/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (/root/Caprice/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:22)
    at WebSocketShard.onMessage (/root/Caprice/node_modules/discord.js/src/client/websocket/WebSocketShard.js:304:10)
    at WebSocket.onMessage (/root/Caprice/node_modules/ws/lib/event-target.js:199:18)
    at WebSocket.emit (node:events:390:28)
    at Receiver.receiverOnMessage (/root/Caprice/node_modules/ws/lib/websocket.js:1137:20)```

This still crashed the library. Someone told me that it would be fixed in <https://github.com/discordjs/discord.js/pull/7812> but it's not the case and not the same thing at all

From what i can see, it comes from an interactioncollector Where in js if (message.interaction.id === this.messageInteractionId) { this.stop('messageDelete'); }

message.interaction is null

Is there a Pr about this issue?

woeful pollen

doesnt that pr address that issue?

cerulean bay

Someone refered me to that pr but i think it's not related to the issue. It's the same result but not the same issue

And it is a major issue as it crashes the library

knotty plover

Yes, #7812

Its the same issue

Its now been merged

A new dev release was published 11 minutes ago which should include it, please update

cerulean bay

Thanks!!!

civic topaz

why will this happens?

 [antiCrash] :: Unhandled Rejection/Catch
TypeError: Cannot read properties of null (reading 'id')
    at ButtonInteraction.deferUpdate (/home/runner/ka-dev/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:200:108) Promise {
  <rejected> TypeError: Cannot read properties of null (reading 'id')
      at ButtonInteraction.deferUpdate (/home/runner/ka-dev/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:200:108)
}

code:

knotty plover

update to latest, bug was fixed

scarlet tangle

I don't know why, but I get this error when trying to set an application command option type
I'm using TypeScript and djs version 14.0.0-dev.1650413390-585169f

velvet jasper
scarlet tangle

Oh ok

cerulean bay

New weird error with the latest version of dev js Error: Received one or more errors at UnionValidator.handle (/root/Caprice/node_modules/@sapphire/shapeshift/dist/index.js:1471:23) at UnionValidator.parse (/root/Caprice/node_modules/@sapphire/shapeshift/dist/index.js:114:88) at EmbedBuilder.setDescription (/root/Caprice/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:261:54) at /root/Caprice/dist/src/imports/messages.js:3871:14 at Generator.next (<anonymous>) at /root/Caprice/dist/src/imports/messages.js:8:71 at new Promise (<anonymous>) at __awaiter (/root/Caprice/dist/src/imports/messages.js:4:12) at ghostPingsEmbed (/root/Caprice/dist/src/imports/messages.js:3863:12) at /root/Caprice/dist/src/imports/ghost-pings.js:28:108

idle galleon

Error came from an EmbedBuilder.setDescription

cinder bane

since the nitro booster role is manageable

knotty plover

I think if you attempt to remove managed roles yes

cinder bane

okay

can i filter the managed role then use .set()?

member.roles.cache.filter((r) => !r.managed).set([])?

or since its a cache it doesnt provide set method

knotty plover

uhhh

Yes but not like that

member.roles.set(member.roles.cache.filter(r => !r.managed))

cinder bane

ah

knotty plover

You want to set it to only managed roles I assume

cinder bane

i just want to remove all existing roles from an user if the user has a certain role but since i cant remove managed roles im trying to filter them out

knotty plover

yeah it would be that then

cinder bane

okay great, thanks

knotty plover

Actually, other way around

filter keeps the things that pass

So member.roles.set(member.roles.cache.filter(r => r.managed))

So you're setting it to managed roles and removing everything else

cinder bane

yeah right

thanks

nova sonnet

why it is not loading slash event etc ?

nocturne kayak

recheck your command handler

nova sonnet
nocturne kayak

then it should work?

djs has nothing to do with handling commands

nova sonnet

@nocturne kayak should i send u the message create code?

knotty plover

uhhh, why would we want message create code

Thats not a slash command

Your handler either isnt finding or isnt counting the files

cinder bane

is there any downside to using UnsafeBuilders?

urban belfry

no validation

rain bramble

For some this is a upside

slow storm
urban belfry no validation

Not only that but you won't be able use camelCase keys in constructor, no emoji string, color string, all the features which where added in djs by extending the safe builders

tame gazelle

if there's Interaction#awaitModalSubmit() there will be a thing like Interaction#createModalSubmitCollector() too?

gloomy kayak

I mean, you can click a button more than once but a modal once is sent it's gone so I don't see really a use case

sharp pine

how would i change here that my bot isn't used it will go to idle?

jaunty vault
dawn phoenix

and what exactly is the use you get out of this procedure?

sharp pine
sharp pine
jaunty vault
sharp pine

it doesnt do anything every 5 secs

jaunty vault
sharp pine

more like every 1 -2,5 minutes

i can show you it doesnt do it every 5 seconds

jaunty vault
nocturne kayak

probably got ratelimited

sharp pine

oh

thats my game

dawn phoenix

which is all presence updates

sharp pine

^^

i just wanna do in here if my bot is idle (not used for a specific time) then he goes idle, and so not he goes back to online

jaunty vault
sharp pine

idc about precenese

when my bot isn't used by commands for eg by users within 2 minutes idk, then he goed idle, when he is being used again go to online

jaunty vault
sharp pine

it is only the precense i am playing, i can make it slower if you want too

dawn phoenix

what you are trying to do is presences tho

i don't think you understand why this cannot work

sharp pine

i am asking if it is possible, and if so how would i do it (referance to a doc for example)

dawn phoenix

you are already using the methods, what would docs use?

your intervals that both persistently set status/activity (both subset of presences) overlap
you'd need to save the state (should the next update be online/dnd/idle + which activity) and set them all together on a large enough interval via #setPresence
vs. setting them separately in overlapping intervals

sharp pine

the only thing i can get out of there is saving the state and thats it?

now it is doing that every 5 seconds which is not checking whether the bot isnt used or it is

proven gust

Souji is saying you should combine your setActivity and setStatus updates into setPresence to avoid rate limiting

There you can set both at once

pallid ice

I still wouldn't advise setting it every 5 seconds, that could be seen as API spam

dawn phoenix
sharp pine
dawn phoenix

makes for a pretty bad test, because that'll cause it to not work

sharp pine

how would i be able to check then whether a slashCommand (all of my commands) are runned so not check if for example 5 seconds have been passed then do something

cause i can't find anywhere where i could maybe get some info from

copper jetty
cinder bane

is SelectMenuBuilder not supported in v14 yet?

const UserEmbedComponents = new ActionRowBuilder()
                .addComponents(
                    new SelectMenuBuilder()
                        .setCustomId('ViewUser')
                        .setMaxValues(1)
                        .addOptions([
                            {
                                label: 'Overview',
                                value: 'overview'
                            },
                            {
                                label: 'Roles',
                                value: 'roles'
                            },
                            {
                                label: 'Avatar',
                                value: 'avatar'
                            },
                            {
                                label: 'Banner',
                                value: 'banner'
                            }
                        ])
                );
urban belfry

it says you didn't pass a value and a label, which are required

cinder bane

i did i think..

urban belfry

oh the addOptions, try not passing an array

cinder bane

...[] will work?

urban belfry

yep

cinder bane

okay thanks

DiscordAPIError[50035]: Invalid Form Body
data.embeds[0].color[NUMBER_TYPE_COERCE]: Value "Aqua" is not int.```

is String not supported in v14?

outer bane

it should be if you are on the latest dev and use the re-exported builder from d.js, not /builders

cinder bane

im not using any builder

outer bane

then it's not supported

cinder bane

okay

outer bane

you can use the Colors enum (I think that's the name, should be a top level export)

cinder bane

okay thank you

How to set a default selectmenu when sending an embed? like whenever I use the command i want it to automatically select an option so that the user cant select it again

nvm got it

are the UserFlag names not the same as the API?

velvet jasper

No they’re PascalCase

cinder bane

Okay thanks

is this supported in discord.js v14

hoary fox
cinder bane

okay

cinder bane

is there any ComponentType Enum?

tame gazelle

there is

you can import it from discord.js

cinder bane

@tame gazelle whats the name for it?

I cant import it

tame gazelle

ComponentType

cinder bane

okay nvm I can now

cinder bane

do I need to fetch members to get their bannerURL in v14?

woeful pollen

pretty sure yes

cinder bane

okay

frigid sleet

Hey, I need help, I want to make a list of all role IDs of a user
I know how to make a list of role names but not IDs

const roidli = interaction.member.roles.id.cache.toJSON()
        console.log(`${roidli}`)
    interaction.reply({content: `${roidli}`})

But how can I make a list with the IDs

tame gazelle
frigid sleet

thanks

fickle fox

Is there a way to edit a response in v14

tame gazelle
fickle fox

thanks lol

Idk why I even asked that that was pretty dumb

tame gazelle

and it is the same as v13 also

fickle fox

yeah

cinder bane

is spliceOptions removed from SelectMenuBuilder in v14?

fickle fox

How can I listen for button clicks in v14? Is it the same way for v13?

cinder bane

How do I exactly use this mutate a SelectMenu?

also I want to know if spliceOptions has been removed in v14 or not since I want remove an option from SelectMenu options

tame gazelle
cinder bane

okay

Expected a string primitive

what error is this? i receive when trying to reply()

nvm

kindred kite

is group dm, but bots cant be added to group dms

yeah but the bots cant be in the gc by themselves can they?:

chrome estuary

Hey guys.

I'm trying to understand something that I'm potentially missing. I'm currently using the dev version (14.0.0-dev.1650240532-9ef7ffd), and using a button to show a modal. I can get the modal interaction and the data from it, but I don't understand why the interaction is called multiple times whenever I cancel the modal then submit it.

Here's all the steps I'm doing for that :
1. Send a message with a webhook with a button
2. Create a collector for that message
3. Once a button is clicked, show a modal
4. Click X times outside the modal (or cancel X times)
5. Submit the modal
X is the number of times the modal interaction is called.

I hope someone can tell me what I'm doing wrong, because I'm out of solutions so far.

kindred kite

you must be doing something wrong

can I see ur code?

yup only calls it once

even tho i used an autoclicker for the cancel button

chrome estuary
kindred kite can I see ur code?

Sure :

messageÉtatPartie = await webhook.send(
{
  // Contenu
  embeds : arrayMessageEmbed,
  
  // Composants
  components : arrayMessageComponents,
  
  // Paramètres
  username : plancheAvatar.nom,
  avatarURL : plancheAvatar.avatar,
  threadId : threadID
});

let collectorÉtatPartie = messageÉtatPartie.createMessageComponentCollector();

collectorÉtatPartie.on("collect", async interactionBouton =>
{
  // Variables
  let modalOptions =
  {
    title : "Proposition",
    custom_id : "plancheProposition",
    components :
    [
      {
        type : 1, // Action Row
        components :
        [
          {
            type : 4, // Text Input
            style : 1, // Short
            label : "Proposer une lettre",
            min_length : 1,
            max_length : 1,
            required : true,
            custom_id : "planchePropositionInput",
          }
        ]
      }
    ]
  };
  
  // On affiche le modal
  await interactionBouton.showModal(modalOptions);
  
  // On récupère les informations du modal envoyées par le joueur
  collectorModal = new InteractionCollector(client, { message : messageÉtatPartie, interactionType : 5 });
  
  collectorModal.on("collect", async interactionModal =>
  {
    await plancheProposition(threadID, interactionBouton, interactionModal, messageÉtatPartie);
  });
});```
forest elm
acoustic temple

On messageDelete event I'm getting content property as an empty string

Someone know why it is happening?

gloomy kayak

Maybe it wasn't cached? (Not sure tho, it should be null in this case) Forgot of message content intent

acoustic temple

It is my intent

tame gazelle

it doesn’t include the MessageContent one

acoustic temple

ih

I'll check here

acoustic temple
tame gazelle

try intents: Object.keys(IntentsBitField.Flags)

tame gazelle

try it

acoustic temple

Ok, I'll try

copper jetty
acoustic temple

😦

acoustic temple
idle galleon

Please just specify ur intents

kindred kite

so

idle galleon

They can create group dms, but no one can see it

tame gazelle
idle galleon
tame gazelle

yes

I use strings in the latest dev

kindred kite
idle galleon
kindred kite
idle galleon
narrow wagon
      errors: [
        [
          'emoji',
          CombinedError: Received one or more errors```
```js
      given: { value: 'tanuki', label: 'Tanuki', emoji: '🍃' },```

__

idle galleon

emoji must be an object

{ name: "name or unicode emoji", id: "id or none" }

chrome estuary
idle galleon

Better off creating it once after the one for the button

chrome estuary

So I should create the InteractionCollector for the modals before collecting the one from the buttons?

Welp, it worked, didn't think of that. Thanks for the help 🙂

knotty plover
bright galleon

Thank you! Its the action rows I missed

bright galleon

Im doing exactly like the link but I have this error:

did something change recentyly ?

actuzlly it may be simply type problem lol. lemme try running it

copper jetty
bright galleon

hoesntly not sure wdym

copper jetty

<TextInputBuilder>

bright galleon

ohhh

ty

Anyone know what did these change to ?

knotty plover

Nothing

What's options?

What's the error on them?

bright galleon
knotty plover Nothing

I had forgotten to change isCommand to isChatInputCommand. Changing that fixed it. Thanks for the response 🙂

cyan jewel

Since EmbedBuilder#addField() has been removed, how can I deal with situations where I want to conditionally add a single field to an embed?

acoustic temple
cyan jewel
acoustic temple

use variables

Sometimes when I use more than one field, I use something like this:

const fields = []

fields.push({name: 'abc', value: 'def', inline:true})
// others pushes

embed.addFields(...fields)
cyan jewel

Ah, I see. I didn't consider that approach. That works.

cyan jewel
acoustic temple

I didn't test it

cyan jewel

OK.

outer bane
cyan jewel
fluid summit

afaik there's not way to showModal after deferReply()?

outer bane

correct, it has to be an initial response

fluid summit

okay, thanks

cyan jewel

So I see the docs for guild.maximumPresences say it's null for all but the largest of guilds. How large, and does anyone know why they changed this?

cinder bane

how do I use SelectMenuBuilder.from()

let UserEmbedComponents = new ActionRowBuilder()
                .addComponents(
                    new SelectMenuBuilder()
                        .setCustomId('ViewUser')
                        .setMaxValues(1)
                        .addOptions(
                            {
                                label: 'Overview',
                                value: 'overview',
                                default: true
                            },
                            {
                                label: 'Roles',
                                value: 'roles'
                            },
                            {
                                label: 'Avatar',
                                value: 'avatar'
                            },
                            {
                                label: 'Banner',
                                value: 'banner'
                            }
                        )
                );

            UserEmbedComponents = new SelectMenuBuilder.from(UserEmbedComponents.toJSON())

im trying to use this as of now but this isnt working

outer bane

from takes api data or something with a toJSON method which returns api data, so you'd have to use the first component from the row here

cinder bane

so

UserEmbedComponents = new SelectMenuBuilder.from(UserEmbedComponents.components.toJSON());
outer bane

components is an array

cinder bane

or components[0]?

okay

outer bane

you don't have to call toJSON btw, from does that internally

cinder bane

ohk ty

also, is spliceOptions() removed in v14?

outer bane

if it doesn't exist it can easily be added, might be an oversight from the /builders transition

cinder bane

how do I add it?

i dont think its there

knotty plover

Yeah probably just an oversight

cinder bane

okay

when will it be added then? @knotty plover

knotty plover

Whenever someone codes it 😄

Open an issue on Github for it and someone will probably PR

cinder bane

okay

uncut ruin

can we still use intents in like string form instead of GatewayIntentBits.Guilds,

nocturne kayak

ts doesnt complain when i do so so ig it's ok
do note that all intent strings are PascalCase

uncut ruin
nocturne kayak

yes

dawn phoenix

would not recommend it, but you do you

uncut ruin

that's why I was asking for the String intents are available or not

short tapir

Has something to do with defering changed? For some reason they just think forever until I get a memory issue shrugg

velvet jasper

Big heads up to everyone The next development release will change builders to only accept arrays instead of rest parameters. In most cases this means surrounding your values in [] and/or removing the leading “…” spread operator.

tame gazelle

all methods that accept rest params in builders?

velvet jasper

Yes they’ll only accept arrays in the next release

short tapir

Okay worked out its stopping here, however I am not really sure how I would debug it?

Also removed @discordjs/builders

storm knoll

Use Enums instead of Strings for Button Styles

short tapir

Oh alright

short tapir

Changed it over however its still stopping

forest elm

what does "its stopping" mean, does the code throw?

short tapir

No error, I have console.logs between the chunk I provided in the image, first one logs, second doesn't

Updating the package seems to have fixed it

unreal blaze

Can I as for solution? Im lost.

forest elm

spread the array, ...choices

unreal blaze

Wow.. You are too clever. No way i would find that out. Thank you ❤️

crystal valve

so my bot logs in normally, but it's not rn
nothing in the code has changed, so I'm wondering if there's anything else going on?

client
    .on("debug", console.log)
    .on("warn", console.log)```
returns nothing in the console

ok something's probably wrong with the platform I'm running my code on, it works once I fork the same code
resolved the issue

brazen knoll

Does ActivityType.Custom mean we can set custom statuses on Bots now?

woeful pollen

no

brazen knoll

then what is it for

forest elm

members can have custom statuses

which your bot can receive

brazen knoll

man

tame gazelle
urban belfry
tame gazelle

thanks

wintry bear

message.content is different now?

woeful pollen

you need MessageContent intent to receive message content

wintry bear

o

violet quarry

Why do I get a error when i try to set a embed color with .setColor('#0099ff') of the EmbedBuilder? When I try to use a integer (so not a string) it works, but i can't use so much colors anymore.

The error:

  Received one or more errors

  1 ExpectedValidationError > s.literal(V)
  |   Expected values to be equals
  |
  |   Expected:
  |   | null
  |
  |   Received:
  |   | '#0099ff'

  2 ValidationError > s.number
  |   Expected a number primitive
  |
  |   Received:
  |   | '#0099ff'

  3 ValidationError > s.tuple(T)
  |   Expected an array
  |
  |   Received:
  |   | '#0099ff'```
forest elm
violet quarry

The builder is already imported. But the second suggestion worked. Thank you! PandaLove

wanton path

Is that a bug or just a breaking change

silk topaz
wanton path
silk topaz and the code thats throwing this error is?
const { colors } = require("../../constants"),
	button = new ButtonBuilder()
		.setCustomId("dismiss_output@dev")
		.setLabel("Dismiss")
		.setStyle(ButtonStyle.Danger),
	actionRow = new ActionRowBuilder().setComponents(button);```

setComponents is doing that

knotty plover

needs to be an array if youre on latest

wanton path

Ohh

wanton path
knotty plover

yeah they all do

wanton path

Alr

wintry bear

can modals only have textinput atm?

knotty plover

yes

wintry bear

checkboxes maybe?

knotty plover

no

dull spruce

Heyo, upgrading from v13, I'm getting this when passing options to a SelectMenuBuilder, checked and every option has label and value with good format, so I'm not sure what to do

CombinedError (2)
  Received one or more errors

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

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  |
  |   Expected:
  |   | [class UnsafeSelectMenuOptionBuilder]
  |
  |   Received:
  |   | [ [Object], [Object], [Object], [Object], [Object] ]
copper jetty
dull spruce

I might need to update then, going to check

I updated to discord.js@14.0.0-dev.1650586180-61a44c5

I'm sure every option has a label and value 🤔, am I missing something?

CombinedError (2)
  Received one or more errors

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

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  |
  |   Expected:
  |   | [class UnsafeSelectMenuOptionBuilder]
  |
  |   Received:
  |   | { '0': [Object],
  |   |   '1': [Object],
  |   |   '2': [Object],
  |   |   '3': [Object],
  |   |   '4': [Object],
  |   |   emoji: undefined }
copper jetty

maybe if they mentioned it in a guide or pinned message people wouldn't be asking about it all the time lol

dull spruce

Still not working thinkEgg

const testArray = [ { label: "Test1", value: "test1" }, { label: "Test2", value: "test2" }, { label: "Test3", value: "test3" }, { label: "Test4", value: "test4" }, { label: "Test5", value: "test5" } ]

const testMenu = new SelectMenuBuilder()
                      .setCustomId(`testMenuBuilder`)
                      .setPlaceholder('ThisIsATest')
                      .addOptions(testArray)

const testRow = new ActionRowBuilder()
                      .addComponents(testMenu);

Same error as above

knotty plover

where tf is that emoji coming from

Are you on the latest builders that expect arrays?

dull spruce
knotty plover

Arrays would only be if youre on builders dev

discord.js itself still uses rest params until the dependency is updated I would think?

Let me check haha

Yeah so, are you importing it from discord.js, or @discordjs/builders

dull spruce

Uhmmm, I checked and I dont have @discord.js/builders
uninstalled discord.js and installed again (npm install discord.js@dev) and the problem persists

knotty plover

Yeah so

The one in core djs still uses rest params, not arrays

It's depends on an older version of builders

bitter sentinel

Need a discord bot dev who can make me a bot for my esports server. Budget: 1500 INR

knotty plover

This is not a place to hire developers

Also that's basically no money at all lmao

bitter sentinel

lmao

green plume

Why I am getting this error?
My code client.channels.cache.get(process.env.ERROR_LOG).send()

knotty plover

channel not in cache

or that id isnt correct

green plume

Okay

cinder bane

is there any enum for AuditLog Actions?

nvm got it

small mica

just now updated djs to latest dev version, shud I even update @builders to latest dev?

uncut kelp

You should uninstall it

It comes with builders installed

small mica

I shud uninstall @builders?

uncut kelp
cinder bane

is the audit log broken or something? at first it was functioning fine but then it started sending wrong info, for eg. I deleted a message sent by an user but the target id is of the bot instead of the user

fetchAuditLogs()

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

so this shud be this now:

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

?

tame gazelle

yep

small mica

ok ty

small mica
 if (file.name) {
          const properties = { directory, ...file };
          client.commands.set(file.name, properties);
      }

?

tame gazelle

nah just all methods that takes rest params before in builders

small mica

ah ok

const directories = [
      ...new Set(client.commands.map((cmd) => cmd.directory)),
    ];
``` so will this be correct?
tame gazelle

try it