#djs-in-dev-version
1 messages · Page 26 of 1
Import ChannelType from discord.js and use ChannelType.GuildText
I cant see it in doc
Can anyone help?
Show the code
how exact?
I just want to send an ephemeral message but here is how I do it:
modal.reply({
content: 'Application Successful!',
ephemeral: true })
It only sends a normal reply
try followup
I tried it
Even tho it sends an error saying reply not deffered and I putted deferReply() but still
Do you use discord-modals?
Yes
#rules 3.
discord.js@dev supports modals natively
My bad
But im not ready for v14 yet
Still changing my codes, is there are any way I could close the modal?
Im going to make it send a message to user DMs
Ask support on discord-modals developers server
U can use v13 branch which supports modal. Also thsi channel is for v14 dev
Where can I find that 
I sent a message in #archive-interactions but someone told me to come here
Maybe on the package npm page
okay
Anyone know what type have discord command handler ?
on ChatInputCommandInteraction
i got Type error in
getString not exist interaction.options.getString('duration')
How can I import intents?
did you narrow it down to chat input interaction?https://discord.js.org/#/docs/discord.js/main/class/Interaction?scrollTo=isChatInputCommand
see pins
I mean in v13 we have type named CommandInteraction in v14 is removed but i cant find something new to mark correct type
well, look at the link i posted
when a member is banned does the guildMemberRemove event trigger with the guildBanAdd event?
Why is the GuildManager constructor private?
YES
also what is the AuditLogEvent for when a GuildMember leaves the guild?
MemberPrune?
There is none
oh
It's only logged if a member is banned, kicked, or pruned (moderator actions)
I'm trying to extend on GuildManager but the constructor is private in index.d.ts
@idle galleon
Yes
okay, can you please tell me what prune exactly is?
Special endpoint for removing inactive menbers
No, unless it was changed by another member
so only MemberMove and MemberDisconnect?
There’s also server mute and deaf
i cant find mute and deaf in AuditLogEvents
Prob member update
okay thank you!
Yea, bc mute and deaf are actually on the raw member object
D.js just puts it in VoiceState instead
👍
why you put it on voice state if its on member object
const { target, extra } = (await member.guild.fetchAuditLogs({ type: AuditLogEvent.MemberKick })).entries.first();
```how do we get the reason for the kick? since `extra` returns null even though i had provided a reason while kicking the guild member
entry.reason
oh
the message content is returning null even I enable the MessageContent Intents.
and also when I enable @ param {CommandInteraction} interaction
Its not working why?
ChatInputCommandInteraction
how about for intents?
iirc when the intent isn't enabled you receive an empty string not null so ig the message doesn't have any content
look this
Did you enable it on discord developer thingi
if they didnt enable, they cant start the bot. an error will throw
put it in an array
and what about when passing it
pass the type new ActionRowBuilder<MessageActionRowBuilder>() i believe the guide mentions this
did you meant new ActionRowBuilder<MessageActionRowComponentBuilder>()
Yes probably
I don't have the docs pulled up
Look at what it wants in this screenshot
thanks
channel.permissionOverwrites.set([
{
id: member.id,
allow: [Permissions.FLAGS.MOVE_MEMBERS],
},
]);
how do i do tis in v14
PascalCase + and look ad channel pins
PascalCase + pins?
yes
It's a naming convention in which the first letter of each word in a compound word is capitalized
but i just want to know how i can change the channel permissionOverwrites?! 
const { PermissionFlagsBits } = require('discord.js')
think this is it
np
the button doesnt disable when the modal shows up, anyone know how to fix this?
collector code: (note: collector is already defined dw)
if (i.customId === 'yes-button') {
if (i.user.id === interaction.user.id) {
i.update({ components: [row2] })
i.showModal(modal);
} else {
i.reply({ content: 'This isn\'t your button.', ephemeral: true })
you can't use update and showModal on the same interaction, that would cause an error to be thrown
ah, what can i do instead?
<ButtonInteraction>.message.edit()
you should prefer <ButtonInteraction>.editReply
otherwise you have to deal with channel permissions and you need a bot user
both of them work, so what's the difference?
oh, channel perms
Message#edit uses the bot user, editReply the interaction webhook
oh sadly <ButtonInteraction>.editReply wont really work, Interaction has already been acknowledged
editReply does not cause this error
is it not?
you have to use editReply after showModal
and make sure showModal resolves before calling editReply
wdym?
btw its still causing the same error
you are in an async context so you can await showModal
ah okay
should i add await onto i.editReply aswell or not?
in general you should handle all promises that can reject, editReply is one of them
alright, btw this is still giving the same error
remove the deferUpdate
showModal is an initial response, you can only do one of them per interaction
Why is the GuildManager constructor private?
i got this error when using Discord Modals
if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
^
Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
at ModalSubmitInteraction.reply (/home/lprp/Discord-Bot/node_modules/discord-modals/src/structures/interfaces/InteractionResponses.js:27:46)
how to check is modal already replied?
because you are not meant to construct it
you don't really need to construct it, just need to use the ones djs gives you
Thats not djs
I need to extend on it and modify a method 
you shouldn't do that, structure extensions were removed for a reason
use a function that takes in a GuildManager then?
I need to add something in then _add function
what do you need to add there that can't be added in your own code?
I want to make it so when a guild is created it automatically sets <Guild>.config
the preferred approach is a function which takes a guild(resolvable) instead of extending d.js classes
or use a weakmap to store additional data for instances
Yes I currently have this until I realized that having one object for all guild-related properties is better
well, extending d.js classes is not better, see the structures removal pr for reasons
uh bro we dont support external packages like discord-modals
im sorry
don't be sorry lol
if you want help i think there's other servers idk
you can use discord.js modals instead of discord-modals
yes because it does
yeah
any docs for it?
discord.js v14 does and 13.7(will) support modals
read the (WIP) guide for modals
@burnt obsidian
thanks
i just used discord.js modals right now, any docs for TextInputStyle and TextInputBuilder?
where
pins, documentations
upper left corner
then you don't know.. i told you to check pins
https://discord.js.org/#/docs/builders/main/general/welcome this has all you need
thanks
TypeError: interaction.isModalSubmit is not a function
Code:
client.on('interactionCreate', async interaction => {
if (interaction.isModalSubmit()) {
did you install the dev version?
can you provide me the link/command to install the dev version?
see pins
which version is the dev version?
GatewayIntentBits where?
where?
i mean, where i can see list of GatewayIntentBits in dev version?
there's a link in the pins
i see, thanks
client.on('channelCreate', async channel => {
const audit = await channel.guild.fetchAuditLogs({ type: 'CHANNEL_CREATE' })
const ok = audit.entries.first()
console.log(ok.executor.id)
})``` code is this
you have to use enums instead of string types in the dev version
ok thanks
client.on('inviteCreate', async invite => {
console.log(invite.code)
})
``` i created invite but not getting code in console
do you have GuildInvites intent
okh
hi
Hi
i'm make a permissions handler but...
// Ready event
for (const command of commands) {
if(!config.production) {
const cmd = await guild.commands.create(command.data)
const roles = await guild.roles.cache.filter(
(x) => x.permissions.has(command.permissions) && !x.managed
)
const permissions = roles.reduce((acc: [], v) => {
return [
...acc,
{
id: v.id,
type: ApplicationCommandPermissionType.Role,
permission: true
}
]
})
await guild.commands.permissions.set({
fullPermissions: [
{
id: cmd.id,
permissions
}
]
})
}
}
[DiscordAPIError[0]: 405: Method Not Allowed]
you can't set commands permissions in discord.js
oh
You can't do it in any library
you can
Where
you can edit it using bearer token
But who will do it, when you can manage it from Discord
discord.js will support that in the future dont worry!
you wont have to do that youirself
honestly, nobody.
perms can be edited in-app
just remove that part of the dashboard and spare yourself the effort to compete with a native UI
bots don't have bearer tokens, only users do
Im aware but thank you for letting all of us know
just making sure you're aware cos "discord.js will support that in the future dont worry!" isn't correct. from a developer POV, slash perms are no longer a responsibility
Is not being able to send embeds typed as EmbedData a bug or intentional behaviour? This throws a TypeError:
const myEmbed: EmbedData = {
title: "some title",
description: "descriptive description",
};
interaction.reply({ embeds: [myEmbed] });
Type 'EmbedData' is not assignable to type 'APIEmbed | JSONEncodable<APIEmbed>'. (full error: https://www.toptal.com/developers/hastebin/nogitoliwi) Ignoring the type error gives no runtime errors at all though
It says it will support it here https://github.com/discordjs/discord.js/pull/7857 so sorry if im wrong
the correct type would be APIEmbed, not EmbedData
EmbedData is the argument type of EmbedBuilder's constructor, it includes stuff like timestamp numbers which the constructor resolves to iso date strings
ah alright, thanks for clarifying
Hi guys i tried to make a sub command but ...
data: new SlashCommandBuilder()
.setName("tickets")
.setDescription("The tickets command is used to create a ticket.")
.addSubcommand(subcommand =>
subcommand
.setName('send')
.setDescription('Send the embed')
)
,
options[0].type[BASE_TYPE_REQUIRED]: This field is required
requestBody: {
files: undefined,
json: {
name: 'tickets',
name_localizations: undefined,
description: 'The tickets command is used to create a ticket.',
description_localizations: undefined,
type: undefined,
options: [Array],
default_permission: undefined
}
}
you have to call toJSON on the builder
oh yeah
thx
const actionRow = new ActionRowBuilder();
actionRow.addComponents([
new ButtonBuilder()
.setLabel("\\📥・Ouvrir un ticket")
.setStyle(ButtonStyle.Success)
])
interaction.channel.send({
embeds: [embed],
components: [actionRow]
})
TS2322: Type 'ActionRowBuilder<AnyComponentBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'. Property 'type' is missing in type 'ActionRowBuilder<AnyComponentBuilder>' but required in type 'ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>'.
anyone can help me pls
ActionRowBuilder<ButtonBuilder>()
oh ok thx
options: [
{
name: 'channel',
description: 'mention a channel that you wanna setup as suggestion channel!',
type: ApplicationCommandOptionType.Channel,
channelTypes: ChannelType.GuildText
},
]```
channelTypes types should be in an array
im making a filter for the channel but Its not Working please help me
channelTypes: [ Channel.GuildText ] or channelTypes: [ { Channel.GuildText } ]
First one
sorry I want the docs,

