#djs-in-dev-version
35223 messages · Page 16 of 36
if I add the ... before new Set I am getting this error
CombinedError (2)
Received one or more errors
1 CombinedPropertyError (2)
| Received one or more errors
|
| input.value
| | MissingPropertyError > value
| | A required property is missing
|
| input.label
| | MissingPropertyError > label
| | A required property is missing
2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [class UnsafeSelectMenuOptionBuilder]
|
| Received:
| | { '0': [Object],
| | '1': [Object],
| | '2': [Object],
| | '3': [Object],
| | '4': [Object],
| | '5': [Object],
| | '6': [Object],
| | '7': [Object],
| | '8': [Object],
| | '9': [Object],
| | '10': [Object],
| | '11': [Object],
| | '12': [Object],
| | '13': [Object],
| | '14': [Object],
| | emoji: undefined }
anyone knows whats wrong?
It's a set of arrays though
I think ....
new Set[
(client.commands.map((cmd) => cmd.directory))
],
shows not a constructor
It is quite strange to access a Set using an Array
yeah, so how can I do it?
You don’t
Set['["foo", "bar", "baz"]'] prob doesn't exist
https://srcb.in/bMOV7Cppga
this is my full help command code. How can I update it latest version if the latest dev version doesnt accept ...?
addFields takes an Array
so
.addFields([name: "test", value: "this is a test"])```
Or no, it says label, not name
so I can use the normal addFields itself, just change name to label?
While it prob is the case, it’s not the current issue
so I can continue using name as well?
no, it takes an array of field objects
so like an object containing a name and a value and optional inline
ohok
Error is from select menu builder
so it means I can even use ```js
...new Set(client.commands.map((cmd) => cmd.directory)),
so like this
.addFields({
[
name: "blah",
value: "test"
]
})
no, that's wrong
it's an array of objects, objects in an array
It doesnt take an array on stable yet
Youd have to be running builders dev
i uninstalled builders coz jiralite said its not needed
so what you're using djs' exported EmbedBuilder class?
yup
Yeah so if you're importing from djs, its not an array. Yet
oh
so a rest parameter, where each is a field object
but whats this error?
okay!
addOptions still takes a rest parameter then
spread that array on your addOptions
ok ill try
.addOptions(
...categories.map((cmd) => {
return {
label: cmd.directory,
value: cmd.directory.toLocaleLowerCase(),
description: `Commands from ${cmd.directory} category`,
};
})
)
still same error
new error after I updated the code to spread the arrays
wait thats from line 55 though
Can you show your imports?
const {
Message,
Client,
ButtonStyle,
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
Util,
SelectMenuBuilder,
SelectMenuOptionBuilder,
ComponentType,
} = require("discord.js");
is it because of the constructor?
constructor?
i don't see why that error would be there
ill just switch back to the dev version before this one that I used to use. Will update when I get a solution
is there any way to get the message content that is deleted in messageDelete event? since message.content is null
is it possible to fetch a deleted message?
what params did you use?
show code
message
no that's the point of it being deleted, it's deleted from the api, you can't fetch it
async EventRun(message) {
try {
if (message.guild.available) {
const { executor, target, extra } = (await message.guild.fetchAuditLogs({ type: AuditLogEvent.MessageDelete })).entries.first();
console.log(message.content, extra.channel);
if (message.id === extra.channel.lastMessageId) {
const AuditLogEmbed = new EmbedBuilder()
.setAuthor({ name: target.tag, iconURL: target.displayAvatarURL() })
.setColor('Aqua')
.setDescription(`*Message has been deleted in ${message.channel}*`)
.addFields(
{ name: 'Sent By', value: `${target}`, inline: true },
{ name: 'Sent On', value: `<t:${Math.floor(message.createdTimestamp / 1000)}>`, inline: true },
{ name: 'Deleted By', value: `${executor}`, inline: true },
{ name: 'Message Id', value: message.id, inline: true },
{ name: 'Author Id', value: target.id, inline: true },
{ name: 'Executor User Id', value: executor.id, inline: true }
)
.setFooter({ text: message.guild.name, iconURL: message.guild.iconURL() })
.setTimestamp();
this.bot.utils.auditSend(Channels.MessageLogId, [AuditLogEmbed], message.attachments.toJSON().map(({ url }) => url));
};
};
} catch (error) {
console.trace(error);
};
};
if the message was cached, there's a chance you could get the content, otherwise, no it's not possible, it's gone
message.content shud work then
yeah maybe it wasnt cached
message.content returns nothing in console
theres a space before undefined, thats the value of message.content
now whats this error?
idk
the color
it expects a number or rgb tuple
that shouldn't happen
yea
and i can't reproduce the error either
color string is supported by EmbedBuilder

