#djs-in-dev-version
1 messages · Page 15 of 1
Yes it is. How can you use MessageEmbed() when you import Embed
makes sense
error'
Bot is online!
C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\types.js:175
throw result.error;
^
ZodError: [
{
"code": "invalid_type",
"expected": "number",
"received": "string",
"path": [],
"message": "Expected number, received string"
}
]
at new ZodError (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\ZodError.js:80:28)
at handleResult (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\types.js:115:21)
at ZodNullable.ZodType.safeParse (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\types.js:191:16)
at ZodNullable.ZodType.parse (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\zod\lib\types.js:172:27)
at Embed.setColor (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\@discordjs\builders\dist\index.js:1:5975)
at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:10:7)
at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)
at Client.emit (node:events:520:28)
at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) {
issues: [
{
code: 'invalid_type',
expected: 'number',
received: 'string',
path: [],
message: 'Expected number, received string'
}
],
format: [Function (anonymous)],
addIssue: [Function (anonymous)],
addIssues: [Function (anonymous)],
flatten: [Function (anonymous)]
}
anyone knows this?
const { ApplicationCommandType, ApplicationCommandOptionType, Embed, Util, Modal, TextInputComponent, TextInputStyle} = require('discord.js');
module.exports = {
name: 'modal',
description: 'Bakaa',
type: ApplicationCommandType.ChatInput,
/**
*
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run: async (client, interaction, args) => {
try{
const modal = new Modal()
.setCustomId('myModal')
.setTitle('My Modal');
// Add components to modal
// Let's create our text inputs
const favoriteColorInput = new TextInputComponent()
.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 TextInputComponent()
.setCustomId('hobbiesInput')
.setLabel("What's your favorites 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 ActionRow().addComponents(favoriteColorInput);
const secondActionRow = new ActionRow().addComponents(hobbiesInput);
// Now we need to add our inputs into the modal
modal.addComponents(firstActionRow, secondActionRow);
// Show our modal
await interaction.showModal(modal);
} catch(e) {
return interaction.followUp(`\`\`\`js\n${e}\`\`\``)
}
}
}```
Code of modals^
Read the updated docs
where are they
BRINGS ME BACK TO START
// at the top of your file
const { MessageEmbed } = require('discord.js');
// inside a command, event listener, etc.
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
channel.send({ embeds: [exampleEmbed] });
code on the website
this is for the stable version
not main (dev)
Yeah.
Anyone got working modals? Or what am I doing wrong here?
but idk how i downloaded the dev i follow turtorial on yt
try to understand what you're doing then
Also ping me when helping with modals
There's a tutorial on YouTube for dev? O_o
probably when passing v12 to v13 ._.
no there is not i cant find them
the deploy preview just has the v13->v14 changes guide, which is also not always up to date
other guide pages are not updated
Shouldn't it be
if (!interaction.isChatInputCommand()) return;
instead of
if (!interaction.isCommand()) return;
Also the latest discord.js dev version is showing this error whenever i start my bot
make sure to install the latest builders dev release. You might have to delete your lockfile for it to prompt you to pick one
ah ok ill try it
can u send what the builders package is? I dont use that so idk
you do use that, it's a dependency on discord.js, just delete your lockfile and reinstall all deps
ohok
what error are u getting?
.
the issue is that they're on the latest djs dev but the builders dev is outdated because the repo uses workspace versions, which don't update and require a clean install
const { Client, ActionRow, CommandInteraction, ApplicationCommandType, ApplicationCommandOptionType, Modal, TextInputComponent, TextInputStyle } = require("discord.js");
module.exports = {
name: "modal",
description: "returns websocket ping",
type: ApplicationCommandType.ChatInput,
/**
*
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run: async (client, interaction, args) => {
const modal = new Modal()
.setCustomId('myModal')
.setTitle('My Modal');
// Add components to modal
// Let's create our text inputs
const favoriteColorInput = new TextInputComponent()
.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 TextInputComponent()
.setCustomId('hobbiesInput')
.setLabel("What's your favorites 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 ActionRow().addComponents(favoriteColorInput);
const secondActionRow = new ActionRow().addComponents(hobbiesInput);
// Now we need to add our inputs into the modal
modal.addComponents(firstActionRow, secondActionRow);
// Show our modal
await interaction.showModal(modal);
},
};
code^
You can't reply twice
how am I replying twice?
showModal is a reply
does your command handler always defer the interaction?
the only way that could be happening is if it's being deffered or replied somewhere else in your handler
What is the maxiumium length of customId of a BTN?
100 characters
okay
am I missing something?
awaitModalSubmit isn't a thing
Oh I thought it was based on doing some searching
how do I retrieve the modal responses?
It is in v13 not v14 yet
interactionCreate event or construct new InteractionCollector
so something like this?
yes
how come it doesn't collect the response?
Magic numbers oh no
You passed wrong componentType or wrong interactionType in collector options
You can use <Interaction>.isModalSubmit()
Got it, I removed the componentType. Which componentType would it come under anyway?
It's probably like ActionRow or something
Modals aren't components
oh gotcha, explains why it's optional
Responding to an autocomplete interaction with
interaction.respond([
{
name: 'Option 1',
value: 'option1',
},
])
returns
DiscordAPIError[50035]: Invalid Form Body
data.choices[0][MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
data.choices[1][MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
I was told that it's still the same as v13 but...?
It takes rest parameters probably instead of array
interaction.respond({
name: 'Option 1',
value: 'option1',
})
``` returns the same error though
How now i know the channel type (String)
If i do channel.type it returns a number
Send full error
use a dictionary
well uuuh read the rest?
<:_:874573924988518500> AutocompleteInteraction#respond()
Sends results for the autocomplete of this interaction.
the example ^
did you read what i said?
It looks the same
wasn't for you but for this message #djs-in-dev-version message
yeah but going with the docs brings up the same error and that guy was replying to me
does modals has opportunity to check if provided data match some regex pattern
no but you can do it client side
you internally check if the data they provide matches your regex pattern, discord doesnt do it
On my code this works:
<Interaction>.respond(["Option 1"].map(choice => ({name: choice, value: choice})));
that sends an array of choices, that is exactly what i did 
Array of objects
yes?
you're contradicting yourself 10 
Strange, don't recall if it was changed or not. Read the source?
Nah they're referring to me
it is planned to be a rest parameter, i'm not sure if it already changed
it wasnt changed, it takes an array
why the sudden change to rest params instead of arrays?
it wasnt changed
no, i meant for other stuff
Heads up everyone, in the next dev release components will be renamed. Instead of having a “Component” suffix they’ll have a “Builder” suffix. For example ButtonComponent -> ButtonBuilder
I’ll try to update the guide later tonight when I get home
whyy
#7584 in discordjs/discord.js by suneettipirneni merged <t:1647110363:R>
refactor: Don't return builders from API data
Yeah
Help Plis
Code
let test = new Discord.ActionRow()
.addComponents(
new Discord.SelectMenuComponent()
.setCustomId("test")
.setPlaceholder('Test')
.setMinValues(1)
.setMaxValues(1)
.addOptions({
label: "test",
description: "test2",
value: "test"
})
)
Error
TypeError: Cannot destructure property 'components' of 'undefined' as it is undefined.
Oh dear lol... I think the import should be from builders now and not discord.js
what
Don't worry it's not relevant to you
alr
but someone explain to me what that is
Not from you, from discord.js
What vps/application it is may I know?
@uncut kelp srry for ping but whats SelectMenuBuilder etc...
ButtonComponent => ButtonBuilder?
Ya
.
I edited the index.js in the discord.js module to fix it
same
Modals only support TextInputs right?
Yes
looks like it's running pterodactyl
why do i get this error while running the code
ig thats an error from the package's side
const client = require("../index");
client.on("interactionCreate", async (interaction) => {
// Slash Command Handling
if (interaction.isChatInputCommand()) {
await interaction.deferReply({ ephemeral: false }).catch(() => {});
const cmd = client.slashCommands.get(interaction.commandName);
if (!cmd)
return interaction.followUp({ content: "An error has occured " });
const args = [];
for (let option of interaction.options.data) {
if (option.type === "SUB_COMMAND") {
if (option.name) args.push(option.name);
option.options?.forEach((x) => {
if (x.value) args.push(x.value);
});
} else if (option.value) args.push(option.value);
}
interaction.member = interaction.guild.members.cache.get(interaction.user.id);
cmd.run(client, interaction, args);
}
// Context Menu Handling
if (interaction.isContextMenuCommand()) {
await interaction.deferReply({ ephemeral: false });
const command = client.slashCommands.get(interaction.commandName);
try{
if (command) command.run(client, interaction);
} catch(e) {
interaction.followUp({content: `\`\`\`js\n${e}\`\`\``})
}
}
});
My interaction create event
Is anything wrong that I am doing?
I installed discord.js@dev
And I got this error:
getting the same error; did you ever find a solution?
Its seems like someone sent a pull request with refactor to things and It made some problems (https://github.com/discordjs/discord.js/commit/549716e4fcec89ca81216a6d22aa8e623175e37a)
There is now a pull request to fix these problems https://github.com/discordjs/discord.js/pull/7649
I see, now I guess we wait for a merge
like this: exports.Modal = require('@discordjs/builders').ModalBuilder; ?
I think that you can use what idris sent here.
Its works for me
aight, thanks
I take that like a "yes" then ._.
yeah, that'd be what it is, though I don't think it's called ModalBuilder, but rather, Modal
^
oH okay
btw does ActionRow don't work for you aswell?
i haven't tried it yet
you have to use ActionRowBuilder
TY
hi is the permission of send message in a channel
SEND_MESSAGE
or
SEND_MESSAGES
SendMessages
so, new error after doing this is:
D:\Programming\itsatelo\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43
this.components = data.data.components?.map(c => createComponent(c)) ?? [];
^
TypeError: createComponent is not a function
guessing it's something that i'll just need to wait for on djs' end
should be Components.createComponent(c), with const Components = require('../util/Components');
maybe @umbral slate can add that into their existing pr
I really don't know what I'm doing wrong
Error:
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
data.components[0].components[0].options[0].value[BASE_TYPE_REQUIRED]: This field is required
Code:
const actionRow = new ActionRowBuilder().addComponents(
new SelectMenuBuilder()
.setCustomId('select')
.setPlaceholder('Nothing selected')
.addOptions([
{
label: 'Select me',
description: 'This is a description',
value: 'first_option',
},
{
label: 'You can select me too',
description: 'This is also a description',
value: 'second_option',
},
])
);
await interaction.reply({ content: "Please choose on what to report.", ephemeral: true, components: [actionRow] });
addOptions takes rest parameters, not an array
set options too?
yes
So what I need to do?
remove the square brackets
thank you so much
how can I know where it could be from?
you have the channel id (from the url), the message content
ah yeah thanks
What I need to put in awaitMessageComponent - componentType?
A string or enum or idk
ComponentType enum
How can I use showModal if I already replied to the interaction?
is it normal that we can still import ActionRow, ButtonComponent etc from discord.js?
i believe so, but they are different from the builders
i believe these are used to access received data
like message.components[0] would give you a ActionRow not a ActionRowBuilder
you use the builder to create new ones
read the PR, that should explain with more detail than ben on phone 🤠
I see thanks
Hi
Hey can someone explain what changed in Djs@dev i can't pass add components to my message :
const raw = new ActionRowBuilder().addComponents(button);
const embed = new EmbedBuilder()
.setTitle(game.name)
.setColor(Colors.Gold)
.setAuthor({name: cuser.username, iconURL: url})
.setDescription(game.description)
.setFooter({text: game.winrate});
channel.send({embeds: [embed], components: [raw]});
in components: [raw] i have
Type 'ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRow<...> | (Required<...> & ActionRowData<...>)'.
Type 'ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>' is not assignable to type 'JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>>'.
The types returned by 'toJSON()' are incompatible between these types.
Type 'APIActionRowComponent<APIButtonComponent | APISelectMenuComponent | APITextInputComponent>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent>'.
Type 'APIButtonComponent | APISelectMenuComponent | APITextInputComponent' is not assignable to type 'APIMessageActionRowComponent'.
Type 'APITextInputComponent' is not assignable to type 'APIMessageActionRowComponent'.
Type 'APITextInputComponent' is not assignable to type 'APIButtonComponentWithCustomId'.
Types of property 'style' are incompatible.
Type 'TextInputStyle' is not assignable to type 'ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger'.ts(2322)
send button builder
you can cast your actionrow to the first type ActionRowBuilder<MessageActionRowComponentBuilder>
oh its work ty
but buttoncomponent is the same?
ButtonComponent => ButtonBuilder
yes
and EmbedBuilder?
yes
ModalBuilder?
yes
they like Builder huh
hello i have this code
const mmm = message.channel.messages.fetch(m => m.content == "hi hi hi")
if(mmm) {
message.reply(`found ${mmm.id}`)
} else {
message.reply("didn't")
}
it reply with found but mmm.id is undefined
any help will be appreciated
fetch doesn't take a function + it returns a Promise
o
Version: 14.0.0-dev.1647130097.549716e
I am not using modal now.
How to fix?
delete the line lol it's a wrong import
the line in discord.js/src/index.js who try to import Modal
its exported in discord.js
no, it definitely exists, update djs
I did tho
restart ts server
show your output from npm ls discord.js
where is the new guide now ;-;
Im getting this, literally just required discord.js
@exotic tusk
and wait a pr for fix this definitely
you have to modify the source code
Did you just break modals on 14.0.0-dev.1647130097.549716e?
It's generally not good to monkeypatch so you can also just wait for the PR
thank you, does the version currently allow for modals?
One's being planned fyi
also, how do we create an embed now?
let emb = new MessageEmbed() ^ TypeError: MessageEmbed is not a constructor
EmbedBuilder
EmbedBuilder
why this isn't updated yet-
the guide's still a WIP
rip, they removed the ability to do "BLURPLE"..
there is still Util.resolveColor no?
you can just import Colors
does the new color scheme use rgb or hex? I think rgb since it asks for a number
if guide not updated where im supposed to see the changes-
in commit, in the doc or the source code
hm
this is a beta my men, not everything is finalised meaning documenting everything would be a waste.
perhaps not a total waste but still
ill just wait for another month or two till djs v14 stable is out
btw, how do we do footers, it just said deprecated on v13 so I stopped using it instead of looking into it
its not gonna hurt my bot as api v9 wont be deprecated till next year
.setFooter({ text: "© 2020 General Land", icon_url: "htl.png" }) there we go, like this?
its footer({text: 'ur text'});
apperiantly github copilot can be bliss lol
sorry ping*
you can ping me np
if(message.content == '!sendV') {
message.channel.send({embeds: [emb]})
} })``` any idea why this wont work?, all intents enabled etc.
messageCreate
its messageCreate
and dont enable all intents
owh yeah, i kept on using message for a year soo
not a public bot / designed to work for one server
so what
It's a better practice to just enable intents you need
Why would you like to slow down your bot
and your pc if you're running it on pc
help
it needs to handle everything in the server from leveling to moderation. I dont know how much it can slow it down by but hardware is not an issue. feel like its best business to not go on about how it makes something worse after the person explicitly told you they need it or / and dont mind having them enabled. - thank you for your concern tho
It's an error from the current version you can cast like this to avoid : components: [(row as ActionRowBuilder<MessageActionRowComponentBuilder>)]
why replit prompt this problem?
TypeError: Cannot read properties of undefined (reading 'GUILDS')
at Object.<anonymous> (/home/runner/ka/index.js:5:23)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at REPL1:1:1
at Script.runInThisContext (node:vm:129:12)
k thanks
Guilds not GUILDS
.setColor(88, 101, 242) - should return blurple yet it returns this;
just do .setColor('Blurple')
I was trying "BLURPLE" for some reason vs code didnt fill it up automatically
if you wanna use RGB it should be .setColor([88, 101, 242])
altho it doesnt seem to work
Also Cannot read property of undefined
oh that works too now?
not for me
I saw that it takes ColorResolvable
yeah apperiantly not, would be a nice addition tho.
you need to import EmbedBuilder from discord.js
let emb = new discord.EmbedBuilder() - I do.
(GatewayIntentBits.Guilds) also not work
Hi! Does anyone know where this error comes from?
C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\structures\ActionRowBuilder.js:6
class ActionRowBuilder extends BuildersActionRow {
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\structures\ActionRowBuilder.js:6:32)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\index.js:74:28)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
Node.js v17.2.0
install builders dev version
How?
npm i @discordjs/builders@dev
Ok
try discord.Util.resolveColor('Blurple')
thanks
That works, thanks !
why GatewayIntentBits.Guilds also returns error:
TypeError: Cannot read properties of undefined
no wait GatewayIntentBits should be a thing
show how you defiend it
const { Client, GatewayIntentBits, Partials } = require('discord.js');
npm ls discord.js on your terminal
he just forgot .Flags prop no?
no it's just an enum, IntentsBitField.Flags is GatewayIntentBits
oh
Ik now
nothing
now do what i told you, show me the output of npm ls
ik now
replit auto installed 13.6
Error: Cannot find module './structures/Modal'
Require stack:
- /home/runner/ka/node_modules/discord.js/src/index.js
- /home/runner/ka/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/runner/ka/node_modules/discord.js/src/index.js:131:17)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
but it returns this
yeaaaa it's a bug, there's a pr, wait till that gets fixed
boom, now merged, just wait for the next released
did button creation etc. change on djs 14?
yes
it became a builder as I understand - or what vscode suggests rather
what
would this be right?
nope
with setLabel then setText - whats wrong
is not setText
yeah, figured that out as I sent it lol
you have to set a custom id
ik ik
and a style
yeah, just asked if the builders were correct.
oh yes
and would this be right aswell for the style?
it is easier to put the number
no idea what the numberes are soo
PascalCase
Nope
1 = PRIMARY
2 = SECONDARY
3 = SUCCESS
4 = DANGER
5 = LINK
.setStyle(discord.ButtonStyle.PRIMARY) => .setStyle(1)
no it's unreadable and we don't recommend magic numbers
why
code characters isn't always what you want to look at, readability is very important too
ok
.setEmoji("⛵") - how would this become an object, I seriously dont see why we need to use an object for thşs
{name: "⛵"}
so there are other variables for it else than name?
if it's a custom id, id: "23234234234234
owh yeah animated etc aswell for the variables - I get it
animated doesn't really do anything from what i've tested
I have animations off due to the epilepsy I didnt even realise I had before discord lol
my anxiaty says this is not how we defer replies on buttons, is it?
help
interaction.deferUpdate()
thanks
Change Embed to EmbedBuilder
But why are you doing as Embed anyways?
this typescript isjust hurting my brain
What’s embed defined as?
Okay so either so as EmbedBuilder or remove the as all together
see its just playing with my brain
perhaps call .toJSON() on it?
Or do as unknown as EmbedBuilder
embed.toJSON() as Embed?
Your options
- Remove the
asdeclaration all together - Do
as unknown as EmbedBuilder - Do
as unknown as Embed
Ok
name: "captcha.jpeg",
file: captcha.JPEGStream
}]``` how can I send attachments - this returns a... large error
attachments: [new MessageAttachment(captcha.JPEGStream, "captcha.jpeg")]
I tried with no as and it didn't work so
thanks
i'm unsure of the recommended system as the PR shows you passing a builder to embeds
but i am sure that it does take in an APIEmbed, so @scarlet tangle EmbedBuilder.toJSON() try passing thatr
I'll try that later when I fix all of the other errors
İs that impossible to put an emoji in interaction slash options choosie?
i think so
Hi! Does anyone know how I can fix this error?
Error: Cannot find module './structures/Modal'
Require stack:
- C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\index.js
- C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Structures\Utils\Bot.js
- C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Structures\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\discord.js\src\index.js:131:17)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\felal\\Desktop\\PRODEFIX\\Discord\\Bot-Slash-3.0\\node_modules\\discord.js\\src\\index.js',
'C:\\Users\\felal\\Desktop\\PRODEFIX\\Discord\\Bot-Slash-3.0\\Structures\\Utils\\Bot.js',
'C:\\Users\\felal\\Desktop\\PRODEFIX\\Discord\\Bot-Slash-3.0\\Structures\\index.js'
]
}
wait for the next release, it's a bug that's already fixed
can we add images to modals?
Ok, but because of this I can't launch my bot
well i know but it is a fix, you'll have to wait for the next release
this isn't the stable branch you know, you shouldn't depend on this for your bot
Ok
.
yep it does work
how can I send a modal I created
Pins
should I just delete that line?
@scarlet tangle
Dev version is not stable
is there a PR?
idk
any way to fix this?
ooooohhk
i'll see if that is indeed the case and make a pr 🤠
really hoping for a ts rewrite soon, the pr broke a lot of things and tbh without ts, it's pretty hard to keep track of too
Nope. It just imported incorrectly.
elaborate
now i get this
the functions just dont work for me
interaction.createMessageCollector is not a function what happened to this
you can't wait for messages on interactions? but it should be a thing on channels
interaction.channel
thanks, completely forget that sometimes
rawError: { message: 'Interaction has already been acknowledged.', code: 40060 `
if (interaction.customId == 'start') {
interaction.deferUpdate()
let emb2 = new discord.EmbedBuilder()
.setTitle("Captcha Verification!")
.setDescription(`
Now that you came all the way here, you may verify yourself thru the
captcha below, good luck sailor!
`)
.setColor([88, 101, 242])
.setImage(`${prop}`)
.setFooter({ text: ":copyright: 2020 General Land", icon_url: "https://i.imgur.com/QXQZQ3l.png" });
interaction.reply({embeds: [emb2], ephemeral: true})```
You can't reply after deferUpdate
It doesn't look like ur doing any hefty computation or api calls, so I wouldn’t even call defer
Just use update or reply
Tho, you can’t edit/update a message to become ephemeral
im trying to get a text input value but it doesnt work (it says the field doesnt exist)
show code
Even I have problems with modals
because they're broken in the latest dev build
.
hmm
How?
I just changed it to createComponentBuilder()
so change it back to createComponent?
read the comment
this?
yes
what do i do with that
you can either make the changes yourself or wait for rodry
i wanna fix it as fast aspossible
is there docs for dev ?
check pins
well, this is a general JS error, not related with djs
You didn't reply
Oh 1 minute
@copper jetty idont understand
await interaction.showModal(modal);
Then ?
Then collect the ModalSubmitInteraction and reply to it
Just found out that <MessageSelectMenu>.spliceOptions was removed on the SelectMenuBuilder
I saw nothing about it in the guide, so was there any sort of replacement for it, or should I just work on doing something similar with normal <Array>.splice ?
Your proficient why your asking us normal people
with the Embed constructor we were able to pass a ColorResolvable, will it be possible with EmbedBuilder constructor ?
i'm still not a supercomputer 
Damn
it's just a role means nothin, just that they can help people better lol 
no
you saw that on a PR?
no im looking at the main branch code, oh EmbedBuilder
before the Embed constructor only accepted a number and after they changed it to a ColorResolvable
and now with EmbedBuilder .setColor takes a number
it seems like it only takes a number now
or an array
rip
if you were using a hex string, simply use 0x<hex>
if you were using one of the predefined colors, just use the Colors enum
whats the big deal
I don’t have an issue with that
I made changes when this channel opened
it was just for knowing
probably an oversight considering the embedbuilder still has spliceFields
I couldn't find any prs explaining why it should be removed, so that was my guess too
either way I found a workaround now that .setDefault() exists on option classes
actually, was that ever a thing?
Documentation suggestion from @white nebula:
<:_:874569335308431382> MessageSelectMenu#spliceOptions()
Removes, replaces, and inserts options in the select menu.
It was the only method removed in the builder other than normalizeOption(s)
oh i thought you were saying it was on builders initially
because it wasnt, it was never added to builders
how can i set an emoji ButtonComponent?
search for setEmoji on this channel, it has been answered plenty of times
.setEmoji({ name: ..., id: ..., animated: ... })
Is this a new v14 function?
#7649 in discordjs/discord.js by ImRodry opened <t:1647136333:R> (changes requested)
types: fix regressions
📥 npm i ImRodry/discord.js#types/fix-regressions
when is this gonna get merged?
#769862166131245066 it'll also be on v13.7
ok it worked
finally updated and working code
btw when is djs 14 gonna use API v10?
You know how it works already...
When it's ready
When the PR is ready and merged it'll use v10
🆗
Hi! Does anyone know how I can fix this error?
TypeError: Cannot set property disabled of #<ButtonComponent> which has only a getter
at Object.disableAllButtons (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Structures\Utils\Bot.js:78:62)
at Object.execute (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Buttons\BotSuggestion\Accept.js:20:64)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Code:
disableAllButtons(components) {
for (let x = 0; x < components.length; x++)
for (let y = 0; y < components[x].components.length; y++)
components[x].components[y].disabled = true;
return components;
}
.setDisabled(true)
components[x].components[y].setDisabled(true) ?
TypeError: components[x].components[y].setDisabled is not a function
at Object.disableAllButtons (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Structures\Utils\Bot.js:78:53)
at Object.execute (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Buttons\BotSuggestion\Accept.js:20:64)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at processImmediate (node:internal/timers:437:9)
10 is bigger than 9 and it has 2 letters
It will give you the actual json of the button
<channel>.awaitMessageComponent Supports Modals?
No, modals aren't components
so, how can i await modals?
You don’t
Construct new InteractionCollector
I want to do something like, show a modal, and then when that modal is responded, so send another modal
You can't reply to modal with another modal
https://discord.js.org/#/docs/discord.js/main/class/InteractionCollector you can use this to collect it
so, there is no way to do that
no
I want to upgrade to djs @ dev for Modals, will I have to change stuff around like the change from v12 to v13?
yes
you need to update to v13 before the end of april otherwise your bot will stop working, so yeah
No no I'm at v13, I mean if I want to switch to v14, will I have to change other stuff or can I immediately implement modals?
you do need to change a whole lot of other stuff yeah, but modals will be coming to v13 so you can wait a little longer for that, since the dev versions arent too stable rn
amazing
can anyone send me the list of intents (@14.0.0-dev)
Pins
thx
does anyone know if the discord.js v14 change log is out yet?
I just want to see the changes incase I gotta rewrite some code
Pins
Thanks
I found the site, but I cannot find the change log 🤔
thanks
Help Plis
Code
let test = new Discord.ActionRow()
.addComponents(
new Discord.SelectMenuComponent()
.setCustomId("test")
.setPlaceholder('Test')
.setMinValues(1)
.setMaxValues(1)
.addOptions({
label: "test",
description: "test2",
value: "test"
})
)
Error
TypeError: Cannot destructure property 'components' of 'undefined' as it is undefined.
Thanks and for the embed how would it be?
EmbedBuilder ?
Yes it's good thanks for the help
ye
For the buttons I change the setLabel right? How would it be
ew no
A is not because I have ButtonComponent but it is ButtonBuilder
yes
All "Component" rename to Builder
same to Modal => ModalBuilder
Ok
all three are valid input
but then this
it implements JSONEncodable<APIEmbed> though. make sure all packages are up to date and try restarting ts server
👍 VSCode's ts server was high
Types of property 'embeds' are incompatible.
Type '(APIEmbed | JSONEncodable<APIEmbed>)[]' is not assignable to type '(APIEmbed | Embed)[]'.```
Seems like the typings weren't updated here
yes, known oversight, there's already a pr to fix it
can I collect Modals with Interaction#awaitMessageComponent?
ok, i'll use InteractionCollector
someone willing to look into my problem 😐
You don’t have a dev script
Oh
No I saw it. Where’s your code?
import { Client } from "discord.js";
const client = new Client({
intents: []
});
client.on("ready", () => {
console.log("WORRRRRRRRRRRKS!");
});
client.login("TOKEN")
its just basic discord.js code
which intent do i need ;-;
i am making a bot that interacts using interactions only so
i added the guilds intent, im still getting the same error @worthy fog
you need GUILDS
i did it, same error
It’s different for v14

yea import it from enum, but still you need guilds intent
import { Client, IntentsBitField } from "discord.js";
const client = new Client({
intents: [
IntentsBitField.Flags.Guilds
]
});
client.on("ready", () => {
console.log("WORRRRRRRRRRRKS!");
});
client.login("")
hmm so @spare fiber is the code correct?
read the guide, i didnt use v14 yet. and make sure all dev package are up to date
wait do i need to install builders and rest too?
yea
that didnt fix it lol
import { Client, GatewayIntentBits } from "discord.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds
]
});
same error
uh
they using ts
when i compile the code from ts to js it gives me the error
yea exactly
this only happens when you use the dev version? or does it happen when you use v13 as well?
dev and main
stable works fine
try to edit tsconfig
what options do i provide
that's odd, try what kagchi said / reinstall the dev version
same error ;-;
what discord.js version are you running? what's your builders and discord-api-types version (if any)
{
"name": "project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@discordjs/builders": "^0.12.0",
"@discordjs/rest": "^0.3.0",
"discord-api-types": "^0.29.0",
"discord.js": "^14.0.0-dev.1647216471.87a6b84"
}
}
@scarlet tangle
try: removing discord-api-types, running npm ci and then running the bot, might be a clash of versions
whats the ci command for yarn
yarn
try running the bot
same error
not really much idea then, might be a library issue
Actually yarn --immutable
so um the error?
I have an error from my bot, can anyone help me?
[antiCrash] :: Unhandled Rejection/Catch
TypeError: (intermediate value).setTitle is not a function
at module.exports.run (/home/runner/ka/events/messageCreate.js:28:12) Promise {
<rejected> TypeError: (intermediate value).setTitle is not a function
at module.exports.run (/home/runner/ka/events/messageCreate.js:28:12)
}
show your code please
Hey, I dont hate yo but I hate your name, its pain 🥲
ik, but this aint the right channel
let embed = new Embed(); // declared before. -> `const {Embed} = require("discord.js")`
.setTitle("xxx")
.setDescription("xxx")
.setColor("GREEN")
check the documentation, maybe they changed the name of the function
The name is right
I dont know what that ; is doing there, and you should check the changes since setColor doesnt accept a string
yea
whats this error i get while transpiling ts to js
Showing the code might be useful
//index.ts
import { Client, GatewayIntentBits } from "discord.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds
]
});
client.on("ready", () => {
console.log("WORRRRRRRRRRRKS!");
});
client.login("TOKEN")
hmm
where is the dev documentation? I can't find
Pinned
check the pins idk, also the code is correct, u just need to remove the semicolon after new Embed
and the setColor
arent embed renamed to EmbedBuilder?
idk 😅
idk thats not my prob, can u help me with the replied msg instead
idk but yea i found someone who get same error like you #djs-in-dev-version message
ig it didnt get fixed?
yea
Its EmbedBuilder now
Yeah ik, realised after they said
You might want to open a thread in #943190505720786985 if no one can you help here
if we send a modal we can't reply to the interaction on which we sent the modal?
my error is related to djs dev
That doesnt mean that you cant open a thread there
showModal is a reply
looks like a mismatch of discord-api-types versions
The modal is the reply
To send a modal on message the best way is to send a button and then reply the ButtonInteraction with the modal?
Sure I guess
SCRIPT ERROR in promise (unhandled): TypeError: Cannot read properties of undefined (reading 'resolveColor')
> Embed.setColor (C:\Users\ericm\Desktop\fxserver\server-data\resources\EasyAdmin\node_modules\discord.js\src\structures\Embed.js:207)
> getServerStatus (@EasyAdmin/server/bot/server_status.js:10)
> updateServerStatus (@EasyAdmin/server/bot/server_status.js:114)
> processTicksAndRejections (node:internal/process/task_queues:96)
in dev, looks like PR #7615 was reverted?
It wasn't reverted afaik but you just have the strings directly now
Util.resolveColor('BLUE') -> 'Blue' (notice the caps)
but i want to use hex 😆
actually this might be my fault
ah no, still happens, im just using setColor(colour || 65280) (colour would be a different hex value)
yeah it doesnt actually matter if i use resolveColor
Cannot read properties of undefined (reading 'resolveColor')
> Embed.setColor (C:\Users\ericm\Desktop\fxserver\server-data\resources\EasyAdmin\node_modules\discord.js\src\structures\Embed.js:207)
sounds like a regression to me?
Known bug iirc on that one
gotcha
what are you even doing to reproduce that?
const embed = new Embed()
.setColor(colour || 65280)
right now on 14.0.0-dev.1647216471.87a6b84
(colour in this case can just be any hex)
wait what? why does Embed still include setColor?
Is it undefined though?
Util is wrongly exported on the file, just checked
you want to use EmbedBuilder instead of Embed
but EmbedBuilder should have methods like these
setColor should not exist on Embed
that'll do it, guess i missed that 😆
Is the guide updated?
for what? no it's still a WIP
Or where can i find all changes in v14?
You cant
there is only the v13 to v14 upgrade guide, see pins
which isn't complete
well thats the point of an in dev version 
v14 isn't finished so there can always be more changes
Fine but where can I find the changes done in v14 till now?
If you want a guide you can check the one pinned in this channel (may not be updated)
I checked it but it's not updated, that's why I am asking for the updated one which describes all changes.
You can compare main branch source code to stable branch
you can check the commit history ig
Is it possible to put back the EmbedBuilder#setColor method that accepts strings?
Use Colors enum
Why do you think we would have made updates somewhere other than literally the thing you're asking for
Ig the string pr accepted today so wait few hrs for next release and then you'll be able to use string
errorbash C:\Users\oyund\Desktop\projectGeneral\node_modules\discord.js\src\structures\MessageAttachment.js:81 if ('size' in data) { ^ TypeError: Cannot use 'in' operator to search for 'size' in asd
code```js
const attachment = new discord.MessageAttachment(data, "RankCard.png", "asd");
message.reply({ content: "here ya go", attachments: [attachment] });
help please
files not attachments
Remove the asd
thanks, it works
error:DiscordAPIError[40060]: Interaction has already been acknowledged.
code: ```js
interaction.update({embeds: [omgemb], components: []})
let randomNum = Math.round(Math.floor(Math.random() * 100) + 30)
interaction.reply({ content: `${interaction.user} collected a price of ${randomNum}` })
update is a reply
you're replying twice
error says it all, you can't update then reply, use followUp after updating if you wanna send a new reply
thanks, didnt know followup was a reply - just used it to edit the message.
it doesn't edit ._.
does kinda
it does if you defer a reply and don't use editReply iirc
ah yeah you're right
how fix this
try what they told you?
import djs from 'discord.js'
djs.Client```and so on
There is any color resolver that supports
BURPLE
#00c8ff
I mean to set the embed color, idk if with a resolve could set it with the color name and with the hexColor too
Oh, thanks i got it
for .setColor('#00c8ff') you can just use .setColor(0x00c8ff)
i was using that but i was getting an error
when will modals be available in v13.7?
"when it's ready"
i hope not longer than v14
logically no but who knows
discord.js@14.0.0-dev.1647259751.2297c2b I tried to import Modal builder from the package like the pinned message say, but it says that Modal does not exist
Np
wait, it didnt work
It's ModalBuilder now the guide is outdated
can we not access embed.footer in discord.js@dev? i don't see anything about it in the guide pinned here
We can
this is in a function with the args being embed: Embed
so i'm not too sure what's going on
iirc that in embed.data
But embed.footer should work too
It was not declared in the types. Will be fixed soon.
I created an ActionRow using ActionRowBuilder, i tried to reply a message with it but its saying that the type cant be attributed (14.0.0-dev.1647259751.2297c2b)
is it possible to put a video in an embed?
no
It's for receiving, no?
you're looking at APIEmbed?
yes
Well there you go
APIEmbed is a raw received embed from discord
Everything you're looking at is probably the received data
received data from the embed right?
Ya
so
why is there a way to receive an embed's video if we cannot put a video? (I'm probably annoying but I'm trying to get ._.)
Okay I don't know a link by memory but that's an example, YouTube links generate a video embed
TypeError: Class extends value undefined is not a constructor or null
24|snakebe | at Object.<anonymous> (/home/clauz/snake/beta/node_modules/discord.js/src/structures/ActionRowBuilder.js:6:32)
24|snakebe | at Module._compile (node:internal/modules/cjs/loader:1097:14)
24|snakebe | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
24|snakebe | at Module.load (node:internal/modules/cjs/loader:975:32)
24|snakebe | at Function.Module._load (node:internal/modules/cjs/loader:822:12)
24|snakebe | at Module.require (node:internal/modules/cjs/loader:999:19)
24|snakebe | at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
24|snakebe | at require (node:internal/modules/cjs/helpers:102:18)
24|snakebe | at Object.<anonymous> (/home/clauz/snake/beta/node_modules/discord.js/src/index.js:74:28)
24|snakebe | at Module._compile (node:internal/modules/cjs/loader:1097:14)
what is this? i get this at bot startup
install builders dev version
uhm how?
It's an error, I think you mean how you mitigate it
Gotta learn to ask the question you actually want to ask
npm i @discordjs/builders@dev
ok thank you
H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43
this.components = data.data.components?.map(c => createComponent(c)) ?? [];
^
TypeError: createComponent is not a function
at H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43:54
at Array.map (<anonymous>)
at new ModalSubmitInteraction (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43:45)
at InteractionCreateAction.handle (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\actions\InteractionCreate.js:69:25)
at Object.module.exports [as INTERACTION_CREATE] (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:520:28)
known oversight, there's already a pr for it
Could have been worse 😂
So if you want to build an embed from another embed, you have to use const replyEmbed = EmbedBuilder.from(<APIEmbed>).<AnyChanges>.data?
you don't have to access .data from the builder
Yeah ^
If I don't, .edit({ embeds: [replyEmbed] }) won't take it.
why not
Also .from accepts a component or api data
because it's JSONEncodable
theres data property in documentetion
edit not accepting it is a typings issue
ok
If I don't include .data:
Type 'EmbedBuilder' is not assignable to type 'APIEmbed | Embed'.
Type 'EmbedBuilder' is missing the following properties from type 'Embed': fields, title, description, url, and 5 more.
Yeah you can ts-ignore it for now
(When using <Message>.edit({ embeds: [myEmbed] }))
It’s a typings bug
Ahh
I was wondering because I looked at MessageEditOptions and it matched the types.
I just ts-expect-error'ed it.
yeah thats better than ts-ignore
In this case, yea 😄
how do i fix it then
install the version of discord-api-types that djs is using
which is...
idk, check djs' package.json perhaps?
this?
i think so yes
How to send message attachment and make attachments? (use for canvacord)
anyone here?
<Message>.channel.send({ files: [<Attachment>] })
<TextChannel>.send({ files: [<attachment>] })
Show the code
Hi, addOptions doesn't seem to take an array anymore. How can I solve this part?
don't pass an array
<:_:818272565419573308> Spread syntax (...)
Spread syntax (...) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.
it worked thanks
Anyone have the version of dev that has modals merged? For some reason they won't work on my end.
Using: discord.js@14.0.0-dev.1647259751.2297c2b
Error: TypeError: Modal is not a constructor
Relevant code:
const {Modal} = require("discord.js");
function showTagModal(interaction){
const modal = new Modal().setTitle("Tag creation").setCustomId("tag-create");
const tagName = new TextInputComponent().setCustomId("tag-name").setLabel("Tag name").setStyle(TextInputStyle.Short);
const tagText = new TextInputComponent().setCustomId("tag-text").setLabel("Tag text").setStyle(TextInputStyle.Paragraph);
const tagRow = new ActionRow().addComponents(tagName);
const textRow = new ActionRow().addComponents(tagText);
modal.addComponents(tagRow, textRow);
interaction.showModal(modal);
}
Also is dev alr a monorepo, or do I need builders or smth
it's now ModalBuilder, no?
ah, explains
in the guide i did suggest the modification of the example
yee I tried the guide way before going to the source x)
thx ben 
here we go https://github.com/discordjs/guide/pull/1060
Ran into
this.components = data.data.components?.map(c => createComponent(c)) ?? [];
Read up and saw there's a PR for this, gonna go look
yeah that's going to be fixed, already a pr,
i don't recommend modifying the source code but this bit should be okay
but yeah perils of using an wip version
yee you can expect this when using dev, fix'd it 
just in this docs https://canvacord.js.org/docs/main/main/general/welcome
no, show your code
if you say this is exactly the example, it's not and it can't be since you're using the Dev version
ok
then how can I make the code for dev version?
do you not have a code that you already claimed doesn't work?
It says Unsupport Image Type
I ask my friend and he says MessageAttachment only accepts .webp. Idk this whether true because I never use MessageAttachment
your friend is wrong, and from what it seems, i've searched that error, it doesn't seem like it's a djs error, ask canvacord support
what is the max TextInputs in one Modal?
5
can i do 2 Modals?
no
Thank you
You can find all this at the Discord API documentation.
How do you pass a unicode emoji into SelectMenuComponentOptionData.emoji?: APIMessageComponentEmoji
.setEmoji({ name: '🍎' })
Ah ok
do modals allow being sent on the messageCreate event?
had a friend do it which is kinda weird.
he said he just used the plain api so idk really
he's making API request himself
but I think you need to have an Interaction object (interaction id and token iirc)
any way you can think of to bypass it?
dunno
how do we make modals again, lemme try a simple one to see if it works
I think ill just use the discord modals package and just add a confirmation button in that case lol - should do the job for now.
this guide is outdated so use ModalBuilder and ActionRowBuilder instead
Hmm, how do I make an action row with a select menu? It's not letting me add them to components.
Current:
const selectMenu = new ActionRowBuilder().addComponents(
new SelectMenuBuilder()
.setCustomId(`roles:main:${user.id}`)
.setMinValues(1)
.setMaxValues(1)
.setPlaceholder('Select the category you would like to view')
.setOptions(...await constructMain()))
and it doesn't work?
at:
await interaction.editReply({ embeds: [mainEmbed], components: [selectMenu, button], content: null })
(Errors on selectMenu & button)
you need to cast action row
why do the content: null - just dont have it. Altho thats as much as I can help and its probably wrong lmfao
Because I'm editing the reply, which originally had content in it.
owh, alrighty lol
Cast it as what?
MessageActionRowComponentBuilder
ActionRowBuilder<MessageActionRowComponentBuilder>()
I've never used TS but isn't .setOptions((...await constructMain()) as MessageActionRowComponentBuilder)) ?
constructMain is my own function, which returns an array of APISelectMenuOption
The casting is a bit annoying imo, is that just in the @dev or will that be brought into stable once it releases?
This worked btw
Can we reply to a button/menu interaction with a modal or we can do it only with chat input commands?
<MessageComponentInteraction>#showModal
👍
how can I install latest discord.js beta from github
i'd rather wait for it myself but what you have to do is clone it, build it then link it to your project to use it
seems like itw as approved tho so lemme try the -dev
@scarlet tangle use EmbedBuilder not Embed
Ok
and just pass the hex setColor(0x4466aa)
^
TypeError: createComponent is not a function``` was this fixed btw?
check if the PR get merged ig
the pr still isn't merged
#7649 in discordjs/discord.js by ImRodry opened <t:1647136333:R> (changes requested)
types: fix regressions
📥 npm i ImRodry/discord.js#types/fix-regressions
yeah no
the npm i generator is very useful actually, thanks.
al mentioned what needed to be changed for your issue
that won't work now that it's a monorepo, i think
yeah it didnt
you can follow al's instructions and modify the code yourself
or you can just wait
thanks
imma just edit it myself fornow -better to have something that works then waiting
Embedbulidet is not a cunstoctor
because it's not? read what i sent and what you used
let embed = new EmbedBulider()
Ohhh
Builder, spelling matters
reminds me of when I used to try pasting code into translate
how'd you define it and what version is it?
V14
the exact one
const {EmbedBuilder} require.....
no the specific
show me the output of running npm ls discord.js
Wait a minute
replit, are you sure you have nodejs 16.9 or higher?
replit doesnt support it out of the box so you need to get nvm
@urban belfry I wasnt able to do the changes my self lol
what does this have to do with the node version
replit uses nodejs 12, its very likely he couldent get discord.js 14 on it - nodejs 12 isnt even supported by v13 atm
okay then i guess wait a couple day, it's fine 👍🏻
yeah lol
no
imagine you jus chat and a modal pops up
Did they change the partials?
Discord modal was add on v14 ?
yes
thxs
Did the message.channel.type change?
it returns a number now
Ok
Do you have the link where the numbers are?
Thxs
How do I create a ModalSubmitInteraction collector
You can use ChannelType enum
Construct new InteractionCollector
<:_:874573855715385394> 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...)
for to create a modal, in the docs (beta) show:
const { Modal } = require('discord.js')
but when i try, show
TypeError: Modal is not a constructor
Ps: I have discord.js@ dev (v14)
how to fix this? 🥺
thx
it's ModalBuilder
its ModalBuilder now
oh, tyy
why IntelliSence tells me that <EmbedBuilder>#setColor takes a ColorResolvable but when pass a ColorResolvable I got an error that is saying that .setColor takes a number? (I know I have to use resolveColor or Colors enum but just for knowing)
it should take one, that's another oversight from the *builder pr that already has a pr to fix it
I see thanks
is there another change in modal creation that hasn't been documented?
const text1 = new TextInputComponent()
.setCustomId('first')
.setLabel('anything!')
.setStyle(TextInputStyle.Short);
exit with error:
TypeError: (intermediate value).setCustomId is not a function

TextInputBuilder
and it's documented https://discord.js.org/#/docs/builders/main/class/TextInputBuilder
thx again, i has view just in discordjs.guide
// interaction is a ContextMenuCommandInteraction
const reply = (
baseOptions: string | BaseMessageOptions,
interactionOptions?: InteractionReplySpecificMessageOptions,
) => {
if (interaction) {
interaction.reply(Object.assign(baseOptions, interactionOptions || {}))
}
}
const row =
new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
new ButtonBuilder()
.setLabel("Original message")
.setStyle(ButtonStyle.Link)
.setURL(message.url),
)
reply(
{
files: [
{
attachment: scaledBuffer,
name: `${message.id}-${attachment.id}-scaled.png`,
},
],
components: [row],
},
{ ephemeral: false },
)
is throwing this error:
Argument of type '{ files: { attachment: Buffer; name: string; }[]; components: ActionRowBuilder<MessageActionRowComponentBuilder>[]; }' is not assignable to parameter of type 'string | BaseMessageOptions'.
Object literal may only specify known properties, and 'components' does not exist in type 'BaseMessageOptions'.ts(2345)
I'm guessing this is some update in v14 that I'm not aware of it. why does "components" no longer exist in "BaseMessageOptions"? How can I make this work again?
Why is <CommandInteraction>.options.getSubcommand() (along with some other methods) omitted from <CommandInteraction>.options?
its bugged
What's wrong with it?
can you show me your code
nvm it should be ChatInputCommandInteraction i think
Error
const exampleEmbed = new MessageEmbed()
^
TypeError: MessageEmbed is not a constructor
at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:8:28)
at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)
at Client.emit (node:events:520:28)
at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:520:28)
a CommandInteraction can be a slash command or context menu command context menu commands don't have subcommands
initiate: async (interaction: NeutronCommandInteraction) => {
if (interaction.options.getSubcommand() === 'create') {
NeutronCommandInteraction:
export interface NeutronCommandInteraction extends CommandInteraction {
client: Neutron
}
EmbedBuilder
code
const { MessageEmbed } = require('discord.js');
module.exports = {
data: {
name: 'help',
description: "help how to use this bot",
},
execute(message, args, Discord, client){
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
channel.send({ embeds: [exampleEmbed] });
}
}
Is there a way to get one of the two?
Embedbuilder?
isChatInputCommandInteraction()
Ahh I see
Yes but it's PascalCased EmbedBuilder not Embedbuilder
May i ask where is it PascalCased EmbedBuilder
Import it from discord.js library
How?
The same way you imported MessageEmbed
const { PascalCased EmbedBuilder } = require('discord.js');
Like this ^^^^
I added a condition with this method, it still doesn't take it:
if (interaction.isCommand()) {
if (interaction.options.getSubcommand() === 'create') {
Exact error: Property 'getSubcommand' does not exist on type 'Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused" | "getMentionable" | "getRole" | "getAttachment" | ... 6 more ... | "getSubcommand">'.
It's just EmbedBuilder, PascalCase is a naming convention
oh i am stupid
it needs to be interaction.isChatInputCommandInteraction()
Also if it's a normal slashcommand??
Still error
const exampleEmbed = new MessageEmbed()
^
TypeError: MessageEmbed is not a constructor
at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:10:28) at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)
at Client.emit (node:events:520:28)
at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:520:28)
normal slashcommands are chat inputs
a slash command is a chatinput command
const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'help',
description: "help how to use this bot",
},
execute(message, args, Discord, client){
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
channel.send({ embeds: [exampleEmbed] });
}
}
Code
Use EmbedBuilder constructor instead of MessageEmbed ;-;
Ah I thought it was something else considering isCommand was the more obvious one 😄
NEW ERROR
const exampleEmbed = new EmbedBuilder()
^
TypeError: EmbedBuilder is not a constructor
at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:10:28) at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)
at Client.emit (node:events:520:28)
at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:520:28)
const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'help',
description: "help how to use this bot",
},
execute(message, args, Discord, client){
const exampleEmbed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
channel.send({ embeds: [exampleEmbed] });
}
}
Code
What's your discord.js version
v14 dev
there's many v14 dev versions
how do i see the version i use
npm ls discord.js in your terminal
ok
why im getting this error, while building an embed?
discord.js@14.0.0-dev.1644797187.0dfdb2c
This version is from February 13, update to latest
how?
my brain no work so good rn
npm install discord.js@dev
(Karma for calling yourself @dev)
ur passing null when it expected a string
discord.js@14.0.0-dev.1647259751.2297c2b
yes, but where? or what option?
show full error
ERROROROOROROOR
send help.js line 11
the errors are self explanatory 🤨
.setColor('#0099ff')
.setColor expects a number, so .setColor(0x0099ff)
ok
ERrrrrrrreeoeoeoeeoeoeeoeoeoorrororroor
.addField('Inline field title', 'Some value here', true)
^
TypeError: (intermediate value).setColor(...).setTitle(...).setURL(...).setAuthor(...).setDescription(...).setThumbnail(...).addFields(...).addField is not a function at Object.execute (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\commands\help.js:23:3)
at Client.<anonymous> (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\index.js:51:37)
at Client.emit (node:events:520:28)
at MessageCreateAction.handle (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (C:\Users\ander\Documents\GitHub\RedLands-Discord-Bot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:520:28)
afaik .addField() was removed in favor of .addFields()
If you can't 'handle' getting errors, I suggest going back to the stable version.
I can handle it
What
nothing wrong with my sentence, use .addFields()
How do i design a embed in discord.js@14.0.0-dev.1647259751.2297c2b
like any website to make it on?
same as v13
just MessageEmbed is now EmbedBuilder, .addField() has been removed and .setColor() takes a number
that's all iirc
ok
error
const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'help',
description: "help how to use this bot",
},
execute(message, args, Discord, client){
const exampleEmbed = new EmbedBuilder()
.setColor(0x0099ff)
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addFields('Inline field title', 'Some value here', true)
.setImages('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
channel.send({ embeds: [exampleEmbed] });
}
}
code
remove the second addFields call
also channel isn't defined
addFields takes objects
Then how do i send in same channel as the command
message.channel
what is an object?
learn js #resources
Documentation suggestion for @scarlet tangle:
<:_:818272565419573308> Object
The Object class represents one of JavaScript's data types. It is used to store various keyed collections and more complex entities. Objects can be created using the Object() constructor or the object initializer / literal syntax.
<:_:818272565419573308> Object
The Object class represents one of JavaScript's data types. It is used to store various keyed collections and more complex entities. Objects can be created using the Object() constructor or the object initializer / literal syntax.
too fast
this .js is like learning a launges that is super hard
it isnt hard its the simplest language actually below python ofc
and scratch
wot
You seriously try to use an unstable version of a package while not knowing JavaScript 
YEssssss IT WORKS
scratch language is simplest
yea idk what i downloaded when i downloaded the discord.js

Well you added @dev and next time I suggest not doing that if you don't know what you're doing.
ok so can i just reinstall without @dev?
SORRY FOR PING TO THE PERSON I PINGED
Is there a PR for the bug where EmbedBuilder.from() can be sent in channels without @ts-expect-error
uninstall and install discord,js
ok tmrw