pins
Client (extends BaseClient)
The main hub for interacting with the Discord API, and the starting point for any bot.
ok
help me..
I was using this code at v13 then I change to v14 and I get this err
you have been told many times. pins. https://deploy-preview-1011--discordjs-guide.netlify.app/additional-info/changes-in-v14.html#enum-values
ty
I only found another version of the url
the v 1060 one
Why do i get this error?
You tried to import discord-api-types directly
You have to import a version/subdirectory
E.g. discord-api-types/v10
anyone know how now is named MessageAttachment ?
Attachment
is .addChoice changed?
addChoices()
what
Like what to put inside the .addChoices
SlashCommandStringOption#addChoices()
Adds multiple choices for this option
Is it the same as old?
it takes objects with name and value as properties
So like this?, If I have multiple choices:
. addChoices (
{name: "Name1", value: "Name1"},
{name: "Name2", value: "Name2}
)
?
try it
from this eval command i can only see the server name but i want to see the server member too
client.guilds.cache.map(g => g.memberCount).join('\n')
ok thx
can't we see with server name and member count
ok
why doesn't .setFooter({ text: 'Example', icon_url: interaction.client.user.avatarURL(), }) work?
it doesn't return any errors
it just contructs an embed footer without the icon
shouldn't it be iconURL?, which class are you using to build the embed?
EmbedBuilder
yea, its gotta be either what you have or just iconURL i guess, try with the later
it didn't work
can you log interaction.client.user.avatarURL() alone and see what it logs?
it returned the avatar url
it's something to do with the builder
from where are you getting the embed buider? discord.js or builders?
shouldn't matter
the one from djs extends the one from builders
but yeah, its iconURL
I see 🤔
How do i fix this?
Show the full error and handleCommands.js line 39
Make sure the ids are correct as well as the token
Is the rest version wrong?
Wait
i forgot to update the rest to djs v14
works now
Why do i get this errror?
show the full stack
you need to pass an array to addFields()
like this?
.addFields([
{name:"Hey", value:"LOL"}
]}?
yes
back to changing again 💀
What's the latest discordjs guide preview?
Guide previews aren't "latest"
They show content of individual updates
So one preview will contain one set of changes and another will have a totally different page or change
oh... is avaliable any preview with some changes in djs14?

thanks
What's the issue
components is an array
you have to send as components: [row], not components: row
Ok and why component collector isn't working?
how can i edit channel permission in v14?
Hello, idk if that's an issue with the v14 but the presence isn't set
const activity = [{
name: `NOOT NOOT`,
type: `WATCHING`,
},
{
name: `to the NOOT NOOT song`,
type: `LISTENING`,
},
{
name: `in the NOOT NOOT war`,
type: `COMPETING`,
},
{
name: `the NOOT NOOT game`,
type: `PLAYING`,
},
];
// tests ??
const index = Math.floor(Math.random() * activity.length);
await this.client.user.setActivity(activity[index].name, {
type: activity[index].type
});
setInterval(() => {
const index = Math.floor(Math.random() * activity.length);
this.client.user.setActivity(activity[index].name, {
type: activity[index].type
});
}, 60000);```
if with an eval i do this.client.user.setActivity('test') it works idk why
you have to use enums instead of string types
yes ```js
*eval this.client.user.setActivity('discord.js', { type: 'WATCHING' });
this does not set the status and throw now errors but setPresence sets it correctly
i'll try 🤔
should throw an error but yeah okay
Is there a doc on all valid input types for modals?
only text inputs
ah i assume more are coming?
Yea
is there a way to tell the difference (without any extra steps like fetching guild commands and checking against cache) between a global command and a guild-specific command in an interaction? looking at d.js docs and dapi docs i presume not, just asking here in case i missed something
I believe global commands don’t have a guild id
ahh right, i assumed as per djs docs that guildId was just a "shortcut" like channelId, i'll give it a go. thanks :]
so i just tested this, the size 0 collection is the guild's commands being fetched, the object below is from the interactionCreate event, using a global command. it appears it always will put it there, even if it's a global command?
That's a ChatInputCommandInteraction so guildId here is the id of the guild where the command was executed
You may use interaction.command to see the command object
Why is this happening?
Intents.FLAGS is now GatewayIntentBits.<intent>
Ok well the guide didnt include that so I need to change, thanks
So I cant use the flag name now?
GatewayIntentBits is now the enum, you basically use it like this
yeah the keys have been changed to follow the new case standard
Hello i need documentation about this
https://cdn.discordapp.com/attachments/824411059443204127/971891451761917972/unknown.png
i literally told them to check pins when i suggested them to ask here 
have they changed this?
I believe that for the type you now have to use the ActivityType Enum from the library
@knotty plover
if (interaction.isModalSubmit()) {
if (interaction.customId === 'staff_apply') {
const staffName = interaction.fields.getTextInputValue('staff_name');
const staffAge = interaction.fields.getTextInputValue('staff_age');
const staffWhyYou = interaction.fields.getTextInputValue('staff_why_you');
if (isNaN(staffAge)) {
return interaction.reply({
content: ":x: Your age must be a number, please resend the form.",
ephemeral: true
})
}
if (!isNaN(staffName)) {
return interaction.reply({
content: ":x: Your name must not includes a number.",
ephemeral: true
})
}
interaction.reply({
content: '✅ Your staff application has been submit successfully.',
ephemeral: true
})
what should i delete to prevent it making errors if it doesn't contain numbers
I want it contains links
Trying to find that
from get input u re getting string
strings are always nan
you can destructure it from the lib i believe, like { ActivityType } = require('discord.js') unless you have to get it from discord-api-types directly, but i dont think that shouldcbe the case
Yep that worked thanks
What you should have deleted is that ping at me
It's github project and I don't know djs so much
now i want it accept numbers links etc..
And you thought the best way to respond to me being annoyed at a direct ping (which breaks one of our server rules) was to reply to me with another ping...
Go away
how do i get the message from the interaction?
basically i want to edit an interaction's action row but keep the embed
interaction.message
Though if you dont pass embeds when editing it shouldnt change them
see it's weird cuz it's not documented
yes it is?
Assuming youre looking at an interaction type that comes from a message
ButtonInteraction#message
The message to which the component was attached
SelectMenuInteraction#message
The message to which the component was attached
ah okay
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
what does this error means
Shouldn’t the modalSubmit event be integrated into interactionCreate
Since you are technically creating an interaction
Or maybe I’m just stupid to think that
There literally is no modalSubmit event
Because it literally is interactionCreate
So yes, I have no idea what youre thinking
are you using discord-modals library?
Yes
discord.js v14 (dev) has modals so you don't need any other external libraries
also discord-modals is not by djs so we cannot do anything in that
Oh I thought it was created by djs devs
it isn't
Nope
Maybe I will switch to v14 dev then
you should
👍
there is a WIP guide for modals https://deploy-preview-1060--discordjs-guide.netlify.app/interactions/modals.html#receiving-modal-submissions and pinned messages has migration guide
Note modals would be added in 13.7
That would be the safer Option than using djs@dev in prod
but why this problem??? 
because whatever you put in there is not an embed?
Hard to know without the error stack or your code
API: 50035 Invalid Form Body
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
at SequentialHandler.runRequest (/home/runner/ka-dev/node_modules/@discordjs/rest/dist/index.js:708:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/runner/ka-dev/node_modules/@discordjs/rest/dist/index.js:511:14)
at async MessageManager.edit (/home/runner/ka-dev/node_modules/discord.js/src/managers/MessageManager.js:166:15) {
rawError: {
code: 50035,
errors: { embeds: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'patch',
url: 'https://discord.com/api/v10/channels/966520619632054332/messages/971949233336893440',
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [Array],
components: [Array],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
}
}
}
Promise {
<rejected> DiscordAPIError[50035]: Invalid Form Body
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
at SequentialHandler.runRequest (/home/runner/ka-dev/node_modules/@discordjs/rest/dist/index.js:708:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/runner/ka-dev/node_modules/@discordjs/rest/dist/index.js:511:14)
at async MessageManager.edit (/home/runner/ka-dev/node_modules/discord.js/src/managers/MessageManager.js:166:15) {
rawError: { code: 50035, errors: [Object], message: 'Invalid Form Body' },
code: 50035,
status: 400,
method: 'patch',
url: 'https://discord.com/api/v10/channels/966520619632054332/messages/971949233336893440',
requestBody: { files: [], json: [Object] }
}
}
full error
yeah whatever you passed to the embeds is not an embed
Well, not an object
Might be a string or another nested array or something
can u join my repl for a while, I cannot send the full function (text too long)
module.exports.pages = pages;
async function pages(message, ...embeds) {
let page = 0;
let pages = embeds.flat(Infinity);
const row = <ComponentRow>;
const curPage = await message.reply({
embeds: [pages[page]],
components: [row]
});
let collector = <PageCreateCollector>
collector.on('collect', async(i) => {
switch(i.customId) {
// Custom Id Switch Change
};
row.components[4].label = `${page + 1} / ${pages.length}`;
await i.deferUpdate();
await curPage.edit({
embeds: [pages[page]],
components: [row]
});
collector.resetTimer();
});
// collect end
}
shorten a lot
help command is from CTK-WARRIOR/Discord-Bot-For-Starters branch discord.js v13 (rewrite to v14)
but some pages works
yeah the ones that arent undefined
if page ends up bigger than the number of actual pages
but at first all pages works
It'll be undefined
but after 1-2 sec delay not clicking btns, ithen start to click, it starts throwing error
oh
nothing ik now
ok now
I changed embeds.length to pages.length
yeah that makes sense
the embeds will be [[Object]]
?
because I use pages(message, [EmbedObject])
instead of pages(message, emb, emb2, emb3)
how do I remove existing ChatInput or ContextMenu commands?
make a new put request to deploy the commands but dont include the ones you want to remove, and then wait accordingly; 1 hour if you deployed globally, a couple of seconds if you deployed to a guild
im not directly using the api, how do I do it with djs?
this.bot.guilds.cache.first().commands.set([])
doesnt seem to be working
ok nvm it worked now..

TypeError: MessageActionRow is not a constructor
TypeError: MessageButton is not a constructor
its in the new guide like this
my bad
TypeError: Found non-callable @@iterator
at ActionRowBuilder.addComponents (/root/PanelBot/node_modules/@discordjs/builders/dist/index.js:526:21)
at Client.<anonymous> (/root/PanelBot/index.js:69:5)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
ActionRowBuilder takes an array
ok
Should we use SlashCommandBuilder from discord.js or use the enums for creating slash command ??Which method is recommended?
I have a similar question to this, but I'm wondering what to do for my use case involving an attachment option ^
how to show a modal via a button
Look at the guide for the modals explained
Can someone please explain to me the GuildMember.disableCommunicationUntil() parameters? I don't understand how you are supposed to specify the duration.
GuildMember#timeout()
Times this guild member out.
They're the same.
Uhh sort of
timeout you just pass how long
disableCommunicationUntil accepts a timestamp in the future
I think the docs explain timeout badly though
Yes I got confused.
timeout(30000) = 30 seconds
disableCommunicationUntil(Date.now() + 30000) = until 30 seconds in the future
timeout does Date.now+ for you
You can timeout any user for however long you want? There are presets on the discord client though...
Up to the max yeah I think so
Huh I did not know that. Thanks 🙂
I think that was why I was getting lots of errors
Using the wrong functions
@knotty plover
Yes?
SlashCommandBuilder is probably the move
😑 answer my question
I figured it out cause I was just messing with it
No
I get CombinedPropertyError (1) Received one or more errors input[0] | CombinedPropertyError (2) | Received one or more errors | | input.value | | MissingPropertyError > value | | A required property is missing | | input.name | | MissingPropertyError > name | | A required property is missing Whenever I run embed.addFields([{ name: 'Reason', value: `${reason}`, inline: false }])
What's happening here? I've tried UnsafeEmbedBuilder as well but that doesn't work either.
Might be on an older version that doesn't use arrays?
What doesn't work with the unsafe one?
I've got the latest version...
Why
Because you randomly pinged me out of nowhere. Refer to rule 6 thanks
😂😂😂😂😂
is the new permissions v2 in djs dev
No
ok
https://clue.isadev.tech/🐲🦯🩺🦂
is Intents still supposed to be in at-dev?
No
😐
?
Because intellisense is not documentation
It literally just remembers things youve typed before
let embed = new Discord.EmbedBuilder()
.setColor("RED")
.setTitle(` Banned \`${member.tag}\``)
.setDescription(`asdasd`)
.setTimestamp()
await message.channel.send({
embeds: [embed],
});
why is it not sending the embed?
is it even reaching this code?
yes if i only do message.channel.send("hi") it works
put a log above and below the .send()
try{
let embed = new Discord.EmbedBuilder()
.setColor("RED")
.setTitle(` Banned \`${member.tag}\``)
.setDescription(`asdasd`)
.setTimestamp()
console.log("1")
await message.channel.send({
embeds: [embed],
});
console.log("2")
// await member.ban();
}catch{
console.log("ERROR -> Bann")
}
``` not logging anything
only the error
so there's an error?
obviously but i don't see the problem here
maybe actually log the error?
For ModalSubmitInteraction
i am using deferReply as soon as i get it and then editReply throws an error saying "The reply to this interaction has not been sent or deferred."
is this not how this is supposed to be done?
ohh i am very sorry my bad
i was missing await
catch(e) {
console.log(e)
}```
The color would be"Red" now
PascalCase
Setting colors or types for something with a string cant be done in v14 anymore
im receiving this error even tho my bot is online, there are no errors either
Outdated
outdated djs version?
What else would be?
the typings ¯_(ツ)_/¯
Which belongs to... discord.js? Lol
Update your version
It's been a change since the latest pin
still not working after update
ActionRowBuilder<ButtonBuilder>
ok thanks
Hi, how to close discord.js modal?
you don't, the user closes it
Does discord send an event when user cancels a modal
no
Damn
and the error is?
Something went wrong, please try again
do you reply to the modal submit interaction?
that is the issue, you have to respond to the new interaction
module.exports = {
name: "setupbug",
category: "System",
run: async (client, message) => {
if (message.member.permissions.has("ADMINISTRATOR")) {
let embed = new EmbedBuilder()
.setTitle("Bug Report")
.setDescription(
`If you want to report a **bug** in one of our bots, a thread will be opened, and we are trying to fix the bug.`
)
.setColor(client.config.color);
const button = new ButtonBuilder()
.setCustomId("bugModal")
.setLabel("Report Bug")
.setStyle(ButtonStyle.Primary);
let row2 = new ActionRowBuilder()
.addComponents(button);
message.channel.send({
embeds: [embed],
components: [row2],
});
} else {
message.reply("no Valid Permissions");
}
},
};
this.components.push(...components);
^
TypeError: Found non-callable @@iterator
what's that?
addComponents takes an array
.addComponents({ components: [button] } );
like this?
no, an array, not an object: addComponents([button])
oh yea, me stupid thanks
not related to the v14 branch but how can i install the dev branch of v13?
you can install the v13 branch off of github
npm i discordjs/discord.js#v13
How do I fix this in v14
How do I send components
Cuz apparently now its impossible to do
Please ping me once someone of you has an answer
The row variable is a ActionRowBuilder btw
Ok fixed it myself lol
How can I create button... if someone click is opening window to write text
check the wip guide for modals
where is it, i can't find
thx a lot
it's in the pins
i have to update from v13 to v14?
you are in #djs-in-dev-version
if you want modals on v13, wait for 13.7 to release
or if you can't be patient then use v14 but you're going to accept the risk of getting your code break at anytime (sorry if my grammar is bad)
It would be great
What does this mean?
Expected an Array, but didn't smth else
I think it changed back to Array
addFields takes an array now yes
I lost track of this Array vs rest param thing tbh
so value use array? or?
Array
well, the plan is that all these will be taking arrays, but like the release of builders 0.13 takes in rest
Trust in the ts typings
do i have to name anything in the Array?
Wdym? Arrays aren’t named
Guild#voiceAdapterCreator
The voice state adapter for this guild that can be used with @discordjs/voice to play audio in voice and stage channels.
What intents do you need to recieve DM messages?
DirectMessages intent and Channel partial
also the MessageContent intent if you want the content of it
How do you define a partial?
It's changed in v14.
pins
you don't need the intent to receive the contents of dms, right?
ah yeah
like messages that are directed towards the bot, the bot will get the content
that's how mention prefixes would work
bot ping -> directed at bot
bot dm -> directed at bot
why message.content is empty (client[intents] has guildMessages)
what about the MessageContent intent?
I want to use messageCreate event
and the intent?
My client part is like this
const client = new Client({
partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.User, Partials.GuildMember, Partials.GuildScheduledEvent],
intents: [GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions, GatewayIntentBits.DirectMessageTyping, GatewayIntentBits.Guilds, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildScheduledEvents, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildWebhooks]
});```
there isn't GatewayIntentBits.MessageContent there
uh Thx
you're welcome! 🤠
If you create a channel under a category without any options, does it automatically inherit the category's permissions?
yes
Use message.author.bot
what are the types of permission overwrites?
User and Role
i meant the integers
oh okay
You can check discord.dev if you want to be sure
0 for role, 1 for member
https://discord.com/developers/docs/resources/channel#edit-channel-permissions
I prefer enums over memorizing every possible value or referring back to docs
Plus, it’s easier for others to understand what it is
why discord.js use combined errors and what is this
what is what?
CombinedError (2)
show the entire error?
CombinedError comes from shapeshift (dependancy of builders@dev), which is used to show multiple ConstraintErrors
can I set default permissions for my slash commands like to have "manager server" perms
yes, #769862166131245066 (though the UI will still show
for at-everyone, it works)
const user =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0] ? args[0] : null) ||
(await message.guild.members
.fetch(args[0] ? args[0] : null)
.catch(() => {})) ||
(await client.users.fetch(args[0] ? args[0] : null).catch(() => {}));
Why is user.tag not working?
because GuildMember#tag is not a thing
then what can i do instead get username + discriminator?
GuildMember#user#tag
the issue is that you have mixed return types here
namely the return type is GuildMember | User here.
if you get a User, user.tag works, if you get a GuildMember instance it'd need to be user.user.tag
ah thank you
you should probably decide on what you actually need here, a user or a member, and make the return type consistent so you know what it is.
alternatively instanceof checks after, i suppose
anyone got docs on APIMessageComponentEmoji
they take an id, name and animated property
it'd be easier to access the types on your end and check
ah I see, ty
hello,
I'm trying to create a form with the new modal. However, there are more than 5 fields in it so I can't use only one modal.
So I tried to do 2 modals but you cant open another modal from the interaction of another modal. So I sent an ephemeral message with a button to continue however, that means that the button will stay for a while.
I also tried to update the ephemeral message to remove everything in it, but then I can't show the second modal.
So is having an ephemeral message the only solution or is there someone who has an idea?
You can just update the ephemeral when you get the response of the second modal
ModalInteraction#update will target the ephem message with the button in it
the only way I found to update an ephemeral is by using a collector an update it's interaction
oh
I'll try that thanks
Hum, I don't have ModalInteraction, only ModalSubmitInteraction and there is no update or edit on it
oh thats what I meant
It should have update though
You might need to isFromMessage() first
ModalSubmitInteraction#update()
Updates the original message of the component on which the interaction was received on.
So, I was missing the isFromMessage() and now I have access to update but now discord says
message: 'Interaction has already been acknowledged.',
code: 40060```
Oh, because I already replied.
That should be doable now
what is this err for :/
EmbedBuilder#addFields takes an array
you passed something else which doesn't have a length property
Where can I find the equivalent of the following v13 code in v14?
const { Permissions } = require('discord.js');
Permissions.FLAGS['ADMINISTRATOR'];
I seem to be unable to find any permission flags, this was my approach for checking if provided permissions are actual valid discord permissions (with input being ['MANAGE_SERVER', 'SEND_MESSAGES', ...perms]). How would I go about validating permissions now?
- Permissions was changed to PermissionsBitField
- Everything is in PascalCase
soPermissionsBitField.Flags['Administrator'];
So that's why it didn't work when I tried with PermissionsBitField 
Thanks a ton!
const { ButtonStyle, ButtonBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder } = require('discord.js')
module.exports = {
name: "setup-quickhelp",
category: "System",
run: async (client, message) => {
if (message.member.permissions.has("ADMINISTRATOR")) {
let embed = new EmbedBuilder()
.setTitle("Bug Report")
.setDescription(
`You can find a list of **frequently asked questions** and other **guides** here.`
)
.setColor(client.config.color);
let Selection = new SelectMenuBuilder()
.setCustomId("QuickHelpSelection")
.setMaxValues(1)
.setMinValues(1)
.setPlaceholder("What do you need help with?")
.addOptions([
{
label: 'Report Bug',
description: 'This is a description',
emoji: '',
value: 'bugModal',
},
]);
let row2 = new ActionRowBuilder().addComponents([Selection]);
message.channel.send({
embeds: [embed],
components: [row2],
});
} else {
message.reply("no Valid Permissions");
}
client.on('interactionCreate', async interaction => {
if (interaction.customId === 'bugModal') {
await interaction.reply({ content: 'Something was selected!'});
}
});
},
};
If selected bugModal it's not replying
why is your interactionCreate event in the command
besides, you aren't creating a anything with the customId bugModal
so what do i have to do?

your issue makes no sense
you are creating a selectmenu with the id QuickHelpSelection
but i want the value so i do interaction.value or what?
what
again
remove that event in there
use a collector
and again, the customId is not the same
How do I set the new slash command permissions?
that I dont know so Im asking
default_member_permissions: 'Administrator', is this right?
this should be number
wdym?
PermissionsBitField.Flags.Administrator
stringified bitfield number
but in docs its String
so I just need to import the PermissionsBitField??
lmfaoo accidently ghost pinged some poor guy
new PermissionsBitfield('Administrator').bitfield.toString()
add more perms if needed to the constructor
and yes you need to import
default_member_permissions: new PermissionsBitfield('Administrator').bitfield.toString(),???
that would be valid payload, yes
Is there any collector for modals?
CommandInteraction#awaitModalSubmit()
Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
thanks Im testing it rn
with my tes acc
I am getting interaction already replied error on interaction.showModal()
showModal counts as an interaction reply
await interaction.deferReply();
interaction.showModal(modal);
What should I change?
don't defer
you can only use one of defer(Reply/Update) / reply / update / showModal per interaction
Isn't there any way?
*other way
no, it's exactly as I said
Also it shows something went wrong when I click on submit, how to fix that?
respond to the ModalSubmitInteraction with any of the above methods (excluding showModal)
hi can i ask what is this and does djs dev version have it ?
yes, its modal check pins
modals, check the pinnned (wip) guide
Can you show modal in sequence with djs?
max characters which can be typed by the user
so isn't it 4000?
no i dont remember limit
then?
thank you i think that's enough lol
return Result.err(new CombinedError(errors));
^
CombinedError: Received one or more errors
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:1470:23)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:113:88)
at EmbedBuilder.setDescription (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@discordjs\builders\dist\index.js:261:54)
at Object.run (C:\Users\Simon Stark\Desktop\koojeAPI\modules\commands\Information\help.js:9:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errors: [
ExpectedValidationError: Expected values to be equals
at LiteralValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:674:76)
at LiteralValidator.run (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:102:23)
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:1465:32)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:113:88)
at EmbedBuilder.setDescription (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@discordjs\builders\dist\index.js:261:54)
at Object.run (C:\Users\Simon Stark\Desktop\koojeAPI\modules\commands\Information\help.js:9:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
validator: 's.literal(V)',
given: undefined,
expected: null
},
ValidationError: Expected a string primitive
at StringValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:1371:70)
at StringValidator.run (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:102:23)
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:1465:32)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@sapphire\shapeshift\dist\index.js:113:88)
at EmbedBuilder.setDescription (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules@discordjs\builders\dist\index.js:261:54)
at Object.run (C:\Users\Simon Stark\Desktop\koojeAPI\modules\commands\Information\help.js:9:10)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
validator: 's.string',
given: undefined
}
]
}
can anyone help`?
Looks like a setDescription call received undefined as its argument
hi, i want to do permissions in slash commands, but this not works. No error in console
if(cmd.permy && !interaction.member.permissions.has(cmd.permy)) return interaction.reply({ embeds: [error(interaction, `Nie posiadasz permisji: \`${cmd.permy}\``)] })
permy: ["ADMINISTRATOR"],
cmd.permy[0]
I co to jest za embed ty mi powiedz xD
funkcja w oddzielnym pliku xd
A no dobra, spróbuj cmd.permy[0]
How did they put an input image into a slash command choice?
attachment option
In SlashCommandBuilder has addAttachmentOption
oh okay thx

