#djs-in-dev-version
35223 messages · Page 6 of 36
you can check the docs for this
I actually just found a variable that holds all events, but they say it's webhooksUpdate now
no it's webhookUpdate
and there is no such variable
It's Discord.Events
But I was wrong, it's webhookUpdate 
I'm really struggling to understand the difference between 'Unsafe' builders and regular builders. for instance I have a help command that previously used a map function to create all the options for a selectmenu, based on the directory/category names of the commands.
however whenever I tried to use it I'd get an error about label and value being required (even though they weren't blank). I got around this by changing some stuff and using a forEach on the array and having a new SelectMenuOption in the function - giving it the label, value, description and emoji for each option:
.addOptions(categories.forEach(cmd => new SelectMenuOption({ label: cmd.directory, value: cmd.directory.toLowerCase(), description: `Everything in the ${cmd.directory} category.`, emoji: emojis[cmd.directory.toLowerCase()] })))
instead now I get a different error: components[0].components[0].options[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
if I console log the ActionRow I can see that options instead shows as options: [ UnsafeSelectMenuOption { data: {} } ] - completely empty and marked as 'Unsafe'
I know this is a dev release and I don't expect things to work 100% but I can build it by making the object statically, so am I missing something or is this an actual bug with SelectMenus in v14 atm?
Hmm looks like a bug, do you mind creating an issue ticket so I can investigate this further?
of course I don’t mind, I was thinking I should but felt it better to check in here first in case
No worries
Doesn't .forEach() there return nothing? @velvet jasper
Iirc that's a void function
really?
Yeah it is, maybe you wanted .map?
Oh you know what, that could work. I’ll try and find out what’s going on
So what .forEach() does is execute your function on categories. Its return value is nothing, so you were ultimately doing .addOptions(undefined)
You definitely want a .map() there
I’ve learned so much about JS in the last 18 months but seems I have some gaps that I shouldn’t have
(X
One more thing when you map the results of the map need to be spread for addOptions
Rest parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.
Ooo I see, thank you
well, good news is that I got the select menu to work however a new error when trying to set emojis but that may be because of a change that I don't understand yet
when giving a unicode emoji it gives the error:
components[0].components[0].options[0].emoji[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
Yeah it accepts an object not a string so { name: “emoji” }
ah, my bad. sorry for being a pest
and ty for your help
No problem
aaaaa
got an odd issue - trying to disable a button based on page
.setDisabled(pageNum < 0? true : false)
however the button remains clickable
buttons.push(new ButtonComponent()
.setCustomId(`selfroles.$prev.${modifier}.${pageNum - 1}`)
.setLabel(LABEL_PREV)
.setStyle(ButtonStyle.Secondary)
.setDisabled(pageNum < 0? true : false));
can you try adding a space between 0 and ?
Or remove the ternary as it would be implied from the comparison
Can't immediately see anything amiss there... that looks okay? Maybe the problem isn't there?
the buttons were originally inside if statements - so they would only show when valid
I fixed it by removing the ternary
Besides the GatewayIntentBits.DirectMessages intent, is there anything else I need to do to listen for messageCreate events to see DMs to the bot? Doesn't seem to be working and my brain is blank lol
You'll also need the channel partial
Yeah got that as well, it's super weird, unless I've just done something totally stupid. I know the event is working because I console logged before it previously to check 
partials also wants enum values
You can import Partials
Oh dangit, thanks dude, let me try that 👍 - Worked, thank you 🙏
why do buttoncomponent don't accept a string?, what would you do if you want a unicode emoji to be shown
Hi! Does anyone know if we can no longer do client.api.interactions(...) in V14? Or has it changed?
gotta use Client#rest now
Ok
It's client.rest(...) ?
no
client.rest.interactions() ?
stop guessing and ask, if you have no idea 
Client#rest returns: https://discord.js.org/#/docs/rest/main/class/REST
But what should I use?
Just out of curiosity, why do you need it
what do you mean "what should i use"? Client#rest returns a REST class instance
which has all the methods and attributes listed there
depending on what you want to do that varies heavily
most likely #get #post #patch etc. or #on #once to attach listeners, i guess
a button interaction has a member callback right? trying to give a role to the user who clicked the button with
interaction.member.roles.add()
I guess I can pull it from the original event
is CommandInteraction#options removed?
you want to use ChatInputCommandInteraction for slashies now
oh
the type guard also changed
for specifically slashies, isChatInputCommand
then what's the CommandInteraction class now
in v13 it was for slash commands on v14 what is it for?
it's what (for now ofc) context menu and slash commands
oh
ChatInputCommandInteraction is only for slash commands?
yep
alr thanks
any way to edit the message on collector end?
since collected is an array of elements, not sure if there is a callback
There is an event for this: https://discord.js.org/#/docs/discord.js/main/class/Collector?scrollTo=e-end
it's a collection, so collection.first()
is the first interaction, and interaction.message would be the message
I am updating the message with clicks, would that affect it?
could you describe the process more please?
its a self role menu and with every click I update it with
await i.update({
embeds: [newPage.embed],
components: newPage.rows,
// fetchReply: true,
});
okay and what do you want to do? edit the message on the end event, right?
correct, I need the user to know that its expired
yeah collected.first().message.edit would work
thank you 🙏 you are a blessing
maybe I'm doing something wrong, I am getting 'Unknown message"
collected.first().message.edit("This operation has expired.").catch(err=>console.log(err));
collected.last().message.edit("This operation has expired.").catch(err=>console.log(err));
they are epheral messages if that matters
are they deleted?
not that I can tell, a user can only dismiss them - at that point it doesn't matter
oh wait they're ephemerals? yeah you can't do it using this, perhaps interaction.editReply would work
when does this "expire"? does it take longer than 15 minutes?
10 minutes - 100 clicks - and I have a close button
10 minutes shouldn't be an issue
but what does this close button do?
it triggers a function collector.stop("close")
ok, note that you can't delete ephemerals
now go with editReply
i'll use update - editReply is spammy
how so?
it gets a long list of ephemerals
also you can't use update, you already updated on collect
not necessarily, I can edit the message on click, but its more when it expires that's the issue
i'm telling you to use editReply instead of interaction.message.edit on the end event
it should edit the message
interesting, so it seems the reply must be deferred - not sure how I would do that for the pagination
the original ephemeral is deferred but the collector simply updates the contents
I set the limit to 1 click to force the end event
could you send me the entire process?
what happens after what?
I'll water it down since its a big block
const paginate = async (event, client, state) =>{
await event.deferReply({ ephemeral: true });
const page = generatePage(roleOptions,currentPage)
let xx = await event.editReply({
embeds: [page.embed],
components: page.rows,
ephemeral: true,
fetchReply: true,
});
const collector = xx.createMessageComponentCollector({
componentType: ComponentType.Button,
time: 1000 * 60 * 10,
max: 1,
fetchReply: true,
});
collector.on('collect', async (i: ButtonInteraction) => {
if(i.customId == $close){
await i.update({content:"closed"});
collector.stop();
return;}
if(i.customId == ***)
const newPage = generatePage(roleOptions,currentPage)
await i.update({
content:message,
embeds: [newPage.embed],
components: newPage.rows,
});
}
collector.on('end', (collected) => {
collected.first().editReply("This operation has expired.").catch(err=>console.log(err));
})
};```
iirc you can't use editreply on a interaction after 15min. And you don't know how long this pagination will take so message.edit with a catch should be used instead
Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred. at ButtonInteraction.editReply
i know how long it can take, 10 minutes
and it's an ephemeral
defer first
or check repliied||deferred if false then update else edit
okay here's the plan @obtuse summit
also remove the max:1, you should end the collector yourself
onCollect((i) => {
i.update() // or whatever replies to this
collector.stop()
})
onEnd((col) => {
col.first().editReply() // edit the reply which should be the original message
})
I mean, if you read my code, deferred is the first line of the block
its basically what I have
What is Auto complete ? (exactly)
yeah but you should remove max
I removed max for now
now try running it
interesting, the button works without it crashing
just need to test it when it times out now
you have control, this is your code, make the time 2 minutes or something 😆
found a potential solution on an empty timeout
const msg = collected.first()|| event;
msg.editReply({```
what is event?
the initial event object ie: client.on =>
will this be executed after 15 minutes?
doubt it no, 10 minutes is my timeout of all things
then it should be ok
ok, found some small errors if you interact with it at the same time it's closing - but other than that, its pretty good. thank you @urban belfry - life saver
read the pins
How I can restrict the access to certain commands to certain users ? like in this image
Guide suggestion for @regal mason:
discordjs.guide results:
• Interactions: Slash command permissions
• Interactions: User permissions
what does MessageAttachment#contentType return if it's a image?
that depends what media type that image has
for jpeg and png what would it return
image/jpeg, image/png
What changes are needed for v14 from v13?
read the pins
Didnt explain it
there's a guide
Ah yeah
did Message#reference and Message#fetchReference() change in v14?
doesn't look like it did
I have code that puts a button on certain command responses that lets the user close the response (if they want) and a listener for those button presses that works flawlessly in v13.6 without error but in current v14 it gives errors about unknown message and/or interaction already replied deferred errors - depending on how its feeling
const client = require('../main');
client.on('interactionCreate', async(interaction) => {
if(interaction.isButton() && interaction.customId === 'botMessageClose') {
if(interaction.message.reference) await interaction.message.fetchReference().then(m => m.delete())
interaction.message.delete()
}
})
it's only a minor issue because it still deletes everything that it's expected to. it's almost like it's running multiple times
then confirm if that's the case
log something, see if that logs multiple times
welp
well yeah that confirmed it, the gateway is seemingly emitting the same event twice
sometimes more than that
not necessarily
what if you added the listener twice?
log something before the client.on
see if that logs multiple times
well that logs once, on bot load as expected
const client = require('../main');
console.log('banana')
client.on('interactionCreate', async(interaction) => {
console.log('apples')
if(interaction.isButton() && interaction.customId === 'botMessageClose') {
console.log('cheese')
if(interaction.message.reference) await interaction.message.fetchReference().then(m => m.delete())
interaction.message.delete()
}
})
for info, I load legacy command files, then event files and then slash commands hence why the 'banana' appearing in the middle of the console.logs in the console output
gonna try on a second device to rule out a client issue
nope, on mobile it still did it and actually sent the event three times instead of two
I think it's a gateway issue because I had noticed that I was seeing The reply to this interaction has already been sent or deferred. errors elsewhere in the code for slash commands as well as buttons and selectmenus
when do you think modals will be done
when this gets merged https://github.com/discordjs/discord.js/pull/7023
ik i have been following that
once that gets merged, they'll be in dev
I found a bug where guildMemberAdd start's emitting before bot is ready.
im consoling the value of Client#isReady and as you can see it's false a.k.a bot isn't ready.
is Djs v14 using experimental nodejs functions?
no, it requires 16.9 but the latest stable node.js is 16.14 anyway
NodeJs warned about using experimental functions
Oh yeah v14 is using experimental features
So does v14 have major changes to shift to from v13? like will it be lots of work to do it like how it was with v12 - v13?
Please read the pins
i did
Did u read the guide?
going to rn
ok... takes a bit of work but ok
ty...
my bad, I didn't get anything like that when I run it and I assumed because it only requires a stable version
oh
I got a "ZodError"
what is that
np
an error
It's a validation error in builders
They suck and we're replacing them
Is the modals pull request merged ?
No
components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
components[0].components[0].options[0].value[BASE_TYPE_REQUIRED]: This field is required```
```js
.addOptions([
{
label: 'Valorant',
description: 'Select Me To View Valorant Commands',
value: 'valorant',
},
{
label: 'Fortnite',
description: 'Select Me To View Valorant Commands',
value: 'fortnite',
},
]),```
I did put value and label but this error shows up
don't pass an array, pass multiple objects in multi parameters
K, Let me try.
client.on("messageCreate", async (message) => {
if (message.author.bot) return;
if (!message.content.startsWith(prefix)) return;
if (!message.guild) return;
if (!message.member)
message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length == 0) return;
let command = client.commands.get(cmd);
if (!command) command = client.commands.get(client.aliases.get(cmd));
if (command) command.run(client, message, args);
});
no reply from bot?
const { Embed } = require("discord.js");
module.exports = {
name: "ping",
description: "Returns latency and API ping",
run: async (client, message, args) => {
const msg = await message.channel.send(`🏓 Pinging...`);
const embed = new Embed()
.setTitle("Pong!")
.setDescription(
`WebSocket ping is ${
client.ws.ping
}MS\nMessage edit ping is ${Math.floor(
msg.createdAt - message.createdAt
)}MS!`
);
await message.channel.send(embed);
msg.delete();
},
};
Send method takes a single object
k
Or string
{ embeds: [embed] }?
did it change or-
nah while copy pasting
i pasted v12 code lol
ah lmao
v12 🤢
nah still no works
Do you have required intents enabled in your client constructor?
const {
Client,
GatewayIntentBits,
Partials,
Collection,
} = require("discord.js");
const client = new Client({
intents: [GatewayIntentBits.Guilds],
partials: [Partials.Channel],
});```
Correct?
You are missing GuildMessages or similar, intellisense will help lul
uhh yah lol
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],``` working in this
msg.delete();```?
Zod Error?
Send the error
No its in .setColor("GREEN")
Any Chnage in that?
Yes, color don't take string anymore
(static) Util.resolveColor()
Resolves a ColorResolvable into a color number.
uhh k
It takes a number or you can resolve the color from string using this method
.setColor("#00FF00");```
still eror
This is still a string
amm then
0x00FF00
will this work ?
`.resolveColor("GREEN")`
Yes
are voiceChannel works in djs 14?
like i tried to play something, the bot join the voiceChannel but no sound were play
Import Util from discord.js, call resolveColor method on it and put your color string as option
uhh k ty
ofc
^
TypeError [COLOR_CONVERT]: Unable to convert color to a number.```
error
Its Green not GREEN
ty
interactionCreate doesn't seem to emit when I use a slash command
is there now a intent that you require to access interaction event? Because I don't seem to receive interaction event.
did you spell it right?
you dont need any intents to receive them
file is called interactionCreate. I checked the raw event and when I use the slash command I don't see discord sending slash command request to the bot
Show code
@steel lance
module.exports = class extends Event {
/**
*
* @param {ChatInputCommandInteraction} interaction Interaction
*/
// eslint-disable-next-line complexity
async run(interaction) {
console.log(interaction);
const start = new Date();
// if (!this.client.ready) return;
if (!interaction.isChatInputCommand()) return;
if (interaction.channel.type === ChannelType.DM) return;
// slash command handler code.
}
}
I tried consoling and it doesn't even emit the event
Huh
Who's handler u using?
I meant which basic or from yt or u made own
custom handler I made for slash command
based on menudoc's handler but for slash commands instead of prefix commands and other events like 'ready', 'guildMemberAdd' all works. This used to work but suddenly it isn't working
Huhhh
like interactionCreate event used to emit but now it doesn't I'll try see if the event emits without using my handler
Ahh maybe some faults in ur handler
code:
client.on('raw', console.log);
client.on('interactionCreate', console.log);
not even raw or interactionCreate emitted.
for interaction related data
so uh it's probably a issue with v14?
Are you using the right bot?
Not really
what djs version are you on
npm ls discord.js
@vague coyote i updated to the latest version 1 hour ago and tried so i think it's the latest dev version
cant reproduce
Yes
Didn't work I don't know why it's not emitting
Even the raw event isn't sending any slash command data related to interaction although bot is online on the server
how are you starting the bot
With discord-hybrid-sharding. The bot emits the ready event so I presume all shards loaded successfully and my test bot has only one shard
if that's a third party library please ask them for support
you should read the change guide in pins as it'll help you understand what needs to change in v14. simply put, anywhere that used screaming snake case formatting now using pascal case and strings for things like colours and styles now use enums
I'm having an issue where the events are being emitted multiple times for single interactions, not sure if its a gateway issue or another issue in the commit
every time i've had that issue before it turned out there was another process running on the same token
without knowing how you're handler works, it could be anything
provide more information please
I confirmed it wasn't with console.logs - #djs-in-dev-version message
thats some simple code that deletes a message that a certain button is attached to and also deletes the replied to message as well (if one exists). confirmed only one process is running
I also noticed the same issue elsewhere in my code where I was getting 'already deferred or replied' errors where I don't get them in v13.6
Guys any idea of when discord v14 is coming out
just askin
when its ready
we dont give eta's
oh ok thx
bruh i tried without using my handler basically just client.on('interactionCreate', console.log) when I used my slash command it didn't emit :|
well, if you don't spell the event name right, that's quite clear
the capital C matters
i manually typed that sry but the code is this
okay then what? your handler doesn't exist?
is the listener even ever attached? does this code run?
my handler is fine here I just wanna know why interactionCreate isn't emitting
it runs yes
how did you make sure it does?
I extended the class and aded those on statements on the file and then ran the start method on the main index.js file and when the bot is loaded the ready event emits so I presume the bot loaded
add console.log(this.eventNames()) after login
alr
[
'shardDisconnect', 'ready',
'disconnect', 'reconnecting',
'debug', 'interactionCreate',
'guildCreate', 'guildDelete',
'shardError', 'shardReady',
'shardReconnecting', 'shardResume',
'guildMemberAdd', 'messageCreate',
'messageReactionAdd'
]
it did add it but it isn't emitting
brain too fucked up
daheck
does the ws one emit?
and messageCreate etc. emit? assuming "this" is client?
let me check
actually messageCreate doesn't emit as well uh
could you show your event handler again?
are you sure this is actually the client?
log this, i guess?
this returns the Bot which is just extended version of Client and just added extra values for like for me to access easily
like the config file etc
I think the event parameter is wrong you should put
Interaction, because the parameter you have passed doesn't correspond to the linked event.
ignore that's just for vsc eslint so I don't have to open docs lol
interaction from a slash command is a ChatInputCommandInteraction. the parameter is correct as far as I can see
ye
agree with you lol
how is the new embed design? because I have already put Author & Footer as objects
You're fine then
ok how is the modal submit event named?
interactionCreate
oh that's a mythic comeback
no special name given like in third party libraries?
No
interaction.isModalSubmit
We don't make up fake events
It is possible to have attachment options on slash commands with djs v14 ?
How ? :)
By adding an attachment option to your slash command
SlashCommandBuilder.addAttachmentOption I think
I dont use builders
Oh okay thanks
I thougth it was not implemented yet
modals aren't am i right?
For now atleast
not merged yet
you are
ok thanks
What is the purpose of this method ?
(On SlashCommandAttachmentOption)
once this gets merged, they'll be usable https://github.com/discordjs/discord.js/pull/7023
It just runs the validators. Not sure why its public
How do I access the submitted attachment from an interaction ?
I'm not sure if this method works (I think not)
ChatInputCommandInteraction#options.getAttachment()
idk people always find more changes
interaction.options.getAttachment(), same as all other option access
Modals are dope, tested out some interaction chains seems promising.
How to find the ID of a Command Interaction like in this example
you mean the id of the command? you'd probably have to fetch all of them using <Guild>.commands.fetch()
Guild#commands.cache.find(cmd => cmd.name === 'command name here').id should work
unless I'm mistaken
yeah but you have to fetch them like i said
if they're not in the cache, then yes you'd need to fetch them
commands aren't cached by default
I'm currently trying to reply to an interaction with an attachment. I already have a url for the attachment. From the docs I understand that I can simply put the url in the constructor as first parameter.
But this does not work:
interaction.reply({
attachments: [new MessageAttachment(imageUrl)]
});
DiscordAPIError: Invalid Form Body
data.attachments[0].id: This field is required
use files instead of attachments
ok, will try
thx
works great 👍
not sure if its v14 or not - but I have noticable lag with the user roles being set to the cache
I am paginating the results after the role assignment based on what roles the user has
it doesn't happen all the time
How to cache guild application commands ?
await guild.commands.fetch()
thx
where is v14 changes html page?
Pins
ty
Why this happens, I removed the attachment option from the command
I invited my bot to a new server and I got this error:
if (this.guild.id !== data.guild_id) throw new Error('GUILD_CHANNEL_UNOWNED');
^
Error [GUILD_CHANNEL_UNOWNED]: The fetched channel does not belong to this manager's guild.```
I am unsure how to fix it- I thought it was a permission but it has administrative permissions
! commands also worked before inviting it
sounds like you are trying to fetch a channel from a guild-based channel manager that's not on this guild
I am responding to the message event with the guild from message.guild.id
<someGuild>.channels.fetch("someid") someid does not belong to someGuild
can you show the full stack trace?
I think I know what the problem was
the original developer used cache.first() and it was throwing things off
Does Numbers still work in the Slash Command Options Type?
like 1-12 or what it is
yeah I think
okay
what does this error mean don't get it and it does not know where the problem is
looks like you're trying to send an empty message
what is your error.js line 5?
info is not a non-empty string
oh
what is it then?
log it
we know it'll be undefined, there's no point
search for where you call this function instead
it could also be an object
true let me check fast
Should be Administrator
Okay
all permission strings are now PascalCase not SCREAMING_SNAKE_CASE
Okay good to know
about the setActivity how does that work now?
did that change or
can't find anything in Guide
it did not change, the only thing there that did is that you now need to use the ActivityType enum
So change the Type to ActivityType??
Like this?
no the property is still type
no, set type to ActivityType.Streaming
do i get the ActivityType from the const { ActivityType }?
the enum, yes
thats fine
So like this or did i understand it wrong?
thats correct
okay
Did any events change?
or is it just the ones with client.ws.on?
ws isnt needed
ik ik
TypeError: (intermediate value).setAuthor(...).setColor(...).addField is not a function
at Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\utility\userinfo.js:68:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\events\interactionCreate.js:33:17)
at async Client.<anonymous> (H:\IdrisGaming\Discord Bot\ObitoInteractions\Structure\Client.js:47:25)
addFields
addField got removed 👍
ah
What does this mean ;-;
you passed a string where it expects a number
Hmm
setStyle too takes the enum ButtonStyle
this is covered in the guide
if i'm right all permissions that has Big caps and _ in it will just be like EmbedLinks?
What about GUILD_STAGE_VOICE? is that just GuildStageVoice now or?
yep
Hey guys, does embed.addFields() work the same as embed.addField() did or is it now essential to parse an array of fields to this method?
Thanks
addField removed
addField takes multiple parameters
Rest parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.
Thanks
Looks like modals are almost done 
If discord adds Permissions v2 within the next 1-2 months, is it going to make v14.x?
no
there's no way of telling, we don't have etas
it comes out when it's ready ™️
Hey, I'm getting this error when I execute this code:
Code:
message.member.permissions.has(PermissionsBitField.Flags.manageMessages)
``` Error:
```Uncaught RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.``` It happens when a member who isn't administrator send a message
Should be ManageMessages iirc
Aah thx
and question: it's now impossible to get the createdTimestamp of an activity ?
I'm getting NaN
modals is looking promising
1 pending vlad
What does this error mean?
The provided emoji for your component was invalid
places that used to accept a string for an emoji now expect an object: { name: 'emoji here' }
ok
other options are id: and animated:
thanks
no worries
Hi! Anyone have a list of badge names?
In V14
Badge's arent exposed in the bot API
The closest is the user flags, but they're pulled from discord-api-types
So I'd go with the discord docs for now
I had an odd error last night -
"unknown interaction"
C:\bot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:487
throw new DiscordAPIError(data, 'code' in data ? data.code : data.error, res.status, method, url, bodyData);
^
DiscordAPIError[10062]: Unknown interaction
at C.runRequest (C:\bot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:487:11)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at C.queueRequest (C:\bot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:200:11)
at ButtonInteraction.update (C:\bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:215:5)
at InteractionCollector.<anonymous> (C:\bot\src\events\microfunctions\selfroles.ts:190:5)
the line in question failed here:
collector.on(
const newPage = await generatePage(i, currentPage, catagory.roles, event.member.roles.cache);
> err >await i.update({
content: message,
components: newPage.rows,
fetchReply: true,
});
What version of djs are you using?
not a thing
That’s not a version
Run npm ls discord.js
^14.0.0-dev.1645661258.8203c5d
I don’t think this is a djs issue it’s most likely an issue with your code. That error occurs when you try to interact with an expired interaction. Try deffering the interaction
this happened just after I put the bot public, I added the self roles and within 2 minutes - it occured
Keep in mind interactions only last 3 seconds by default
Make sure you’re responding in enough time
it is deferred at the top, this is inside the collector
timeout set to 10 minutes
are you creating the collector on a message or in a channel
and at the end, it changes the messages to 'expired'
message:
// reply
let xx = await event.editReply({
content: message,
// embeds: [page.embed],
components: page.rows,
ephemeral: true,
fetchReply: true,
});
// collector
const collector = xx.createMessageComponentCollector({
componentType: ComponentType.Button,
time: 1000 * 60 * 10,
fetchReply: true,
});
Have you deferred the interaction within the collector event
no, should I?
It’s worth a try because your error is basically saying the interaction wasn’t responded to in less than 3 seconds
is there a way to check if it is already deferred? I believe an error is thrown if you try and defer twice
Yeah interaction.deferred
thanks, hopefully that solves it
I've had similar issues with interactions seemingly being emitted multiple times with v14
so it might not be just you
any updates?
Since no one made an issue... no
._.
the "I" was suggesting you to make one
As color hex isn't supported anymore for Embed Color, is there an easy way to convert #9100fb?
0x9100fb
This isn't supported either. I can only use one of these number | RGBTuple | null
That is a number
It’s a hex number literal
you dont put this in a string, its a hex literal
Hoo, i see. Thanks!
Is there a class builder for that? In which i can pass a string and it returns a number?
why? you can literally just use 0x<hex> instead of "#<hex>"
Or just use Number()?
e.g. setColor(0x9100fb)
Yea but my 9100fb will be a string.
From the way i pull the data. I can always just cast it
there is Util.resolveColor() if u really want to
Thanks!
Documentation suggestion for @cerulean bay:
(static) Util.resolveColor()
Resolves a ColorResolvable into a color number.
Perfect. Thanks
I've made some researches but can't find where or how is this feature called.
modals
Thanks!
Is it in v14 yet?
Can't find it in the doc
no
Has addField been removed?
Replaced by addFields only
Gave me a lot of rework 😂
You just need to replace addField with addFields
Not exactly
why not
.addField('name', 'value', true)```
As to be replaced by
```js
.addFields({
name: `name`,
value: `value`,
inline: true
})
Just adding the s dosen't do the trick
oh thats pre 13.6 I think
Maybe.
that's pre 14
Meh
Not sure what you mean but that's how it now works in v14
addField was taking an object too in v14 few days ago
It's still like this
yeah, initially in v14 addField was changed to only accept an object, but then got removed as it was obsolete since addFields exists
Hoo i understand
Alright!
So depending on how you were using .addField, refer to my message #djs-in-dev-version message
Just noticed that this PR has been approved 4 hours ago. Impatient for it to be merged 😂
https://github.com/discordjs/discord.js/pull/7023
I have actually moved most of the bot to dev v14 (changing fields to objects etc) only now I had a problem with addField
So just add an s
that's because the change occurred recently
Can modals be used in any type of interaction? Can i return a modal for someone clicking on a button?
I know, I already did it with IntelliJ's built-in tool (changing 50 files manually is not much fun)
a deprecation message should be added to v13 
yes to the second part
Nice!
they can be used for any interaction except modal interactions themselves
That's nice. And can we have a select menu inside a modal?
not yet
no, text only for now
no, only text inputs
Thanks guys xD
In the Discord Doc, they say that a modal can have messageComponent but they don't specify that it's only Textinput. Weird https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
They only say between 1-5 components
yeah at the moment you can only have 5 text input components
Yea. It's only that they don't specify that it's only TextInput. They only say Components and refer to all 4 component types
For AutoComplete Interactions, is there a limit of items we can return? I can't find the limit and wondering if Discord will accept to many items if i don't filter them?
20
yeah no, its 25
close enough
was 20 selects, or is that 25 as well?
also 25
i cant think of anything that has a limit of 20
then i have no idea where i got 20 from 
Alright, thanks!
choices were up to 20 in the past, they then increased it to 25
maybe u confused with that
Is that a discord limitation or discordjs implementation limitation?
Discord limitation
we don't know
The answer is always...
ETA: when it's ready™️
it's ready so it will be merged soon i think but idk
Yeah, it's looked like this several times during the process, that just denotes that current conversations and reviews are resolved, not that new ones aren't still happening or due. It could be merged 5 minutes from now or a month from now. Unfortunately, we don't know at this stage and we will just have to be patient.
Please stay on topic
what
<@&839912195994812420> off topic
It's ready when all of the core maintainers have approved it
And even then we might not merge it right away
v14 merged 
for those wondering, the pr was just merged 🎉 (don't forget the 12 hour release cycle though)
the dev release should be available in about 3 hours 👀
keep the channel on topic, both of you.
oh, sorry
but if prs merging don't follow the topic then whoever asked if it will be merged is also not following it
gtg though
sounds very on topic 
this is a channel about the @ dev version, so why does that have to be problems only?
wouldn't make any sense
are modals merged on v14 now?
noice
#7023 in discordjs/discord.js by suneettipirneni merged <t:1646380421:R>
feat: Add Modals and Text Inputs
permission flags changed in v14?
Please read the upgrade guide
String flags turned into enums
hmm okay!
As of 16 minutes ago modals are now available in v14 dev
How do I blacklist a user from using any commands. Is there any way for the command to not work when that user uses the command?
Where did the client.api go???
Did it get removed or
I believe you need to use client.rest now
either create a role, then set permissions of that role to false, or just set that user's permission to false
now removed since .rest is a thing
but note that we don't support raw calls, we support the built in djs methods and stuff like that
you'd have to do that for every command though
does djs 14 have types for errors?
like collector error.. etc
I'm a little confused about modals. I was under the impression that you could trigger a text input modal to appear on screen as a response to a ChatInput command but the brief example on the PR implies that it is itself a completely separate form of CommandInteraction. the PR shows how to handle the received data from the modal submit but not what would trigger the modal to be shown in the first place
instead of replying to the interaction, you show modal to the user.
hmm I saw that but don't have .presentModal() as a method on a ChatInputCommandInteraction so thats why I was asking
hm.. do you have .showModal()?
showModal, too?
no to both
oh wait no I fatfingered it and typed showModel, not showModal lol
lol ok
Yeah the example is outdated
do we know when typings will be done? for things like intellisense?
They are done
okie doke, I know its dev so I don't expect them until its pushed to stable. just curious
I did notice a maybe bug that I need to open an issue for related to events being emitted multiple times
I've basically had to change all my event listeners from client.on to client.once
Nah typings are already done
then i guess you have nested listeners or something? this is an issue you'd want to fix
nope, no nested listeners
odd, i'll have to test that out too then, what event are you listening to?
can you give more detail on this?
so the event that made me spot the issue was this one listening specifically for button presses with a certain customId
with it set to client.on I found that I would get interaction already replied to errors. using console logs I confirmed the event was being run multiple times
yeah perhaps try changing to the event handler in the guide
If you want the event to fire only once use client.once client.on will fire until you stop the proccess
looking at that screenshot gives me the feeling thats not the only place in your bot where you have an interactionCreate listener lol
its not but I use typeguards and if statements to check what its listening for and only take action if its meant to
this file is being called by main.js in a way, and you also require main.js here too, not really something i'd recommend
instead i'd recommend the guide's handler
its not being called by main at all
but ok
no it must be, it can also be that main calls another file that calls this
i did say in a way
can i use collectors to get modals submit interaction?
to clarify, there is nothing wrong with my handler as it's worked flawlessly since v13 first got pushed. this issue now only started happening when I moved to the v14 dev. as nothing in the current 13 > 14 guide mentions changes to client.on or client.once I have to assume it's a bug
you and I discussed this the other day and you never gave your input on it after I did what you asked. would be great to confirm if you still think it's a handler issue please
in short, the file gets loaded once by the handler but ran multiple times with client.on even though the button it's listening for only gets pressed once
huh, well i am sick so i randomly go off sorry 😰
could you change to the event handler in the guide though?
https://discordjs.guide/creating-your-bot/event-handling.html#individual-event-files
if it was an actual issue with discord.js you'd be able to replicate it in a single file too, no need to be changing handlers. try creating a minimal reproducible example
tbh, I'd rather do that. because this handler has served me and hundreds of others well for over a year and I don't feel like changing it when it's clear I shouldn't need to.
I'll produce a small environment to demonstrate the issue clearer
Yes
what does it mean with this?
making a request before the token is available / deleting the token
Well i don't see any problem here ;-;
Well for v14 your componentType in the collector is wrong. Remember that all screaming snake case string inputs have been changed to enums
So Button now then
I’m not at my PC to check, but if I recall correctly it’d be componentType: MessageComponentType.Button
Okay
It's called ComponentType
Oh there we go
so
ComponentType: MessageComponentType.Button
right?
componentType: ComponentType.Button
ahh thanks
No, the option hasn’t changed
Yeah that
So I’ll concede that I wasn’t able to replicate the issue in a single file bot setup while still using client.on (which is a must because obviously need the event listener to keep listening). But I’m baffled about why it wasn’t an issue with my handler in v13.0.0 -> v13.6.0 and only became an issue now in the v14 dev
The example is builders
I’ve had to go out but when I get back as a test I’ll convert my event handler over to the one in the official guide and see what the result is. I’m using effective typeguards and if statements so I know for a fact that only the one event file is being called - confirmed by the console logs only being in that one file and still being run multiple times
nope
multiple choice objects ( rest parameter )
if things breaking surprises you, you should probably not run a development build - or pin it to a certain commit in your dependencies
There’s still another large builder refactor to come 
what is that? the zod errors being fixed?
whats wrong with zod errors
not really that descriptive
and unhelpful for narrowing down where the error came from in cases
No
#7584 in discordjs/discord.js by suneettipirneni opened <t:1646166816:R> (review required)
refactor: Don't return builders from API data
📥 npm i suneettipirneni/discord.js#discord.js/refactor/api-return-structures
makes sense so the zod issue's not being worked on?
It is, but that change shouldn’t affect how you use builders
zod errors are veri clear to me
why did you change SEND_MESSAGES to SendMessages? this makes it really hard to edit the way people wants ( i aint using it, just asking)
Is it that hard? Lol
is there a dev build for Attachment option on v13?
no
surely possible, i use api anyways so it doesn't affects me, i was just wondering why
Attachments have been out for a few weeks
how do i use it on v13?
It's not in version 13
only gonna be on v14?
ik but im just asking how can i use it on a dev build like the modals PR request
You install it with npm install discord.js@dev
is modals on that version aswell cus im still using the modal pr request
Hi, i got this error starting my bot
yes
Yes
Read the guide in pins
okay
awesome thanks and what is the type value for attachment?
Use the enumerables
apologies if this is off-topic, but do enums affect memory usage? what i mean is, rather than using type: 1, you import a class / enum, then get the value from the enum key you want. obvsiously we're probably talking bytes here so im not worried about running out of ram, just wondering if there's any negatives to using them for larger scale bots. fwiw, i'm not against enums lol (in fact i like the change)
i prefer using raw json but that's just me
Maybe, but as you said it’s negligible. We recommend enums over magic numbers because they’re readable unlike raw numbers
yeah im finding them a lot easier to use, saves having about 20 tabs of dapi docs with all the types fields lol
everyone has preferences ¯_(ツ)_/¯
How i can create a form?
ty
can you put true instead of 1 in the type?
what type?
slash commadn
no
they specifically take numbers right? also it's needless, what will you do for 2, 3 , 4 and so on?
true + true
you're not funny
name is displayed to the user
you can either use enums or numbers, but you have to check docs for types
the enums end up passing numbers in the end
is what i was referring to
idk how to do it... im new on this
its good for people that cant remember the types
try reading it
yes but im so noob :(
i just started
Also if you use a build system like esbuild with typescript it will avoid the import and just inline the number
ok...
unless if there's a setting or something for it, it doesn't do that
I’ve tested it with the latest version, enums are inlined unless you do dynamic reverse mapping
does discord.js@14.0.0-dev.1646395406.6f7a366 have modals?
yes
welp, then
const m = new Modal()
.setTitle('aaa')
.setCustomId('a')
.addComponents([
new TextInputComponent()
.setCustomId('texto')
.setLabel('sera!')
.setValue('boh!')
.setStyle(1)
])
await message.reply({content: 'a', components: [m]})
why this is returning components[0][COMPONENT_TYPE_INVALID]: The specified component type is invalid in this context?
you have to use action rows in modals not text inputs directly
add text input to the action row and the action row to the modal
and addComponents doesn't take an array
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width
at C.runRequest (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:7:581)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async C.queueRequest (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:5:3049)
at async ChatInputCommandInteraction.showModal (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
at async Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\utility\modal.js:30:9)
at async Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\events\interactionCreate.js:55:17)
at async Client.<anonymous> (H:\IdrisGaming\Discord Bot\ObitoInteractions\Structure\Client.js:48:25)
I think ActionRow takes only one TextInput
Im feelin like going to dev build just for the modals what do you guys think
with my soon production bot
only one text input per action row
thanks guys
const m = new Modal()
.setTitle('aaa')
.setCustomId('a')
.addComponents(
new ActionRow()
.addComponents(
new TextInputComponent()
.setCustomId('texto')
.setLabel('sera!')
.setValue('boh!')
.setStyle(1)
)
)
gives same error
fixed, i had to show the modal in an interaction and not in a message
Version 14.0.0-dev.1646395406.6f7a366
its just spamming that
how can I set activity? I'm doing js const { GatewayIntentBits, Partials } = DiscordJS const client = new DiscordJS.Client({ partials: [ Partials.Channel, Partials.Message ], intents: [ GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages ], presence: { status: 'online', activities: [{ name: 'Roblox', type: 'PLAYING' }] } }) but it's not setting activity..
Import ActivityType from discord.js and use ActivityType.Playing for the type
Fixed had to do npm remove discord.js
and they said v14 wouldn't be much different from v13
ff- tysm
It's nearly the same
wait, do I just do Playing: name or-
type: ActivityType.Playing
I just wished they had docs for v14
no I get that but- OH
You can find it in the source code
TypeError: Cannot read properties of null (reading 'tag')
at Object.execute (/root/ObitoInteractions/commands/utility/bot.js:47:85)
at Object.execute (/root/ObitoInteractions/events/interactionCreate.js:55:31)
at Client.<anonymous> (/root/ObitoInteractions/Structure/Client.js:48:37)
at Client.emit (node:events:520:28)
at InteractionCreateAction.handle (/root/ObitoInteractions/node_modules/discord.js/src/client/actions/InteractionCreate.js:76:12)
at Object.module.exports [as INTERACTION_CREATE] (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketShard.onPacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:22)
at WebSocketShard.onMessage (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketShard.js:304:10)
at WebSocket.onMessage (/root/ObitoInteractions/node_modules/ws/lib/event-target.js:199:18)
interaction.client.application?.owner.tag
Fetch the application
hello folks, potential bug or am I being unsmart again?
it seems TS doesn't complain when I send a single element
I have await client.application?.fetch(); in my ready event
But a list of elements is an issue for setComponents function
I believe you need to spread that
didn work
did work
i tried it before but I did it wrong apparently cause it works now
how to get modal submits with collectors? Message.createMessageComponentCollector isnt getting it
@urban belfry as per your advice earlier, rewrote my event handler using the official guide and can confirm that events that use client.on are still being emitted multiple times from a single file for a single interaction
They're not message components, construct an InteractionCollector if required
Could it be a typing issue? I've lost some braincells over this
ActionRow<ModalActionRowComponent>
Try that
That seems to have worked, sorry, still new to TS!
Right now there is no modal collector in the dev branch right?
Legends say interactioncollector works
Hi for interaction options type 11
Im trying to get attachment url
const picture = interaction.options.getAttachments('avatar');
Console log :
getAttachments is not a function
You made the right decision to move to ts 😛
I love the strongly typed JS
@dawn phoenix
why
There is, construct new InteractionCollector
😂
how to construct it tho
oh nvm, found it
That does indeed work thank you very much
Can you help me?
no, stop pinging
The method is called getAttachment not getAttachments
There seems to be a change with interaction.options
It no longer fetches options, I don't know how to get stuff from slash commands atm
Lol
did you even read what they said? ._.
I'm not entirely sure this is /slash command, if it is, the interaction returns a commandinteraction and idk how to get this from the CommandInteraction
Remove s at the end
Perhaps a simple casting will suffice, lemme try
Slash commands returns ChatInputCommandInteraction
There is interaction.isChatInput()
Ahh I getcha
For now at least
Command interaction may include slashies and context menu commands
I think that would be a better resolution but the devs would know better
interaction isn't ChatInputCommandInteraction or you're not using latest dev version
Djs vrs : 13.6.0 the latest
this is a channel for discord.js@dev
You can't use Attachment options in v13 yet, update to dev branch if you want to use it
Ok .
or... don't yet, if you are struggling with version updates
because you're using typescript
The base InteractionCollector should work
You need to type your ActionRow<ModalActionRowComponent>
Everyone seems to be killed by this xD
Then why are you getting a TS error?
js intellisense is powered by ts
Can probably ignore it then
pins
Bitfield flags changed in the upgrade, see pins
Idk why people are struggling with modals so much? Works fine, just wish discord would let you add Select components to them.
that's coming™️
they picked to release it with just text instead of waiting much longer, which i personally appreciate, but some people are upset about?
people are weird
the typings for them arent cooperating so well
I'm using js for my project not having issues.
its an issue with the typings, not the runtime behaviour
The typings are intentional, you’re supposed to provide a generic parameter for action rows now
sounds unnecessary
It isn't
I mean it's that or have two separate classes MessageActionRow and ModalActionRow
You'd still have to differentiate
Which I want to avoid, and it’s a problem generics solve. Imagine having to have a new array class for each kind of element it holds
Sounds like an unsustainable maintenance nightmare
if the generic is required why does it have a default type that makes it not actually required
It can probably be removed iirc rodry added that. But you can’t enforce classes to provide generic parameters anyways
You can't? I thought without a generic default it would tell you it requires one
Like Collection does
Collection doesn’t it’s perfectly valid to do new Collection()
only on type annotations, its not actually required when you construct it
Right
new Collection() is valid, but let thing: Collection is not
Yeah…? Js doesn’t have generics
It doesn't matter in JS though
I'm not upset at all, I just can't wait for fully functional Modals
This will do for my bot atm
What exactly isn't functional
Missing components
There is only one though, I don't think we're missing any?
They're talking about the Soon™
Modals can take all kinds of components
From what I gather
No, just one
Ah, it was my confusion! Apologies, I thought the select menus for modals were a thing on discord api already
Only text input at the moment
(unsure if this is a djs-dev issue, sorry if it is). using ts-code to run if that makes a difference?
probably have to install @discordjs/builders@dev too
yeah that worked, thank you
Hi
Modals input texts are ready for v14-dev?
yes
alr
Structure pro
Any idea why ModalSubmitInteraction has no deferred or replied like other interactions?
It's a bug
Gotcha, cheers
GatewayIntentBits.Guilds
require GatewayIntentBits from discord.js
const { GatewayIntentBits } = require('discord.js');
A quick suggestion. Along with v14 of discord.js
It would be nice if you could add TypeScript code examples too. Like those tabs with TS and JS.
That's something we intend to do eventually
do i need to check if member is a GuildMember before using this, or have i done it wrong?
should probably add an inCachedGuild check beforehand
that's new
it's GatewayIntentBits and there's no flags
oh
Thx, i skipped that update it looks like
actually if you want flags its IntentsBitField.Flags now
at SlashCommand.run```
This changed too?
see pins
i did, still not understanding what changed, im quite new to bot developing so go easy on me 😄
if you're trying to go from v13 to v14 dev without reading the migration guide in pins then you're in for a bad time, like others have said - read pins
i read all the links right there except for that one
Sorry'
Thx for the help guys
how many action rows can we put in a Modal?
in the <Modal>#addComponents() method
5
thanks
someone ghost pinged me?
do u guys have a quick example of command wrote in v14, so i can integrate faster the changes?
all codes are different
read the guide, try to update
and if you got an error you can still ask here
well that's the reason i asked for an example cuz i don't want to keep asking
we don't even know what your bot does
I know, i'm just asking for embed declaration, that's it cuz i keep gettin the zod error
the other things like action row and etc works like a charm
MessageEmbed is now Embed
.addField() got removed
.setColor() now takes a number
that's all for embed iirc
THANK U
the setColor got me the error
bruh
Embed is re-exported from builders which has documentation too
found it, thanks
Hey there, i realised that message.author.ban() wasn't a thing, what would be the correct syntax please ?
message.member
Does that automatically put the member as the author ?
didn't get
I mean, the point of it is to ban the author, so message.member is the author of the message ?
as a GuildMember and not a User, yes
Oooh i see
because you cannot ban a User
Thank you !
no prob
a small clarification, you can ban a user, just that the method can't be called on a user object
Embed zod error also rises if you dont specify the type of textfields
Type or style?
Uhh sorry style
The short vs paragraph
Im not at home cant reproduce but I can if needed
That’s not a bug, you have to specify style
Yeah I know but should it throw the zod message in normal use?
Yeah? Why wouldn’t it, it’s required
addField removed? How can I add fields in the embed?
.addFields()
Oh bruh
I forgot that
Why's addField going away 🤔
I've read the pins and the links don't seem to mention anything about it
cuz its work in progress?
so there's no reason for it yet?
wdym, sure there is a reason, I was talking about it missing in the guide
Oh, I'm just wondering why it's going away, since I just Refactored a fuckton of my embeds to use sole objects and now I hear this 😂 🥲
#7522 in discordjs/discord.js by imranbarbhuiya merged <t:1646213851:R>
refactor(Embed): remove add field
@haughty sequoia ^
I'm guessing these are typos
Yes, of course
might be worth editing ¯\_(ツ)_/¯
Hi, so after installing the master branch, I began experiencing this issue.
check pins, Intents part
I'm getting this error when I create my client.
Please provide your code with the error
const { MessageActionRow, MessageButton, Client, Collection, GatewayIntentBits, Partials } = require('discord.js');
const client = new Client({ partials: [Partials.Message, Partials.Reaction], intents: [GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMembers, GatewayIntentBits.Guilds, GatewayIntentBits.DirectMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessages] });
need node 16.9 or higher
How can I see the changed features in v14 version?
pins
Hi, I was wondering if some kind of "interaction.channel.awaitModalSubmit()" was coming or was planned?
You can use interaction collector for now
Thanks, I didn't know this kind of stuff existed
const { ActionRow, TextInputComponent, TextInputStyle, Modal, ModalActionRowComponent } = require("discord.js");
// command handler stuff....
const modal = new Modal()
.setTitle("Test Modal")
.setCustomId("test");
const textInput = new TextInputComponent()
.setCustomId("text")
.setLabel("Test input")
.setStyle(TextInputStyle.Short);
const rows = [textInput].map(
(component) =>
new ActionRow<ModalActionRowComponent>().addComponents(component)
);
modal.addComponents(...rows);
await interaction.showModal(modal);
(as specified in the PR) - why is it returning an unexpected token ) in the new ActionRow<> part?
discord.js version: discord.js@14.0.0-dev.1646395406.6f7a366
Node.js version: 17.6.0
remove the <ModalActionRowComponent>
Bot turns on now, let me try the command now
amazing, thanks
any docs / guide on modals atm?
It is on the main branch for documentation at the moment
is js const rows = [ignname, previousexperiance].map( (component) => new ActionRow().addComponents(component) );best way to add components?
is their a yes / no Text Input Style
Uhh I guess that way works to add them
I don't know what you mean by yes/no text input
They do not restrict what text you can input
he means multiple choice
Well that wouldn't be a text input
No
Modals only support text input right now
ok
hope they add more soon
The pin method seems not to work in the discord.js@14.0.0-dev.1646395406.6f7a366 version. I'm posting in case it's a bug 🤷
interaction.channel?.send('Test').then(message => {
message.pin()
})
DiscordAPIError[0]: 405: Method Not Allowed
at C.runRequest (C:\Users\...\Bot\node_modules\@discordjs\rest\dist\index.js:7:581)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async C.queueRequest (C:\Users\...\Bot\node_modules\@discordjs\rest\dist\index.js:5:3049)
at async MessageManager.pin (C:\Users\...\Bot\node_modules\discord.js\src\managers\MessageManager.js:167:5)
at async Message.pin (C:\Users\...\Bot\node_modules\discord.js\src\structures\Message.js:694:5) {
rawError: { message: '405: Method Not Allowed', code: 0 },
code: 0,
status: 405,
method: 'put',
url: 'https://discord.com/api/v9/channels/949781425413058611/pins',
requestBody: { files: undefined, json: undefined }
}
that is indeed a bug
#7610 in discordjs/discord.js by muchnameless opened <t:1646518072:R> (review required)
fix(MessageManager): pin route
📥 npm i muchnameless/discord.js#fix-pin-route
how can I add descriptions to my modals?
modals don't have descriptions
What is the correct way to 'close' a modal after it has been submitted?
u need to reply to the modal
so the MessageButton() method changed to only Button()?
ButtonComponent
Thx
TextChannel#awaitMessageComponent does not accept modal submit event. I tried to specify componentType. What's wrong?
it's not a component. you can use an InteractionCollector instead
i'll try it. ty 👍
what codeblock is used for this magic???
ascii as far as i know
close enough, ansi