I can use util resolver or pascal case, both work
it's the djs exported builder chewie
it uses color resolvable
its from the fields
doesnt addFields take an array now, or is that not yet in dev release
you have 2
addFields
the version they're using, it takes a rest parameter
dev of builder does if not shortly will use arrays but the latest release uses rest
eb!eval message.channel.send({embeds: [new EmbedBuilder().setTitle("Hello").addFields({[name: "test", value: "A test"]})]})
Is this what you mean by array? Shows unexpected :
that's just invalid syntax
"discord.js": "^14.0.0-dev.1650586180-61a44c5",
again, objects in an array, not that it's relevant here right now
.addFields(
{},
{}
)```
oh like that
but thats what I did here
or ```js
.addFields(...[])
you had 2 .addFields ig
maybe that caused the error
only one here :/
why would it?
.
doesnt seem like arrays is the error 
but you know what it makes sense
you can pass upto 25 fields, thus the number 25, it's checking a length
yeah
you did it wrong, try passing an array of objects [{...}, {...}, {...}]
this is how, basic js
ok wait lemme try
i have no idea what mon was on about now
djs@dev uses builders v14-dev internally
Ah yes, arrays was the problem
thanks @urban belfry
told ya 
mon confused me
yea
Oh it does? That's dumb lol
that sucks. Have to update all the code again 😢
it makes sense, the dev version of djs uses the dev version of the packages, some monorepo workspace blah blah
then why are you using dev? 🤨
Means we need to change it before releasing stable
As I dont wanna rewrite my bot again in some months lol. Just thought it was silly to pass arrays to all fields now 😅
you know there will be more changes and reverting changes right? my suggestion would be to wait and do it after it releases after you get a complete guide
why does message.author return null for messageDelete event? shouldnt it atleast send the .author property?
what makes you say that?
these are all the api gives you, the only things guaranteed would be the channel, the id and the guild (if any exist of course) that's because they're always cached
in this event, the api doesn't give you the author id either, nor are the users always cached
other than everything i just mentioned, what you get purely depends on your cache
how do i cache the messages then
any sure way to cache the messages sent to a guild?
well if you don't limit the cache and enable the GUILD_MESSAGES intent, you should receive the messages
by adding Message and User partials too no?
that would cache partial messages, which is the opposite of the point
i have Message and Reactions partials enabled so
ig ill remove them
you don't really need to remove them
you can check if something's partial by checking the .partial property
oh yea right
disabling would mean the event doesn't get emitted for the events, judging by wherever you have already used it, it might not be the best idea to disable it
yea
GuildMessages are enabled and I dont think i have any cache limit
i have not worked with djs in a while, i don't know if there's a default for the message cache, probably was 200 the last time i saw
you can try looking around the docs and see if you find anything
okay thanks
fields.fields?
Yes use this
use the ChannelType enum
Documentation suggestion for @dull mango:
ModalSubmitFieldsResolver#fields
The extracted fields from the modal
thx, figured it out
ah worked
tho ```js
let forwardButt = ApplicationRow.components.find(component => component.customId === 'application_forward')
forwardButt.setDisabled(true)````TypeError: Cannot read properties of undefined (reading 'setDisabled')`
changed?
are you sure that row even has that component with that matching id?
i mean it did work before updating so yea
no i don't think that changed
Console log ApplicationRow.components
[
ButtonBuilder {
data: {
type: 2,
emoji: [Object],
custom_id: 'application_back',
label: 'Previous Question',
style: 1,
disabled: true
}
},
ButtonBuilder {
data: {
type: 2,
emoji: [Object],
custom_id: 'application_forward',
label: 'Next Question',
style: 1,
disabled: true
}
}
]```
builders don't have getters for their data
use component.data.custom_id instead
yep
You dont need to disable them because their already disabled
not always
its fixed now
ok um this confusing
msg.embeds[0].setFooter({text: `App Progress: ${appType === 'veteran' ? (((question + 1) / vetaranQuestions.length) * 100) : (((question + 1) / normalQuestions.length) * 100)}%`})
````setFooter is not a function`
couldn't you use EmbedBuilder.from and pass the embed data
.from?
yes
from( data here )
yeah you can't really modify the received embed data, you can create a modify-able clone using the method
Discord.EmbedBuilder.from(msg.embeds[0]).then(embed => {
embed.setFooter()
})```?
it deosn't return a promise, does it?
it doesnt
well then there you go
the from should return an embedBuilder which you can call the modifying methods on
let toModify = Discord.EmbedBuilder.from(msg.embeds[0])
toModify.setFooter({text: `App Progress: ${appType === 'veteran' ? (((question + 1) / vetaranQuestions.length) * 100) : (((question + 1) / normalQuestions.length) * 100)}%`})
msg.edit({
embeds: [toModify]
})```something wrong huh?
is there anything that's telling you that something's wrong? like perhaps an error?
embeds[0].fields[1][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required```only this
nvm fixed it by using setFields
Will the dev version be removed when the official one releases or can I continue to use it if I don't get time to update to official one after it released?
the branch will be there and it'll be for the development of the next version
Will I still be able to use this version -
"discord.js": "^14.0.0-dev.1648339713-520f471",?
But why
Ok question, which is meant to be right
.addComponents(b1,b2,b3)
.addComponents([b1,b2,b3])
First one (which I used fine in v13) is Found non-callable @@iterator
Second one (which searching here has told me is correct) gives me component.toJSON is not a function
now you pass arrays so the second is correct
and show me the definitions for the variables
Making them directly in
So
.addComponents([new ButtonBuilder.setName('etc'), new ButtonBuilder.setName('etc2')])
Okay nethermind about that issue now, just gotta fix the fields
TypeError: Discord.Util.splitMessage is not a function``` huh
it's removed (iirc)
e
const Discord = require("discord.js");
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
[...]
const modal = new Discord.ModalBuilder()
.setCustomId("testmodal")
.setTitle("Test Modal")
const favoriteColorInput = new Discord.TextInputBuilder()
.setCustomId('favoriteColorInput')
.setLabel("What's your favorite color?")
.setStyle(TextInputStyle.Short);
const hobbiesInput = new Discord.TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
.setStyle(TextInputStyle.Paragraph);
const firstActionRow = new Discord.ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new Discord.ActionRowBuilder().addComponents(hobbiesInput);
modal.addComponents(firstActionRow, secondActionRow);
await interaction.showModal(modal);
[...]
Here is the Error;
this.components.push(...components);
^
TypeError: Found non-callable @@iterator
at ActionRowBuilder.addComponents (E:\Modals Test Bot\node_modules\@discordjs\builders\dist\index.js:526:21)
at Object.execute (E:\Modals Test Bot\ApplicationCommands\Slash\PUT_COMMANDS_HERE\exampleSlash.js:39:63)
at Client.<anonymous> (E:\Modals Test Bot\events\interactionCreate.js:25:13)
at Client.emit (node:events:390:28)
at InteractionCreateAction.handle (E:\Modals Test Bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (E:\Modals Test Bot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (E:\Modals Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (E:\Modals Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (E:\Modals Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (E:\Modals Test Bot\node_modules\ws\lib\event-target.js:199:18)
Node.js v17.3.0
[nodemon] app crashed - waiting for file changes before starting...```
any idea?
use arrays on the addComponents
Pinned message
same thing
show your updated code in that case
same thing but
modal.addComponents([firstActionRow, secondActionRow]);
now is that the only addComponents in your code?
works now... i had 2 more with just one value
thanks
bot doesnt start after switching and changing
no errors
const {
Client,
Intents,
MessageEmbed,
ActionRowBuilder,
ButtonBuilder,
SelectMenuBuilder,
Interaction,
GatewayIntentBits,
Partials
} = require("discord.js");
const Bot = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildIntegrations,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.DirectMessages,
],
//shards: Cluster.data.SHARD_LIST, // An array of shards that will get spawned
//shardCount: Cluster.data.TOTAL_SHARDS, // Total number of shards
partials: [Partials.Channel],
});
could it be due to this
I made a statistics command and added a refresh button below, it edits the message, but the messages in it remain the same, how do I fix it?
the typings seem to be completely messed up in the latest version, is that known?
That is literally so unhelpful
Could you give an example?
Show code
node_modules/discord.js/typings/index.d.ts(599,19): error TS2416: Property 'addOptions' in type 'SelectMenuBuilder' is not assignable to the same property in base type 'SelectMenuBuilder'.
Type '(...options: (APISelectMenuOption | SelectMenuComponentOptionData | UnsafeSelectMenuOptionBuilder)[]) => this' is not assignable to type '(options: (APISelectMenuOption | UnsafeSelectMenuOptionBuilder)[]) => this'.
Types of parameters 'options' and 'options' are incompatible.
Type '(APISelectMenuOption | UnsafeSelectMenuOptionBuilder)[]' is not assignable to type 'APISelectMenuOption | SelectMenuComponentOptionData | UnsafeSelectMenuOptionBuilder'.
node_modules/discord.js/typings/index.d.ts(602,19): error TS2416: Property 'setOptions' in type 'SelectMenuBuilder' is not assignable to the same property in base type 'SelectMenuBuilder'.
Type '(...options: (APISelectMenuOption | SelectMenuComponentOptionData | UnsafeSelectMenuOptionBuilder)[]) => this' is not assignable to type '(options: (APISelectMenuOption | UnsafeSelectMenuOptionBuilder)[]) => this'.
Types of parameters 'options' and 'options' are incompatible.
Type '(APISelectMenuOption | UnsafeSelectMenuOptionBuilder)[]' is not assignable to type 'APISelectMenuOption | SelectMenuComponentOptionData | UnsafeSelectMenuOptionBuilder'.
use an array
also Type 'SelectMenuBuilder' does not satisfy the constraint 'AnyComponentBuilder'., which isn't inside of the typings themselves (and thus could be an intended change) but doesn't make sense to me.
it got updated, all the setX and addX methods now take in arrays, not rest parameters
those are errors within the typings themselves though, at least according to the path.
try installing builders@dev
now?
no packages were updated/changed, the errors are still there :P
Do npm why discord-api-types
line of code ``` .addFields({name:Need help?, value:Support Server: https://discord.gg/bigben})
Update ur discord-api-types or remove it from ur package.json
whats wrong with mine above
they're not in my package.json.
Oh, it’s from rest
Was d.js not updated to conform to the change in builders? 
fine no one wants to help me :(
You should remove this dependency btw. This comes with discord.js installed
Oh, there was a fix for that pushed 2 hrs ago
yeah I know, I immediately removed it afterwards.
alright, I guess I'll just wait for the next build then.
Yea, it'll be at midnight
3617093 in discordjs/discord.js by Hibanka committed <t:1650653439:R>
fix(SelectMenuBuilder): options array (#7826)
.addFields({name:`Need help?`, value:`Support Server: https://discord.gg/bigben`})
addFields takes an Array
not in v14 they said
Yea…
well im on v14
so why isnt mine working
That was thrown out just recently
the guide isn't complete, neither is v14, everything is currently in development
In dev/master means breaking changes can happen at any time
yeah but i have no choice to switch as people were using buttons my bot sent previously in voice channel text to break my bot
You could just revoke use application commands in voice text channels
how cuz im using interaction create...
It’s a permission
and as i said they are using old buttons
the bot has sent, so that wouldnt fix my problem
why is this not working
var row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('editsettings')
.setLabel('Edit Settings')
.setStyle(ButtonStyle.Primary)
.setDisabled(disableadminbutton)
)
addComponents prob takes an Array too
why such usless changes omg
Anything that was a rest param is now Array
breaking everything
It’s mainly affect addX and setXs (setX but X is plural) methods
Prob why some ppl opt to just use raw objects + discord-api-types interfaces for typings
like rn people are rating my bot on top.gg 1 star cuz of this
Bc it crashes?
why're you using the dev version for your bot?
Bc ppl are crashing his bot w/ buttons in voice text
becuz of discord text channel update as i said above
It’s a public bot
haha that's just mean
some people prob are not aware about it
is it fixed in v13.7.0?
Oh yea, you could've just updated to the v13 branch on gh
yeah exactly
It’d pretty much the v13 dev
but it's much much closer to v13
it doesnt exist yet
it's in dev too
It’s the v13 branch on gh
but is it fixed already tho kinect?
Idk if it was pushed yet
this is bad, imo there should be an emergency patch version release just to fix this if that's possible
#6921 in discordjs/discord.js by SpaceEEC opened <t:1635539041:R> (review required)
feat(VoiceChannel): add support for text in voice
📥 npm i SpaceEEC/discord.js#feat/text_in_voice
Still awaiting reviews
also why did a new builders version get released?
how to use FooterOptions
ahhhhhh
doesn't stable djs use builders v0.11 internally?
wouldn't users installing 0.13 now cause discrepancies internally?
They shouldn’t be installing builder manually. If they do, they should make sure it’s the same version
wait what? the guide recommends it btw?
and it doesn't mention that it should install the version their djs version has installed
like this right? setFooter({text:"Question: " + messageContent});
Yea
and did thye change setting satuses?
due to my bots status not showing
you'd use the enums
No more magic string/numbers
i think the guide mentions it
the ActivityType enum
did they switch add options
it takes in an array
Is there an error w/ that?
what the fuck
and so this one wants rest?
¯_(ツ)_/¯
so what do i do
🤦♂️
let me check
Is that a select menu?
ye
Yea
If so the change for array params got merged two hours ago there hasn’t been a release since
For now use rest and tonight you can switch them over
oh all of them weren't changed at once?
No there were some oversights
bruh ahhhhhhhh, this is just sucky ngl whenver theres an error people think its my fault and the bot is bugged
But now ur bot is popular for it
why coudlnt they have released the fix for v13 yet
no it was already b4 but now people are hating on my bot now
ok how to fix the options thing
That’s just how ppl are tbh
Sorry idk what to say dev releases aren’t meant for production bots
Remove the Array
Well people are spamming my discord buttons which is breaking my bot
they are pressing discord buttons my bot sent in a voice text channel
wait can't you like modify your code to just not send a button there?
there are already BUTTONS
ah rip lol xD
and they are clicking the ones that were sent
It’s a public bot, so he can’t control the servers either

yeah okay mb, that's bad
wait it's fixed on v14?
which pr was it?
Oh, the one I pulled up apparently
that wasn't for 13.7???
so there's just no version that's safe right now, got it
#7755 in discordjs/discord.js by Jiralite merged <t:1649776351:R>
fix(InteractionCreateAction): Ensure text-based channel for caching messages
I think this PR patched it
I think a better solution is to clone the v13 branch and npm link it
ah so it's fixed on v14, at least there's that
So it is fixed in v13 dev?
Yeah
Couldn’t they just do npm i discordjs/discord.js#v13 then?
yeah it doesn't use monorepo there
Maybe? I haven’t tried tbh
Is there an error?
remember, it's v13, the code you used to convert to v14 should be discarded
no as i said the button stuff doesnt have an error
ik i did lol
It should have an error
I’m taking about v13-dev not v13
how to install v13 dev
nvm I set it to invisible
after it starts up lol, cuz i set it so when i disconnect the bot it sets it to invisible but then when it restarts its supposed to set to online but for some reason it was setting it to inviisble, fixed.xd
Why invisible?
Just call client.destroy()
discord takes a while to register
that the bot is offline
Call client.destroy() then
It’ll disconnect properly
question, can v13 dev reply to voice channels?
or should i keep it from.
I think I just updated the migration guide. I hope I haven't missed anything
so the fix is that selection menus just wont work in vc texts?
and stuff
Huh, I don't understand your reply
makes it look like my bot is broken
in vc texts
I just updated a migration guide
on v13 dev selection menus dont work in text vcs or?
Version 13 doesn't have text-in-voice channel support
Until that is added, interactions will not be received
But it won’t crash
ah ok kinda makes my bot seem broken but ok
when is that estimated to be added
Shrugs
Im getting this error when i try create embed with EmbedBuilder
ExpectedConstraintError > s.number.le
Invalid number value
Expected: expected <= 25
Received:
| NaN
at Object.run (C:\Users\developer\Desktop\Sorogl\node_modules\@sapphire\shapeshift\dist\index.js:703:72)
at C:\Users\developer\Desktop\Sorogl\node_modules\@sapphire\shapeshift\dist\index.js:114:66
at Array.reduce (<anonymous>)
at NumberValidator.parse (C:\Users\developer\Desktop\Sorogl\node_modules\@sapphire\shapeshift\dist\index.js:114:29)
at validateFieldLength (C:\Users\developer\Desktop\Sorogl\node_modules\discord.js\node_modules\@discordjs\builders\dist\index.js:133:24)
at EmbedBuilder.addFields (C:\Users\developer\Desktop\Sorogl\node_modules\discord.js\node_modules\@discordjs\builders\dist\index.js:243:5)
at Object.execute (file:///C:/Users/developer/Desktop/Sorogl/commands/Bot/bot-info.js:43:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
addFields() now wants an array
uh
thanks, but why?
idk
:/
should be explained in the pr
I'm trying to host my bot on Ubuntu ARM server. On Windows it works just fine. Is this problem with architecture?
Why is interaction.member.voice not null after someone leaves a voice channel? Is this a bug or intended behavior?
If I restart my bot, then it is null. Maybe a caching problem?
Do you have the GUILD_VOICE_STATES intent?
Son of a... intents should be the first place I check when this kind of thing happens. 😅
Heh, that was it. Thanks! Maybe that's my cue to take a break and workout. lol
no reason
nvm the reason is that people have errors related to the change that hasn't been documented anywhere
any idea why this is happenning, v13 branch
looks like https://github.com/discordjs/discord.js/issues/7383 but it actually happens in build
hacked my way out of this with a bunch of ts ignore, but that aint the way to go
Go to #djs-help-v14, this is for version 14
ah alr
Because my exams will start in some months and I wont have time to recode the bot to v14, which is why I started re-writing in dev version. Now if I dont get time to make the necessary changes, can I continue using the "discord.js": "^14.0.0-dev.1648339713-520f471", version?
yep
Once youve installed it, even if we deprecate it, its still there to use
okay thanks!
now we can create application commands like this right?
await client.application.commands.create(/*data*/);
since v13, yes
👍🏽
bump?
ah okay sorry I forgot about []
this is not working btw
Ok
I use rest anyway
hi, please help me solve this problem
update nodejs
latest version
doubt
but oh well i'm going to sleep
The v14 is the current dev version, but is it stable enough to use it now for my bot?
What does "not stable"/"in development" mean here?
\✅ Use the build without crashing everything (probably)
\❌ Finalized API
\❌ Free of bugs
\❌ Consistent API (Things may change drastically from one commit to the next)
\❌ Refactor a large code base that a lot of people depend on to use this build
well yea it's currently being worked on, no i don't recommend you use it on your bot for prod
my suggestion, for the new features, wait for 13.7 to release
Thanks!
this has been reported before (^), but the current typings prevent you from initialising ModalBuilders with components (i.e. without using ModalBuilder#setComponents()). should I create an issue on GH for this? I can't find any existing issues or PRs.
Se eu abrir um modal, preencher os dados, cancelar e abrir um novo modal com todos os dados preenchidos e enviar, o meu sistema tenta criar 2 canais, por conta desses 2 modals, como eu posso impedir isso?
are uh message commands gonna go in djs v14?
Message commands?
yes
Elaborate please
like >warn
You can't reply to an interaction twice
No. "message commands" are gradually becoming "impossible" to make without the message intent
And even then should you be moving over to slash commands
for public bots?
mines a private one
Any bot over 100 servers
ok yea i should be fine
You do whatever you want with your private bot. You can make message commands without v14
I know, but I wanted to do something so it doesn't create these 2 channels, somehow find out when the user created more than one modal so I don't get this error
You should show code
It's too long, split between files
const filterModal = (interaction) => interaction.customId === 'ticketConfigModal';
const collector = new InteractionCollector(client, { filter: filterModal, max: 1, time: 120 * 1000, guild: interaction.guild, interactionType: InteractionType.ModalSubmit })
const closeTicketButton = new ButtonBuilder({
"style": ButtonStyle.Danger,
"label": `Fechar`,
"custom_id": `closeTicketButton`,
"disabled": false,
"emoji": {
"id": null,
"name": `🔒`
},
})
const row = new ActionRowBuilder().addComponents(closeTicketButton)
collector.on('collect', modelInteraction => {
modelInteraction.update({})
const mainEmbed = new EmbedBuilder({
"title": `Canal de suporte criado`,
"description": `Olá ${modelInteraction.user}, você criou um novo ticket, basta aguardar para receber o suporte.\n\n🌟 **Assunto:**\n:pontoArchio: ${modelInteraction.fields.getTextInputValue('ticketSubject')}\n\n`,
"color": 0x5865f2,
})
modelInteraction.guild.channels.create('ticket', { // futuramente mudar
type: ChannelType.GuildText,
parent: '965105073174745139', // pegar no banco de dados
permissionOverwrites: [
{
id: modelInteraction.guild.id,
deny: [PermissionFlagsBits.ManageChannels, PermissionFlagsBits.ViewChannel],
},
{
id: modelInteraction.user.id,
allow: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.ViewChannel],
}
]
}).then(channel => channel.send({
content: modelInteraction.user.toString(),
embeds: [
mainEmbed
],
components: [
row
]
}))
@chilly zephyr
Very long
Not sure but your error indicates you're trying to use <Interaction>.reply twice
Ok
I'll check
1 of these are invalid/undefined but I can't figure out which one it is
const client = new Client({
intents: [GatewayIntentBits.GuildsGuilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildWebhooks, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.DirectMessages],
partials: [Partials.GuildMember, Partials.Message, Partials.Channel, Partials.Reaction]
});```
wtf
WTF IS THIS
probably GuildsGuilds

That makes sense yeah
ok
My bad thank you
welcome to v14
i feel bad for the typescripters
why's that? #archive-offtopic
me too
have no problem with using djs + typescript
much more readable code really
anyway off topic
but ts has ugly blue icons and js has pretty yellow icons

stop
The “documentation” is this entire channel. The amount of people who were using arrays instead of rest parameters was literally every other message. To make matters worse a lot of people didn’t even know what rest params were. It’s clear that this has been a bad UX and this channel has made that extremely clear.
You could fix nearly every error by using ctrl + f but some people are too lazy to find answers, the same questions are repeated all the time in #djs-help-v14 too. Stable version also uses rest parameters and peoples don't have any problems with it but i don't want to argue with this decision because it doesn't change anything for me
Correction: only some structures allowed rest params and once again based activity here, most people seem to default to arrays anyways
for(var i = 0; i < results.length; i++){
console.log(`deleted ${results[i].key}`)
}
let dekey = results[i].key
//console.log(`Status: ${res.status}`)
connection.query("DELETE FROM `keys` WHERE `key`=?", [dekey], (err, results, fields) => {
if (err) return console.log(err);
if (!results || results.length <= 0) {
const noLicense = new EmbedBuilder()
.setDescription(`You have no license registered in the old database.`)
.setColor(stormColor);
return interaction.reply({ embeds: [noLicense], ephemeral: true })
} else {
console.log('deleted ' + results[i].key)
}
})
// console.log(results)
}
})
this doesn't work but how would i fix it (cause it can't read at the last console (.key)
how would i fix that it deletes (dekey, which can be 1 or 2 or 3 et cetera) delete this ones and not 1000x times
How to fix?
npm ls discord.js
console.log(interaction)
It'sIt's logging client though.
show your handler
client will be the first parameter
The order of function parameters must match between definition and function call.
function execute(client, message, args) { ... };
execute(message, client, args);
• mismatch! you pass a Message where the client is expected
• mismatch! you pass the Client where a Message is expected
What does this mean?
did u actually add a valid field?
U have to call toJSON() on the builder
name: 'market',
type: ApplicationCommandType.ChatInput,
options: [
{
name: 'add',
description: 'Add a pokémon to the market',
type: ApplicationCommandOptionType.SubCommand,
options: [{
name: 'pokémon',
description: 'Specify the id of the pokémon which you want to add.',
type: ApplicationCommandOptionType.Number,
required: true,
min_value: 1
}]
},
],
}```
that's the json data.
i have this code and i get a typescript error. why can't i add the select menu to the action row?
new ActionRowBuilder<SelectMenuBuilder>()
and what can i do about this?
pass it in an array
the type has a [] at the end for a reason
oh yes...
i read the message that in the next update they will only accept arrays
If i pass my actionRow to the command i get the following error.
CODE: ```const selectMenuBuilder = new SelectMenuBuilder()
.addOptions([{
label: "test",
value: "test"
}])
const actionRow = new ActionRowBuilder<SelectMenuBuilder>()
actionRow.addComponents([selectMenuBuilder])
return await command.reply({
ephemeral: true,
content: "content",
components: [actionRow]
})
you need a customId
if i have defined a customId for a SelectMenuBuilder. how can i get the customId back?
how would i send a dm to the person i specify in here?
interaction.options.getUser('user')
and call .send() on it
whut it didn't work some secs ago, but thanks tho
It'll fail for a variety of reasons... such as if they have DMs closed
i know
why does this not work? (like it still says connected to database) but it doesnt reply or anything
Hi, I was wondering if there is a way to respond to a modalSubmitInteraction without sending a reply or an deferred reply ?
Just to confirm the reception
send an ephemeral message to confirm the reception
no idea where all of this "acknowledge without response" comes from
honestly, UX wise you should always let het user know if something worked
(granted, the preferred way would probably be toasts, but since those are not available to use at the moment, ephemerals is the next best thing)
To make it simple I work on an embed that the user completes as he goes along and I use modals to complete the text. It's quite annoying to have to send back a message just to say "Embed above updated". But it's good to know that there's no way to do it differently yet, thanks ^^'
if the embed updates then the updating itself is the response and notion of completion 
Yes, but it is not possible to update the message from the interaction received from the modal 🥲
update original as a response to a modal originating from a button press will update the message the button was pressed on that prompted the modal
So I have to use the interaction of the button? And it will respond to interaction of the modal?
you respond to the button press with a modal
you respond to the modal submit with update
=> updates the message the button was pressed on, yes
I dont have "update" with the modal interaction
Just reply et editReply
ModalSubmitInteraction#update()
Updates the original message of the component on which the interaction was received on.
Hmmm, maybe i need to update my package ^^'
Weird...
why is my embeds not replying anymore after i ran one command?
cause it says connected to db but it doesnt do anything anymore
Is it possible to get the title of a modal on submission? I can't seem to find anything in interaction
bump
I'll take a look at this tonight
what changed when it comes to slash command permissions?
except the types, nothing really?
permissions[0].type[NUMBER_TYPE_COERCE]: Value "ROLE" is not int.
before it worked fine
how do i check if players dm's are off before doing anything?
you cannot
attempt to dm, catch the rejection
and don't dm many people at once/within a short time frame
damn
send and catch
well
i need to check it before deleting something from db
use the proper enum
dont know from where to import it tho
PermissionsBitField (extends BitField)
Data structure that makes it easy to interact with a permission bitfield. All [GuildMember](<https://discord.js.org/#/docs/discord.js/main/class/GuildMember>)s have a set of permissions in their guild, and each channel in the guild may also have [PermissionOverwrites](<https://discord.js.org/#/docs/discord.js/main/class/PermissionOverwrites>) for the member that override their default permissions.
should be listed here, somewhere
PermissionFlagBits
but thats only the permissions
not the type
PermissionFlagBits is the type
But for User/Role?
Wouldnt that be ApplicationCommandPermissionType from discord-api-types
type: PermissionFlagsBits.Flags.Role
``` ?
o
oh, right, that, shit, i was thinking permission flags, ignore me
ah ApplicationCommandPermissionType, can import from djs
what is the best way in my case to check if the person his dm is off BEFORE deleting something from the database?
like souji said, send a dm and catch the rejection
in a for i loop?
never said its a good idea 
^^
there is no other way tho
but there is no other way for me?
yea i can't check from a function, which i maked to only run 1 time to do .catch(() => { });
or is that possible?
dont see how that would be any different than doing it in the for loop?
idk man
my brain is so dead now
i can't solve this problem after 5 hours
so how would i do it?
cause i need to retrieve the deleted data from the db
attempt to dm, catch the rejection
and don't dm many people at once/within a short time frame
wait
how do i do a function + send a private message?
this doesnt work
or persoon.send(func here, {})
if sucess
Hello öh so i used Slash Command Builder but i cant find out what to use in the new Version
await your promises
which promises
.send
cause it console.logs the error, but not the embed
How can I use local image in embed image?
new Attachment("file path")
and pass it into files option and in setImage pass attachment://name.png
Same thing
TypeError: Attachment is not a constructor 😦
reinstall discord.js@dev
or use MessageAttachment
because im pretty sure your using old version
I'm in dev version
^14.0.0-dev.1649937833-b01f414
Its MessageAttachment not Attachment
Attachment
Represents an attachment.
Oh its so far down on mobile 
It's strange, because here only shows MessageAttachment, but no Attachment, I'm installing again
Their removing Message from every class name
for example MessageAttachment Is Attachment or MessageButton is ButtonComponent
@copper jetty I'm making this, but not work 😦
Image isn't in embed
attachment://Vantagens.png
worked, thanks
What is this error?
the code
addFields takes an array
now it takes an array?
yes
omg
everything takes an array now xD
It fucked me 🤣
ae modals working with dev? if so, is there a guide on how to use them?
are they fully working tho?
yes
alr thx
anyone able to help?
You passed rest parameters instead of an array probably
im guessing it's the way i did my embeds
can you give an example of how im supposed to make an embed?
new EmbedBuilder()
from discord.js?
And then call methods you want on it
Yes
how do i add a field?
like can u give an example pls
<EmbedBuilder>.addFields([{ name, value}])
wait that's so stupid
I know
it was better when we could just use .addField("", "") bruh
Well addField is removed in v14 because it's useless when you have addFields. The syntax makes more sense the more you use it
Will server owner will also receive this message if he doesn't have higher role than the bot?
if (ctx.interaction.member.roles.highest.position <= ctx.interaction.guild.me.roles.highest.position) return ctx.interaction.reply({ content: `${process.env.FAILURE_EMOJI} | You must be higher than me to use this command`, ephemeral: true });
Yes
Thanks
what is TextInput component type?
can som1 help me
ask a question and sure
help plz
You dont have applications.commands scope in that guild
how to get access?
Its an invite scope
You need to invite the bot with it
let components = [{
type: ComponentType.ActionRow,
components: [
//overview,
...options.map(({ data }) => data)
]
}];
it shows the error cannot serialize component type but im using an Enum of Component Type?
Whats the point of that map
looks like theres something undefined in there
i need to set an option to default and i couldnt find any other way
UserEmbedComponents = SelectMenuBuilder.from(UserEmbedComponents.components[0]).options;
let [overview, ...options] = UserEmbedComponents;
overview.data.default = true;
components.options = [
overview,
...options.map(({ data }) => new SelectMenuOptionBuilder)
];
this is the whole code
i need to set the first option to default and the pass the other options as they are
Yeah I have no idea what this is, but overview.data.default isnt a valid option
Try overview.data?
Since that appears to be the actual properties
okay 1min
overview.data
it contains this and im changing the default value to true, since it may sometimes be set to false or undefined
I don't understand a little
help
DiscordAPIError[50001]: Missing Access
at SequentialHandler.runRequest (/home/jan/Загрузки/FoxBot/node_modules/@discordjs/rest/dist/index.js:708:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/jan/Загрузки/FoxBot/node_modules/@discordjs/rest/dist/index.js:511:14) {
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'put',
url: 'https://discord.com/api/v9/applications/967677012909117440/guilds/957302288937001031/commands',
requestBody: { files: undefined, json: [ [Object], [Object], [Object] ] }
}
When you invite your bot
You need to tick the applications.commands scope
АА
go to the OAuth2 URL Generator that is in the applications page of developer portal and generate an invite by ticking to applications.commands scope and the bot scope as well
then copy the generated url and use it to invite the bot
how do I install v14? and what's the v14 doc?
oh got it nvm
Help
node:internal/fs/utils:345
throw err;
^
Error: ENOENT: no such file or directory, scandir './commands'
at Object.readdirSync (node:fs:1406:3)
at Object.<anonymous> (/home/jan/Загрузки/FoxBot/index.js:8:25)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: './commands'
}
Node.js v17.9.0
Not related at library, but not exists directory 'commands'
Subcommand Enum doesn't work
what do you mean by "doesn't work"?
const message = await interaction.reply({
embeds: [Embed],
components: [Select],
fetchReply: true,
});
const collector1 = await message.createMessageComponentCollector({ componentType: 'SELECT_MENU', time: 60000, max: 1 });
console.log(collector1);
collector1.on('collect', async i => {
console.log(i);
if (i.user.id === interaction.user.id) {
if (i.customId === 'extensions') {
await collector1.stop();
const step1 = require('./setup/step1.js');
step1.run(interaction, client, locale, db_servers, i, Embed, message);
}
}
});
i upgraded but now my collector doesnt collect anymore
it creates an collector but regardless of what i do it doesnt catch it
use the ComponentType enum
ohhhhh
DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
components[0].components[1].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
ohhh what does that mean
i wanted to use a custom emoji so i put the id of it in .setEmoji("here");
setEmoji({id: "id}) 
however if you import ButtonBuilder from discord.js then you can use strings with setEmoji
i did
show me your import
i tried like this now it works 
Idk why but today my event who work last time doesn't work anymore and give me this error that i don't understand
Overload 1 of 2, '(event: "interactionCreate", listener: (interaction: Interaction<CacheType>) => Awaitable<void>): Client<boolean>', gave the following error.
Argument of type '(interaction: Interaction<CacheType>) => Promise<InteractionResponse<boolean> | undefined>' is not assignable to parameter of type '(interaction: Interaction<CacheType>) => Awaitable<void>'.```
Soooo how can i check if a guild member has administrator rights?
Don't return anything from it
Hey, i have a qustion, i try to send a file in a message, but in v14 MessageAttachment doesn't work
what do I have to take instead?
message.channel.send({content: 'Content' files: [new MessageAttachment(Buffer.from(`${require('util').inspect(guilds)}`), 'all_guilds.txt')]})
Attachment
thanks
oh i see thanks you
I don't know if it is the place to but I have a suggestion for the update
We know that with masked links we can do like hypertext by doing this click me but we can not use the mailto: mode, maybe it can be useful !
You should tell Discord that
Hi when i look in the discord docs theres written that you can use select menus in modals
hooowwww
Where?
bruh sorry i was lost
oh no
huh
https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
here when i click on components it redirects me to this site:
https://discord.com/developers/docs/interactions/message-components
i was not wrong sorry 
"components array of components between 1 and 5 (inclusive) components that make up the modal"
read the yellow box above that

hmmm
.addChoice('Aktivieren', 'on')
^
TypeError: option.setName(...).setDescription(...).setRequired(...).addChoice is not a function
ehhhhmmm 
.addChoices({ name: 'Aktivieren', value: 'on' }),

addChoices takes an array
all kinds of .addX or setX takes an array now
oh
.addChoices([
{ name: 'Aktivieren', value: 'on' },
{ name: 'Deaktivieren', value: 'off' },
]),
like tis?
yea
I asked this in #djs-help-v14 but got referred here even though I'm not convinced its an issue with v14, but anyway;
it's rare I need to ask for help but I'm asking today for a weird one. I've written countless bots in JS using discord.js and never really had any issues I couldn't work out or resolve on my own. but I'm now delving into TS for a bit of fun and having an issue with commands not appearing at all.
I've narrowed it down to the defaultPermission option in the command. if this option is set, the command will not appear at all on any client (desktop, mobile or web). when I console log the guild.commands I see that it exists on the API and I've set permissions appropriately as also confirmed with a fetch of client.application.commands.permissions.fetch({ guild: 'the guild id' }). am I missing something obvious?
to clarify a few things when I asked this in #djs-help-v14 that came up, all other commands appear. the command(s) that have defaultPermission set are not greyed out, they just don't appear at all as if they don't exist. even though a fetch confirms they most definitely do on the API, along with their corresponding permissions as set by me
@silent hedge sounds a bit like yours, doesn't it?
yeah, can you repro this on mobile as well? @pallid ice
I talked with
I can, with defaultPermission set the command won't appear on desktop, mobile or web. as if it just doesn't exist
oh
but a fetch confirms it does
yeah I could also repro this and after talking with like.. 2 discord engineers someone reset the guild for me - after that the commands were showing but only on desktop (both stable and canary) the permissions for just default_permission: false were ignored, so no one could run those commands - they were grayed out
this has yet to be fixed as I reported the issue on friday and its the weekend
the issue is tied to a guild experiment labeled backend v2 that redoes how slash commands are handled
see if the command was greyed out, I'd assume I hadn't set perms correctly. but as it just doesn't appear at all it leaves me super confused
backend v2 includes hiding of commands you don't have perms to use, as does infix based command search
yeah I can still repro the issue - they work fine on android, API reports proper perms but no one can run em on desktop
and before the guild reset they didnt show at all
best advice I can give is to reach out to someone on monday once they're in office if they don't roll out a fix by then
i.e. via ddevs
im still waiting for it to be fixed myself
hmm ok, thanks for the help and input. I'll see what I can do tomorrow
its a very odd issue, lol
how would i delete a message (interaction) from a person's dm?
(bot his message)
interaction.deleteReply()
or <message>.delete()
.addSubcommand(subcommand => subcommand.setName('test').setDescription('This is a description').addChoices([
{ name: 'Aktivieren', value: 'on' },
{ name: 'Deaktivieren', value: 'off' },
])
),
why this dont work?
.addSubcommand(subcommand => subcommand.setName('test').setDescription('This is a description').addChoices([
^
TypeError: subcommand.setName(...).setDescription(...).addChoices is not a function
could you why're you trying to add choices to a subcommand?
oh wait
no, I thought that would be an option, I'm so lost
is there a roadmap from discord oficially what they plan to do for bots in the next realeases?
hello, i saw the guide of permissions on slash commands, i get the same error: [GLOBAL_COMMAND_PERMISSIONS]: Permissions for global commands can only be retrieved or changed by providing a GuildResolvable or from the guild application's command manager. is there any way to fix this problem?
Is it mandatory to put the guild id?
yes
permissions are always guild level, even for global commands
is it possible to edit the server avatar of a bot?
yeah, client.user.setAvatar
you can probably do it on the dev portal too
client.user
hmmmm bot does it really set the avatar only in the current server

.setAvatar(avatar)
Sets the avatar of the logged in client.
bots cannot have guild avatars
yeah i just rad in the discord docs
sad
is there such as a modal component to create modals? or is it just pure json
ModalBuilder
alright
is there any way to know if an account exists with just the account id?
client.users.fetch('user id'), if the promise rejects the user doesn't exist
would that work if the user does not share any server with the bot?
yes
ok thx
CombinedError (2)
Received one or more errors
1 CombinedPropertyError (2)
| Received one or more errors
|
| input.value
| | MissingPropertyError > value
| | A required property is missing
|
| input.label
| | MissingPropertyError > label
| | A required property is missing
2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [class UnsafeSelectMenuOptionBuilder]
|
| Received:
| | { setLabel: 'Teknik Destek',
| | setDescription: 'Hizmetiniz için teknik destek alabileceginiz kategori
!',
| | emoji: undefined }
im getting this error on SelectMenuBuilder
show how you're using it
const categoryMenu = new ActionRowBuilder()
.addComponents(
new SelectMenuBuilder()
.setPlaceholder("Lütfen bir kategori seçiniz")
.setCustomId('selectmenu-main')
.addOptions([
{
setLabel: "Teknik Destek",
setDescription: "Hizmetiniz için teknik destek alabileceğiniz kategori!",
},
{
setLabel: "Satış Öncesi Destek",
setDescription: "Alacağınız hizmet için satış öncesi destek alabileceğiniz kategori!",
}
])
)
the options are label and description (on the addOptions method)
CombinedError (2)
Received one or more errors
1 CombinedPropertyError (1)
| Received one or more errors
|
| input.value
| | MissingPropertyError > value
| | A required property is missing
2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [class UnsafeSelectMenuOptionBuilder]
|
| Received:
| | { label: 'Teknik Destek',
| | description: 'Hizmetiniz için teknik destek alabileceginiz kategori!',
| | emoji: undefined }
const categoryMenu = new ActionRowBuilder()
.addComponents(
new SelectMenuBuilder()
.setPlaceholder("Lütfen bir kategori seçiniz")
.setCustomId('selectmenu-main')
.addOptions([
{
label: "Teknik Destek",
description: "Hizmetiniz için teknik destek alabileceğiniz kategori!",
},
{
label: "Satış Öncesi Destek",
description: "Alacağınız hizmet için satış öncesi destek alabileceğiniz kategori!",
}
])
)
and the options are missing the value
Can I pay somome here for a discord bot
uh okey thx
Can someone please tell me wtf this error is?
TypeError: discord_js_1.Intents is not a constructor
I'm trying to use the latest dev version of Discord.js.
This is my code:
const SparkV = new Client({
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildBans
],
partials: [Partials.MESSAGE, Partials.REACTION]
});
are you using Intents anywhere else in your code?
I'll check.
That worked, thanks.
Nvm, the error is still there.
Oh, I see the source of the error is coming from DisTube.
TypeError: Found non-callable @@iterator
what is that
thx
How can i fix this?
addComponents takes an array
again?
was now supposed to use rest parameters
How do i get all Channels of A Guild
<Guild>.channels.cache
Hi, I'm trying to spawn a Modal using an interaction from a command, but I'm getting this error
ExpectedConstraintError > s.array(T).lengthGe
Invalid Array length
Expected: expected.length >= 1
Received:
| []
This is all my code does
async function execute(interaction) {
const modal = new ModalBuilder().setCustomId("myModal").setTitle("My Modal");
await interaction.showModal(modal);
}
you need to add components to it
Oh, right. Sorry 😂
Sorry to bother you. I copypasted this code from the documentation
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
// Add components to modal
// Create the text input components
const favoriteColorInput = new TextInputBuilder()
.setCustomId('favoriteColorInput')
// The label is the prompt the user sees for this input
.setLabel("What's your favorite color?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Paragraph);
// An action row only holds one text input,
// so you need one action row per text input.
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);
// Add inputs to the modal
modal.addComponents(firstActionRow, secondActionRow);
// Show the modal to the user
await interaction.showModal(modal);
But I get this error
TypeError: Found non-callable @@iterator
you need to pass an array to addComponents
Hmm, so the example here https://deploy-preview-1060--discordjs-guide.netlify.app/interactions/modals.html#building-and-responding-with-modals is wrong
it's a WIP
Ye, I'm not blaming you. Just warning you about it
it's not the finished guide, it's just outdated
yes we know
It is wrong I’ll try to fix it tonight if I forget just ping me
that seems easy enough, let me just do it right now, done
I perfectly understand. In the daytime I'm a dev too ahah
I was trying to use messageCreate event handler, but content is empty no matter what I type
{
channelId: '966699710679232582',
guildId: '315884215701078016',
id: '967836101551198268',
createdTimestamp: 1650820508135,
type: 0,
system: false,
content: '',
author: User {
id: '209473799991590912',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 64 },
username: 'SaltySpag',
discriminator: '2578',
avatar: 'cf88d75f5d77c80f2b350a72cae4834e',
banner: undefined,
accentColor: undefined
},
pinned: false,
tts: false,
nonce: '967836086740975616',
embeds: [],
components: [],
attachments: Collection(0) [Map] {},
stickers: Collection(0) [Map] {},
editedTimestamp: null,
reactions: ReactionManager { message: [Circular *1] },
mentions: MessageMentions {
everyone: false,
users: Collection(0) [Map] {},
roles: Collection(0) [Map] {},
_members: null,
_channels: null,
crosspostedChannels: Collection(0) [Map] {},
repliedUser: null
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: MessageFlagsBitField { bitfield: 0 },
reference: null,
interaction: null
}
do you have the MessageContent privileged intent enabled?
Is a new Intent?
yea, it's an intent
Where can I find it?
add it on your code and on your dev portal
I can't find it under GatewayIntentBits enum
what are you looking at? the pinned link? that's outdated
i mean that's for v9, djs now uses v10, i notified souji
but yes that does indeed exist
Oh, I'm using v9, lol
whaa
if you're using the up to date djs@dev, it would be using v10
Ok let me try
Nice, it works. Thanks
MessageEmbed is not a constructor?
new MessageEmbed
djs 14 dev
see pinned guide
EmbedBuilder
has the guide been updated for embeds
yes
Hello, Im currently workin with modals but i have a problem:
const Buttons = new ActionRowBuilder()
.addComponents([
new ButtonBuilder()
.setCustomId('back')
.setStyle(EnumResolvers.resolveButtonStyle('DANGER'))
.setEmoji({ id: locale.commands.extensions.setup.buttons.back }),
new ButtonBuilder()
.setCustomId('reopen')
.setStyle(EnumResolvers.resolveButtonStyle('PRIMARY'))
.setLabel(locale.commands.extensions.setup.buttons.reopen),
new ButtonBuilder()
.setCustomId('next')
.setStyle(EnumResolvers.resolveButtonStyle('SUCCESS'))
.setEmoji({ id: locale.commands.extensions.setup.buttons.next }),
]);
...........................
const Modal = new ModalBuilder()
...................................................
Modal.addComponents([FirstInput, SecondInput]);
await i2.showModal(Modal);
this is my code and i want the modal to reopen when clicking on:
new ButtonBuilder()
.setCustomId('reopen')
.setStyle(EnumResolvers.resolveButtonStyle('PRIMARY'))
.setLabel(locale.commands.extensions.setup.buttons.reopen),
but it gives me an already replied error
TypeError: Found non-callable @@iterator
modals
code?\
array 😉
copied from that to see what it was
the builders' setX and addX methods now take in arrays
ah
the guide will be updated soon
just updated 👍
?
Modals guide is updated now
can you show your full code please
why
i only want to know how to show a modal twice
so I can try and help you?
oh
I didn't see the text inbetween your code blocks
np 
you can't
sad
if i wanna update to v14 do i need to change anything?
yes
f
alote?
see the guide in pins
depends on your code
hmm leme see the guide
note that the guide is also a WIP
wdym????????
is it important to change to djs v14?
this is an in dev version, so now definitely not
latter?
FYI, v13 will still get updates after this, most of the new big features like modals are also featured in v13.7
no it's absolutely not necessary, i suggest you wait for 13.7 and use that for production when it's out, use this version for testing if you like
ok ty
when it is fully done is it important to change to v14 like how we changed from v12 to v13?
probably, not immediately but surely
well yes, sooner or later support for v13 will be dropped
fuck
at this point you're just waiting to hear that and cry, chill
v13 will probably get updates in the future and in the maybe distant future it'll die, just like how v14 will
now if you don't have any questions and still want to try out v14, check the pins
Have these changed?
For message component collectors
Do I need to use the enums now instead
the docs are updated and right now i don't see an issue, they're pretty reliable
yes
yes, as they would lead you to believe, yep
Oh
What would they be found under
ComponentType.Button ?
How can I check if a channel is nsfw or not?
That is indeed correct
Alright
<TextChannel>.nsfw
use the typeguards, i.e. !channel.isDM() && message.channel.nsfw
channel.isText() is what you want
idk if this is the right place to ask, but i am using discord.js#pull/7581/head and im trying to use showModal on an interaction ive already replied to but im getting The reply to this interaction has already been sent or deferred. any ideas of a workaround to just show a modal?
showModal() has to be the initial reply
and you cant defer it either
i see that, is there any way to show a modal after an interaction? nothing like followUpModal?
you have to basically make them click a button or something
or you can just use showModal() right away, as i just said
yeah, ok thanks
can anyone help about this: #967883592309022780
interaction.guild.me
.permissionsIn(currentChannel)
.has([PermissionFlagsBits.SendMessages])
This is returning false but my bot is clearly responding in currentChannel. What am I missing here? If I switch SendMessages to ViewChannel I return true
Interaction responses are webhooks and don't need the Send Messages permission
But if the bot were to send a message outside of an interaction, would that be blocked?
If it lacks the permission, yes
Yup, looks like my mistake. I kicked the bot to reset and now it's returning what I expect. I must've had some role perms I wasn't aware of... thanks for the help
👍
One more questions. Is PermissionsFlagsBits.SendMessages preferred to 'SendMessages'? Both seem to work
PermissionsFlagsBits is the preferred way
🙏
Well, I can't speak for the library, but that would definitely be my choice
It doesnt matter it will be converted to a number anyway
but for preferred, we prefer you use the enums and not just strings
https://shanara.host/i/1l3onp1ty
It works first time, shows this error when I try the second time. Used to work before
You cant reply twice
Theres no reply in my code
you respond to the interaction twice, don't do that
How did I respond two times? The message edits itself and then the select menu becomes disabled after a certain time that I have set in the collector.
i don't know why you overcomplicate this so much anyways
if someone chooses a category, just interaction#update, which edits the message the select menu is on
that should be the only response you need here
each selection/button press is it's own interaction instance
that error means you responded to the same instance twice.
yeah thats what i am doing right? The embed edits when a different category is chosen
Why you deferUpdate but never edit the defer
And you deferUpdate every interaction
I defer the update because all the menus will be updated if I dont. If I type help 2 times, both will get updated
So you have to editReply every interaction and it will cause an error if you use a command
also it will show interaction failed even tho it doesnt
You deferUpdate every interaction so this error can happen anywhere where you reply to an interaction
how do I fix it? I cant remove the defer update as it will edit all embeds then
outlined the approach here
i see no reason to defer in the first place, since i cannot see anything computationally heavy happening here
on a more meta level this all looks like a giant bandaid you stick onto things to not have to use slash commands, which would make that entire thing largely obsolete
If I don't defer, and I have two help menus (if 2 people use the help command), both the embeds are getting edited
pardon?
That's a really annoying way to share screenshots
But... is there anything I am doing wrong?
Sounds like your collectors and/or custom ids aren't sufficiently unique
So they listen to interactions from both
I just noticed even without deferUpdate all embeds are getting edited wtf
well yes, you dont update nor reply, so that defer is useless
How to only edit the embed of which the category was chosen from?
use a proper filter that only returns true if the message id is equal with the embed one
and consider using interaction.update()
I just make my customIds unique
So I know exactly what I'm listening for
How do I make it so each embed has different customids?
again, you dont need that. You have the initial message object, so just compare message ids in the filter
https://shanara.host/i/op6l34dd
100% I am doing wrong, this doesn't even edit the initialMessage. How do I check for what you said?
tysm @vague coyote hat worked :)
how can I fix this? It works but still..
either call deferUpdate() or update() the message instead (it's the same as edit interaction.message)
const schema = require("../../Database/custom-commands");
const { EmbedBuilder, Util } = require("discord.js");
module.exports = {
name: "cc-list",
run: async (client, message, args) => {
const data = await schema.find({ Guild: message.guild.id });
if (data.length <= 0) {
const noEmbed = new EmbedBuilder()
.setTitle("No data")
.setDescription("There are no custom commands in this server")
.setColor(Util.resolveColor("DarkPurple"));
return message.channel.send({ embeds: [noEmbed] });
} else {
const embed = new EmbedBuilder()
.setColor(Util.resolveColor("DarkPurple"))
.setTitle(`A list of custom commands in ${message.guild.name}`)
.setDescription(`There a total of ${data.length} custom commands in this server!\n ${data.map((cmd, i) => `\`\`\`fix\n${cmd.Command}\`\`\``).join(", ")}`);
message.channel.send({ embeds: [embed] });
}
},
};
why does it show like this?
If I remove the codeblocks part it works fine
I want it like this
use `text` then
new codeblock -> new line
or put all in one codeblock
how do I put all in one cb?
ok wait i'll try
wrap it around the whole thing and not in .map()
ah yes that worked thanks
how can i save my stuff in a object?
How is it djs related?
leme get the cmd
wait
i have ```js
client.on('messageCreate', async message => {
const prefix = 'm-';
let party = []
if(message.content === prefix + 'join'){
if(party.length === 0){
party.push({
name: ${message.author.username},
type: 'Party leader'
})
} else {
party.push({
name: `${message.author.username}`,
type: 'Player'
})
}
await message.channel.send({ content: ${party[0].name} joined and he is ${party[0].type} })
console.log(party)
}
})``` the user who join is not getting saved in the object
Your let party = [] is inside the messageCreate event
That means it gets reset every single message
ahhh
but even if i remove it it does not save
i think
I dont see what this has to do with discord.js v14 though
leme try
This is the v14 channel and this is a basic JS scoping issue
Nothing to do with v13 too #useful-servers
fffff sorry bc on my pc i was on #djs-help-v14 now my pc died and im on phone i didnt notice so sorry
np
Its ok i forgive you, don't worry!
ty @knotty plover and @copper jetty
@knotty plover like i said the object is not saving the stuff
where are you declaring it?
nvm ty it is fixed
can bots not set guild vanities?
bots can set guild vanities, but its not documented so discord.js didnt implement it
whats the request path
thank you
how i fix it?
ohh
i fix
intents are PascalCased
Hi i'm trying to send the user few menus but I have this problem:
with this code:
const res = [];
let currentMenu = new SelectMenuBuilder()
.setCustomId("value")
.setPlaceholder("Select a value.");
for(let i = 0; i < arr.size; i++) {
console.log(i);
if(i % 25 == 0 && i != 0) {
console.log("New Menu");
res.push(new ActionRowBuilder().setComponents(
currentMenu
));
currentMenu = new SelectMenuBuilder()
.setCustomId("value")
.setPlaceholder("Select a value.");
}
const currentOption = arr.at(i);
console.log(currentOption.name);
currentMenu.addOptions({
label: prefix + currentOption.name,
value: currentOption.id
});
}
if(currentMenu.options.length > 0) {
res.push(new ActionRowBuilder().setComponents(
currentMenu
));
}
interaction.reply({content: "f", components: res});
.setComponents and .addOptions now take an Array
I want to kill myself now.
After changing it it's still not working with the same error
show your updated code
const res = [];
let currentMenu = new SelectMenuBuilder()
.setCustomId("value")
.setPlaceholder("Select a value.");
for(let i = 0; i < arr.size; i++) {
if(i % 25 == 0 && i != 0) {
res.push(new ActionRowBuilder().setComponents([
currentMenu
]));
currentMenu = new SelectMenuBuilder()
.setCustomId("value")
.setPlaceholder("Select a value.");
}
const currentOption = arr.at(i);
currentMenu.addOptions([
{
label: prefix + currentOption.name,
value: currentOption.id
}
]);
}
if(currentMenu.options.length > 0) {
res.push(new ActionRowBuilder().setComponents([
currentMenu
]));
}
interaction.reply({content: "f", components: res})
.addOptions([{ label, value }])
I updated the code and It's still not working
check the stack then
i am using modals
error: DiscordAPIError: Invalid Form Body
data.components[0]: The specified component type is invalid in this context
You used modal in wrong context
its wrong?
new Modal()
.setCustomId('REQUEST_VIP_TAG')
.setTitle('❗» REQUEST VIP TAG')
.setComponents(
new TextInputComponent()
.setCustomId('EVIDENCE')
.setLabel('EVIDENCE')
.setStyle('SHORT')
.setMinLength(10)
.setMaxLength(100)
.setPlaceholder('LINK')
.setRequired(true)
)```
setComponents would take in an array
Yes Modal takes action rows
and it would be ModalBuilder?
and TextInputBuilder unless you use old version
thx
with actionRow it worked
is there any way to know the people who have entered through an invitation or which invitation a person entered with?
yes fetch all invites and when someone join check which invite uses went +1
ok
I assume MessageAttachment has changed to Attachment
indeed
Their removing Message from every class name
Ah
At one point I wondered if it would be AttachmentBuilder
still a pr
No, maybe not yet 😂
why?
not yet potentially, it's still a pr
Attachment don't have any builder methods like setName so its kinda useless
are you sure about that? https://discord.js.org/#/docs/discord.js/main/class/Attachment
nvm it has builder methods ive never seen anyone using it
Did setting a presence/status change at all?
ActivityType enum
Ah, cheers
Im glad enums exist now lmao
Same
DiscordAPIError: Invalid Form Body
data.components[0].components[1]: The specified component exceeds the maximum width
data.components[0].components[2]: The specified component exceeds the maximum width
data.components[0].components[3]: The specified component exceeds the maximum width
new Modal()
.setCustomId('REPORT_PLAYER_MODAL')
.setTitle('❗» Denúnciar jogador')
.setComponents(
new MessageActionRow().addComponents([
new TextInputComponent()
.setCustomId('PLAYER_NAME')
.setLabel('Nome do jogador')
.setStyle('SHORT')
.setMinLength(1)
.setMaxLength(16)
.setPlaceholder('Insira o nome do jogador que deseja denúnciar.')
.setRequired(true),
new TextInputComponent()
.setCustomId('REASON')
.setLabel('Motivo')
.setStyle('PARAGRAPH')
.setMinLength(50)
.setMaxLength(500)
.setPlaceholder('Insira o motivo pelo qual está denúnciando este jogador.')
.setRequired(true),
new TextInputComponent()
.setCustomId('SERVER')
.setLabel('Servidor')
.setStyle('SHORT')
.setMinLength(1)
.setMaxLength(16)
.setPlaceholder('Insira o nome do servidor em que ocorreu esta denúncia.')
.setRequired(true),
new TextInputComponent()
.setCustomId('EVIDENCE')
.setLabel('Prova')
.setStyle('SHORT')
.setMinLength(10)
.setMaxLength(100)
.setPlaceholder('Insira um link de uma imagem que comprove esta denúncia.')
.setRequired(true)```
you can only have one textinput per row, 5 rows per modal
how come... what version is this? aren't these suffixed with Builder now?
yes, they probably just didnt update
13.06.0
whaaaa
I'm not familiar with a version like that?
are you using djs v13.6.0 with builders 0.13?
i wouldn't recommend that, see djs 13.6 uses builders 0.11 internally, so it's probably not the best idea to mash different versions and stick with the version djs uses internally
i am installed by repo
npm i discordjs/discord.js#v13
ah okay
i really think we should have a channel for v13-dev to avoid confusions like these
especially since it'll get more updates
i am not understand
on every actionrow, you can have up to 1 text input
and as usual, up to 5 rows on a modal
you added 4 text inputs to action row not 1
yes i fixed it