#djs-in-dev-version
1 messages · Page 14 of 1
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
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()
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
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

oh cool thanks
Everything is in the pins as per the topic
ight
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
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) ?
<:_:874573924988518500> InteractionResponses#showModal()
Shows a modal component
@forest elm
thx bro
no, actually only text inputs are supported by discord
I guess only certain components can be added to a modal
how did u fix the select menu, i have this ```pl.map((playlist) => {
resultplay.push({
label: ${playlist.name},
value: ${playlist.id},
});
});
const playinput = new ActionRow().addComponents(
new SelectMenuComponent()
.setMinValues(1)
.setMaxValues(1)
.setCustomId("select_playlist_play")
.setPlaceholder("Select a Playlist to play")
.addOptions(resultplay)
);
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```
like this
.addOptions(
{
label: "DPS",
value: "dps"
},
{
label: "Tank",
value: "tank"
},
{
label: "Support",
value: "support"
}
)
it's not an array
like this ↑
np
you have to use enums / numbers. Read the pinned guide preview
oh
iirc you can also use Pascal cased strings here but that's not encouraged to use
ah ok
pain, im guessing this is the slash command options types?
where can i find the new ones, if they are new ones.
BRUH
i tried it for the past hour, but how the am i gonna add to the options, the things i have in the resultplay array
no problem
check pins
thanks
TypeError: embed.addField is not a function
const embed = new Embed()
.setTitle(`\\✨・Nouvelle demande de recrutement`);
embed.addField({
name: "Pseudo Zenith",
value: pseudoZ,
inline: true
})
why ?
removed, use the plural #addFields, same usage
oh ok thx
yes
How to fix it?
you have to use toJSON() on the buttons if you want to pass them in the constructor iirc
will be fixed in the next dev release
ok, thx
Sorry I forgot to reply to this but I meant it should be throwing DiscordAPIError
how can i find the colors as numbers
example 0x7289da
or how can i convert them to numbers using djs
you can use 0x7289da, that's a hex literal
Ik, but what if i want different colors
0x<hex>, you can use a color picker or something
One only receives that error from Discord. That wasn't from Discord, so no, it should not return that
ohhh, ty
https://convertingcolors.com/decimal-color-11010294.html?search=Decimal(11010294) i used this and put the color in the config
so for the .setFooter and .setAuthor field what should be the input, cuz i give it the string but says received undefined
Tag suggestion from @copper jetty:
<MessageEmbed>.setFooter() and <MessageEmbed>.setAuthor() now each take an object:
- embed.setAuthor('This is an example text', 'https://exampleicon.com', 'https://websiteofauthor.com')
+ embed.setAuthor({ name: 'This is an example text', url: 'https://websiteofauthor.com', iconURL: 'https://exampleicon.com' })
- embed.setFooter('This is an example text', 'https://exampleicon.com')
+ embed.setFooter({ text: 'This is an example text', iconURL: 'https://exampleicon.com' })
Why there are many breaking changes in v14
because it's a semver major version bump. would you rather have a major for each breaking change and end up at d.js v1320?
you can find a reason for the changes in the pins
does discord.js/voice have breaking changes too?
It's probably SelectMenuComponent
this channel is for discord.js@dev, not voice, but afaik no
thats what i thought, lemme try
What?
components has to be an array
pretty self-explanatory, show the code
.addOptions([
{
label: '🎟️Autorole',
description: 'Server Config for Auto Role!',
value: 'autorole',
}, {
label: '🔥Role Keeping',
description: 'Server Config for Role Keeping!',
value: 'rolekeep',
}, {
label: '✅Verification',
description: 'Server Config for Verification System!',
value: 'verify',
},
{
label: '🥣Logging!',
description: 'Server Config For Logging!',
value: 'logging',
},
{
label: '🪙Voice Role',
description: 'Server Config For Voice role!',
value: 'vr',
},
]),
at options: put ...menu
remove the [], you have to use rest parameters
thanks bro
thx
so with the new gatewayIntents if i put it like this it's the same as the v13 form: intents: [ Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGES, ], or do i have to use flags still?
you can either use the enum directly or IntentsBitField.Flags
you tried to send an api request before logging in the client
or after destroying it
only possibility of this happening while the client is logged in is a bug where you try to use a wrong token for a webhook which in turn sets your bot token to null
exactly
But how can i find the error for that one?
there's an open pr to fix it, for now you could check for a 401 status and do rest.setToken again
so i could use GatewayIntentBits.Guilds_VOICE_STATES
For befor i havent had this problem befor with v13 but when i changed to v14 it started happen but okay
#7508 in discordjs/discord.js by vladfrangu opened <t:1645277692:R> (approved)
fix(RequestHandler): only reset tokens for authenticated 401s
📥 npm i discordjs/discord.js#fix/rest/reset-token-on-401-only-for-authenticated-calls
will this uninstall v14?
you can't really use this install link
that command wont work out of the box
pascal case
What should i do then :/
should i add the error event?
and listen for the 401 status?
you can do that, or wait till the pr gets merged and released
as always no eta but there's no blocking requested change currently
GuildVoiceStates
GuildMessages
the setToken() should be my bot token right?
Hmm
This fixed half of my bot
Still learning sry for all the stupid questions
So like this right?
if am not wrong
you don't have to do it in 1 line
setToken is sync, no need to await it. the error event will only be emitted if a listener callback throws btw
catch and handle it everywhere you send something with a webhook
if you want to use the error event await webhook send calls
and check if <DiscordAPIError>.code is RESTJSONErrorCodes.InvalidWebhookToken
how do you set a emoji to a button now
{ name: "emoji here" }
yeah it's internal
show your error with the stack
const allButtons = [startButton.setDisabled(true), backButton.setDisabled(true), forwardButton.setDisabled(false), endButton.setDisabled(false)]
let group2 = new ActionRow().addComponents(allButtons)
let helpMessage = await interaction.followUp({
content: `Click on the buttons to change page`,
embeds: [em1],
components: [group2],
})
``` code
<:_:818272565419573308> Spread syntax (...)
Spread syntax (...) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.
spread the array and pass that addComponents(...allButtons)
oh
ehm
Looks to be working as intended
Should be validated by zod once the PR is merged but yeah labels on select menu options are required
?
Need to use node 16.9 or higher
Ok thanks
guys in the Modals PR example there is a type ModalActionRowComponent import, how do i require it in js?
You don't need it in js
No that import is only needed for typescript
i removed it thanks but i got this error
Can you show me your entire code
All 250 lines?
The code for the modal
wait that error could be due to the fact that im using messagecollector?
or it doesnt matter?
It doesn't matter
Add TextInput to ActionRow and the ActionRow to Modal
const modal = new Modal()
.setTitle('Add songs to the playlist')
.setCustomId('add_modal');
const ModalTextInput = new TextInputComponent()
.setCustomId('add_modal_text_input')
.setLabel('Insert URLs to add')
.setStyle(TextInputStyle.Short);
modal.addComponents(ModalTextInput)
await i.showModal(modal);
}``` u lost me what do u mean
oh thats why
Theres an example https://github.com/discordjs/discord.js/pull/7023
const rows = [tvShowInputComponent, haikuInputComponent].map(
(component) =>
new ActionRow<ModalActionRowComponent>().addComponents(component)
);```
this part right>
it gives me an error like this
im gonna try again
you dont need the generics unless youre using TS
is there a way of checking if the interaction is already replied?
Documentation suggestion for @fiery anvil:
<:_:874573879153160212> CommandInteraction#replied
Whether this interaction has already been replied to
send the error
ill send them later
i just wanted to let u know cuz im eating my dinner rn
ok i can send them now
let me find it first
lmao what
One of your command files don't have data property exported
export data property in every command file
follow the guide again, you likely missed a data: property in one of your command files
yeah, you messed up echo
what was i supposed to do
well, compare it to ping.js and you'll work it out
ok thank you
what does module.exports do
is that how i use my slashcommands, and register them
from deploy-commands.js and slash-register.js
i know it exports it from another fiel
I suggest you take some time to learn some basic JS before you start messing with development versions of d.js
where do i start
and how long does it take to learn
few hours
deadass
where do i start
like which one should i click on
@copper jetty
@pallid ice
lmao what?
ik its not v14
and ill ping people if i want to, i was talking to them
secondly, im new here, so i was looking whre to find help
generally yes
yes
You can use just ‘Green’ now in the latest version
TypeError: Cannot read properties of undefined (reading 'resolveColor') at Embed.setColor (/home/liyue/bot/node_modules/discord.js/src/structures/Embed.js:24:32)
wtf?
okay
same
has solution?
replace src/structures/Embed.js with
- const { Util } = require('../util/Util');
+ const Util = require('../util/Util');
TY
alr thank you
welp did modals release?
v14 it's merged, 13 it's still a pr(?)
Question: If canceling a modal isn't indicated against the api, how would I handle a user cancelling a modal and reopening another? Is there a way/example of how to do this with the promises instead of collector?
When i use deferReply on a <ModalSubmitInteraction>, interaction.replied says undefined
await interaction.deferReply({ephemeral: true})
if (interaction.isRepliable()) {
console.log(interaction.replied) //false
}
And trying to reply to it returns 'INTERACTION_ALREADY_REPLIED'
Modals in v14??
you can't reply to already deferred/replied interaction. use editReply()
also Interaction#isRepliable doesn't check the interaction is deferred, or replied.
yes
I know. But interaction.replied should be true or false when i defer the reply to it.
Not Undefined
Nice
The reason why i use isRepliable() is for typings only.
- Yeah it should be false not undefined.
- When you defer replied is still false but deferred will be true
True, i can use deffered instead. Thanks.
Whenever I try editing a ephemeral reply, I get this error. This happens when I click a button, it sends a reply and try to edit it
why?
Do you have fetchReply?
no I dont
You can't fetch ephemeral reply, use editReply method
Ahh yea forgot that
I'm doin such thing, but it throws an error when it edits the reply
Hmm
Have you tried use deferReply?
If you haven't try use it before you editReply
Use collected.update()
Or do that ^^^
That how i do it. @crude valley
You can't reply twice, update is a reply
Update updates the reply
no
Im gonna test
Try defer the reply and use editReply
You are right. On my side, i'm able to do it as my first reply has a button in it so i'm updating the message from the interaction inside the ephemeral message. Otherwhise, i think you can't edit an ephemeral message.
I would suggest you to simply defer the reply instead of saying please wait. Discord will already show a loading thing
Update updates the message the the component is attached to
ohh
ok give me a sec
The thing works fine, but it throws 2 errors on edit
You will need to use .followUp()

When deffering
what are you even trying to do?
@cerulean bay@urban belfry
okay but what are you trying to do?
edit the message, like what? what's the process?
Also, why are you using a collector?
on collector#collect
what do I use exactly?
A simple interaction. With interaction.isButton() and comparing the customId if the interaction matching the one you've set for the button
Like this, you will not be waiting for someone to click the button
Then, simply disable it after your timeout instead
Disabled button is better than a not working one
And what's the difference between a collector and interaction create event?
If your bot crashes or reboots, the button will still be working if not a collector.
I mean, the button works fine. but this error is making me confused
mhm I see
I think this issue isn't related to @dev so u can ask in #djs-help-v14
True
ah but the error doesn't show up in older versions, that's why I'm asking here
d
is there any docs for djs v14?
Read pins
Hi, Is there any reason why Discord.Util.resolveColor() isn't working anymore?
not working as in...? show your usage as well
Not to worry, I've figured it out now.
It seems you can't use .setColor(Discord.Util.resolveColor('Blue')) now when building an embed, and after looking at the code and realising that it should now accept a string again as it did with v13, I tried that and it still doesn't work.
I worked around it for now by removing the new colour setter method from the structure.
there's currently a fix in a PR
I noticed it in #archive-github-djs, for now I'll work with my modified structure and wait for the fix before turning all my setColor() methods back to strings.
I must say I am always happy with the help and support offered here.
Did anything change in displayAvatarURL for when i try to get the Bots Avatar URL in png format it still gives it has a webp
and it even shows the formats that i can put
`you're looking at the wrong docs
this is what they take in now https://discord.js.org/#/docs/rest/main/typedef/ImageURLOptions
how do you use Custom Emojis in SelectMenu Options setEmoji(APIMessageComponentEmoji)
The Guide does not mention anything related to that
nor do the Docs explain what an APIMessageComponentEmoji is
Instead of using format: 'png' use extension: 'png'
ahh okay
probably { name: "emoji" }
neh, had to look at code to figure it out

