#djs-in-dev-version
35223 messages · Page 13 of 36
Ok thank you!
Am I missing something, shouldn this exist?
hi hi, do we have any ETA of a v14 release by chance? just curious 
no
All good thanks!
hello, my slash commands won't register, meaning when I type in /, my bot doesn't have any slash commands.
const commands = await globPromise(
`${process.cwd()}/SlashCommands/*/*.js`
);
const commandArray = [];
commands.map((value) => {
const file = require(value);
if(!file.name) return;
this.client.slashCommands.set(file.name, file);
commandArray.push(file);
});
this.client.on("ready", async () => {
await this.client.slashCommands.set(commandArray);```
this is for my handler ^^
```js
const {
Client,
CommandInteraction,
ApplicationCommandType,
ApplicationCommandOptionType,
} = require('discord.js');
module.exports = {
name: 'balance',
description: 'View the balance of your wallet and bank, or a specific user\'s wallet and bank',
type: ApplicationCommandType.ChatInput,
category: 'Economy',
options: [
{
name: 'member',
description: 'A specific member that you want view their wallet and bank',
type: ApplicationCommandOptionType.User,
required: false,
},
],
/**
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run: async (client, interaction, args) => {
return interaction.followUp({ content: 'hi!' });
},
};
this is my command so far.
this is in v14 btw, and no errors
okay but how are you registering them on Discord? how are you sending them to the API?
const commands = await globPromise(
`${process.cwd()}/SlashCommands/*/*.js`
);
const commandArray = [];
commands.map((value) => {
const file = require(value);
if(!file.name) return;
this.client.slashCommands.set(file.name, file);
commandArray.push(file);
});
const rest = new REST({ version: '9' }).setToken(process.env["TOKEN"]);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationCommands('958848741790609468'),
{ body: commandArray },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();
this.client.on("ready", async () => {
await this.client.slashCommands.set(commandArray);```
I think the `REST` stuff does that
okay so, did you wait one hour at least?
ok so I logged commandArray, but there's nothing there.
[] is logged.
const commands = await globPromise(
`${process.cwd()}/SlashCommands/*/*.js`
);```
yeah
log commands
[]
ok so you have to investigate your globPromise function
right
ok I think it worked, or at least it logged this
i'll wait now, hopefully it loads
you could make a separate script to deploy to your test guild instead so you dont have to wait an hour everytime you test something related to interactions
ah alright, how would I do that ||sorry||
lemme see in the guide, im pretty sure theres something there
👍
yep, here https://deploy-preview-1011--discordjs-guide.netlify.app/interactions/registering-slash-commands.html#guild-commands, you have to change the rest route and add a guild id, take a closer look
just a few changes, so you can test things more easily an faster, you still have to be mindful of the ratelimit for creating / updating commands, which is 200 requests per day
got it
DiscordAPIError[50001]: Missing Access
at SequentialHandler.runRequest (/home/runner/v14/node_modules/@discordjs/rest/dist/index.js:679:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/runner/v14/node_modules/@discordjs/rest/dist/index.js:482:14) {
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'put',
url: 'https://discord.com/api/v9/applications/958848741790609468/guilds/932785394355941406/commands',
requestBody: { files: undefined, json: [ [Object] ] }
}```
so I re-invited my bot with application scopes, and still get the same error
uhhhhhhhh...
i dont know
alright, thanks anyway!!
I got it :)
ok, so everytime I restart my bot, is there a way to make it so that the bot doesn't duplicate commands?
Don't register guild and global commands with the same name and description
another way would be when you are done testing a command and its ready to be deployed globally, you can delete it from the guild
got it
thanks, to the both of you!!
how can i set button style in v14? (.setStyle('SUCCESS') is not working)
setStyle(ButtonStyle.Success)
thanks
Also please read the guide in the pins
okey
<@&839912195994812420> ^
Yeah that's violates so many ToS rules
<@&839912195994812420> again ^
Just spent the evening playing with dev, and I must say I like all the changes in v14 so far. Code is more readable, and modals are fantastic. Keep up the good work, and good luck with release. 💪
was ButtonBuilder.setEmoji changed in v14 dev? I'm getting ZodError of Expected string, received null
current code:
any ata for v14?
edit: nevermind, fixed it with
read pins
ty
How to fix error?
code:
await rest.put(Routes.applicationCommands(client.user.id, { body: client.commands }))
I dont think client.commands is compatible JSON usually
Interactions: Registering slash commands
read more
client.commands = (global.commands = [])
that doesnt seem to be the case
Ig client.commands is a collection but you need to pass an array of slash command data.
const commands = [];
const { REST } = require("@discordjs/rest")
const { Routes } = require("discord-api-types/v10")
const rest = new REST({ version: "10" }).setToken(client.config.bot.token)
fs.readdir("./src/commands/", async (err, files) => {
if (err) throw new Error(err);
files.forEach(async (file) => {
if (!file.endsWith(".js")) return;
let command = require(`./src/commands/${file}`);
commands.push({
name: command.name,
description: command.desc,
type: command.type ? ApplicationCommandType.ChatInput : ApplicationCommandType.ChatInput,
options: command.options
});
await rest.put(Routes.applicationCommands("953716268685479936", { body: commands }))
console.log(`✅ Command Loaded: ${command.name}`)
})
});
what do i need to change?
nothing?
looks fine to me
command.type ? ApplicationCommandType.ChatInput : ApplicationCommandType.ChatInput
This doesnt quite make sense to me
maybe move the put outside of the foreach
I'm fixed error
Routes.applicationCommands("953716268685479936", .....
Correct: Routes.applicationCommands("953716268685479936"), ....
Partials.Channel,
Partials.Message,
Partials.User,
Partials.GuildMember,
Partials.GuildPresences,
],
Property 'GuildPresences' does not exist on type 'typeof Partials'.ts(2339)
all other go fine. Have anyone an idea for this error
i think you are confusing partials and intents right now
const client = new Client({
intents: 32767,
partials: [
Partials.Channel,
Partials.Message,
Partials.User,
Partials.GuildMember,
],
})
y i thinks so too now >.<
that is wrong? i am much confused now
onst client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.MessageContent
],
partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.GuildPresences]
});
theres no presences partial
that's an intent
I think you should explain what you are trying to do
IntentsBitField (extends BitField)
Data structure that makes it easy to calculate intents.
how do you set a nickname in v14? user.setNickname() isn't working
it was never user.setNickname()
whaa?
<GuildMember>.setNickname()
so this isn't valid?
const user = interaction.options.getUser('user');
const nickname = interaction.options.getString('nickname');
if (!interaction.member.permissions.has('ManageNicknames'))
return interaction.reply({ content: 'You don\'t have permissions to use this command', ephemeral: true });
user.setNickname(nickname);```
interaction.options.getMember('user')
ah
And name the variable member to avoid confusion later on
ty
Hey there, does anyone have the link for the guide updated to the latest dev version? Seems like I’ve updated and tons of stuff just broke xD
Pins
This doesn’t cover the latest dev update
What is missing
Everything has been working fine with some other v14 dev version today, I’ve update to the latest one and I’m now getting
Constructor of class 'Embed' is private and only accessible within the class declaration.
I’ve been using new Embed().setWhatever to make my embeds till now
thats in the guide
That wasn't in the latest dev update because that was made ages ago
It is in the guide
The guide is clearly showing that this still works fine
Yet it isn’t, at least for me
I was a 2 or 3 weeks old dev version, so yeah this may be the case
I don't know what you're looking at
But it's right here
Property 'setFooter' does not exist on type 'EmbedBuilder'.
Well it may just be my brain being tired, but the guide is saying that EmbedBuilder.setFooter is a thing. Seems like TS isn’t
Yea idk why you are getting this issue, works fine for me
I’ll just try reinstalling djs
use EmbedBuilder from @discordjs/builders or within the discord.js module
I’ve already tried using this
No errors from TS
I’ve reinstalled discord.js@dev and its now working
Well I don’t know what could’ve been causing that
Huzzah
Thanks for the help
same as v13
.setFooter({ text: 'string', iconURL: 'string' })
try passing rest params
remove the array
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.
({...}, {...})
replace ... with label etc..
what error?
Where can I find all examples of TextInputStyles?
How do I send a DM to everyone who has a role?
not for api abuse
correct, you dont
thats against discord tos
against tos
okay, you can stop dogpiling now
technically, if it happens with the consent of the staff, it is consent for people to be in the guild
you should generally prefer to mention roles, whenever possible
but if it is not a surprising thing for your bot to do, and it is par of it's explicit purpose to give these notifications it's not the end of the world, and not a tos break.
fetch all members guild.members.fetch(), make sure the promise resolves successfully and access the role's role.members
it returns a filtered subset of all guild members (those who have that role)
you can then iterate over these and send a message to each via member.send("hi")
make sure to gracefully handle the promise rejection, as you cannot check if the member may have DMs disabled or your bot blocked.
Resources to understand Promise:
• MDN: learn more
• Guide: learn more
• JavaScript info: learn more
GuildMemberManager#fetch()
Fetches member(s) from Discord, even if they're offline.
Role#members
The cached guild members that have this role
GuildMember#send()
Sends a message to this channel.
these are the docs for the things mentioned above
if you have trouble with a part, please make sure to specify which part of the explanation it is that is giving you trouble and what you need to know to resolve it
@sullen karma see above
const modal = new ModalBuilder()
.setTitle('TEST')
.setCustomId('test')
.addComponents(
new TextInputBuilder()
.setLabel('test')
.setCustomId('test')
.setRequired(true)
)
interaction.showModal(modal)
:\Users\Soro-\Desktop\discord-bot\node_modules\@discordjs\rest\dist\index.js:679
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, res.status, method, url, requestData);
^
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[BASE_TYPE_REQUIRED]: This field is required
at SequentialHandler.runRequest (C:\Users\Soro-\Desktop\discord-bot\node_modules\@discordjs\rest\dist\index.js:679:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\Soro-\Desktop\discord-bot\node_modules\@discordjs\rest\dist\index.js:482:14)
at async ChatInputCommandInteraction.showModal (C:\Users\Soro-\Desktop\discord-bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:242:5) {
rawError: {
code: 50035,
errors: {
data: { components: { '0': { components: [Object] } } }
},
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'post',
url: 'https://discord.com/api/v10/interactions/962485064120270898/aW50ZXJhY3Rpb246OTYyNDg1MDY0MTIwMjcwODk4OkF1MFY2eHRlT0FvQkJiS3g0NzBBRHVaUVkxQ0dESHNIS3IyS21Md28zTDJYYVM3WWdhWGoxVnBKM0FYcGVyTUZDT0ppTjZHRVZSMjdmTUdRaGdRcHRVY0FxMmZVS2pTOG9EQURMYlNGcGQ4UTdYckpZNFpHZkpsVjQ0OGFpOW50/callback',
requestBody: {
files: undefined,
json: {
type: 9,
data: {
title: 'TEST',
custom_id: 'test',
components: [ { type: 1, data: [Object], components: [] } ]
}
}
}
}
I getting this error when i use interaction
my code
<ModalBuilder>.addComponents() takes ActionRow's, which have TextInputBuilder in them afaik
hmm
what is the voice intent in v14
GatewayIntentBits.GUILD_VOICE_STATES is not it
oh wait nevermind, I found the logs
const Event = require("../../Structures/Classes/event");
const client = require("../../index")
const {
EmbedBuilder
} = require('discord.js') //discord.js@dev (replace with MessageEmbed in v13/v12)
module.exports = new Event('voiceStateUpdate', async (oldState, newState) => {
let newUserChannel = oldState.voiceChannel
let oldUserChannel = newState.voiceChannel
let newaE = new EmbedBuilder()
.setTitle('welcome')
.setDescription(`${newUserChannel}; ${oldUserChannel}`)
client.channels.cache.get('946544494487150633')?.send({
embeds: [newaE]
})
})```
is this not right?
```js
let newUserChannel = oldState.voiceChannel
let oldUserChannel = newState.voiceChannel``` return undefined...
oldState.channel
VoiceState
Represents the voice state for a Guild Member.
like ```js
let newUserChannel = oldState.voice.channel
let oldUserChannel = newState.voice.channel
?
`TypeError: Cannot read properties of undefined (reading 'channel')`
Documentation suggestion for @crystal valve:
VoiceState#channel
The channel that the member is connected to
yep, got it
<VoiceState>.channel
oh right, my bad
no worries, tysm! got it to work finally
where can I see planned / in-dev (in discord.js@dev) things
what was your err
no error
we aint gonna debug your code
careless mistake
ok nothing
How do I define the GatewayIntentBits or whatever, how do I get it, I can't import it from api types, it didn't work with an error about something with a package.json
You need to import from discord-api-types/v9
I tried
const GatewayIntentBits = require('discord-api-types-)
Should I do
import GatewayIntentBits from discord-api-types/v9 or smth
yes
You don’t have to import from discord-api-types, you can just import from discord.js
this is importing the default export not the GatewayIntentBits btw
how
is message.reactions.cache broken in dev?
count says 1 but there is no users
The user isn't cached
ReactionUserManager#fetch()
Fetches all the users that gave this reaction. Resolves with a collection of users, mapped by their ids.
Use <Reaction>.users.fetch() to fetch them
I'm tryna make a button give a role when someone clicks it but, interaction.user isn't working, so how do I make it know I'm tryna do it when a user clicks a button?
MessageEmbed has now been renamed to EmbedBuilder. but in example its Embed() not EmbedBuilder()
what to use?
when its ready
How can i check modalSubmit event?
both the same things
There isnt one, its just interactionCreate
Theyre interactions
okey thanks
Input not instance of UnsafeSelectMenuOptionBuilder I keep on having this, anyone has a snippet of code to fix it or to make me understand?
are you passing an Array to the .addOptions() method?
what error
idk what error
Yeah
Remove the array and just pass the objects {…},{…}
so like .setOptions({ label: "one", value: "one" },{ label: "two", value: "two" })?
Yup
oh okay
same problem
wait no
nvm
On top is the code that I evaluate at the bottom
addComponents takes rest parameters, not an array
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.
Same as you did for setOptions
Okay now it works 👍 sorry for slow brain I got used to v13 so much
Did you use code from youtuber krazy developer?, If yes dm me I'll help you i know the fix
Yes
Manager#resolve() checks only the cache?
yes
thanks
this is correct right? i am getting a error
.setEmoji({ id: 'string' })
So this doesn't work anymore, so how, possibly, could I fix this?
roles.match(/<@&\d+>/g).forEach((string) => {
let role = message.guild.roles.cache.get(string.match(/\d+/g)[0]);
// CHANGE ARRAY TO REST PARAMETER
array.push({
label: role.name,
value: role.id,
emoji: role.unicodeEmoji ?? null,
default: false,
});
});
const newComponent = new Discord.ActionRowBuilder().addComponents(
new Discord.SelectMenuBuilder()
.setMinValues(1)
.setMaxValues(maxSelect)
.setCustomId(`setRoles_${actualComponents.length}`)
.setPlaceholder(placeholder)
.setDisabled(false)
.setOptions(array) // array is still array :/
);```
I know the problem is that the options is an array
if there are any ways, tell me as fast as you can 👍
just spread the array
Spread syntax (...)
Spread syntax (...) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.
so like i do setOptions(...array) and it should work?
try it
I have and it doesn't
Input not instance of UnsafeSelectMenuOptionBuilder
well you will have to use the builder then
afaik they also take json so you could try to do it that way
This worked tho
const x = [
{ label: "one", value: "one" },
{ label: "two", value: "two" },
];
interaction.channel.send({
components: [
new Discord.ActionRowBuilder().addComponents(
new Discord.SelectMenuBuilder()
.setMinValues(1)
.setMaxValues(1)
.setCustomId("none")
.setPlaceholder("Placeholder")
.setDisabled(false)
.setOptions(...x)
),
],
});```
I've noticed (much like everything else), that ButtonBuilder.setEmoji has changed; I can't figure out how to properly use it though.
Anyone got a clue?
I can see that it wants me to populate it with an object, however, how do I just use default Discord emojis?
it takes an object with name and id afaik
That is correct.
However, how do I use the like default Discord emojis?
you just use the name then
Such as, 1️⃣, 2️⃣, 3️⃣, etc..
I've tried that and it says it's an invalid emoij.
So I'm lost.
I've even tried using the emoji unicode.
Oh, uhm, it's just randomly started working.
Okay, that's great.
Can msg.showModal() not be used if the reply has been deferred?
I find that to be a little bit weird.
Nope
That sucks.
msg.showModal({
name: "Test",
customId: "Main",
components: [
new ModalBuilder()
.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId("Test")
.setLabel("Test")
.setPlaceholder("Test")
.setStyle(TextInputStyle.Short)
)
)
]
});
I've tried following the documentation and created this; it looks correct, however, it doesn't seem to work.
data.components[0][COMPONENT_TYPE_INVALID]: The specified component type is invalid in this context
Disregard. ^^ Figured it out.
msg.showModal(new ModalBuilder()
.setTitle("Test")
.setCustomId("test")
.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId("Test")
.setLabel("test")
.setStyle(TextInputStyle.Short)
)
)
)
0 is the type
what does this error mean have never seen it befor
Nvm fixed it.
my code;
success(content, emoji) {
if (typeof emoji !== "string") return;
const success = new EmbedBuilder()
.setColor(Util.resolveColor("Green"))
.setDescription(`${emoji} ${content}`)
.setTimestamp()
return success;
}
how to fix?
show how you use that method
success("Message", "⚠️")
the whole code, not just... that
ok
wait
const { Client, Message } = require("./src/frame")
const bot = new Client({ token: "" });
const i = new Message();
bot.on("ready", async () => {
bot.channels.cache.get("955072493197074508").send({ embeds: [i.embed.success("Success!")]})
})
whats new Message()?
let rp = message.member.roles.cache.hasAny(["618976181026422814","139836912335716352"])
if(rp) console.log("has role")
its takes more keys how i can do it for array ?
not works any1 help me
i need them in array
not sure why you constantly ignore answers you get
#djs-help-v14 message
Wouldn't it be new Messages() instead of Message()?
const Framework = require("./Utility/framework");
const Messages = require("./Utility/Message");
const Client = require("./Discord/client/Client")
module.exports = {
Message: Messages,
Framework: Framework,
Client: Client
};
i pull from here
BRUH
You send everything incomplete
how?
if you didn't enable the MessageContent intent in the client constructor, that is indeed normal
Do modal component text input custom Id's collide?
Do what it says
i dont get it
also this doesn't have anything to do with this channel
good question, idk. There's only one way to find out
It's interesting discord even called it that, should've been like slash command options imo
I'm about to try this, I'll report back
@velvet jasper tried it out on two accounts & platforms at the same time, the customId being the same does not seem to have any effect
cool good to know
So this would've been good
on 14.0.0-dev.1649505803-3c0bbac right now, it seems message collectors no longer pass the message thats been collected correctly? tested with following code inside aninteraction
const filter = m => m.author.id == interaction.member.id && m.channel.id == interaction.channel.id;
const collector = interaction.channel.createMessageCollector({ filter, time: 10000, max: 1 });
collector.on('collect', async m => {
console.log(m) // returns Map {}
let channel = m.mentions.channels.first().id // Cannot read properties of undefined (reading 'id')
});
tested & working on 14.0.0-dev.1647259751.2297c2b
in fact, it looks (to me) like it always just returns Map {}, printing m.id, m.mentions etc all return Map {}
Doesn't make sense for m.id to log that, but if you're on v14 have you enabled the message content intents?
okay yeah thats my bad, ID is valid, i slipped into the wrong bit of code there so my change of the print didnt stick, i'll check whats wrong.
a-ha! i have to fetch the message before i can get the mentions
weird that it only happens since i bumped the dev build, wonder what changed.
well no, you just dont have the message content intent
Which is what I said
dev build uses API v10 where its required to be provided if you want message content, mentions etc
Can modals be created from message input as well?
Modals can only be sent in response to an interaction
oh i see
First day looking into v14, is there any real advantage in using Builders instead of Unsafe Builders in production code, assuming you've (moderately) tested your code beforehand?
I mean, imo unsafe builders have no advantage over just raw JSON
They're just a stylistic choice for building data
regular builders do data validation so it will throw errors if you're ever putting through user input for example
But like would there be any downside in say, prefixing all builders with Unsafe when pushing to prod?
You lose data validation
i guess with user input yeah
If its static pre-validated data no, but then theres no advantage to a builder at all imo
I guess thats true yeah, i just prefer the styling for it as well
then thats fine
Yeah so for any builders where i just use my own hardcoded stuff i might as well use unsafe right
probably yeah
Can you add buttons inside Modals?
not yet, no
const textinput = new TextInputBuilder({
customId: "balaaaaaaaaaadhuyaeuyfegfyuaegyiegfaygkfgjzhdkgfagyugalifbhj",
label: "label boi",
style: TextInputStyle.Short,
minLength: 3,
maxLength: 3000,
required: true,
value: "pre filled data k",
placeholder: "place holder baka"
});
const row = new ActionRowBuilder({
components: [textinput]
});
const favoriteColorInput = new TextInputBuilder()
.setCustomId('favoriteColorInput')
// The label is the prompt the user sees for this input
.setLabel("What's your favorite color?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Paragraph);
// An action row only holds one text input,
// so we need one action row per text input.
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);
// Now we need to add our inputs into the modal
const modal = new ModalBuilder({
customId: "mymodal",
title: "test title",
components: [row]
})
modal.addComponents(firstActionRow, secondActionRow);
await interaction.showModal(modal);
code above
error below
[antiCrash] :: Unhandled Rejection/Catch
ValidationError > s.string
Expected a string primitive
Received:
| undefined
at StringValidator.handle (/workspace/node_modules/@sapphire/shapeshift/dist/index.js:1372:70)
at StringValidator.parse (/workspace/node_modules/@sapphire/shapeshift/dist/index.js:114:88)
at validateRequiredParameters (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:762:21)
at ModalBuilder.toJSON (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:777:5)
at Object.run (/workspace/slashCommands/CHAT_INPUT/owner/modal.js:52:21)
at ChatInputCommandInteraction.showModal (/workspace/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:245:46)
at Object.run (/workspace/events/discord/guild/interactionCreate.js:107:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5) Promise {
<rejected> ValidationError > s.string
Expected a string primitive
Received:
| undefined
at StringValidator.handle (/workspace/node_modules/@sapphire/shapeshift/dist/index.js:1372:70)
at StringValidator.parse (/workspace/node_modules/@sapphire/shapeshift/dist/index.js:114:88)
at validateRequiredParameters (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:762:21)
at ModalBuilder.toJSON (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:777:5)
at ChatInputCommandInteraction.showModal (/workspace/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:245:46)
at Object.run (/workspace/slashCommands/CHAT_INPUT/owner/modal.js:52:21)
at Object.run (/workspace/events/discord/guild/interactionCreate.js:107:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
}
any clue why is it happening when im execing it
Try custom_id instead of customId
And min_length max_length
okay worked
can i use smth else instead of interaction event to ccatch the modal submits?
InteractionCollector
how?
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...)
k
how'd you do .addFields() in v14? I think I might have done it wron
<EmbedBuilder>.addFields(...Array<EmbedFieldData>)
.addFields(
{ name: 'Name', value: `${user.username}`, inline: true },
)``` so this is correct?
Yes
.addStringOption(option =>
option.setName('currency')
.setDescription('currency to trade')
.setChoices(
{label: 'Bitecoin', value: 'btc'},
{label: 'Endereum', value: 'eth'},
{label: 'Riperl', value: 'xrp'},
{label: 'Lintcoin', value: 'ltc'},
{label: 'Stealer', value: 'xlm'},
{label: 'Discoin', value: 'discoin'}
)
.setRequired(true))``` this returns multiple errors, how do we add choices?
Error being what
Doesnt choices consist of name and value
no idea
name and value, not label and value
thank you
I am not good at debugging these lol
const filter = (interaction) => interaction.customId === 'accept' && interaction.user.id === member.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 30_000 });
collector.on('collect', i => {
i.reply('debug response')
});
collector.on('end', collected => {
interaction.editReply({content: 'this trade has expired'})
});
```did they change button collectors?
you have to specify the component type no?
it straight up can't create the collector
try to create it on a Message object
both interaction.message and interaction.message.channel doesn't work
the errors respectively
How to check if a deleted message is text, or an image?
theres message.content and message.attachments which is a collection of attachments, check if the size is more than 0
I have this odd error
CombinedPropertyError (1)
Received one or more errors
input.id
| CombinedError (2)
| Received one or more errors
|
| 1 ExpectedValidationError > s.literal(V)
| | Expected values to be equals
| |
| | Expected:
| | | undefined
| |
| | Received:
| | | null
|
| 2 ValidationError > s.string
| | Expected a string primitive
| |
| | Received:
| | | null```
when using `.setEmoji("📜")` on a button
.setEmoji({ name: '📜' })
Ohhh. Thanks!
lol it was supposed to be clearer than zod errors
Lol honestly I was lost
Make sure you import the button builder from discord.js not discord.js/builders
The djs builder allows emojis to be passed in directly
In the pinned messages, it says In client settings, where's that at?
the options you pass when constructing a new client
Ok, how do I allow message content thinger? It says Make sure you also set the intent in Client settings MessageContent = 1 << 15
Use the MessageContent intent flag
GatewayIntentBits.MessageContent?
const client = new Client({} /* Everything inside the curly brackets is considered client settings or options */)
it worked, ty
It gives you full stacktrace so u can easily figure out from where it's coming. Also there was input.id which explains it
dude this error says received null when he passed a string lol
He's using djs builder which uses Util.parseemoji so basically that one will convert id to null
Ig this validation needs a fix to allow null because Util.parseEmoji will always return id null for default emojis
That's odd, I'm using const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js"); 
Whats the predicted time v14 will officially come out?
at some point in the future
when its ready
Nevermind, for some reason I did use discord.js/builders instead only on this specific case, problem solved
This error occurs after removing store channels.
I think just removing a store channel type should't lead to this error.
What I also should to change?
All packages are on the latest version (3c0bbac)
new SlashCommandBuilder()
.setName('name')
.setDescription('Description')
.addChannelOption((option) =>
option
.setName('name')
.setDescription('Description')
.addChannelTypes(
ChannelType.GuildNews,
),
),
seems like a version mismatch from discord-api-types
what does npm/yarn why discord-api-types show?
you have both v0.29 and v0.31.1 installed. enums from different versions are considered different enums so you can't assign one to the other
So should I wait for the fix update?
you can also use yarn resolutions or npm overrides to pin it to one version
seems like it got bumped in d.js for the store channels removal but not in the other packages
Ok, thank you
do button clicks on uncached messages emit an interactionCreate or a raw event
InteractionCreate
ty
wait raw event was removed?
I get a zoderror, how do I start debugging it?
Relevant code:
const lfgEmbed = <Message>.embeds[0].data;
const guardians = lfgEmbed.fields.pop().value.split(", ");
const newEmbed = new EmbedBuilder()
.setFooter(lfgEmbed.footer)
.addFields(lfgEmbed.fields);
if(guardians.includes(ic.user.tag)){
return ic.reply({content: "You're already in this LFG.", ephemeral: true});
} else {
guardians.push(ic.user.tag);
newEmbed.addFields({value: guardians.join(", "), name: `**Guardians Joined: ${guardians.length}/6**`});
}
<Message>.edit({components: <Message>.components, embeds: [newEmbed]});
Have you tried reading the error it usually tells you whats wrong
I wouldn't be asking how to debug if it gave me information
Line 80 is .addFields(lfgEmbed.fields);
Remove .data at first line
but it's an object and the stuff is inside .data
latest dev should give you shapeshift errors which are more descriptive
Same error, same line
Imma update to latest to get more descriptive errors
Ah I see, I pass an array instead of rest
does the received embed include some data you don't want to send? otherwise you can use EmbedBuilder.from to convert an Embed to a builder
I edit one of the fields, rest would be fine
I guess I could just edit the field with the new embed then
DiscordAPIError[50035]: Invalid Form Body
components[0].components[BASE_TYPE_REQUIRED]: This field is required
Interesting 
youre not on the latest version if youre getting zod errors
I know I updated, irrelevant
you can't resend actionrows currently, there's a bug with toJSON not including components
oof
Wait do y'all need the dev version of builders to be installed in order to use them for djs?
I think so since d.js extends renamed classes
That's strange bc I'm testing it right now doing new ActionRowBuilder and I only have the dev version of djs installed and it works
you probably get the builders dev if you don't have it manually installed
yeah ig thats why I'm confused bc I swear some people in here stated that you have to manually install the dev version of builders to get them to work with the dev version of djs. But it seems like installing just the dev version of djs is all that's needed.
if you follow the d.js guide for slash commands you have to manually install builders since slash command builders are not re-exported
yeah that might need to be reconsidered given the naming conflicts
bc vsc auto-import will only suggest builders if it's in your package.json. Most people just want to use the builders from djs
yes, I think slash command builders were the first part of the builders package and nothing was re-exported back then. There's still other stuff like isJSONEncodable and embedLength which is not re-exported
at this point I don't think it hurts to reexport everything from builders since it's a regular dep anyways
that would hopefully solve the confusion with d.js re-exports behaving differently
fix is in a pr
its commented out it doesnt change anything
Yeah its just jsdoc
But thanks for pointing it out
Its a component type for Modals
The only supported component type at the moment
Idk about android but it’s supported on iOS
yes
i think style is 1 or 2, use TextInputStyle enum
you can't send empty embeds
Nothing that has a label, style, value and placeholder also has a description to my knowledge
Its telling you an embed needed a description, not a TextInput
no it does not
It goes in an ActionRow in a Modal
TextInputs don't have descriptions
You're not putting them in a Modal
This is the correct one
are you attempting to send the modal in a message?
as a component?
Modals arent components
ChatInputCommandInteraction#showModal()
Shows a modal component
Interaction response type
So, idk what happened but i uninstalled and reinstalled djs, and now im getting typescript errors lol
Discord.js version is still the same as before the uninstall (14.0.0-dev.1649505803-3c0bbac), however in my lockfile discord-api-types updated from 0.31.0 to 0.31.1 (Dependency of discord.js)
The error im getting is:
node_modules/discord.js/typings/index.d.ts:2970:14 - error TS2536: Type 'T' cannot be used to index type 'MappedChannelCategoryTypes'.
2970 ): Promise<MappedChannelCategoryTypes[T]>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/discord.js/typings/index.d.ts:3008:14 - error TS2536: Type 'T' cannot be used to index type 'MappedGuildChannelTypes'.
3008 ): Promise<MappedGuildChannelTypes[T]>;
~~~~~~~~~~~~~~~~~~~~~~~~~~
Strange thing is obviously that these are djs types and not in my control, but yeah im unable to build my source now
"skipLibCheck": true, works as a temp fix but id obviously prefix not to have to do that
show code please
and the error stack?
Not sure if EmbedBuilder needs to be toJSON'd
I mean it shouldn’t make a difference but yeah you don’t have to tojson it
config is undefined
oh scoping of course
why do you have two separate try blocks
dont use var
use let or const
I mean yeah but if you hadnt used var you wouldnt
So just keep it in scope
Is there any known issue with the message content intent? I have 4 bots running with the exact same config.
When fetching the same message, 2 of them get the full content, and 2 of them get a result without any content/author/etc.
I mean the only issue I can think of there is not having the intent enabled
they all have the intent enabled and selected
an error would be thrown if im trying to identify with the intent without having it enabled in the dev panel right
and passed in ClientOptions?
yes
yup
they use the same object of clientoptions lol
whats the intents field exactly
export const config: ClientOptions = {
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildScheduledEvents,
],
}
it looks correct.
yup seeing as 2 of them are able to get the content of the message i doubt its an issue in the config
its just very weird that 2 of them consistently cannot get the content
its the same 2 bots, persists across restarts too
and theyre all on v14/ API v10
i mean unless i have to do something special to get them there, yes
thats optional chaining, which is sort of a way
the 4 bots are launched in a for loop with the exact same settings, only the token is different ofc
It depends what you intend to do with the access
yeah cant think of any reason
very weird
Tried disabling and re enabling the message content intent in the dev portal as well but didnt change anything either
again, please show your code
So it doesnt exist because you didnt put a value in it, right?
So why dont you typeof it before trying to parseInt it
This is just coding basics
Check that its defined before trying to use it
So pass the false so that it isnt required, or catch that error since its basically already doing the check for you
Why Type 'ApplicationCommandOptionType.String' is not assignable to type 'ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup | ApplicationCommandOptionType.Channel | ApplicationCommandOptionType.Attachment'?
I need to install another PR?
Usually mismatched API types version
Is it normal that the type property now has type any? I updated the latest version of discord-api-types.
probably not? restart the ts server maybe
No effect 
Is there a PR for discord-api-types that is on par with discord.js@dev?
Do npm why discord-api-types
npm why?
oh
https://srcb.in/30rQz95GHO code
Error: Cannot properly serialize component type: undefined
at createComponentBuilder (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:516:13)
at /workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:529:46
at Array.map (<anonymous>)
at new ActionRowBuilder (/workspace/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:529:35)
at new ActionRowBuilder (/workspace/node_modules/discord.js/src/structures/ActionRowBuilder.js:8:5)
at /workspace/node_modules/discord.js/src/structures/MessagePayload.js:135:84
at Array.map (<anonymous>)
at MessagePayload.resolveBody (/workspace/node_modules/discord.js/src/structures/MessagePayload.js:135:49)
at ChatInputCommandInteraction.reply (/workspace/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:106:56)
at Object.run (/workspace/slashCommands/CHAT_INPUT/utility/help.js:251:41)
error above, why?
are default emojis not supported that way anymore?
it's an object iirc
{ name: "🎉" }
how to send components
same way to v13
Will it still be possible to do prefix commands in v14?
not recommended, you will need the MessageContent intent
Depends, are you making a bot for 1 guild or many?
yes, it will be possible. thats it
as long as you have the message content intent
that should be possible again, make sure you are on the latest version and import ButtonBuilder from discord.js, not from /builders
ohh thanks i was on ^14.0.0-dev.1649160496-402514f
$tip @outer bane cookie
still the same error 
you didnt show any error, but are you importing the EmbedBuilder from discord.js?
sorry
Only reason why I ask is because unless there's a way to hide certain slash commands and make it viewable to roles like admin. (Yes I know I can just block the commands from roles below but I'd prefer it to be unviewable to lower roles instead of it being listed in the slash commands.)
that might be possible in the future with command permissions v2
Yeah that’s not possible at the moment
Only reason why I'm still doing prefix commands. xD
You and me both, just keep your fingers crossed for a better permissions system in v2 🤞
found the bug, will be fixed soon^tm

I had mentioned earlier. Util.parseemoji changes I'd to null and the validation at builder expects a string/undefined I'd which is causing the error. That validation needs a fix
or the util resolver needs one
otherwise you'd have to change typings in builders too
okay 
Does the InteractionCollector also call/trigger "end" if the model was exited through esc for example?
no, there is no way to detect that
Alright thank you
Is there something wrong with this builder?
const commandData = new ErisCommandBuilder().setName("profile").setDescription("Display someone's profile or edit yours.").setCategory("general")
.addSubcommand(subcommand => subcommand.setName("view").setDescription("View your or someone else's profile.")
.addUserOption(option => option.setName("member").setDescription("The member who's profile you'd like to see.").setRequired(false)))
.addSubcommand(subcommand => subcommand.setName("edit").setDescription("Edit your profile.")
.addStringOption(option => option.setName("modification").setDescription("What about your profile you'd like to edit.").setRequired(true)
.addChoices([["description", "description"], ["image", "image"], ["color", "color"]])));```
``` CombinedPropertyError: Received one or more errors
at ObjectValidator.handleIgnoreStrategy (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:973:66)
at ObjectValidator.handleStrategy (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:907:47)
at ObjectValidator.run (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:103:23)
at ArrayValidator.handle (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:394:37)
at ArrayValidator.parse (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:114:88)
at MixedClass.addChoices (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:1083:22)
at D:\PlanetLily\commands\general\profile.js:12:14
at MixedClass._sharedAddOptionMethod (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:1293:50)
at MixedClass.addStringOption (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:1282:17) {
errors: [
[ 'value', [CombinedError] ],
[ 'name', [MissingPropertyError] ]
]```
addChoices takes rest param
Ah like so (?)
yes
Gotcha thank you
I think it still wants an object: ValidationError: Expected the value to be an object, but received string instead
.addChoices("description", "image", "color")
{ name: "strinf", value: "string" }
Ah okay, that worked! Thank you
Did Constants.APIErrors change in any way? I can't find anything about it but can no longer use UNKNOWN_MESSAGE
user clicks temporary message button
How to delete the button and open the modal?
(not delete Temporary messages)
This channel is for questions regarding the dev version of djs v14 please use another channel
Instead of returning null or undefined, the promise rejects when fetching a message which does not exist. I have code below the fetch to handle a missing message but now it just throws the rejection to my catch block and stops further execution, is this normal?
can you show how you did
try {
for (const x of xArray) {
const message = await channel.messages.fetch(x);
if (!message) /** Does not ever reach this code, followed it through debugger**/
}
} catch(error) {
// Reaches this
}
that is expected behaviour, you can handle the "no message" case in the catch block
Why does it not just return undefined? I'd rather keep the catch block for errors.
because you'd need an additional check after fetching and undefined doesn't convey any information like the error code
Yes but now I have to copy an entire block of code over to the catch block
what do you need to check if the promise resolves?
What do you mean exactly?
you said you'd have to copy an entire block of code, what do you do that you have to do in both cases?
also if you really need the promise to always resolve you can write your own fetch function which does all of this
Well in this case specifically I first check if the old messages exists, and if it does I can just easily 'copy' the embed that is already on that message to use again. If a user has deleted the message it needs to construct a new one, the output of the if (!message) { } else { }; is later used as embed to send in a channel.
In this case it would not be that bad but maybe it would be nice if there was an option that makes it always resolve?
as I said, wrap the fetch call in your own function which does the try catch
or use .catch
Yes I'm going to do that for now, but do you think it is a good idea to include this in djs?
I think that should be left to the end user, error propagation is a common concept and you loose a lot of information if you just return undefined / null. maybe you want to know if it failed due to a network outage or missing permissions or a deleted message or ...
I'm suggesting an option is added like force and cache, e.g.: <Channel>.messages.fetch(id, { alwaysResolve: true })
fetch(...).catch(e => { /* handle error, at least log it */ return null; })
I don't see how that option would be any different from the above line of code. silencing errors is in general not a good idea
Well not unless your code is designed to expect <Message<boolean>> or undefined
you can also return undefined from catch
Testing that out right now ^
It works
Perhaps you can tell it to suppress errors, e.g.: <Channel>.messages.fetch(id, { suppressErrors: [10008] /** Is unknown message **/ })
Catch is indeed also a possibility, but would still like prefer this ^^
you can define a function fn somewhere, handle different errors based on code and do fetch(...).catch(fn)
(you should also use dapi-types enums instead of magic numbers)
Yes I know, I was just giving an example
I still don't think this should be handled at the library level, but feel free to suggest it somewhere
Maybe I'll open an issue on the GH
See what others think about it
Hey
I need help, I would like to have the ID of a role, which can be selected with a SlashCommand option, but I always get undefined
Code:
//Slashcommand builder
.addRoleOption(option => option.setName('role').setDescription('The Role').setRequired(true))
//const the role
const word = interaction.options.get('role')
//how i try to get the id:
${word.id}
||I'm asking in v14 because I'm working on v14||
getRole()
such small mistakes happen again and again, better if someone else looks over them, thank you
you can use get() too but getRole() returns the Role you selected and get() returns CommandInteractionOption so you would have to access role property from it
Ah yes I didn't know that, thanks for the info
code: js let channels = (await guild.channels.fetch()).filter(ch => ch.permissionsFor(guild.me).has('SEND_MESSAGES') && ch.type === 'GUILD_TEXT') // Filters all the channels the bot has send messages perms & is a text channel
Error: ```js
node:events:368
throw er; // Unhandled 'error' event
^
DiscordAPIError[50035]: Invalid Form Body
channel_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
i dont believe that code would have caused that error
but besides, you have to use SendMessages, and for the channel type you have to use ChannelType.GuildText
did the author field get removed from Embeds? or is this a bug?
No it’s still there, what does your code look like?
yes, it is a bug, wait for the next dev release cycle
👍
so many bugs...
it's a development version, what did you expect?
^
npm install discord.js@dev
will that be v13 dev or v14 dev
v14-dev
So how do I get v13 dev
there is no npm tag for that
is modals in v13 main branch?
youd have to install it from the repository
the main branch is v14-dev
so what command do I run to get v13 main
on another note, the "MAX" option seems to be missing from the enum ThreadAutoArchiveDuration. is that also a known bug or is it in a different enum?
install the v13 branch from the repo
ThreadAutoArchiveDuration
A number that is allowed to be the duration (in minutes) of inactivity after which a thread is automatically archived. This can be: (more...)
is modals on that?
yes
there is no "max" option api-wise, not a bug
so
npm i https://github.com/discordjs/discord.js/tree/v13
try it and see
so... it got removed? is there an inbuilt function for calculating that as a replacement?
its working but will that give me what I want?
It's documented so i dont think it got removed
it's documented, but not implemented (and the documentation seems to be incomplete-ish)
I think your understanding of it is incorrect?
it doesnt exist on runtime on the enum, the docs are wrong
We allow sending it. Discord doesn't send it back to us
O_o
okay, they arent "wrong", but discord.js' typedef and the discord-api-types enum arent the same
there is no discord.js enum on runtime for it, thats what i meant
theres one on the Util class
(static) Util.resolveAutoArchiveMaxLimit()
Resolves the maximum time a guild's thread channels should automatcally archive in case of no recent activity.
thanks
Yay, phew
TypeError: Discord.ModalBuilder is not a constructor
you are using unsupported versions
wdym
npm i discord.js@dev
this is for v14-dev, not the v13 branch from the repo
doesn't seem to be in the current dev version yet though :P
oh so I cant get help
dang
Util.resolveAutoArchiveMaxLimit()? That's been out for a longgggg time
you can in #djs-help-v14
Oh it's not in the typings
you can either use @dev or just wait until 13.7 is released
oof
Just // @ts-expect-error, it'll work
You'll know when the fix is out because that'll line will error <:
or you can just pass "MAX" to it
without using an enum
Yea that'll work too
Can I deferReply and show a modal?
no
Alright thank you
what did exactly mean? EmbedBuilder#setFooter() now accepts a sole FooterOptions object. (add link to dapi site) i get this error if i put footertext and footericon
this does exist in Embed.data though. why does EmbedData exist in the first place?
I'm receiving messages (probly partial) where message.author is null. Is that normal? I logged the Message and this is it.
Its an object now, { text: "string", iconURL: "string" }
In partial messages, aren't we suppose to still get the authorid?
Not according to the docs, Message#author is marked as nullable/optional
I just rechecked my code. What i'm doing is if the message is partial, (in message update), i fetch the message from the id. Seems like it's now fetching properly. I will need to do more test i guess
Whats the point of doing that...
To get the author
In messageUpdate the new message isnt ever partial, and the old one can't be fetched otherwise you just get the new one again
Maybe i'm wrong on what i'm doing. Let me recheck 😂
The only message in messageUpdate that can be partial is the old/previous state
But you cant fetch that - its old
if thats the case then the typings are wrong
Ho, i think i'm doing it in messageReactionAdd
Ahh okay fair enough
Maybe we mark it as partial now incase intents are missing
you wont receive the event at all if you dont have the intent
The MessageContent intent?
that doesnt affect the author
nvm, its isntcontent is already nullable
I never said it effects the author, it effects the message typing
being Partial
but you should still have everything apart from the content fields?
I'm pretty sure if an uncached message event is updated, the new message will still have some null stuff?
Sure but its still partial if fields are missing
Discord docs say MESSAGE_UPDATE might not send a full message
so what, if you dont use the messagecontent intent every message you receive will be partial?
But in practice it always used to
Either that or we need to make a new typing called MessageWithoutContent yes
Partial = not complete
Fields missing = not complete
Fields missing = partial
Unless we want to treat them as a "complete" message with null fields
Partials are kinda a messy area as it is
Embed#fields
An array of fields of this embed
DMChannel#createMessageComponentCollector()
Creates a component interaction collector.
CommandInteraction#channel
The channel this interaction was sent in
Will v14 use the permissions system v2?
Or not yet
not yet. it is still not released
just started getting this error after updating discord.js@dev (as far as i know), anyone else have this issue?
send code
that is the code, it runs right after client ready event
function/timeloop.js
it's just a chain of async functions called after ready that lead up to that buttonbuilder
theres a known bug with setEmoji right now
Not sure if this is it though
Yeah this is new
Temporary fix would be to pass an empty object to the ButtonBuilder constructor
yep that seems to fix it, should i make a bug report for it?
I'll fix it now in a PR
cool cool, thanks!
Could you tell us when it is fixed?
There was actually already a PR pending oerge
Merge
TypeError: Cannot destructure property 'emoji' of 'undefined' as it is undefined.
at new ButtonBuilder (C:\Users\Jan\OneDrive\Dokumente\LDVoice\node_modules\discord.js\src\structures\ButtonBuilder.js:8:17)
at C:\Users\Jan\OneDrive\Dokumente\LDVoice\interactions\slash\setup\setup.js:109:29
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (C:\Users\Jan\OneDrive\Dokumente\LDVoice\interactions\slash\setup\setup.js:102:27)
at async Object.execute (C:\Users\Jan\OneDrive\Dokumente\LDVoice\events\slashCreate.js:37:4)
at async Client.<anonymous> (C:\Users\Jan\OneDrive\Dokumente\LDVoice\bot.js:63:23)
Can you help me with this one?
read like the last 10 messages lol. good timing
oh
xd thank you
C:\Users\Jan\OneDrive\Dokumente\LDVoice\node_modules\discord.js\src\structures\Webhook.js:203
const query = makeURLSearchParams({
^
TypeError: makeURLSearchParams is not a function
at InteractionWebhook.send (C:\Users\Jan\OneDrive\Dokumente\LDVoice\node_modules\discord.js\src\structures\Webhook.js:203:19)
at ChatInputCommandInteraction.followUp (C:\Users\Jan\OneDrive\Dokumente\LDVoice\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176:25)
at Object.execute (C:\Users\Jan\OneDrive\Dokumente\LDVoice\interactions\slash\setup\setup.js:143:21)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.execute (C:\Users\Jan\OneDrive\Dokumente\LDVoice\events\slashCreate.js:37:4)
at async Client.<anonymous> (C:\Users\Jan\OneDrive\Dokumente\LDVoice\bot.js:63:23)
Another one i can't fix somehow
Already worked on the new version
But not it doesn't work anymore
Error at line 63 in bot.js file
If you pay attention to the error you will see the problem
What can mean
TypeError: Cannot destructure property 'options' of 'undefined' as it is undefined.
in 14.0.0-dev.1649808570-01a423d?
Stack please? could be a known issue
Were you trying to build a SelectMenu?
Yeap, SelectMenuBuilder
Known bug, to be fixed
Pass {} to the constructor to temporary fix it
I didn't quite get it. Could you give a simple example of a fix?
new SelectMenuBuilder({}).addOptions(...)
.
I'm getting the same error when showing a modal, but the latest release should already contain this fix/PR (?)
Error: Cannot properly serialize component type: undefined
hi how do i send the input from this modal to a channel? https://cdn.protyo.live/images/Discord_hcuttnthcG.png
get the channel in the interactionCreate event and send it there
yea ik like message.channel.send but what do i send?
modals are only available in interaction replies iirc
how are you able to show it in the first place?
module.exports = async (client) => {
const bugChannel = "955208454774063214";
const modal = new Modal() // We create a Modal
.setCustomId('modal-customid')
.setTitle('Test of Discord-Modals!')
.addComponents(
new TextInputComponent() // We create a Text Input Component
.setCustomId('textinput-customid')
.setLabel('Some text Here')
.setStyle('SHORT') //IMPORTANT: Text Input Component Style can be 'SHORT' or 'LONG'
.setMinLength(4)
.setMaxLength(10)
.setPlaceholder('Write a text here')
.setRequired(true) // If it's required or not
);
client.on('interactionCreate', (interaction) => {
if(!interaction?.isButton()) return;
const { member, channel, message } = interaction;
if(channel.id == bugChannel && interaction?.customId == "bugModal") {
showModal(modal, {
client: client,
interaction: interaction
})
}
});
}
I think it's a third-party package
where do i find the real package?
well, it's discord.js
what's showModal defined as
nah its the package discord-modals
I meant
We do not provide any help with third party libraries like discord-buttons.
• Discord.js supports buttons natively: guide
const { Modal, TextInputComponent, showModal } = require('discord-modals') // Now we extract the showModal method
We don't help with any libraries other than djs
discord.js supports modals
ah okay wait a sec
no need to use another package for that
if i do const { Modal, TextInputComponent, showModal } = require("discord.js");
const modal = new Modal() // We create a Modal
^
TypeError: Modal is not a constructor
You need to make a ModalBuilder
Make sure you're on the dev build of course
a okay
const { Modal, TextInputComponent, showModal, Discord, ModalBuilder } = require("discord.js");
module.exports = async (client) => {
const bugChannel = "955208454774063214";
client.on('interactionCreate', (interaction) => {
if(!interaction?.isButton()) return;
const { member, channel, message } = interaction;
if(channel.id == bugChannel && interaction?.customId == "bugModal") {
const modal = new ModalBuilder()
.setCustomId('modal-customid')
.setTitle('Test of Discord-Modals!')
.addComponents(
new TextInputComponent() // We create a Text Input Component
.setCustomId('textinput-customid')
.setLabel('Some text Here')
.setStyle('SHORT') //IMPORTANT: Text Input Component Style can be 'SHORT' or 'LONG'
.setMinLength(4)
.setMaxLength(10)
.setPlaceholder('Write a text here')
.setRequired(true) // If it's required or not
);
showModal(modal, {
client: client, // Client to show the Modal through the Discord API.
interaction: interaction // Show the modal with interaction data.
})
}
});
}
const modal = new ModalBuilder()
^
TypeError: ModalBuilder is not a constructor
^
yea did that but now
Discord.Intents.FLAGS.GUILDS,
^
TypeError: Cannot read properties of undefined (reading 'FLAGS')
should i define client different?
read the guide
pins
if v14 only working with interactions?
No the stable versions work with interactions too but only the dev branch currently has modals
and message and stuff ?
you can receive message via the "messageCreate" client event, provided you
- have the intent (dev dashboard/verification request, if verified bot)
- set the intent in client settings (in your code)
but the modals in the dev version seem to be broken :P
Many people use them, they work fine. Even if they don't, that's why it's the dev branch 
yea but when i did
const { Client, GatewayIntentBits, Partials } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds], partials: [Partials.Channel] });
it wasn't responding to for example !help anymore
do not see a message content intent anywhere
also GuildMessages no?
oh true
right, not even that one
D_MEMBERS, Discord.Intents.FLAGS.GUILD_MESSAGES], partials: [Partials.Channel] });
^
TypeError: Cannot read properties of undefined (reading 'FLAGS')
whats wrong with FLAGS, this also not working anymore?
ah nvm it's Flags right?
It changed to GatewayIntentBits
You should open this one
const { Client, GatewayIntentBits, Partials } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent], partials: [Partials.Channel] });
thanks

var embed1 = new Discord.MessageEmbed()
^
TypeError: Discord.MessageEmbed is not a constructor
so messageEmbed not working anymore i guess?
Please buddy just click it once it'll be open until you close it again and has your answers
no modal it's just a help comand
Oh forgive me
Updated the link
ah so i have to change the name from MessageEmbed to EmbedBuilder right?
Yeah that's all
thank you sir at least someone helping here 🙏
If you go to the docs you can change the branch to main as well, that's where the WIP docs go to as well so you can find Modal stuff if you search through the main branch
ah great
whats with this one now?
constructor({ emoji, ...data }) {
^
TypeError: Cannot destructure property 'emoji' of 'undefined' as it is undefined.
can't find anything about this
. @wicked tusk
so like this ?
let button_back = new Discord.ButtonBuilder({}).setStyle('PRIMARY').setCustomId('1').setEmoji("833802907509719130").setLabel("Back")
Yes
and the style is like
.setStyle(ButtonStyle.Primary) right?
Yes
jeez what is this
^
CombinedPropertyError: Received one or more errors
at ObjectValidator.handleStrictStrategy (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:998:70)
at ObjectValidator.handleStrategy (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:910:47)
at ObjectValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:951:17)
at ObjectValidator.parse (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:114:88)
at ButtonBuilder.setEmoji (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@discordjs\builders\dist\index.js:593:42)
at ButtonBuilder.setEmoji (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\structures\ButtonBuilder.js:21:20)
at swap_pages2 (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\utilfunctions.js:978:92)
at Object.run (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\commands\Information\help.js:29:5)
at Client.<anonymous> (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\commands.js:101:29)
at Client.emit (node:events:402:35) {
errors: [
[
'id',
CombinedError: Received one or more errors
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:1471:23)
at UnionValidator.run (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:103:23)
at ObjectValidator.handleStrictStrategy (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:983:40)
at ObjectValidator.handleStrategy (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\@sapphire\shapeshift\dist\index.js:910:47)
pass it as {id: "833802907509719130" }
i don't know even which id is meant
.setCustomId('1') ?
ah the emoji+
so like .setEmoji({id: "833802907509719130"})
yeah
could anyone tell me what is jesus christs name this is?
components: this.components.map((component) => component.toJSON())
^
TypeError: component.toJSON is not a function
i've never had that error before
gonna bump this since you're here right now (@ Monbrey)
it's ActionRowBuilder
yea like this? const allbuttons = [new ActionRowBuilder({}).addComponents([button_back, button_home, button_forward])]
.addComponents doesn't take an Array
do const allbuttons = [new ActionRowBuilder({}).addComponents(button_back, button_home, button_forward)]
now it gives me DiscordAPIError[50035]: Invalid Form Body
where do i see how to make an embed in v14?
Nothing else has changed
its something with the components
DiscordAPIError[50035]: Invalid Form Body
components[0].components[1].emoji.id[NUMBER_TYPE_COERCE]: Value "🏠" is not snowflake.
at SequentialHandler.runRequest (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@discordjs\rest\dist\index.js:714:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@discordjs\rest\dist\index.js:517:14)
at async TextChannel.send (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15)
at async swap_pages2 (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\utilfunctions.js:983:19) {
rawError: {
code: 50035,
errors: {
components: { '0': { components: { '1': [Object] } } }
name not id
Just to confirm, GUILD_PRIVATE_THREAD should be GuildPrivateThread right
in setEmoji or what
yes
And would these also be pascalCase (scheduled events)
nope you have to use enums
Alright, thanks
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, res.status, method, url, requestData);
^
DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
components[0].components[2].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
let button_back = new ButtonBuilder({}).setStyle(ButtonStyle.Primary).setCustomId('1').setEmoji({name:"833802907509719130"}).setLabel("Back")
let button_home = new ButtonBuilder({}).setStyle(ButtonStyle.Danger).setCustomId('2').setEmoji({name:":house:"}).setLabel("Home")
let button_forward = new ButtonBuilder({}).setStyle(ButtonStyle.Primary).setCustomId('3').setEmoji({name:"832598861813776394"}).setLabel("Forward")
i did name like you said
.setEmoji({ name: '🏠' })
.setEmoji({ id: '832598861813776394' })
ah okay that makes sense
whats wrong with filter?
node:events:368
throw er; // Unhandled 'error' event
^
TypeError: Cannot read properties of undefined (reading 'filter')
code
huh
what's the code that is causing this error?
client.on("ready", async () => {
//get the right guild
let guild = client.guilds.cache.get(guildId)
if(!guild) return;
//fetch all members of that guild
let aM = await guild.members.fetch().catch(()=>{})
//get the memberswho need the role, because they have the right status but not the the role yet
let members_who_need = [...aM.filter(m =>
!m.user.bot && !m.roles.cache.has(roleId) &&
m.presence && m.presence.activities.some(({ state }) => state?.includes(textInStats) || state?.includes(textInStats2))
).values()];
//get the members who have the aM, but not the right status
let members_who_remove = [...aM.filter(m =>
!m.user.bot && !m.roles.cache.has(roleId) &&
(!m.presence || !m.presence.activities.some(({ state }) => state?.includes(textInStats) || state?.includes(textInStats2)))
).values()];
//add the roles for those who needs it
for(const m of members_who_need){
await m.roles.add(roleId).catch(() => {});
await delay(350); //wait 0.35 secs
}
//remove the roles for those who needs it
for(const m of members_who_remove){
await m.roles.remove(roleId).catch(() => {});
await delay(350); //wait 0.35 secs
}
})
else if (cmd == "setupbug") {
if (message.member.permissions.has("ADMINISTRATOR")) {
let embed = new EmbedBuilder()
.setTitle("Ticket Support")
.setDescription(`If you need **help**, select your concern down below.`)
.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")
}
}
node:events:368
throw er; // Unhandled 'error' event
^
TypeError: Cannot destructure property 'emoji' of 'undefined' as it is undefined.
there is no emoji so why this error?
tbh you are asking a lot of questions unrelated to the dev version here
some not even related to d.js
btw how to get discordjs/builders dev version ?
@discordjs/builders@dev
but the typings are broken
tbh that's not helping me instead of just answering my questino "nOt ReleaATed do d.js"
you should read the rules and the purpose of this server and the channels
known bug, a workaround is to pass { options: [] } to SelectMenubuilder's and {} to ButtonBuilder's constructors
look @scarlet tangle it's d.js related thank you muchnameless
const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Paragraph);
How do i get the Input now and send it to a channel?
with Args?
ModalSubmitFieldsResolver#getTextInputValue()
Gets the value of a text input component given a custom id
where is problem? "discord.js": "^14.0.0-dev.1649808570-01a423d"
pass an empty object to the constructor
👌
it's a known issue, will be fixed soon
ok
code: js let channels = (await guild.channels.fetch()).filter(ch => ch.permissionsFor(guild.me).has('SEND_MESSAGES') && ch.type === 'GUILD_TEXT') // Filters all the channels the bot has send messages perms & is a text channel
Error: ```js
node:events:368
throw er; // Unhandled 'error' event
^
DiscordAPIError[50035]: Invalid Form Body
channel_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
Have a slight suspicion they're on 13.7-dev
It's just very slight, like... super slight
How to build an actionRow with buttons in ? I'm having trouble to do that
what's the error?
using DataResolver.resolveFile() throws an ExperimentalWarning. is that intended? and can you disable that warning somehow? I can't find a --experimental flag for this
Hi guys, why when do client.guilds.fetch(ID) i've this format ?
'644238052062920705' => OAuth2Guild {
id: '644238052062920705',
name: 'Discord DEV',
icon: 'dc83fd81e2db474ab856e5ec8afa5156',
features: [],
owner: false,
permissions: PermissionsBitField { bitfield: 1071698665025n }
}
guilds are always cached you don't need to fetch them
but when get i've undefined
show code
Yeah, it is. discord.js uses a Node.js experimental feature which triggers the warning. Totally expected
make sure the code in some event (after ready event)
it's in command
const guild = await client.guilds.cache.get(lfg.message.guild); // "lfg.message.guild" return good id
alright, thanks. and is there a way to prevent the logs/console from being massacred with these warnings? :P
is lft.message.guild a number or a string
Number
ActionRowBuilder<MessageActionRowComponentBuilder>
make it a string then, numbers lose precision if they are huge (as in bigint)
What does that means ? 🤨
pass MessageActionRowComponentBuilder as the first generic parameter of ActionRowBuilder
same thing
undefined 644238052062920700
node:events:368
throw er; // Unhandled 'error' event
^
TypeError: Cannot read properties of undefined (reading 'channels')
const guild = await client.guilds.cache.get((lfg.message.guild).toString());
console.log(guild, (lfg.message.guild).toString())
const channel = await guild.channels.fetch(lfg.message.channel);
that's not how it works
lfg.message.guild should be a string to begin with, not converted to a string
But when fetch, the id is'nt problem
are you sure the id is correct and same
even fetch checks cache first
i've say nothing it's the number thx men
I mean, it should be logged only once and this is more a nodejs-related question (so please #869652447881207858 if you need help with it)
I'm probably missing something obvious, I set this as the type when creating a thread: ThreadChannelTypes.GuildPrivateThread. Its not working so I'm assuming its wrong, what would be the correct version?
This is the error:
Cannot read properties of undefined (reading 'GuildPrivateThread')```
how
by doing what i sent before that
same for PrivacyLevel.GuildOnly
use ChannelType.GuildPrivateThread
Thanks!
StageInstancePrivacyLevel
or GuildScheduledEventPrivacyLevel
Thanks as well
Suppose I set the vetting channel and save it to the database
Do I want to encrypt? Or save the ID directly?
what intents do i need to use the guildMemberUpdate event?
Guilds and GuildMembers
thx bro
what is the way to build a select menu (or anything else) in this version?
SelectMenuBuilder
What's wrong here?
const rolesOptions = interaction.guild.roles.cache.map(role => { return { label: role.name, value: role.id } });
rolesOptions.slice(0, 25);
const selectMenu = client.functions.selectMenu("Chose roles")
.setCustomId('roleId')
.setOptions(rolesOptions)
.setMaxValues(rolesOptions.length);
selectMenu: placeHolder => {
return new SelectMenuBuilder().setPlaceholder(placeHolder);
}

Anything that screams it is wrong? Like an error?
didn't understand what he doesn't like
.setOptions(...rolesOptions)
also what's that slice doing there?
slice retunrs a new array and doesn't modify modify the original
are you looking for splice?
No ur right I didn't notice, ty
it worked, ty, but idk what '...' mean 
where can i find the docs of discord.js@dev?
can I do something like
.setEmoji({ id: null, name: '📩' });
On a Button?
Thanks
How would I get the value of a select menu when a modal is submitted? All I need to know is what is after interaction.fields for select menus
What is this error? it is coming from another package, but it is from Discord.js
Error: Received one or more errors
in theory yes, though ButtonBuilder's validator currently doesn't accept null for the id, you can omit that property entirely though
if that's all the other package is providing you there is not nearly enough information
I don't understand your question, SelectMenuInteractions and ModalSubmitInteractions are different types of interactions
Can select menus be within modals?
no
Oh well
discord planned other components afaik but currently it's only textinput
Alright, thanks
const SelectMenu = new SelectMenuBuilder().setCustomId('setup-menu').setMinValues(1).setMaxValues(data.length).setOptions({ label: "test", value: "test", emoji: "🤖" })
why is this not working?
Error: ```console
Error: Received one or more errors
at ObjectValidator.handleStrictStrategy (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@sapphire\shapeshift\dist\index.js:998:70)
at ObjectValidator.handleStrategy (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@sapphire\shapeshift\dist\index.js:910:47)
at ObjectValidator.handle (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@sapphire\shapeshift\dist\index.js:951:17)
at ObjectValidator.parse (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@sapphire\shapeshift\dist\index.js:114:88)
at SelectMenuOptionBuilder.setEmoji (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules@discordjs\builders\dist\index.js:867:42)
at SelectMenuOptionBuilder.setEmoji (c:\Users\mmgam\OneDrive\Desktop\Tickets\node_modules\discord.js\src\structures\SelectMenuOptionBuilder.js:17:20)
at Client.<anonymous> (c:\Users\mmgam\OneDrive\Desktop\Tickets\ismm.js:472:97)
that's not the full error
I think
Now, setOptions should receive an array
https://discord.js.org/#/docs/builders/main/class/SelectMenuBuilder?scrollTo=setOptions
npm ls discord.js
log interaction
Tried uninstalling and reinstalling and works now,thanks
how can I send a modal?
Interaction#showModal()
embed.fields now returns undefined, what would the alternative be?
try embed.data.fields
That worked, thanks!
I change my question...
What is a modal? 

i saw a bot like this that doesn't have presence, its possible with this version?
nothing to do with versions, it's websocketless bots
our docs bot doesn't have one either
what's the difference between builders and "unsafe" builders?
builders validate input fields (for stuff like length)
unsafe do not have any validation
oh ok, thanks, i asked because my friend wanted to do it
@dawn phoenix
my friend asks how to do it
nothing discord.js helps with
discord.js is based on websocket connections
ok, thanks
Is this the correct way to use typedefs?
const { StickerType, StickerFormatType } = require('discord.js');
let sticker = await currentSticker.fetch(); // A random sticker
console.log(StickerFormatType[sticker.format]);
console.log(StickerType[sticker.type]);
I want to convert the number to a string so that the user can easily understand it.
(I ask about this because in v13 it was returning a string instead of a number)
Yup
This works for me
const { StickerFormatType, StickerType } = require("discord.js");
console.log(StickerFormatType["1"], StickerType["1"]); // PNG Standard
Okoko, tysm 
Is the limit of 5 action rows the same in modals?
I'm pretty sure yeah
What is the max amount of components in a modal?
Oh sorry I didn't see
5 rows with 1 text input each
where is error? Interaction failed
This isn't even an interaction
It's a message event
yes
On the buttons?
Because you don't respond to the interaction
ok
Like data.reply
also data.customId
what are the big changes in v14?
read channel pins
not work
client.on('modalSubmit', (modal) => {
const header = modal.components[1].value
const welcomeChannel = member.guild.channels.cache.find(ch => ch.id === '937470079896002590');
welcomeChannel.send(`${header}`);
})
whats wrong with the modal.components ?
modalSubmit is not a discord.js event
No idea what you're using
ah yea i copied it from the npm module, then how do i send a message with the input to a channel?
could you pls tell me i am still new at d.js
What npm module?
We don't have a separate module for modals
discord.js
ah you mean where i copied it from?
You couldn't possibly have copied that from discord.js lol
discord-modals
Yeah that's not ours
yea now ik
Modals fire interactionCreate
do you know how i can do this?
interaction.isModalSubmit() to check if it is one
interaction.fields.getTextInputValue(customId)
interaction.reply
so if i do message.channel.send(interaction.fields.getTextInputValue(customId))
No, use interaction.reply
There's no message here
so i have to send it in the same channel ?
You have to respond to the interaction somehow yes
but what if i want it in a different channel ?
That would be pretty terrible UX
You can respond to the submit AND send something to another channel
But you still need to respond so the user knows you got the input
yea i could do like interaction.reply("sent") or something like that but what i want to do is like a bug report form and in one channel the users should see the modal and in the other channel i should see the reported bugs
so i need to send it to another channel
That's fine as long as you also reply
ah so i can do message.channel.send tho?
Well I mean that's still going to be the same channel
yea if i define it just an example
And I'm still confused as to where a message came from, Modals can only be sent in response to interactions
so if a user clicks on a the button in the channel #bugreport and comes to the modal and i want the incoming bugs to be in channel #reports this possible?
if i respond to the interaction
Yes
ok my last question for today is if i sent the message, then how do i get the input of the modal ?
thanks
wow, you're verified bot dev nice

On the node of receiving modal input, I got an issue on my own. I'll grab the code real quick
can you inform me when you found a solution?
To my own problem? Yeah sure 
idk maybe it's useful
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
module.exports = async (client) => {
const bugChannel = "955208454774063214";
client.on('interactionCreate', async (interaction, message) => {
if(!interaction?.isButton()) return;
const { member, channel } = interaction;
if(channel.id == bugChannel && interaction?.customId == "bugModal") {
// Create our modal
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
// Add components to modal
// Let's create our text inputs
const favoriteColorInput = new TextInputBuilder()
.setCustomId('favoriteColorInput')
// The label is the prompt the user sees for this input
.setLabel("What's your favorite color?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Paragraph);
// An action row only holds one text input,
// so we need one action row per text input.
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);
// Now we need to add our inputs into the modal
modal.addComponents(firstActionRow, secondActionRow);
await interaction.showModal(modal);
if (!interaction.isModalSubmit()) return;
// Get data entered by user
const favoriteColor = interaction.fields.getTextInputValue('favoriteColorInput');
const hobbies = interaction.fields.getTextInputValue('hobbiesInput');
console.log({ favoriteColor, hobbies });
}
});
}
this is also not working did i do anything wrong?
Which part isn't working though, like what isn't working? Does it log favoriteColor and hobbies?
no it doesn't
this is all i get
no logging
const { member, channel } = interaction;
if(channel.id == bugChannel && interaction?.customId == "bugModal") {
// Create our modal
const modal = new ModalBuilder()```
Put some console logs in there, see if they run
Nvm it shows the modal
yes
the problem is that if i submit nothing happens eventhough it should log favoriteColor & hobbies
You have your modal submit if statement inside your isButton statement
so remove it or what to do idk?
Don't put it inside that if statement
if (itsabutton) {
// do something
} else if (itsamodalsubmission) {
// do something else
}```
so for } else if (itsamodalsubmission) {
i do
const favoriteColor = interaction.fields.getTextInputValue('favoriteColorInput');
const hobbies = interaction.fields.getTextInputValue('hobbiesInput');
console.log({ favoriteColor, hobbies });
this right?
Yes but you should also check the ID and whatnot
It'll never be a button, it'll always be modal submission
what do you mean why else if (itsamodalsubmission)
that aint a real thing tho?
No it's pseudo code
so just else without the () right?
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
module.exports = async (client) => {
const bugChannel = "955208454774063214";
client.on('interactionCreate', async (interaction, message) => {
if(!interaction?.isButton()) return;
if (interaction.isButton) {
const { member, channel } = interaction;
if(channel.id == bugChannel && interaction?.customId == "bugModal") {
// Create our modal
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
// Let's create our text inputs
const favoriteColorInput = new TextInputBuilder()
.setCustomId('favoriteColorInput')
// The label is the prompt the user sees for this input
.setLabel("What's your favorite color?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Paragraph);
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);
modal.addComponents(firstActionRow, secondActionRow);
await interaction.showModal(modal);
if (!interaction.isModalSubmit()) return;
}else {
const favoriteColor = interaction.fields.getTextInputValue('favoriteColorInput');
const hobbies = interaction.fields.getTextInputValue('hobbiesInput');
console.log({ favoriteColor, hobbies });
}
}
});
}
like this?
Read your code
Tell me what this does js if(!interaction?.isButton()) return; if (interaction.isButton) {
oh forgot to remove itr
hey 🙂 we're making progress https://cdn.protyo.live/images/cmd_lUP6x6pY9y.png
https://cdn.protyo.live/images/Discord_qAVfALAzgI.png but it's still failing, because i need to reply to it or do something rigght?
Yeah, it's a normal interaction, you need to reply to it
ok thanks great

Why do you have message as the second parameter in that event?
Hi, now how to compare oldChannel to newChannel ?