yo
does @dev have docs?
shit i didnt mean to ping
oh cool thanks
Everything is in the pins as per the topic
ight
include the escape character
it also simply doesn't works on android or ios yet
Hi guys
I've an error```
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
const selector = new SelectMenuComponent()
.setMaxValues(3)
.setCustomId("roles_bm")
.setPlaceholder("Choisissez vos rôles (en tant que Blade Master)")
.addOptions([
{
label: "DPS",
value: "dps"
},
{
label: "Tank",
value: "tank"
},
{
label: "Support",
value: "support"
}
])
Anyone can help me pls ?
try updating to the latest commit, add passing multiple parameters instead of an array on addOptions
"add passing multiple parameters instead of an array on addOptions" ?
addOptions({...}, {...}, {...})
```instead of an array
like thi
.addOptions(
{
label: "DPS",
value: "dps"
},
{
label: "Tank",
value: "tank"
},
{
label: "Support",
value: "support"
}
)
this*
yes
yeah it's working
thank's u
How do I use the APIMessageComponentEmoji type in my buttons? I want to use ✅ and ❌
you'd need to pass them in an object with the property name
Got it. thank you
Any doc for modal / text input (discord.js) ?
InteractionResponses#showModal()
Shows a modal component
@forest elm
lol
thx bro
Can i add button on modal ?
or select menu
no, actually only text inputs are supported by discord