has to be converted to
{
"name": "disableNoSwitch",
"id": "831557873070637066",
"animated": false
}
kinda shitty how they removed the resolvers
they exist on djs, the package, on the util class, not on builders, moving it out to builders means they wouldn't have access to that
probably can be added back to djs builders
How can I collect a modal text input after user submit?
Construct new InteractionCollector or listen to interactionCreate event
Over the interaction event. Check with isModalSubmit() i guess.
isModalSubmit()
Thx ❤️
Can I get an example function for Sweepers.guildMembers.filter?
Hey its me again, So I've been working on the modal submit collector and this works:
let string: string = '';
const modal_collector = new InteractionCollector(client, { interactionType: InteractionType.ModalSubmit, max: 1})
modal_collector.on('collect', async (modal_interaction: ModalSubmitInteraction) => {
string = modal_interaction.fields.getTextInputValue('textinput')
await modal_interaction.reply({content: `Entered ${string}`})
})```
However, I'm wondering if this is the right way to go. Does it work the same as https://discord.js.org/#/docs/discord.js/main/class/Message?scrollTo=createMessageComponentCollector ?
This is the right way to go
ok thanks
components[2].components[0].emoji:
{ id: '946108238737338388', name: 'News', animated: false }
components[2].components[1].emoji:
{ id: '946108238817030174', name: 'Category', animated: false }
DiscordAPIError[50035]: Invalid Form Body
components[2].components[0].emoji[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
components[2].components[1].emoji[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
whats the issue here
both emojis are valid


new Discord.SelectMenuOption()
.setLabel(<channel>.name)
.setValue(<channel>.id)
.setEmoji(<client>.objectEmotes.channelTypes[<channel>.type]);
<client>.objectEmotes.channelTypes:
"4": { "name": "Category", "id": "946108238817030174", "animated": false },
"5": { "name": "News", "id": "946108238737338388", "animated": false },```
this the code for it
What is c? It's obviously not getting the object, so there is where you begin debugging
:
Hi guys, is there an example for the modal builder available?
Thanks
Much appreciated.
Hello how can i install 13.7.0 dev version
no
Don't know why but if I do client.user.setActivity('.help') It doesn't work
@scarlet tangle
one way to find out
.addChoice() got removed too? ._.
in the sense I dont think it ever existed, probably
in the SlashCommandBuilder
But yeah I think we're shifting to use the plural methods only
takes rest parameters similar to all other plural methods
thanks
how i can get label or min max values of a input text
how does <Embed>#setColor() work now?
You can read docs here https://discord.js.org/#/docs/builders/main/class/Embed?scrollTo=setColor
I did
👍
.setColor(member.displayColor)
TypeError: Cannot read properties of undefined (reading 'resolveColor')
at Embed.setColor (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\Embed.js:24:32)
at Object.execute (H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\utility\userinfo.js:67:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
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)
That's a bug that has a current pull request
any alternative?
No
rip
i can not right?
only type value and customid
Yeah the ModalSubmit doesnt receive those values
F
so they copy paste in the src of djs builders lmfao
...what
in the builders input text there are this.data.label lmfao
and its null for a ModalSubmitInteraction
Not seeing the issue
The label needs to exist in builders
it's going to be removed soon when we don't return builders from the API
is there a way to check to avoid Interaction has already been acknowledged errors?
bruh
how do I get guild id in modal submit interaction
ok its extending Interaction so guild.id
can i collect modal replies through MessageComponentCollectors on Messages or Channels
it seems like i cannot, are there plans to add this?
(quick dumb question) does .addField got removed? if yes then what is the alternative? [I got error when adding an Embed with .addField]
plural, same usage
.addFields(...fields), also works with one
oh alr thx
did modals release 😐
its available on the dev branch
Is there a way to put the menus inside the modals?
not yet, more types coming, so far only text input
From no where the setColor on the Embed Not work anymore and its a DecimalColor
So idk what changed
It's a bug
setColor now takes a number iirc, so 0x would work ig
For i have it like this
Jiralite said theres no alternative so i think you have to downgrade
Have anything changed in setEmoji? to for
{ name: "emoji" }
Ahh ok
So would this work?
just read it is a bug so prob not, didn't know it was there srry
ahh okay
Hi guys
when try to add emoji to selector i've this error
Only dictionaries may be used in a ModelType
{
label: "HTC Vive",
value: "vive",
emoji: "950797639237128252"
},
This is an option ↑
can u help me pls
oh
thx bro
Hi , when im trying to get user avatar url
Iw always give me webp format in v14
user.displayAvatarURL({ format: "jpg" })
it's extension now
How ?
const yy = user.displayAvatarURL({ format: "png" })
Didnt work
did you read the linked documentation?
Yes
where did you find format in it?
and my message? ._.
there's no format, there is extension
Discord api was having some issues try again
Hey, where is the MessageComponentsOptions type ?
Do you mean ComponentType
No, MessageComponentsOptions
Where in the source code?
No, it's impossible to import the type
because it doesn't exist
What are you trying to do?
It seems that the components are broken
Go to v14 ( dev )
What?
I develop in Typescript
What code is not working?
{ name: “emojiName” }
They come from discord-api-types
Oh okay ! Thanks !
Then I suggest installing it
no i have it installed
npm ls discord.js
i know i know
Follow this https://discordjs.guide/
k
npm install discord.js@dev
alright, now you move to #djs-help-v14 since thats obviously not dev related 
k xd
I've just noticed that my bot doesn't receive directMessages since i upgraded to djs14. Anyone having this issue?
Yes
Ho, actually, i've disables partials. Let me try that.
I see.
That was the issue. Thanks xD
/Users/nikan/Nikan-Utilities/node_modules/discord.js/src/structures/Embed.js:24
return super.setColor(Util.resolveColor(color));
^
TypeError: Cannot read properties of undefined (reading 'resolveColor')
at Embed.setColor (/Users/nikan/Nikan-Utilities/node_modules/discord.js/src/structures/Embed.js:24:32)
at nikansUtil.<instance_members_initializer> (/Users/nikan/Nikan-Utilities/src/structures/Client.ts:35:110)
at new nikansUtil (/Users/nikan/Nikan-Utilities/src/structures/Client.ts:55:5)
at Object.<anonymous> (/Users/nikan/Nikan-Utilities/src/index.ts:4:23)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Module.m._compile (/Users/nikan/Nikan-Utilities/node_modules/ts-node/src/index.ts:1455:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions.<computed> [as .ts] (/Users/nikan/Nikan-Utilities/node_modules/ts-node/src/index.ts:1458:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
why do I get this error on Util import?
known bug at the moment
so i'm not really sure if this goes here or in #archive-builders since it's builders @ dev (sorry whoever i pinged), but
do UnsafeModals need to go through @discordjs/rest (like Slash Commands or Context Menus) or can you use them like Buttons or Select Menus?
Neither, you use them with interaction.showModal()
huh
no that was it lmao; ig the way i was thinking was like: oh somebody joined a server, lemme throw a modal up in their face 
Nope, its a type of reply :(
interesting, thanks
How do I make interaction.fields.getTextInputValue not throw an error if the field doesn’t exist? (TypeScript)
✨ try catch ✨
Why do you try to get a non existing field tho?
This field will exist if a user selects something in the slash command and will not exist if not
could also make it required (if it should be always present)
if the field is empty it returns an empty string, not error
No, the field will not exist at all
Yes, was talking to mega
Ok
Hello when using the guildMemberAdd Event
Can I get the Inviter ?
no
.addField({name: "Kick", value: `${message.guild.me.permissions.has("KickMembers")? "Yes": "No"}`})```
It shows yes even if it doesn't have the permissions. Any idea why?
Did the <member>.presence.activities change? for everytime i try to eval it i just get null
and one more question did message.args get removed?
message.args? was never a thing
I have an engineering question (not sure if this is the right channel). If I'm trying to make my bot configurable for different servers, I should just store the settings in my database mapped to the server ID, right? Or is there a clearly better solution?
Right but this channel is for dev version of discord.js
Where ıcant find
look changes for partials
show full error
How do you add the AttachmentOption type with the discordjs/builders
.addAttachmentOption()
How about normal slash commands?
The same
const command = {
...,
type: 4,
};
Thank You!
type: 'AttachmentOption'?
11
ApplicationCommandOptionType.Attachment
Alright
Documentation suggestion for @latent lion:
<:_:876041770423701554> Discord Developer docs results:
• Change Log: Interaction Modals and Application Command Attachment Option Type
• Application Commands: Application Command Object
Please don’t recommend magic numbers
they were using them so I gave that too ._.
Oh I missed that ignore me
I am getting this issue: TypeError: (intermediate value).setName(...).setDescription(...).addAttachmentOption is not a function The current version of discordjs/builders I am using is ^0.12.0 should I be using a different version to have the addAttachmentOption()?
use builders dev version
npm i @discordjs/builders@dev
channels aren't bitfields so they should be using enums right?
Please don't send pictures
Yes
if(type === "threads" && !interaction.guild?.features.includes("PrivateThreads")) return await interaction.reply({ content: `:Failure: This server does not have access to private threads.`, ephemeral: true })
You use the GuildFeature enumerable
GuildFeature.PrivateThreads?
Try it and see
O K
Your IDE should autocomplete it
im using pterodactyl
What is that?
its a panel used by a lot of hostings
Yes it worked
Why doesn't streaming activity type work?
needs to be a valid twitch stream url
Let me try
unsure of the rest of the syntax but that's not optional
Wdym?
pretty sure the type is wrong as well
Oh
ActivityType.Streaming
Thanks
Yeah basically you can only fake streaming with a bot or a bot user and/or client mods
I am receiving this error, and I am confused to what could be causing it.
^ it repeats itself multiple times
The .setname command's code is ```js
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('setname')
.setDescription('change the name of a channel')
.addChannelOption(option => option.setName('channel').setDescription('the channel you want to rename').addChannelTypes('GuildText').setRequired(true))
.addStringOption(option => option.setName('name').setDescription('The new name of the channel').setRequired(true))
.addStringOption(option => option.setName('reason').setDescription('The reason for the change').setRequired(false)),
async execute(interaction) {
const Channel = interaction.options.getChannel('channel');
const Name = interaction.options.getString('name');
const Reason = interaction.options.getString('reason') || 'No Reason Provided';
Channel.setName(Name, [Reason]);
await interaction.reply({ content: `I have changed ${Channel.name} name to ${Name} successfully.`, ephemeral: true });
},
};```
use the enum values for addChannelTypes
ChannelType.GuildText
Thanks! For future reference where did you find that?
in the docs
Okay.
Thank You!
I cant find message button in v14 docs for some reason
ButtonComponent
Does it work with other urls other than YouTube and twitch?
No, only those two will work.
What is this mean
{ name: 'string' }
thx
Why are UnsafeModal and UnsafeTextInputComponent not re-exported in discord.js?
what's the problem, I cant set color for embed
because it's dev version
It's a bug
#7615 in discordjs/discord.js by Raiden-Ei opened <t:1646627434:R> (approved)
fix(Embed): fix incorrect destructuring import
📥 npm i Raiden-Ei/discord.js#main
I was testing the new Attachment option but the error says it's not a function
oh cool
send code
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('attachment')
.setDescription('Attach files.')
.addAttachmentOption(option => option.setName('file')
.setDescription('the file to attach.')),
permissions: 'Administrator',
async execute(interaction) {
console.log(interaction.options.getAttachment('file'));
await interaction.reply('Pong!');
},
};```
Yeah I was just asking whether this is an oversight
most likely an oversight yeah, will pr
Do npm ls @discordjs/builders in your terminal and send the output
and your error?
could someone show me how to add a string option for choices? since the documentation isnt complete its very confusing
got it working - for the future if you want to add a single choice you'd do stringoption.addChoices({ name: '', value: '' })
pretty self explanatory, and that is explained in the guide
not self explanatory when you've been using d.js for years and so many drastic changes have been made that break the predictability of the library
also colours in embeds appear to be broken i am unable to set numerical RGB colours or resolvable colours <embed>.setColor('Blurple') / <embed>.setColor('0xFFFFFF')
TypeError: Cannot read properties of undefined (reading 'resolveColor')
known bug
sound
any temp fixes? otherwise I can quickly hook up a temp solution for myself by manually adding back the resolveColor method into the code
you can import the embed from builders directly if you don't use camelCased constructor input or you edit the local file with the fix which is to remove the {} from the util import
otherwise wait for the pr to get merged and released
yeah fixed the import for now
hi, so i ran into a problem whilst updating to the newest dev version
const jumpButton: ButtonComponentData = {
label: "Jump to your DMs",
url: startMessage.url,
style: ButtonStyle.Link
};
const jumpRow = new ActionRow({
components: [jumpButton]
});
interaction.reply({embeds: [successEmbed("Started the application process in your DMs")], components: [jumpRow]});
used this code and ran into the error Error: Cannot serialize component type: undefined, which I found someone asked earlier and components doesn't take an array anymore... so I changed that
const jumpButton: ButtonComponentData = {
label: "Jump to your DMs",
url: startMessage.url,
style: ButtonStyle.Link
};
const jumpRow = new ActionRow({
components: jumpButton
});
interaction.reply({embeds: [successEmbed("Started the application process in your DMs")], components: [jumpRow]});
then i ran into this error TypeError: components?.map is not a function, which wants me to change it back to an array
im a bit stuck, any help?
You need to specify type
ComponentType.Button
components: jumpButton
Keep the jumpButton in array
ty
one more question, curious why this throws a type error
const jumpButton = new ButtonComponent({
label: "Jump to your DMs",
url: startMessage.url,
style: ButtonStyle.Link,
});
const jumpRow = new ActionRow({
components: [jumpButton] // ERROR HERE
});
Type 'ButtonComponent' is not assignable to type 'APIMessageActionRowComponent | APITextInputComponent'.
Type 'ButtonComponent' is not assignable to type 'APIButtonComponentWithURL'.
Types of property 'url' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
it works fine with my method above using a ButtonComponentData object, but not a ButtonComponent
yeah thats why i did the mistake of forgetting ComponentType earlier, I switched from ButtonComponent to ButtonComponentData and forgot to add the type back
but i prefer ButtonComponent because of the camelCase customId so just wondering why this throws that error, i can use ButtonComponentData object but its not ideal
hi, for addChannelTypes, i see that it should be taking rest params (but docs doesn't show it properly), any example for this?
nvm got it to work, missed out on a bit in my code
how is the "manage permissions" permission called?
I dont think theres manage permissions permission
ManageChannels
nope that doesnt work
thats ManageRoles
Ok
It says channels permissions
but discord
good for you that you can read, doesn't matter tho
ManageChannels is just the channel name and stuff
why
seems like you have no perms to send msg to the channel
No perm to create the channel*
probably a good idea to check your bot's actual permissions, that tick screen is just an invite url generator...
i used to set the presence like this, client.manager.init(client.user.id); client.user.setPresence(client.config.presence); client.log("Successfully Logged in as " + client.user.tag); but now it gives me this error TypeError: Cannot read properties of undefined (reading 'presence')
Do you need the webhook intent to make webhooks works or??
Do you have it in the ready event?
yeah
doesnt seem like a d.js error, make sure your "config" property is actually set
oh ok
Thx u were right
someone know what is this ? (node:18624) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time (Use `node --trace-warnings ...` to show where the warning was created)
you can ignore it
does ChatInputCommandInteraction was the new BaseCommandInteraction?
ChatInputCommandInteraction different from BaseCommandInteraction iirc, you might be looking for CommandInteraction instead
Did the <member>.presence.activities change? for everytime i try to eval it i just get null
<Embed>#setColor() now takes a ColorResolvable?
not just a number?
Yes
interaction.channel.send({embeds: [new Discord.Embed().setTitle('hi').setColor(Discord.Util.resolveColor('AE6800'))]})
whats wrong
i need help
#AE6800
how do i make this
Read this https://discordjs.guide/popular-topics/embeds.html but apply v14 changes
tf no
status: "online",
activities: [
{
name: "Music on a few guilds",
type: "LISTENING",
},
],
});``` this code doesn't give me errors but dont show up on discord either
Use enums instead of strings ActivityType.Listening
have to import it?
Thank you
guys, i used to use this way in V13
const client = new Discord.Client({
intents: Object.keys(Discord.Intents.FLAGS)
})
how can i do it in V14?
GateawayIntentBits
Don't use all intents, choose the ones you need
i want them all
i don't want to type them all
btw this haven't worked
Uncaught TypeError TypeError: Object.hasOwn is not a function
update Node.js to 16.9.0 or newer
ok
it worked, thank you
Code: ```js
const TextInput = new Discord.ActionRow().setComponents(
new Discord.TextInputComponent()
.setLabel('Label')
.setCustomId('customId-example')
.setPlaceholder('type:')
.setStyle(1)
)
await i.reply({ ephemeral: true, embeds: [Embed], components: [TextInput]})
```console
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0][COMPONENT_TYPE_INVALID]: The specified component type is invalid in this context
what is the problem?
You need to add that ActionRow to Modal
i will see
Worked, thank you
Btw setColor should be fixed now
gonna bump this here, any solutions?
why is there a error?
oh, figured it out, I did { name: ... } instead of { text: ... }
only icon and not icon_url
It’s iconURL
it doesn't matter both work
Yea meant icon_url and iconURL will work
format isn't an option anymore, it's extension now
and dynamic is now forceStatic
May i know the reason why Embed#addField is removed?
Because we have addFields() which does the exact same thing, but can do multiple
the same change will be happening across all builders as well, so addComponent will be removed etc
But now we need to pass objects
you had to pass objects to addField anyway even if it wasn't removed?
MessageEmbed#addField(name, value, inline)
that was for v13, in @dev it was changed to use an object
Thats my issue
its been discussed many times and this is the change that came out of it, it's easier to have a single method that can do one or multiple
My problem is now i have to construct an object for each fields
oh no, we need to add a few more characters and now we have intellisense for field options and it removes a useless method... yeah I'm team addFields ngl
i find it easier to use addFields, can just create an array of fields and spread them into the method, saves having loads of addField... i feel it actually declutters rather than creates more
You could also do that in v13
But anyways, i can define Embed#addField by my own, i don't want to talk about it anymore
Where can we now find APIErrors that lived under Constants?
RESTJSONErrorCodes enum
i use addField more because if i get any error it will then declare which line aka which block of field generated that error which is difficult to find in addFields
i would suggest to add addField back as it's useful
you can just use multiple addFields?
can we?
why you can't?
i thought we can use only one lmao
then there's no issue
yep
it has been removed yes
What's the new way of initializing a MessageActionRow? Apparently it isn't a constructor anymore: js new Discord.MessageActionRow()
Read the pins
So you couldn't have told me it was just js new Discord.Modal()
...
Considering that's still wrong, no
It worked
oh sorry got it fixed now
why is custom ids now required for URL buttons?
It’s not
v14 is out?
Pins
I kept getting the error with a url button and I added a custom I'd and it's gone now
That's a bug if that's the case, but you might not have correctly changed the button style to the new input?
can u share ur code?
yeah i think theres a problem with button typings, for example:
const jumpButton = new ButtonComponent({
label: "Jump to your DMs",
url: startMessage.url,
style: ButtonStyle.Link,
});
const jumpRow = new ActionRow({
components: [jumpButton] // ERROR HERE
});
Type 'ButtonComponent' is not assignable to type 'APIMessageActionRowComponent | APITextInputComponent'.
Type 'ButtonComponent' is not assignable to type 'APIButtonComponentWithURL'.
Types of property 'url' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
correct me if im wrong, its just no one has given me a solution so im assuming there is probably none
What's inside of the startMessage.url variable?
startMessage is just a message url
it’s not a problem with that, i’ve even used a ButtonComponentData object with the same info it’s just the ButtonComponent which is messing it up
There's a fix for this in a PR
How do I use modals?
Check out the guide on creating, sending and receiving modals here:
https://deploy-preview-1060--discordjs-guide.netlify.app/interactions/modals.html
awesome thanks
Np
Also will the .showModal() function be added in ModalInteraction event?
Ask discord
?
Oh it's Discord's API limitation?
oh you mean responding to a modal with another modal
Mhm
yeah discord api limitation
So we can make a big form
Oh sad
C:\Hydro\node_modules\discord.js\src\structures\Modal.js:6
class Modal extends BuildersModal {
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (C:\Hydro\node_modules\discord.js\src\structures\Modal.js:6:21)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Hydro\node_modules\discord.js\src\index.js:127:17)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
Node.js v17.5.0```
I get this error when I update to the latest version of discord.js@dev
Show the code for BuildersModal (where you import it)
I don't import it
Oh that's from discord.js
Yes
Are you using a modal anywhere?
I think so I haven't seen that b4
Nvm
I uninstalled discord.js@dev
and reinstalled it
Also, How do I show modal to a specific channel ?
Look at the guide, link is in pins
It says about interaction
what bout message ?
Also was .addField changed again ?
TypeError: (intermediate value).setTitle(...).setThumbnail(...).setDescription(...).addField is not a function```
.addField({name:"About Me:", value:"I am Gamecord. A Bot Made To Display Game Stats Directly in-to your servers.\n I Do This With The Help Of Official And Unofficial API's.",inline: false})```
This is where the error is coming from
What's ur builders version? npm ls @discordjs/builders
I don't have it installed
gamecord@1.1.0 C:\Hydro
└── (empty)```
Can you run it anyways?
there you go
Use npm why instead of npm ls
kk.
C:\Hydro>npm why @discordjs/builders
@discordjs/builders@0.13.0-dev.1646913825.dcd4797
node_modules/@discordjs/builders
@discordjs/builders@"^0.13.0-dev" from discord.js@14.0.0-dev.1646914074.dcd4797
node_modules/discord.js
discord.js@"^14.0.0-dev.1646914074.dcd4797" from the root project```
Oh right, the singular method was removed
You can safely change it to addFields (plural)
ooof
Iirc you can respond with model only for interactions
Though I don't think so...
A Person Made This
And this is a command, so it will obviously use message.
a button is an interaction
so How do I show modal using it ?
<ButtonInteraction>#showModal ig
I'll let you know if that works...
did anything change for button emoji it keeps returning me a cracked error
var _this = _super.call(this) || this;
^
ZodError: [
{
"code": "invalid_type",
"expected": "object",
"received": "string",
"path": [],
"message": "Expected object, received string"
}
]
at new ZodError (F:\Hurricane\node_modules\zod\lib\ZodError.js:81:28)
at handleResult (F:\Hurricane\node_modules\zod\lib\types.js:115:21)
at ZodObject.ZodType.safeParse (F:\Hurricane\node_modules\zod\lib\types.js:192:16)
at ZodObject.ZodType.parse (F:\Hurricane\node_modules\zod\lib\types.js:173:27)
at ButtonComponent.setEmoji (F:\Hurricane\node_modules\@discordjs\builders\dist\index.js:3:4858)
at Base.run (F:\Hurricane\Src\Interface\Commands\Base\Security\antinuke-wl.js:151:79)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
issues: [
{
code: 'invalid_type',
expected: 'object',
received: 'string',
path: [],
message: 'Expected object, received string'
}
],
format: [Function (anonymous)],
addIssue: [Function (anonymous)],
addIssues: [Function (anonymous)]
}
any idea? how can i fix it?
provide an object
with what properties?
id, name and/or animated
i see but if its a inbuilt discord asset cuz they don't have ids
I think you do { name: '🍴' }
ok i'll try thanks for helping me out
theres a pr to accept emoji strings
#7616 in discordjs/discord.js by suneettipirneni opened <t:1646667379:R> (changes requested)
refactor: allow button builders to accept emoji strings
📥 npm i suneettipirneni/discord.js#discord.js/refactor/allow-emoji-strings
Do autocomplete responses not accept an array of objects or something?
<:_:874569335308431382> AutocompleteInteraction#respond()
Sends results for the autocomplete of this interaction.
Same as v13
actually, why are they not using var args
Same thinking xD I'll make a pr today
Ig this is the only method left which accepts array
error
Bot is online!
C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:9
const exampleEmbed = new MessageEmbed()
^
ReferenceError: MessageEmbed is not defined
at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:9:28)
at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)
at Client.emit (node:events:520:28)
at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:520:28)
Code
const { Embed } = require('discord.js')
module.exports = {
data: {
name: 'help',
description: "help how to use this bot",
},
execute(message, args){
const exampleEmbed = new MessageEmbed()
.setColor('#ff2436')
.setTitle('Help')
.setDescription('This command is a help command')
.addFields(
{ name: 'Commands', value: '-about\n-help\n\nAdmin commands\n-ban\n-kick' },
{ name: 'Roles', value: 'Owner = Owner of the roblox server\nDiscord Owner = Owner of the discord server and me the bot\nHigh Mod = High Mod in discord and ingame\nMod = Mod in discord and ingame\nAdmin = Admin ingame\nVerifyed = Players\nBots = Bots in discord\n' },
)
.setTimestamp()
channel.send({ embeds: [exampleEmbed] });
}
}
thats common sense
was looking at the wrong class to fix