wow 😅
on the v14 ?
yep
Too bad, I'll wait for 13.7 xD
@coral pumice how do i play music
i want the page of changes

how can I get an message attachment link or the file?
message 
Message#attachments
A collection of attachments in the message - e.g. Pictures - mapped by their ids
and get .first() url
that's what I'm trying the whole time but getAttachment is not a function
Then you aren't on latest dev or something
I just installed the new dev a few mins ago
I mean if you're using messages it's not a dev question at all
And it's what Jaw0r3k said
CommandInteractionOptionResolver#getAttachment()
Gets an attachment option.
Is there any reason that a ModalSubmit interaction in a DM returns different than a ModalSubmit in a guild channel?
In guild: interaction.message.components[].components[].data.options
In dm: interaction.message.components[].components[].options
Edit: using v10 API and discord.js@14.0.0-dev.1651493371-4ba0f56
Perhaps cached and raw interaction?
Could you show the actual types?
Is this what you are after? Both interactions (DM and guild) show the same
Hey, do we have an approximate period of when we could be expecting v14? im not looking for anything specific, just trying to see if i should wait for the update or go with a third party to get modals
On closer inspection, there is an array of components containing ActionRow[s] in both interactions (directly nested under the interaction. On the DM interaction, the interaction.message is of type Object (as are the components[] under it), where the guild interaction is of type Message (and everything is propery typed under that)
v14 prob not gonna be released anytime soon
if you just wanted modals, wait for v13.7
oh will v13.7 include modals? i expected them to only be in v14
Yes
interesting, then with the same aspect, anything about its expected release date i might have missed? i prefer staying away from dev since it tends to change a lot
alright so this is the first time I've use Discord.js v14 dev build and am working with typescript
I've been unable to find a valid reason for why I'm getting shown this error when I followed the "preview" link on the pinned message
na I figured out the issue and it's already made within a textinputbuilder which is required to be passed to an actionrowbuilder
for whatever reason when trying to add it anyway besides .addComponents() it returns that error so if I tried
const modal = new ModalBuilder({
customId: `test`,
title: `Test Modal`,
components: [firstActionRow]
})
I was given that error but
const modal = new ModalBuilder({
customId: `test`,
title: `Test Modal`,
components: []
}).addComponents([firstActionRow])
it would work
Oh, it’s supposed to be TextInputComponent
what's the maximum amount of text inputs allowed on a modal?
is it 25?
thank you
how do I setup the new slash command permission in my bot?
slash command permissions are handled by server owners now
oh also anyone know if the dm_permission boolean will be added in the future?
I mean for default perms
I know I can do that.
for now, you can still use defaultPermission as before and it'll deny everyone
I that only available in REST?
no
module.exports = {
name: "help",
description: "List of the commands.",
type: ApplicationCommandType.ChatInput,
defaultPermission: 'Administrator',```
there are probably ways, but it's not the bot developers responsibility to set perms for slash commands anymore
defaultPermission: false denies the command to anyone without the builti-in permissions. by default, anyone with the Administrator perm can use all slash commands anyway
and also slash cmds perms v2 had a user perms but how about bot developers only command
I mean like eval command or something
if you need commands for dev use only, register them at guild level for one guild like a dev guild where you can control who has access to them
I know how to do that but if I try to use client.commands.set() all the commands will push.
so don't push the ones you don't want to push globally
how?
const { ApplicationCommandType } = require('discord.js');
module.exports = async (client, globPromise, ascii) => {
const table = new ascii('Slash Commands Loaded');
table.setHeading('File', "Load Status");
const slashCommands = await globPromise(
`${process.cwd()}/src/SlashCommands/*/*.js`
);
const arrayOfSlashCommands = [];
slashCommands.map((value) => {
const file = require(value);
const L = value.split('/');
if (!file?.name) {
return table.addRow(L[7], '❌');
} else {
client.slashCommands.set(file.name, file);
table.addRow(L[7], '✅');
};
if ([ApplicationCommandType.Message, ApplicationCommandType.User].includes(file.type)) delete file.description;
arrayOfSlashCommands.push(file);
});
client.on("ready", async () => {
// Register for a single guilds
await client.guilds.cache.get('926400183867146290').commands.set(arrayOfSlashCommands);
// Register for all the guilds the bot is in
// await client.application.commands.set(arrayOfSlashCommands)
});
console.log(table.toString());
}``` this is my code.
Or your meaning is delete the file and if the commands is set in all guild I will back it right??
^^^
so you're currently only registering them for one guild anyway, but you can just not put any sensitive commands in to arrayOfSlashCommands and put them in a different array that you register on a different guild
but thats not really a d.js thing and more a basic JS thing
you mean use .filter??
you could filter I guess, or just not put them in in the first place
I was thinking to make a new file seperately so the file will ignore it is that posible??
DiscordAPIError: Invalid Form Body
components[1].components[0].options[1].emoji.id: Invalid emoji
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async TextChannel.send (/home/container/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15)
at async Object.execute (/home/container/commands/info/help.js:207:23) {
method: 'post',
path: '/channels/960462723836170271/messages',
code: 50035,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [Array],
components: [Array],
username: undefined,
avatar_url: undefined,
allowed_mentions: [Object],
flags: 0,
message_reference: [Object],
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
at Object.execute (/home/container/commands/info/help.js:215:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
is dm_permission is added?
so I noticed when I click submit for modals it doesn't automatically close the modal is there a way to do this?
nvm just it not replying/deferring correctly
wdym json?
BTW what is the slash commands perms I can setup?
not builder but discord command object
ApplicationCommandOption
An option for an application command or subcommand.
not this
you need a GuildMember not a User object
How do I set a client status in v14?
similar to how you do in v13, except you gotta have to import ActivityType enum instead of using string
thats I doesnt know
destructure it from discord.js const {ActivityType} = require('discord.js')
DiscordAPIError: Invalid Form Body
components[1].components[0].options[1].emoji.id: Invalid emoji
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async TextChannel.send (/home/container/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15)
at async Object.execute (/home/container/commands/info/help.js:207:23) {
method: 'post',
path: '/channels/960462723836170271/messages',
code: 50035,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [Array],
components: [Array],
username: undefined,
avatar_url: undefined,
allowed_mentions: [Object],
flags: 0,
message_reference: [Object],
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
at Object.execute (/home/container/commands/info/help.js:215:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
hello, is it possible with
collector.on('collect', async (collected) => {
if (collected.customId === "some") ```
read a modal?
i mean if i log the interaction in the interactionCreate event he give me the output with customId: :/
no. modal isnt a message component
use awaitModalSubmit() instead
k
how long more till the production release of discord.js v14?
When it's ready™️
thanks
anytime
const { GatewayIntentBits } = require('discord-api-types/v10')
const Mean = require('./client/Mean');
const mean = new Mean({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildScheduledEvents,
GatewayIntentBits.MessageContent
],
disableMentions: { parse: ['everyone', 'here'] }
});
global.mean = mean;
mean.login();``` I rarely ask questions here, but right now I can't find the answer myself. I'm switching from v13 to v14. And I don't find ClientOptions.disableMentions in the documentation. What has changed?
allowedMentions just like in v13
ClientOptions
Options for a client.
but this will actually turn on the ping of these mentions
And I need to turn them off
Why the modal appear but when I click submit button the command does not respond (no error)
(I'm using https://github.com/discordjs/discord.js/pull/7431)
when you dont parse everyone, its not getting mentioned
and that is, just delete the old parameter?
it's just that I sometimes ping users in my code
no, you have to provide allowedMentions in it to take effect
You can control which entities receive notifications via the allowedMentions option. You can:
• Set a default on the client
• Set for a specific message
• Use the repliedUser key to disable in-line reply mentions
{ ..., allowedMentions: { parse: ["users", "roles"] } }
your custom id check doesn't make much sense, how would it have the id of the interaction that was just created on it
@vague coyote I apologize for the ping, but what is the name of the dynamic (user.displayAvatarURL) option on v14?
forceStatic ?
dynamic is now default, forceStatic is needed to produce the reverse output
format v13 -> extension v14?
wdym
yes
thanks 
the format option is now called extension
ah i see
it's still difficult for me to figure it out, I'm sorry
you can try checking the guide in pinned message in case you haven't
.displayAvatarURL({ forceStatic: false, extension: 'png', size: 4096 })
so has dynamic option changed or not?
dynamic option is now called forceStatic
thanks
the previous dynamic: true behaviour is now the default behaviour, as forceStatic defaults to false
Permissions -> PermissionsBitField
PermissionsBitField (extends BitField)
Data structure that makes it easy to interact with a permission bitfield. All [GuildMember](<https://discord.js.org/#/docs/discord.js/main/class/GuildMember>)s have a set of permissions in their guild, and each channel in the guild may also have [PermissionOverwrites](<https://discord.js.org/#/docs/discord.js/main/class/PermissionOverwrites>) for the member that override their default permissions.
wtf is this? all of my interactions suddenly stopped working ;-; help
We can't help without your code
hard to say without other information - your app doesn't respond to that interaction instance
it was working fine till the last hour i haven't even touch anything and yet it starts acting up, should i share my interaction emitting instance code?
this ;-;
the modals and the application commands seems to work fine but select menus and buttons ain't working
The color in the embed can't be in the string now? EmbedBuilder().setColor()
yes it can't
and how do I translate color to number?
user ColorResolvable
Util.resolveColor(...)
you can if you import it from discord.js
if you trust discord to validate it people can change that in server settings
this is just a default you as a bot dev can set, people can override that
import EmbedBuilder directly from discord.js (not from builders) and do .setColor('Red') directly
Hi, how to add permissions to slash commands?
Danke!
Set fetchReply option to true in reply method
How can i get the value in interactionCreate now?
{
label: 'Report Bug',
description: 'This is a description',
value: 'bugModal',
},
Its the same in v13
is it possible to implement a modal collector instead of awaitModalSubmit?
I think the discord.js developers thought about it, but what's wrong with this modal?
what do you mean?
it's just a promisified InteractionCollector - which does exist.
https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/structures/interfaces/InteractionResponses.js#L272-L283
Perhaps you misunderstand me, but still. The collector is much better than await. After all, I need to watch the model without time. And if it still did not come, then give an error. After all, I can print in the model longer than the time allotted in awaitModelSubmit({ time: ... })
then use the collector?
Yes, you can use fetchReply on interaction when you send the modal and use this reply to create an InteractionCollector<ModalSubmitInteraction>
Yes
then what's your question/concern?
you asked why a collector doesn't exist, but it does
did it change back to array?
But is not really useful because you can receive only one submit interaction by showable modal
Yes
welll
I have not yet fully understood the realities of v14, if it is possible to create a collector with Modal, then please show the documentation page for the given tag, please 
i linked you to the source code for the await* above, it demonstrates exactly how the collector within is used
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...)
ok, I'll take a look
not channel cache
what needs to happen
the client needs to be ready, presumably (or you need to fix the ID or invite the bot to the channel with that id)
is this in a dm?
no dm
try enabling the Channel Partial first
why isn't RANDOM working for color on embed with embedbuilder?
embeds[0].color[NUMBER_TYPE_COERCE]: Value "RANDOM" is not int.
Can you post an example of sending a message to the channel in discord.js v14?
same as v13
message.channel.send({content: `Should be text`})
``` same
nothing changed
why is it giving error
probably interaction.channel is undefined try to console.log it
console.log is running
do you have the Guilds intent and a bot user in the guild?
client.channels.cache.get("id").send({content: "asd"})
this command doesn't work either
do you somehow remove channels from the cache?
can you log client.channels.cache.size
what i'm doing wrong?
new ActionRowBuilder<ButtonBuilder>()
you need to pass the type to the generic
oh okey thank you so much!
plys my send docs discord.js v14

How do I resolve the thing for discord status type so I can use a config file to change it based on a list of different statuses? I have the list but it doesn’t change for playing, watching, listening and streaming.
TypeError: Cannot read properties of undefined (reading 'getTextInputValue')
const title = interaction.fields.getTextInputValue('title');
what is the error?
oh nvm found it
activity type must be number
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require("discord.js");
module.exports = {
name: "ticket",
run: async (client, message, args) => {
message.delete().catch(e => console.log('e'))
let ticket = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("ticket").setStyle("SECONDARY").setLabel("Open Ticket").setEmoji("📩")
);
let embed = new EmbedBuilder()
.setTitle(message.guild.name)
.setDescription(`Para abrir um ticket click no \"📩\"`)
.setColor(client.color)
message.channel.send({ embeds: [embed], components: [ticket] })
}
}
not function, not error
whats bad?
What is that
TypeError: Found non-callable @@iterator
const firstActionRow = new ActionRowBuilder().addComponents(title);
you need to pass an array on addComponents
@wicked tusk you too
put array
which matrix plus the code is not answering if it would not delete the message
and the style should use the ButtonStyle Enum
TypeError: components.map is not a function
modal.addComponents(firstActionRow, secondActionRow, thirdActionRow);
array as well?
array - [component1, component2]
What now?
let ticket = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("ticket").ButtonStyle("SECONDARY").setLabel("Open Ticket").setEmoji("📩")
);
setStyle to enum not what u do
.setStyle(ButtonStyle.Secondary)
Right so what’s the number for each then? I can’t find the numbers for the activity types.
Use ActivityType enum
Right… and how do I find that? I can’t find it in the enum resolver.
Import it from discord.js
let ticket = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("ticket").setStyle(ButtonStyle.Secondary).setLabel("Open Ticket").setEmoji("📩")
);
yeah
Anyone mind having a look at the code https://sourceb.in/jumw990PoF and telling me why it's only replying to the interaction but not creating a thread, sending a message?
new Embed() or new EmbedBuilder()??
EmbedBuilder
Yes because that totally will work. I would have to take the discord.js value and put that code as part of my database so like “Discord.watching” or something just to make the fact I look through a database of statuses that are updated by my website updates and stuff…
ok
Embed is discord object
I’ll have to make a function to set a variable equal to the value of X based on what it says in the database…
Code:
client.on("messageCreate", (message) => {
if (message.content.startsWith(`<@!${client.user.id}>`) || message.content.startsWith(`<@${client.user.id}>`)) return message.reply({ content: `🟢 **|** Olá eu so o bot de ticket da **Green Codes** para ver meu preço vai até o [#972625786051887144](/guild/222078108977594368/channel/972625786051887144/)` });
if(message.channel.type === 'dm') return
if(message.author.bot) return;
if(!message.content.toLowerCase().startsWith('g.')) return;
if(!message.guild) return;
if(message.content === 'g.ticket') {
message.delete().catch(e => console.log('e'))
let ticket = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("ticket").setStyle(ButtonStyle.Secondary).setLabel("Open Ticket").setEmoji("📩")
);
let embed = new EmbedBuilder()
.setTitle(message.guild.name)
.setDescription(`Para abrir um ticket click no \"📩\"`)
.setColor(client.color)
message.channel.send({ embeds: [embed], components: [ticket] })
}
})
not function
what is not a function
mean non functional I believe
questioning why it isn't working
The code is not working
anyone please when i put console.log its not logging
error? + do u have message content intent?
yes I'm using all the intens
const { Client, Collection } = require("discord.js");
const client = new Client({ intents: [32767] })
Ok now I have all the gateway intents… why won’t my bot show the content of a message?
it's literally just one you need, having all is very much not a good idea
Yes I am aware but I am trying to figure out the ones I need when testing in one server then removing those I don’t need. I just can’t see any message content from my server and it’s weird.
Surely this would mean I can read message content?
node:events:505
throw er; // Unhandled 'error' event
^
UnknownEnumValueError: Expected the value to be one of the following enum values:
at NativeEnumValidator.handle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@sapphire\shapeshift\dist\index.js:1602:66)
at NativeEnumValidator.parse (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@sapphire\shapeshift\dist\index.js:113:88)
at ButtonBuilder.setStyle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\builders\dist\index.js:583:48)
at module.exports (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\eventos\interactionCreate.js:13:14)
at Client.emit (node:events:539:35)
at InteractionCreateAction.handle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:384:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
value: 'DANGER',
enumKeys: [ 'Primary', 'Secondary', 'Success', 'Danger', 'Link' ],
enumMappings: Map(15) {
'Primary' => 1,
1 => 1,
'1' => 1,
'Secondary' => 2,
2 => 2,
'2' => 2,
'Success' => 3,
3 => 3,
'3' => 3,
'Danger' => 4,
4 => 4,
'4' => 4,
'Link' => 5,
5 => 5,
'5' => 5
}
You should refer to sapphire support server for sapphire errors
all intents == 131071
your intents are old intents without message content and shedueld events
what sapphire??? sapphire of the iphone?
Yes the GuildMessages intent does not work.
so you send literally all intents but the single one you need
C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\builders\dist\index.js:526
this.components.push(...components);
^
TypeError: Found non-callable @@iterator
at ActionRowBuilder.addComponents (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules@discordjs\builders\dist\index.js:526:21)
at Client.<anonymous> (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\index.js:24:45)
at Client.emit (node:events:527:28)
at MessageCreateAction.handle (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (C:\Users\geren\OneDrive\Área de Trabalho\Ticket - Green\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:527:28)
No they are all there… right?
so then i'm just too blind to see where you supply MessageContent?
Oh that isn’t on the list of intents…
what list?
have they still not documented that, wew
Nope 😂
it's 1 << 15, but should be in the types you import there
we re-export it from discord-api-types https://github.com/discordjs/discord-api-types/blob/8e87b3e1ce/gateway/v10.ts#L174-L192
Ok cool. Now I just need to figure out how to set my status to watching…
Because apparently discord.playing works but discord.watching and discord.listening don’t.
last time i checked PresenceStatusData was still a string?
https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/structures/ClientUser.js#L125-L132
Uhm… activity type?
Yeah… .setActivity({type: <enum>})
Or whatever it is… it sets the message but not the type.
oh, that, right, but why discord.playing?
i think we export those under ActivityType.Playing etc?
might be because discord.playing is undefined and that trips 0? which is Playing, which is "playing..."
https://github.com/discordjs/discord-api-types/blob/d331e0dff3bc55d8cd456e5adee95412cfc00e95/payloads/v10/gateway.ts#L241
Because Discord is discord.js
undefined```• d.js `14.0.0-dev.1649030898-5748dbe` • Type: `undefined` • time taken: `0.104767ms`
-ev Discord.ActivityType.Playing
Application Commands: Application Command Object