#djs-in-dev-version
35223 messages · Page 10 of 36
does discord.js@14.0.0-dev.1647259751.2297c2b use api v10?
no, it's merged but not released yet
Is message.awaitMessageComponent different in DJS v14?
no
the only difference is the componentType option is an enum, not a string
but it works exactly the same
how use in v14 "ActionRow" --> components???
its ActionRowBuilder
What does this error means ?
Ah okay.
Interesting cause I can’t use collectors for select menus
Can you show your code?
d.js tried to make an api call, but client.token was null
Either the client was destroyed or you manually edited the property
That doesn't make sense
How so?
Well, I mean that you tried to make an api call via d.js
Looks like a channel.send
Ah yes I'm doing this kind of api calls
That's not d.js tho
Also not a channel.send
Stack doesn't include where it was called, unfortunately
Yes that why i'm stuck
But, that's not d.js ?
No
Well, it is our packages (the discordjs org), but not the d.js package
Ah yes okay
You can actually use the apiRequest event to track when an api request is made
how would i get a commandinteraction's options? the options property is not in the docs for commandInteraction for main branch
CommandInteraction can be context menu or slash command, ChatInputCommandInteraction#options
Is it not in the dev version? 
ohh okay, thanks
👍
Oh, right, dev uses the rest package
oof, so modals only support unicode emojis, and there's no emoji picker?
when V14 is planned to be released or there is not date yet?
when its ready to release
const menuRow = new ActionRowBuilder({
components: [selectMenu.toJSON()]
});
is it intended that we have to call toJSON() on adding components to action rows now?
otherwise it throws this error: Type 'SelectMenuBuilder' is not assignable to type 'APIMessageActionRowComponent | APITextInputComponent'.
Are modals coming in 13.7 or 14?
Ugh modal submitting still isn't fixed...
i think you should pass a type parameter:
new ActionRowBuilder<SelectMenuBuilder>({ components: [new SelectMenuBuilder()] });```
Yeah, though more generically it should be something like MessageActionRowComponent or ModalActionRowComponent
I forget exactly unless that's changed
Maybe you can fix urself until new version comes out
When will discord.js v14 out?
when its ready
...
廢話... I also k when it is ready...
Thats literally the answer everyone gets, check pins
v14 isnt official right?
Its in development
no it is it's just still in development
I mean it's official, as in its by the discord.js team
Is this error a known issue? DiscordAPIError[50035]: Invalid Form Body 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
I get it while trying to make a select menu.
If there's a PR for it, lmk.
code?
const row = new Discord.ActionRowBuilder().addComponents(
new Discord.SelectMenuBuilder()
.setCustomId('menu')
.setPlaceholder('Nothing Selected')
.addOptions([
{
label: 'Select me',
description: 'This is a description',
value: 'first_option',
},
{
label: 'You can select me too',
description: 'This is also a description',
value: 'second_option',
},
]),
);
await interaction.editReply({ components: [row] });```
addOptions doesn't take an array
spread it or pass them individually .addOptions(option1, option2)
oh..
The guide said addOption was not available. (this one: https://deploy-preview-1011--discordjs-guide.netlify.app/additional-info/changes-in-v14.html)
I'm not talking about addOption
see my message again
Oh. Anyways thanks for the help.
It feels it takes ages for 13.7 😄 I really have some cool implementation
How can I send buffer to an interaction, I tried that but idk if the buffer isn't a real buffer or I did something wrong with the attachement
TypeError [INVALID_TYPE]: Supplied channel is not a GuildChannelResolvable.
kinda explains itself
whatever you provided is not a channel
Hey guys its safe start use v14?
no
How mush more time to wait ?
when it's released
many many time
i dont know how many
Xd i want use modls have other way ?
Just wait
Oki :)
you could install the dev branch but its unstable
I have big xommunity and bot cant stop work all time, maybe its better wait
the dev branch is not meant for production use at all
i use it for production
dont care + didn't ask + not relevant
I haven't encountered any error through this process fyi
this is changed?
client.generateInvite({ scopes: ['bot', 'applications.commands'], permissions: ['ADMINISTRATOR'] })
the permissions need changing, checl the guide
and the scopes too, need to use the enums
- new PermissionsBitField()
this is req?
yes
i cant find
name: 'black-list',
options: [
{
name: 'data',
description: 'Lists the users in the blacklist.',
type: 1,
options: []
}]
Is this necessary to change?
and my bot Slash Commands not loading
help?
yes
it's not finished yet so can't tell but read the guide (pins)
i cant find scopes
and my bot is ready for v14
but where is slash commands 🤔
When using collectors, I'm attempting to collect data from a select menu. In DJS v13 it works fine, but when using the development build the interaction just gets deferred with no errors.
const filter = (async (i) => {
if (i.customId.split("-")[1] != i.member.id) {
await i.deferReply({ ephemeral: true });
return await i.editReply("Only <@" + i.customId.split("-")[1] + "> can use this menu!") && false;
}
return await i.deferReply() || true;
});
message.awaitMessageComponent({ filter, componentType: 'SELECT_MENU', time: 60000 }).then(async (interaction) => {
}).catch((err) => {
return;
});
``` the status here works but thats about all, did it change? - cant get the activity to work
@zealous sierra @scarlet tangle you have to use enums instead of strings now, you can find the enum names in the docs for the method, they should all be re-exported from d.js
ah ic. ty!
const { ComponentType } = require("discord.js");
message.awaitMessageComponent({ filter, componentType: ComponentType.SelectMenu, time: 60000 })
Thanks!
;)
help :/
cant seem to find one, do you mind sending a link?
any info about APIApplicationCommandOptionChoice the documentation doesn't have info abt it
it's from discord-api-types
thanks, I randomly tried 1&3 and 3 happened to be what I needed lol, anyways im definetely pinning this link on my browser
How to fix?
Code?
I don't know how your command handler works
İs that impposible to share screnn in v14 ?
yes
bots don't have screens
Yes, it is impossible.
V14 (Dev) is can't load Slash Commands :/
@undone yew
you only showed the command itself, instead show the command registration code
wait
ss or direct code file?
any clue when https://github.com/discordjs/discord.js/pull/7649 might merge and release? It looks to be approved and It's blocking my current release 😦
we don't work on etas pal
as always "no eta"
you know the drill, "when it's ready"
does not fit in the screenshot
you should really use global commands
How will I do?
and group the permissions so you only do one request per guild
refer to the guide
Wdym how
Impossible means not possible
src regarding the sent components 👀
Hey there!
When a user responds to a model (by using the button "Send" button), I get this error (I'm using discord.js@dev):
/Users/max/Documents/Bot/eliott/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:43
this.components = data.data.components?.map(c => createComponent(c)) ?? [];
^
TypeError: createComponent is not a function
at /Users/max/Documents/Bot/eliott/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:43:54
at Array.map (<anonymous>)
at new ModalSubmitInteraction (/Users/max/Documents/Bot/eliott/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:43:45)
at InteractionCreateAction.handle (/Users/max/Documents/Bot/eliott/node_modules/discord.js/src/client/actions/InteractionCreate.js:69:25)
at Object.module.exports [as INTERACTION_CREATE] (/Users/max/Documents/Bot/eliott/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (/Users/max/Documents/Bot/eliott/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketShard.onPacket (/Users/max/Documents/Bot/eliott/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:22)
at WebSocketShard.onMessage (/Users/max/Documents/Bot/eliott/node_modules/discord.js/src/client/websocket/WebSocketShard.js:304:10)
at WebSocket.onMessage (/Users/max/Documents/Bot/eliott/node_modules/ws/lib/event-target.js:199:18)
at WebSocket.emit (node:events:526:28)
Node.js v17.5.0
Does someone have an idea? Thx
known bug
Is there a way to fix it rn?
by not using modals
:/
and isn't there a way if I want to use them? ^^
Code?
you can use an earlier commit though that was before the *Builder changes, the pr to fix this error is https://github.com/discordjs/discord.js/pull/7649
that's internal
ok ty
i think that's not coming from my code bc the modal is built correctly
You use ModalBuilder right?
it's an internal error, nothing to do with userland code
using builders or not won't affect it
Alr
What is the permission to ping all like KICK_MEMBERS
PermissionFlagsBits.MentionEveryone
so like this
if(!message.member.permissions.has(PermissionFlagsBits.MentionEveryone)) return message.reply("You can't mention Everyone")
if(!message.guild.me.permissions.has(PermissionFlagsBits.MentionEveryone)) return message.reply("I can't mention Everyone")
seems fine
What’s in for this update?
Error
C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\pingall.js:7
if(!message.member.permissions.has(PermissionFlagsBits.MentionEveryone)) return message.reply("You can't mention Everyone")
^
ReferenceError: PermissionFlagsBits is not defined
at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\pingall.js:7:44) at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:53: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)
You know you don’t have to show the whole error stack
code
module.exports = {
data: {
name: "kick",
description: "this command kick a person!",
},
execute(message, args){
if(!message.member.permissions.has(PermissionFlagsBits.MentionEveryone)) return message.reply("You can't mention Everyone")
if(!message.guild.me.permissions.has(PermissionFlagsBits.MentionEveryone)) return message.reply("I can't mention Everyone")
message.reply("||@everyone|| you all just got pinged by me")
}
}
then what?
I guess it’s fine. Just don’t need to know your file structure
you obviously have to import it, it's re-exported in d.js from dapi-types
showing thr ehole error stack is recommended here
so what should i import?
PermissionFlagsBits
from what?
or PermissionsBitField and access Flags
from d.js
d.js?
discord.js
oh ok
error
if(!message.member.permissions.has(PermissionFlagsBits.MentionEveryone)) return message.reply("You can't mention Everyone")
^
ReferenceError: PermissionFlagsBits is not defined
Your variable is not defined.
const { PermissionsBitField } = require('discord.js');
module.exports = {
data: {
name: "pingall",
description: "this command pings all!",
},
execute(message, args){
if(!message.member.permissions.has(PermissionFlagsBits.MentionEveryone)) return message.reply("You can't mention Everyone")
if(!message.guild.me.permissions.has(PermissionFlagsBits.MentionEveryone)) return message.reply("I can't mention Everyone")
message.reply("||@everyone|| you all just got pinged by me")
}
}
code
I'd advise you to brush up on your js in #resources before trying a dev release
Use PermissionsBitField instead
works now
thanks! 👍
It’s not that he/she is bad at JS, it’s just a silly mistake people make, use the wrong variable. Even senior devs make that mistake, maybe they just debug first or use some common sense I guess :)
But redirecting him/her to another server just waste’s time, and has nothing to do with JS knowledge. We can help the person as much as anyone else can.
Note to @scarlet tangle: if you see * is not defined, just think about it logically. The variable was not defined. May be a scoping issue, may be you just making a simple typo
k
help please
i am trying to use APIButtonComponent but it will only let me use ButtonComponentData
what node version is required for v14
16.9
ty
Ok i just imported APIButtonComponent from discord-api-types/v10
Code: ```js
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
Error: `Cannot read properties of undefined (reading 'FLAGS')`
Read the pinned guide
Nvm, i got fixed.
can someone help me?
Don't reply twice
And ask in discord-modals support server if you use it
Is there any difference in function between these 2?
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord-api-types/(9/10)');
A bit confused
could be wrong but i think they are the same, djs imports it from discord-api-types and exports it
they are the same why would they name different things the same
I don't mean specifically the imports, more the difference (likely none) between importing from "discord.js" and "discord-api-types"
Thanks
I keep getting an ActionRowBuilder is not defined error. I'm on the latest discord.js@dev and @discordjs/builders. Any known work arounds?
Import it from discord.js
Using const { ActionRowBuilder } = require("discord.js");?
yes
That's how I'm importing it. Still getting the not defined error
• ReferenceError: "x" is not defined: learn more
• TypeError: Cannot read properties of undefined/null (reading "x"): learn more
It is normal to an button be caught by the collector and the interactionCreate event?
a collector is just a (temporary) wrapper around the client event, you will always get all interactions in interactionCreate
How old are you, I am 36 years old
Got it, thks
Hey, I saw this PR addressed in this channel already but didn't see any help with installing it https://github.com/discordjs/discord.js/pull/7649 (the one that fixes modal input). I've tried several ways of pulling it to no avail. Even though this PR is likely to merge soon, I'd like to know how i'd install it myself for any future needs (of installing a PR). How would you do it?
Please ping me for anything
Help, why does this error show?
The error line is here
Does that api not return the image alone?
image is supposed to be an object
Most likely image: { url: "…" }
Yes
What does it return then?
This works
I'm recieving an internal error from discord.js while using an interaction collector. It gets triggered whenever I interact with a select menu for a second time.return options.fetchReply ? this.fetchReply() : undefined; ^ TypeError: Cannot read properties of undefined (reading 'fetchReply')
Are the docs for v13 valid in v14?
you passed undefined to the options
show your code
i just said it was an internal error
it has nothing to do with my code
internal errors r most of the time because of the developer
then why does it not provide a location of error on my code?
a big reason for internal errors is you passing the wrong type of data 
can you just show the code
well here's my code: js const collector = new Discord.InteractionCollector(interaction.client, { componentType: 3 }); collector.on('collect', async collected => { await interaction.editReply({ embeds: [embed] }); await collected.update(); });
see that, update is called without anything
shouldnt you be using .createMessageComponentCollector instead of using new InteractionCollector
what am i supposed to pass with update()?
uhm, that wouldn't work under v14.
it's the same as editing the original message, so interaction.update({ embeds: [embed] })
it's updating a select menu interaction?
that most definitely will
why wouldnt it? seems like a valid function
not with the new v14 changes. components aren't defined as being part of messages anymore.
what
such as new EmbedBuilder() instead of new MessageEmbed()
that shouldnt affect collectors
no but its collecting an interaction
and it works just fine anyway
did you try using .createMessageComponentCollector() to come up with this conclusion
no i didn't i assumed from the other changes i have noticed. why are you making this a big deal?
not a big deal, just trying to understand why it wont work. it's a valid function so it should work
well i'm not concerned because my way works just fine
alright then
Is this way of registering slash commands is working ? (Because it do not work, without returning an error)
what error?
await the request to see if it errors
global commands takes up to an hour to register
It's a guild command 
.
When does it fire? On ready?
Yes
No error
setTimeout
For 1 minute
Then run the function
You passed wrong guild id
.setChoices("bitcoin", "ethereum", "doge", "shiba", "bat")isnt this how to define choices in a commandbuilder in v14
no, the parameters are choice objects
oops wrong channel
Is there a way to install a PR from the djs repo instead of the actual dev package?
you would have to clone the repo and install it manually
oh... anyways i guess i just need to wait for modals to be fixed then
I've been messing around with select menus since this doesn't seem to work:
let options = res.map(({text,url}) => ({label: text, value: url}));
const selectMenu = new Discord.ActionRowBuilder()
.addComponents(
new Discord.SelectMenuBuilder()
.setCustomId("website")
.setPlaceholder('Select')
.addOptions(options),
);
So I copied from the DJS Guide and fixed MessageActionRow and MessageSelectMenu to the new v14 settings, but I get the error that label and value is a required field:
const selectMenu = new Discord.ActionRowBuilder()
.addComponents(
new Discord.SelectMenuBuilder()
.setCustomId('select')
.setPlaceholder('Nothing selected')
.setMinValues(2)
.setMaxValues(3)
.addOptions([
{
label: 'Select me',
description: 'This is a description',
value: 'first_option',
},
]),
);
addOptions takes rest parameters, not array
ah ic. mb. ty
are select menus available now for modals on v14?
only text inputs
do we know when its meant to be released on v14?
already released
no, when select menus on modals is released
ask Discord
discords api allows it
where?
send a link
in the modal table it states components "array of components" as its all the variations
i think thats a lie
Hi!
Why is the bot not responding to messages in dm ?
messageCreate event does not react.
Partials Channel and Intent DirectMessages are enabled.
Maybe your assumptions are wrong
I.e?
@vestal ibex show your code
works on my end
Everything works on the server.
In dm does not respond.
you have to use the Partials enum
It is necessary?
yes
Okay, thx!
I mean you can also use magic numbers
the intents work because theyre a bitfield, partials only have the enum
but especially for partials that is not a good practise
hmm....
Whats modal? It's something like it: https://getbootstrap.com/docs/4.0/components/modal/
Kinda
Btw will it be possible to setup Rich presence on bot acc?
no
Whats this?
TypeError: createComponent is not a function
Happens when I run a modal
known internal bug
Will it be fixed?
of course
i can install this to my bot?
not easily
sure?
Yes, it's a monorepo which makes installing individual PRs difficult
wh-
I do not know why my slash are not updating, what I am doing is starting to pass everything to v14 and then also improve and change certain messages but it is not updated, the previous slash and its messages remain and does not let me continue developing so if I change any string option it appears after null
you need to deploy the commands again if you want to update them
Will modals be in a subver of 13?
modals are in the dev version; discord.js@dev
im not sure if they are currently working atm
i mean like will it be v14 only or will a version of v13 support it
i didnt realize this was the dev channel lol
but yeah he said this:
so djs v13.7
where can i see the names of the new permissions
Docs for the main branch
ok
what did i do wrong here?
What does the error say?
quite a long error
Type 'TextInputStyle' is not assignable to type 'ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger'.
and
Type 'ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRow<...> | (Required<...> & ActionRowData<...>)'..```
my action row was pretty much empty
Ahh you're using TS
You need to specify the type of builder going in the action row
ActionRowBuilder<ButtonBuilder> for example
ah that was it thank you
I installed the fix-regressions PR on my local clone of DJS, how can I install it in my project without having to replace all import .. from 'discord.js'
Found it
Why the status not work
This function not work
you need to provide the name i think
wait never mind
Any errors?
No error
and are you calling the function?
Have
and where are you calling the function?
V13.6 work
I upgrade v14
i see
Not work
String doesn't work anymore
How change
Use ActivityType enum
playing is the default activity no?
i think
not sure though
What is Playing number
^
This ?
Yes
Ok work,thx
what does it mean?
means you are accessing that before defining it
But i'm not accessing anything?
on index.js line 80
Thats not the bot
thats pm2
pm2 is a Hosting thingy
that runs the bots and that
It does not manage anything on the Discord.js
What Node version are you running?
This might be a djs bug, seems related to a recent change
v17.8.0
Seems to be a bug, use previous version
17.7.2?
It still shows this errors
Use a previous version of discord.js*
That's a bug in discord.js's development version
Found the problem in GuildAuditLogs.js line 61, 62 just had to remove does lines
That won't solve the issue, now it's not exported
Just revert to an earlier version
const test = prise.roles.cache.find(ro => ro.id === role.id);
test.edit({
permissions: [{
SEND_MESSAGE: false,
} ]
})
})
DiscordAPIError[50046]: Invalid Asset
at C.runRequest (F:\Rolex\node_modules\@discordjs\rest\dist\index.js:7:581)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async C.queueRequest (F:\Rolex\node_modules\@discordjs\rest\dist\index.js:5:3049)
at async GuildStickerManager.create (F:\Rolex\node_modules\discord.js\src\managers\GuildStickerManager.js:67:21) {
rawError: { message: 'Invalid Asset', code: 50046 },
code: 50046,
status: 400,
method: 'post',
url: 'https://discord.com/api/v9/guilds/864853109519024128/stickers',
requestBody: {
files: [ [Object] ],
json: { name: 'sussy', tags: 'headstone', description: 'good bro' }
}
} Promise {
<rejected> DiscordAPIError[50046]: Invalid Asset
at C.runRequest (F:\Rolex\node_modules\@discordjs\rest\dist\index.js:7:581)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async C.queueRequest (F:\Rolex\node_modules\@discordjs\rest\dist\index.js:5:3049)
at async GuildStickerManager.create (F:\Rolex\node_modules\discord.js\src\managers\GuildStickerManager.js:67:21) {
rawError: { message: 'Invalid Asset', code: 50046 },
code: 50046,
status: 400,
method: 'post',
url: 'https://discord.com/api/v9/guilds/864853109519024128/stickers',
requestBody: { files: [Array], json: [Object] }
}
}
``` i was tryna create a sticker and idk why but this keeps coming up even tho the asset is valid i am using the asset 🪦 as per the example does anyone know whats causing this error?
Do you have the GuildEmojisAndStickers Intent?
yes
weird
is it a bug or smth?
cuz well i am not sure what to do at this point
even the given example doesn't work
idk
Maybe bug or something not sure
i'll try to use the discord api for now if you can find the solution please let me know
iirc stickers only accept png, apng and lottie
^^^^
no webp?
no
let me try
current dev (pulled a few minutes ago) is not starting for me. not even with the default main file (https://deploy-preview-1011--discordjs-guide.netlify.app/creating-your-bot/#git-and-gitignore)
ReferenceError: Cannot access 'GuildAuditLogsEntry' before initialization
Is it something on my side or maybe the current dev branch is just broken and i need to wait a bit?
ah, should have checked PRs first
thank you
@forest elm
#rules 6
how can i access modal docs
Will input boxes be added in v14?
already added
wow
how can i access document?
its pinned
thanks 🙏🏻
thx
does someone know the latest working commit? Otherwise i will go to sleep and hope for a better tomorrow
Is there already a way to get the attachment Interaction Option?
nvm found it in the docs
ReferenceError: Cannot access 'GuildAuditLogsEntry' before initialization
whats this
it looks like reference error to me
Ihave error when im trying to update role permmison
object isn't a valid bitfield flag or number
How can i solve this problem ?
Pass valid bitfield flag or number into permissions option array
Ohh on minute iwill try
I tryed to enter 8 administrator number but the same error
but it crashes my bot
i mean whats this error?
it's an internal bug
there's already a pr to fix it
Hey in v14 how can i edit role permmision its steel give me error
Not sure if you used a real converted/exported png apng or lottie file. Can't just rename.
I am sorry but i was very dumb i entered the sticker Id within the ${} so it thought it as a variable when i checked i knew so i immediately converted it to the <Parameter>.id anyways thanks for letting me know the sticker formats :)
you need to provide a valid bit number, you provided an object
Is there message.deleted, if not, how to check?
not anymore, you can fetch and that's all really
there is not, you have to keep track of it yourself
or catch and check the error code, depending on what you want to do you (e.g. delete the message) can already ignore it
Hey, I want to check if someone is kickable, after fetch him (and check if I have a complete GuildMember) I do member.kickable and got this
at GuildMemberRoleManager.get cache [as cache] (D:\clc_backup\Code\sommet-bot-v3\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:37:101)
at GuildMemberRoleManager.get highest [as highest] (D:\clc_backup\Code\sommet-bot-v3\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:79:17)
at GuildMember.get manageable [as manageable] (D:\clc_backup\Code\sommet-bot-v3\node_modules\discord.js\src\structures\GuildMember.js:243:32)
at GuildMember.get kickable [as kickable] (D:\clc_backup\Code\sommet-bot-v3\node_modules\discord.js\src\structures\GuildMember.js:253:17)
Seems like the member is not in the cache but I fetched him a few seconds before
(The member is stored in a this in class. The fetch in a different function than where i check if he is kickable)
do you have the Guilds intent?
I have guildmessages and guildmembers
you need Guilds as well for d.js to work properly
the issue is because roles are not cached and there is no internal check for this case
Oh yes it work lol thanks for the answer
guys im trying to check if message exists but I cannot do it in this version of discordjs, can someone help?
what error are you facing
Hmm I can not get a local package of DJS working, in my package.json yarn added the following:
"dependencies": {
"@discordjs/builders": "D:\\dev\\Discord.JS\\packages\\builders",
"@discordjs/rest": "D:\\dev\\Discord.JS\\packages\\rest\\",
"discord.js": "D:\\dev\\Discord.JS\\packages\\discord.js\\",
}
When I try to start the bot I get the following error: Exception has occurred: ReferenceError: Cannot access 'GuildAuditLogsEntry' before initialization
known error
#7703 in discordjs/discord.js by Jiralite merged <t:1648152051:R>
fix: Audit log static reference
the next dev release will fix this
That's a discord js bug just revert to older djs version
Yes however the error does not occur when installing it from npmjs 😂
I'll locally install that PR.
so in 3 hours
.addChoice('Channel')),
@urban belfry
yeah no choices must have values and show me the version of builders you're using
Does the MessageOptions interface also take EmbedBuilder?
(Because right now I either ts-expect-error or .data it)
const { SlashCommandBuilder } = require('@discordjs/builders');
the version
^0.12.0
it's a typings bug, will be fixed
Should I just add | EmbedBuilder as a quick fix for now?
the proper type would be JSONEncodable<APIEmbed> | APIEmbed
then the redirect to here was wrong haha, the user was confused
#archive-builders
The type is already set to this, yet the error still occurs.
Ahh I see
There is different interfaces
yes, it hasn't been changed in edit options
That was the issue indeed
Is a PR open for it?
yes
Alright
How do I remove all slashes in Discord from my bot?
how did you register them
its basically the same way, except if you wanna remove them you pass an empty array
umm hello, why i get this error after update the package and start the bot? 
What is your dev version
this is my djs dev version
"discord.js": "^14.0.0-dev.1647259751.2297c2b",
Update
Will v14 include support for the recently announced slash command localization?
anyone know what's going on?
come code would be nice
I mean the error's pretty self explanatory 🙂
found it out though! it's because ApplicationCommandData is a union and description doesn't exist on all the potential types
okay thats nice
just as a little off-topic heads-up! make sure these have the cursor: pointer; property applied so it's clear to the user they're clickable! 🙂
oh u were looking at my website!? yes i should do that lmao.
i'll configure my css now
and change size when hovering it or add shadow
This is not the place to discuss this, try #archive-offtopic
its alr they just made a comment on my website. we were talking on topic until then.
Key word “until then” all I’m saying is let’s stay on topic here and try not to drift off
yes
This is new version ?
That is new version
Ok
@scarlet tangle
Yes
?
Use words dude
Have you tried uninstalling the module and installing it again
this is ok?
Yes but why you asking?
because slash no
this ok
slash not have
I get this error whenever im trying to run my bot, what do I do?
EmbedBuilder
I'm using the Modals Branch in #769862166131245066 and I'm getting an error I'm not sure how to fix.
import { MessageActionRow, Modal, TextInputComponent } from "discord.js"
const modal = new Modal().setCustomId("myModal").setTitle("My Modal")
const favoriteColorInput = new TextInputComponent()
.setCustomId("favoriteColorInput")
.setLabel("What's your favorite color?")
.setStyle("SHORT")
const hobbiesInput = new TextInputComponent()
.setCustomId("hobbiesInput")
.setLabel("What's your favorites hobbies?")
.setStyle("PARAGRAPH")
const firstActionRow = new MessageActionRow().addComponents(favoriteColorInput)
const secondActionRow = new MessageActionRow().addComponents(hobbiesInput)
modal.addComponents(firstActionRow, secondActionRow)
await interaction.showModal(modal)
It says I need a TextInputComponent instead of a MessageActionRowComponent when trying to add the Action rows to the modal, but it seems like that's what I'm using?
no MessageActionRow()
Is this v13?
And can I ask why is there only setColor method on EmbedBuilder?
const actionRow = new ActionRowBuilder();
13.7 I guess, its https://github.com/monbrey/discord.js/tree/modals
Make sure you install the dev version of discordjs/builders as well
ops
I dont have that 
Just npm i @discordjs/builders@dev
Anyone else know what might be going on here?
This confuses me even more, because it does use a TextInputComponent
but it seems to think I'm not
Decided to just make it with modalOptions and that worked for some reason
Did you add it to ur path?
There was a checkmark for it if you used the installer
Ur environment path
If you used the installer, there was a checkbox to add it to ur $PATH
why this no function
what version of djs is this and what is interaction even
djs : "discord.js": "^14.0.0-dev.1648166883.cedd053",
interactionCreate
not good enough, log interaction and show it to me
wait
type: 2,
id: '956794512246734929',
applicationId: '947344436973699104',
channelId: '956551274369777704',
guildId: '945198619278082080',
user: User {
id: '868822847869571083',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 128 },
username: '神魂火SpiritFire',
discriminator: '3164',
avatar: 'faf37f36c9f8fdfd75a8fa929cc46dd9',
banner: undefined,
accentColor: undefined
},
member: GuildMember {
guild: Guild {
id: '945198619278082080',
name: 'IMSC DSC SECRET SERVER & Dev chat by KLAE',
icon: 'ecc8891e0ef2b13a742be183e41f3f72',
features: [Array],
commands: [GuildApplicationCommandManager],
members: [GuildMemberManager],
channels: [GuildChannelManager],
bans: [GuildBanManager],
roles: [RoleManager],
presences: PresenceManager {},
voiceStates: [VoiceStateManager],
stageInstances: [StageInstanceManager],
invites: [GuildInviteManager],
scheduledEvents: [GuildScheduledEventManager],
available: true,
shardId: 0,
splash: null,
banner: null,
description: null,
verificationLevel: 2,
vanityURLCode: null,
nsfwLevel: 0,
premiumSubscriptionCount: 0,
discoverySplash: null,
memberCount: 21,
large: false,
premiumProgressBarEnabled: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: '945242729313607700',
premiumTier: 0,
explicitContentFilter: 2,
mfaLevel: 1,
joinedTimestamp: 1647308970092,
defaultMessageNotifications: 0,
systemChannelFlags: [SystemChannelFlagsBitField],
maximumMembers: 500000,
maximumPresences: null,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: '945201696508903454',
publicUpdatesChannelId: '945201696508903455',
preferredLocale: 'en-US',
ownerId: '811036647037993012',
emojis: [GuildEmojiManager],
stickers: [GuildStickerManager]
},
joinedTimestamp: 1647243816979,
premiumSinceTimestamp: null,
nickname: null,
pending: false,
communicationDisabledUntilTimestamp: null,
_roles: [
'950383090457538560',
'945200515401277490',
'950193800385556522'
],
user: User {
id: '868822847869571083',
bot: false,
system: false,
flags: [UserFlagsBitField],
username: '神魂火SpiritFire',
discriminator: '3164',
avatar: 'faf37f36c9f8fdfd75a8fa929cc46dd9',
banner: undefined,
accentColor: undefined
},
avatar: null
},
version: 1,
memberPermissions: PermissionsBitField { bitfield: 2199023255551n },
locale: 'zh-TW',
guildLocale: 'en-US',
commandId: '956769810488909834',
commandName: 'ping',
commandType: 1,
deferred: false,
replied: false,
ephemeral: null,
webhook: InteractionWebhook { id: '947344436973699104' },
options: CommandInteractionOptionResolver {
_group: null,
_subcommand: null,
_hoistedOptions: []
}
}```
this?
@urban belfry
?
ok wait
ChatInputCommandInteraction
give this
What's that other error in white?
Is the bot even ready?
Those error only happen when ur deploying application commands
can slash ,but have this error
Why are the application commands being deployed/created when an interaction is received?
idk
Can you show ur interactionCreate event?
ok
const discord = require("discord.js")
const { OwnerID } = require('../../botconfig/config.json')
if (!interaction.isChatInputCommand()) return;
console.log(interaction.constructor.name)
const command = client.slash.get(interaction.commandName);
if (!command) return interaction.reply({ content: 'an Erorr' });
if (command.ownerOnly) {
if (!interaction.member.id == OwnerID) {
return interaction.reply('Command under developement!')
}
}
if (command.userPerms) {
if (!client.guilds.cache.get(interaction.guild.id).members.cache.get(interaction.member.id).permissions.has(command.userPerms || [])) {
if (command.noUserPermsMessage) {
return interaction.reply(command.noUserPermsMessage)
} else if (!command.noUserPermsMessage) {
return interaction.reply(`你需要以下 \`${command.userPerms}\`的權限`)
}
}
}
if (command.botPerms) {
if (!client.guilds.cache.get(interaction.guild.id).members.cache.get(client.user.id).permissions.has(command.botPerms || [])) {
if (command.noBotPermsMessage) {
return interaction.reply(command.noBotPermsMessage)
} else if (!command.noBotPermsMessage) {
return interaction.reply(`我需要\`${command.userPerms}\`這些權限`)
}
}
}
const args = [];
for (let option of interaction.options.data) {
if (option.type === 'SUB_COMMAND') {
if (option.name) args.push(option.name);
option.options ?.forEach(x => {
if (x.value) args.push(x.value);
});
} else if (option.value) args.push(option.value);
}
try {
command.run(client, interaction, args)
} catch (e) {
interaction.reply({ content: e.message });
};
}```
That console.log wouldn't have ran if the if statement failed
is that ok?
can someone tell me
That means the error may of not occurred there
Or that event failed when it ran a second time
Move the console.log above the if statement
i need to create mod bot
ok
That would indeed be an issue
Can't have parameters being swapped
this is bug?
Yes, it would be a bug in ur code
Hello i need help, i got the error
TypeError: createComponent is not a function
when i submit a modal
My discord.js version is 14.0.0-dev.1648166883.cedd053
nvm fixed
Is there an ETA for v13.7?
yes, when its ready
I need modals + attachments for slash commands
what should I do to work around it not being released?
use the dev version
isn't that v14?
yes, you can also install the github branch tho
you can't?
because of the new monorepo structure?
that doesn't affect the v13 branch tho
oh yeah, didn't think of that! thanks
Why an v13.6.0?
I'm try npm i discord.js@dev
but discord.js version is 13.6.0
I did it already.
npm remove discord.js
npm ls discord.js
npm i discord.js@dev
npm ls discord.js
Thank you!
Mhm, trying to show a Modal, which results in a TypeError: registerModal.showModal is not a function error.
const registerModal = new ModalBuilder()
.setCustomId('registerModal')
.setTitle('Registration');
const registerInput = new TextInputBuilder()
.setCustomId('Name')
.setLabel("Who are you?")
.setStyle(TextInputStyle.Short);
const firstActionRow = new ActionRowBuilder().addComponents(registerInput);
registerModal.addComponents(firstActionRow);
await registerModal.showModal(registerModal);
Code is ripped from the guide, so maybe something changed in between which i dont see?
you call showModal() on the interaction, not on the modalbuilder
oh wow, sorry.
looks like i didn't follow the guide closely enough. Modal is shown now.
Interestingly sending it crashes the bot though.
/home/mark/discord-bots/packages/discordbot-master/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:43
this.components = data.data.components?.map(c => createComponent(c)) ?? [];
^
TypeError: createComponent is not a function
at /home/mark/discord-bots/packages/discordbot-master/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:43:54
at Array.map (<anonymous>)
at new ModalSubmitInteraction (/home/mark/discord-bots/packages/discordbot-master/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:43:45)
at InteractionCreateAction.handle (/home/mark/discord-bots/packages/discordbot-master/node_modules/discord.js/src/client/actions/InteractionCreate.js:69:25)
at Object.module.exports [as INTERACTION_CREATE] (/home/mark/discord-bots/packages/discordbot-master/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (/home/mark/discord-bots/packages/discordbot-master/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketShard.onPacket (/home/mark/discord-bots/packages/discordbot-master/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:22)
at WebSocketShard.onMessage (/home/mark/discord-bots/packages/discordbot-master/node_modules/discord.js/src/client/websocket/WebSocketShard.js:304:10)
at WebSocket.onMessage (/home/mark/discord-bots/packages/discordbot-master/node_modules/ws/lib/event-target.js:199:18)
at WebSocket.emit (node:events:526:28)
Looks like it directly crashes when the event is received 
Its a bug
oh, so no modals possible currently?
I'll wait some more time in that case 😄 Thank you.
You can downgrade
Oh, which version is working?
That bug should be fixed in the latest release(s)
it's failing in discord.js@14.0.0-dev.1648166883.cedd053 unfortunately which is the latest version i can get through yarn add discord.js@dev. Are you sure that the fix should be fixed in there already?
Oh wait nvm that’s a fix coming in a PR
help me
discord.js doesnt export client, you probably wanted to use new Client()
you're assigning client to itself
damn, you had me exited 
that right ???
yeah, but you named your client instance discordjs this time, not client
seems like you're lacking javascript knowledge #resources
one more error
=)))
i think you should take this to #djs-help-v14
I'm new coder
Doesnt matter, this channel is for the dev version of djs, not for basic djs issues
can i ask what's the pr for fixing "createComponent is not a function" bug?
is someone able to install that version?
yarn add discordjs/discord.js#refs/pull/7649/head just fails
error /home/mark/discord-bots/node_modules/@discordjs/discord.js: Command failed.
Exit code: 1
Command: is-ci || husky install
you'd probably have to clone the repo manually and use yarn link or yarn pack
mhm. I'll just wait a bit longer 
PR already has 1 approval, so it cant take that long 

yeah 
still have to wait for the dev release 

What is it changed to?
ah now its everything builder I see. Thanks
Is this possible to send localized application commands with djs v14 ?
it probably will be in v14, but the pr is still open as far as I know
pr ?
pull request on github
Hello! How i can fix it?
from what I've seen, I'm pretty sure this is a known bug
oh. This is very bad...
I'm not sure if it's fixable
Its fixable just edit the source code
You can fix it in source yourself or wait for PR merge
is there any workaround for this while waiting for pr merge?
Which code block is used in this message ? 😅 #djs-in-dev-version message
Some great dev help right there
Your question is answered literally above your own message
quick question, is it possible to make a bot that pins a message if it has enough reactions (starboard but for pins)
oh
i'm new where should i ask
ok
if (i.values[0] === "jpg") {
ctx.interaction.editReply({
embeds: [{
author: {
name: user?.tag,
icon_url: user?.displayAvatarURL({
dynamic: true
})
},
description: `${user?.avatar.startsWith("a_") ? `[\`PNG\`](${user?.displayAvatarURL({ format: "png" })}) | [\`JPG\`](${user?.displayAvatarURL({ format: "jpg" })}) | [\`WEBP\`](${user?.displayAvatarURL({ format: "webp" })}) | [\`GIF\`](${user?.displayAvatarURL({ format: "gif" })})` : `[\`PNG\`](${user?.displayAvatarURL({ format: "png" })}) | [\`JPG\`](${user?.displayAvatarURL({ format: "jpg" })}) | [\`WEBP\`](${user?.displayAvatarURL({ format: "webp" })})`}`,
image: {
url: user?.displayAvatarURL({
format: "jpg",
size: 1024
})
},
footer: {
text: `Requested by ${user?.tag}`,
icon_url: user?.displayAvatarURL({
dynamic: true
})
},
color: 0x2F3136
}]
})
}
``` does anyone know this issue i edited the embed from the avatar dynamic to format jpg but it stills shows the gif format any idea why?
The property is now called extension instead of format
Also, they're automatically dynamic now, so you don't have to include where you currently do
i see thanks
also did smth changed for size?
uhh extension ain't working ;-;
how can i use slash command localications in discord.js?
Thanks...
Finally got @dev with Rodry's types/fix-regressions PR working on my test bot locally
I believe that yarn v1 was actually causing the problem in some way
Did not really change anything other than yarn version 🤷
Yes why would I lie about that?
no
pr wasnt merged
You would need to locally clone discord.js repo and add the PR yourself.
Is there any PR open that fixes the issue where I have to add as ActionRowBuilder<MessageActionRowComponentBuilder> to every ActionRowBuilder?
i dont think thats an issue
Should it not automatically detect that type?
Ah I see, because the modal interface is different from the other components it does not do that anymore.
Yes
Why is my bot not connecting? My code: await client.login(process.env.token);
There are no errors at all. It's just not connecting.
Tag suggestion for @river harbor:
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
client
.on("debug", console.log)
.on("warn", console.log)
• Note: if you initialize your Client as bot or other identifiers you need to use these instead of client
• If the output is too long to post consider using a bin instead: gist | hasteb.in | sourceb.in | hastebin
@scarlet tangle Still nothing.
Did you run the code?
is your main file named index.js?
Yes
Try logging something I guess
Or show more of your code
It's working.
I just logged "cheese" and it worked.
I've also reinstalled all my packages.
How can I set color with hex?
Are you running TOKEN={this is your token} node .
why the edit not work
anyone here
not toJSON is not work
same problem with me
and have toJSON not work
why would it not work
can you show your error
not error
no error occured
How do you add choices?
There isn't a option type 'Choice'
ofc there isnt
then what
specify choices: [] property
How?
add choices to your option obj?
Like ```js
type: [
{
name: 'choice1',
//other stuff
}
]
also its type is ApplicationCommandOptionChoice
Ok
?
no, it isnt a type
Can you show me an example?
{
name: "name",
description: "description",
type: ApplicationCommandOptionType.String,
// Choices are only available on string option type
choices: [
{
name: "Im what will be displayed to the user",
value: "im what the bot will receive",
},
{...}
],
};
Alright thanks
Types don’t exist at runtime
Hmm
Did Permissions bitfield changed in discord.js v14?
if(!message.member.permissions.has("ADMINISTRATOR")) {
}
I got an error: RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: ADMINISTRATOR. [Symbol(code)]: 'BITFIELD_INVALID'
Ok
it’s Administrator
and no need to use enums for permissions
oh sure
I already used resolver
I saw docs and most things changed to: First letter upper case, other lower case
https://media.discordapp.net/attachments/949530111693180931/957151815990906900/unknown.png
is this possible with the use of discord.js?
Sure
Ignore that, was wrong
ok
It's not a status, it's a HTTP interaction bot
right, apologies
but that will block the access for other emitters
What does that mean
https interactions endpoint only allows the bot to receive interaction based events thats what i know if i am wrong may correct me aswell
Yes. They're not in the server
It's not "blocked", they just don't get them
hmm so there isn't really another way for me to do it?
No
alright thanks
btw for the <User>.displayAvatarURL() function imageurl options "extension" aint working any idea why and extremely sorry for the ping
works fine for me
show how you did
const sussybaka = ctx.interaction.options.getUser("user");
sussybaka?.displayAvatarURL({ extension: "png", size: 1024 })
@tame gazelleuh you there?
try format
doesn't works either
its actually converting the extension for non animated pfps but not for animated
ones
i already did it
yet even when i used extension it doesn't change the gif extension to png or any other
ButtonComponent is renamed to ButtonComponentBuilder ?
ButtonBuilder
ok thx
is there a way to create a modal collector? or i'll have to make a modal handler on my own?
Documentation suggestion for @nocturne kayak:
InteractionCollector (extends Collector)
Collects interactions. Will automatically stop if the message (Client#event:messageDelete messageDelete or Client#event:messageDeleteBulk messageDeleteBulk), channel (Client#event:channelDelete channelDelete), or guild (Client#event:guildDelete guildDelete) is deleted. (more...)
How to use generateInvite() ?
Documentation suggestion for @undone yew:
Client#user
User that the client is logged in as
createComponent is not a function still not fixed?
update djs
I did, npm i discord.js@dev
nvm it wasnt fixed yet
#7649 in discordjs/discord.js by ImRodry opened <t:1647136333:R> (review required)
types: fix regressions
📥 npm i ImRodry/discord.js#types/fix-regressions
I just get an error when i try to :p
GUILD_TEXT is now Channel.isText right?
the type is ChannelType.GuildText, but <Channel>.isText() is a typeguard that checks for that type
ohok
do if (!channel) return ...
await the create
it returns a Promise
const e = await message.guild.invites.create(channel);
message.channel.send(e)```
Same issue
e is an Invite object
not a string
there's user and member prop when i try to log raw data of ModalSubmitInteraction
why is it not present yet in its structure?
nvm
what shud I do then?
ZodError: [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [],
"message": "Required"
}
]
🤔
const putInSelect: APISelectMenuOption[] = data.map(
(element, index) => ({
label: element.title.slice(0, 25),
description: element.description.slice(0, 50),
value: index.toString(),
}),
);
const select = new SelectMenuBuilder()
.setMinValues(1)
.setMaxValues(1)
.setPlaceholder("請選擇App")
.addOptions(
{ label: "取消", description: "取消查詢", value: "-1" },
...putInSelect,
);
any field or select menu property is required and I forgot to assign value to it?
you forgot to add the custom id
Ehm what? v14.0.0-dev.1648166883.cedd053
Hi, I just updated discord.js@dev and i have this error on every embed ^^'
Version : discord.js@14.0.0-dev.1648166883.cedd053
import { Embed } from 'discord.js';
const embed = new Embed() // Error : Constructor of class 'Embed' is private and only accessible within the class declaration.
Does anyone know how to fix this?
You can't construct new Embed thats what EmbedBuilder is for
Wait they changed Embed() to EmbedBuilder()? now
yes
Are you sure? I can only do .setColor on the builer
Ehmmm
im sure
It's not logical, they wouldn't have made any changes on the fields if they don't want to use .addFields
🤔
It doesn't seem right
Prob have to call toJSON on it
I can't
I have only .setColor()
wait will EmbedBuilder().setColor() and all that work?
Refer to the documentation, not your intellisense suggestions
or
I'm in TS, so this will not compile
Got it working again weird that they changed the Embed() to EmbedBuilder()
Are in JS or TS ?
JS
Okay
Not working in Typescript 😢
const {
Client,
GatewayIntentBits,
Colors,
ButtonBuilder,
ButtonStyle,
EmbedBuilder,
ActionRowBuilder,
} = require("discord.js");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
],
});
const { token } = require("./config.json");
client.on("ready", async () => {
console.log(`bot is on ${client.user.tag}`);
});
client.on("messageCreate", async (message) => {
if (!message.guild || message.author.bot) return;
let prefix = "!";
let args = message.content.slice(prefix.length).trim().split(/ +/);
let cmd = args.shift()?.toLowerCase();
switch (cmd) {
case "test":
{
let embed = new EmbedBuilder()
.setColor(Colors.Blurple)
.setDescription(`>>> HI How are you`);
let buttons = new ActionRowBuilder().addComponents([
new ButtonBuilder()
.setCustomId("1")
.setLabel("GREEN")
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setCustomId("2")
.setLabel("RED")
.setStyle(ButtonStyle.Danger),
]);
message.reply({ embeds: [embed], components: [buttons] }).catch(e => console.log(e.message))
}
break;
default:
break;
}
});
client.login(token);
this code is correct ?
reinstall discord.js and @discordjs/builders
Is the ButtonComponent the new ComponentType??
A lot have changed so idk what to change to get everything to work
Its Button
Wait so AddCompenets is ButtonComponent?? or
It works, thanks !!
i facing error when i am sending buttons
TypeError: t.toJSON is not a function
at /media/techboy/20121DFB121DD69E/Programing/coding/My_Code/YOUTUBE TUTORIALS/dicordjsv14/node_modules/@discordjs/builders/dist/index.js:3:4258
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (/media/techboy/20121DFB121DD69E/Programing/coding/My_Code/YOUTUBE TUTORIALS/dicordjsv14/node_modules/@discordjs/builders/dist/index.js:3:4249)
at /media/techboy/20121DFB121DD69E/Programing/coding/My_Code/YOUTUBE TUTORIALS/dicordjsv14/node_modules/discord.js/src/structures/MessagePayload.js:135:30
at Array.map (<anonymous>)
at MessagePayload.resolveBody (/media/techboy/20121DFB121DD69E/Programing/coding/My_Code/YOUTUBE TUTORIALS/dicordjsv14/node_modules/discord.js/src/structures/MessagePayload.js:134:49)
at TextChannel.send (/media/techboy/20121DFB121DD69E/Programing/coding/My_Code/YOUTUBE TUTORIALS/dicordjsv14/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:169:32)
at Message.reply (/media/techboy/20121DFB121DD69E/Programing/coding/My_Code/YOUTUBE TUTORIALS/dicordjsv14/node_modules/discord.js/src/structures/Message.js:792:25)
at Client.<anonymous> (/media/techboy/20121DFB121DD69E/Programing/coding/My_Code/YOUTUBE TUTORIALS/dicordjsv14/index.js:49:17)
at Client.emit (node:events:527:28)
Node.js v17.6.0```
addComponents method takes rest parameters
mean
let buttons = new ActionRowBuilder().addComponents([
new ButtonBuilder()
.setCustomId("1")
.setLabel("GREEN")
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setCustomId("2")
.setLabel("RED")
.setStyle(ButtonStyle.Danger),
]);
valid ?
no.
Do you know what's rest param?
hmm
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.
yems
Is it not possible to reply to a modal with ephemeral?
it's entirely possible
modals with forms not yet viewable in Discord (standard version not development/canary)?
they are viewable in discord standard version
Oh okey so maybe i do something wrong?
<Interaction>.showModal(modal)
okay thanks so it's only through an interaction, is there a documentation where I could find this information?
ModalSubmitInteraction (implements InteractionResponses)
Represents a modal interaction
Thanks
and you can showModal() in any type of interaction except autocomplete and modal itself
hello, could i ask whats the solution?
you need to reply to the interaction
I am having a similar issue. This pr seems to fix it. https://github.com/discordjs/discord.js/pull/7649
Yeah, that PR fixes an error with modals. Just wait for it to be merged and released
const options = categories.map(category => ({
label: category.name,
value: category.name,
})
)
const menu = new SelectMenuBuilder()
.setCustomId('help')
.setPlaceholder(`Choose a category`)
.addOptions(...options);
Why this doesn't work?
t.toJSON() is not a function
you can just ping Mod role
it looks like you didnt define guildid for me
learn js #resources
you can use //@ts-ignore
Some mistakes were made...
What partials are used to recieve GuildMessages?
I have no idea what's wrong here.
Message
like Discord.Partials.Message?
In ModalSubmitInteraction.js the specified "createComponent" function was renamed to "createComponentBuilder" I believe but they forgot to update the file.
yes
its a bug
it has a PR
ik
i just wanted to point it out
How to send buffer attachment ?
channel.send({ files: [file] })
https://github.com/discordjs/discord.js/pull/7649 Is ready to be merged!
nvm
The error explains itself.
Nothing to do with v14 itself, that's a standard JS error for using await incorrectly
What argument does <EmbedBuilder>#setAuthor() take?
User or Member?
Or can I use both?
MessageEmbedAuthor
Represents the author field of a MessageEmbed
stable docs :T
if it's the same then thx
Thought using object was deprecated or smth
using string was
Ah, thx
<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' })
I don't really understand
EmbedBuilder, the Embed class is only used when receiving embeds, you cant construct it yourself
oh okay
It is possible to set an buffer in setImage() ?
Tag suggestion for @regal mason:
MessageEmbed#attachFiles has been removed. Files should be attached via the message option object instead:
const attachment = new MessageAttachment('./image.png', 'image1.png');
const embed = new MessageEmbed()
- .attachFiles([attachment])
.setTitle('Attachments')
.setImage(`attachment://${attachment.name}`);
- channel.send(embed)
+ channel.send({
+ embeds: [embed],
+ files: [attachment]
+ });
in the message attachment constructor you can pass a buffer as the first argument instead of a file path
I feel like I can't be the only one who's getting this, but while using modals, the bot completely freezes up, and this happens:
no errors in console
using both InteractionCollector, and client.on
you didnt reply to the modal?
It won't let me reply to the interaction cuz the bot freezes once I click "submit":
const col = new Discord.InteractionCollector(client, {max: 999});
col.on("collect", async (i)=>{
console.log("f")
if(!i.isModalSubmit()) {
const modal = new Discord.ModalBuilder().setTitle("My Modal.").setCustomId("mymodal").addComponents(new Discord.ActionRowBuilder().addComponents(new Discord.TextInputBuilder().setCustomId("yasser").setPlaceholder("no placeholder?").setStyle(Discord.TextInputStyle.Short).setLabel("Yasser").setRequired(true).setValue("yasser").setMinLength(3).setMaxLength(200)))
i.showModal(modal)
} else if(i.isModalSubmit()){
console.log("e")
i.reply({content: "yetys"})
}
})
to elaborate, once I click submit the bot won't respond to anything, console.log anything, or listen to any other messages or slash commands
Why is it waiting for 999 submissions
I just wanted to make sure that it dosen't have a default max
Do collectors have a default time from which it ceases to function?
well this code worked for me perfectly normally
modal submits are broken rn. there's PR for it.
Ah alr thanks for saving me time, I was gonna spend like 5 hours finding a fix
Code:
const modal = new ModalBuilder()
.setTitle("LFG Creation")
.setCustomId("lfg-create")
.addComponents(
new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId("lfg-time").setLabel("Time").setStyle(TextInputStyle.ShortText)),
new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId("lfg-desc").setLabel("Description").setStyle(TextInputStyle.Paragraph)));
interaction.showModal(modal);
Error: ZodError: Invalid enum value. Expected 1 | 2
Full stack: https://pastebin.com/YuX1YsxP
I'd like to know what's wrong and how to debug a ZodError
Never encountered one before
I think the text input style is Short not ShortText
that would make sense.
Yeah you're right.
I wish the error was more verbose about what value was wrong
yeah :/ Just remember it usually has to do with Schema, etc.
Here is the actual package on NPM you haven't already looked at it
https://www.npmjs.com/package/zod
Might take a peek, thanks ^^
No
We're replacing Zod with Shapeshift too
Cause Zods errors suck
Zod errors are pretty clear usually but sometimes they are a little less clearer
Pretty clear? That was in no way clear.
Anyway, if we are to discuss about it -> #archive-offtopic
7705?
7649
anyone remember or know what the last good commit was before modal submits broke? I wanna do some testing with them for an upcoming project
doesn't work anyway
This was a commit that worked for me 14.0.0-dev.1647259751.2297c2b
how can i resolve guild permissions in cmds like SEND_MESSAGES to enum number
Import PermissionFlagsBits and do PermissionFlagsBits.SendMessages
Show the full error
why prefix not work
new version
Tag suggestion for @carmine bridge:
To help you we need more information:
• What are you trying to do?
• What is your code?
• What errors and debug logs do you have?
the
last version can
i upgrade the ^14.0.0-dev.1648339713-520f471
can't
no error
the command not work
i trying the help
no response
i use this is ok
this is not work
Its retun bigint
And when i set commands giving error j can't resolve bigint
prefix cmds not working in djsv14
it will not work ?
Show the code and the error
They can, but it’s not recommended, discord introduced a new intent on gateway v10 which discord.js v14 uses, you now need the guild_messages and message_content intents
yes
idk why
last dev version ok
14.0.0-dev.1648339713-520f471 this is new version
prefix not work and no error in the console
You need the message content intent
And make sure it’s also enabled on the bots application dashboard
But fair warning, prefix commands aren’t recommended, and you should switch to slash commands
so prefix cmds not work on unverified bots ?
They do, but they aren’t recommended, and you need message intents for them
So I recommend switching to slash commands/application commands for the most capabilities, and they’re less annoying to use and develop
How to loading slash fast
guild slash commands are instant, global can take up to an hour to appear
How to use guild slash commands are instant
Can you give me the eg?
You put smth weird or incorrectly in an ActionRowBuilder
This is the code
You can't send SelectMenuBuilder, you need to put it into ActionRow
Show the row too
const row = new ActionRowBuilder()
.addComponents([menu])
Just figured it,nvm
It prob doesn't take an array
use spread syntax or just pass separately
Yea I did it and it fixed, thanks
can u send me this intent
GuildMessages
is this also includes in djs v13
its GUILD_MESSAGES in v13
ok
then I added already
I add all intents to my bot :-)
Message content intent isn't guild messages intent
??
GUILD_MESSAGES isn't the same as the privileged message content intent
that is added in v10, or will be, i'm not sure but it's a separate intent
ah, never knew that
You still can receive messages without message content intent but the content property will be null
Yeah, afik you will have to explicitly specify that intent for message content
InteractionCollector
extends CollectorCollects interactions. Will automatically stop if the message (messageDelete or messageDeleteBulk), channel (channelDelete), or guild (guildDelete) is deleted.
Will this behaviour remain the same in v14?
yes? why not
Didn't really go through source but thought it might be affected by the removal of Message#deleted
not at all
Thanks, and my bad I was looking at the Collector file for the listeners. Should've checked what the name was
this?
Yes
Correct now you need the message intent, it is 1 << 15
Some1 pin that maybe^
I mean, why would you use 32_768 instead of 1 << 15
What is js SelectMenuOptionrenamed to?
const options = categories.map(category => ({
label: category.name,
value: category.name,
})
)
const menu = new SelectMenuBuilder()
.setCustomId('help')
.setPlaceholder(`Choose a category`)
.addOptions(...options);
const row = new ActionRowBuilder()
.addComponents(menu)
message.channel.send({ components: [row] })
Why this doesn't work?
SelectMenuOptionBuilder
okay
@velvet jasper
I think select menu options needs description
No?
.addOptions(
categories.map((cmd) => {
return {
label: cmd.directory,
value: cmd.directory.toLocaleLowerCase(),
description: `Commands from ${cmd.directory} category`,
};
})```
Even this doesn't work
Are modals already on the dev version?
Not working for me too
yes
I think yes
What is the class called
Ahh thanks
Why not use the data object instead of relying on builder for this? Just a suggestion if you want to quickly resolve.

