#djs-in-dev-version
1 messages · Page 18 of 1
How to send buffer attachment ?
channel.send({ files: [file] })
https://github.com/discordjs/discord.js/pull/7649 Is ready to be merged!
nvm
The error explains itself.
Nothing to do with v14 itself, that's a standard JS error for using await incorrectly
What argument does <EmbedBuilder>#setAuthor() take?
User or Member?
Or can I use both?
<:_:874569310025179188> MessageEmbedAuthor
Represents the author field of a MessageEmbed
stable docs :T
if it's the same then thx
Thought using object was deprecated or smth
using string was
Ah, thx
<MessageEmbed>.setFooter() and <MessageEmbed>.setAuthor() now each take an object:
- embed.setAuthor('This is an example text', 'https://exampleicon.com', 'https://websiteofauthor.com')
+ embed.setAuthor({ name: 'This is an example text', url: 'https://websiteofauthor.com', iconURL: 'https://exampleicon.com' })
- embed.setFooter('This is an example text', 'https://exampleicon.com')
+ embed.setFooter({ text: 'This is an example text', iconURL: 'https://exampleicon.com' })
I don't really understand
EmbedBuilder, the Embed class is only used when receiving embeds, you cant construct it yourself
Tag suggestion for @regal mason:
MessageEmbed#attachFiles has been removed. Files should be attached via the message option object instead:
const attachment = new MessageAttachment('./image.png', 'image1.png');
const embed = new MessageEmbed()
- .attachFiles([attachment])
.setTitle('Attachments')
.setImage(`attachment://${attachment.name}`);
- channel.send(embed)
+ channel.send({
+ embeds: [embed],
+ files: [attachment]
+ });
in the message attachment constructor you can pass a buffer as the first argument instead of a file path
I feel like I can't be the only one who's getting this, but while using modals, the bot completely freezes up, and this happens:
no errors in console
using both InteractionCollector, and client.on
you didnt reply to the modal?
It won't let me reply to the interaction cuz the bot freezes once I click "submit":
const col = new Discord.InteractionCollector(client, {max: 999});
col.on("collect", async (i)=>{
console.log("f")
if(!i.isModalSubmit()) {
const modal = new Discord.ModalBuilder().setTitle("My Modal.").setCustomId("mymodal").addComponents(new Discord.ActionRowBuilder().addComponents(new Discord.TextInputBuilder().setCustomId("yasser").setPlaceholder("no placeholder?").setStyle(Discord.TextInputStyle.Short).setLabel("Yasser").setRequired(true).setValue("yasser").setMinLength(3).setMaxLength(200)))
i.showModal(modal)
} else if(i.isModalSubmit()){
console.log("e")
i.reply({content: "yetys"})
}
})
to elaborate, once I click submit the bot won't respond to anything, console.log anything, or listen to any other messages or slash commands
Why is it waiting for 999 submissions
I just wanted to make sure that it dosen't have a default max
Do collectors have a default time from which it ceases to function?
well this code worked for me perfectly normally
modal submits are broken rn. there's PR for it.
Ah alr thanks for saving me time, I was gonna spend like 5 hours finding a fix
Code:
const modal = new ModalBuilder()
.setTitle("LFG Creation")
.setCustomId("lfg-create")
.addComponents(
new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId("lfg-time").setLabel("Time").setStyle(TextInputStyle.ShortText)),
new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId("lfg-desc").setLabel("Description").setStyle(TextInputStyle.Paragraph)));
interaction.showModal(modal);
Error: ZodError: Invalid enum value. Expected 1 | 2
Full stack: https://pastebin.com/YuX1YsxP
I'd like to know what's wrong and how to debug a ZodError
Never encountered one before
I think the text input style is Short not ShortText
that would make sense.
Yeah you're right.
I wish the error was more verbose about what value was wrong
yeah :/ Just remember it usually has to do with Schema, etc.
Here is the actual package on NPM you haven't already looked at it
https://www.npmjs.com/package/zod
Might take a peek, thanks ^^
No
We're replacing Zod with Shapeshift too
Cause Zods errors suck
Zod errors are pretty clear usually but sometimes they are a little less clearer
Pretty clear? That was in no way clear.
Anyway, if we are to discuss about it -> #archive-offtopic
7705?
7649
anyone remember or know what the last good commit was before modal submits broke? I wanna do some testing with them for an upcoming project
doesn't work anyway
This was a commit that worked for me 14.0.0-dev.1647259751.2297c2b
how can i resolve guild permissions in cmds like SEND_MESSAGES to enum number
Import PermissionFlagsBits and do PermissionFlagsBits.SendMessages
.
Show the full error
Tag suggestion for @carmine bridge:
To help you we need more information:
• What are you trying to do?
• What is your code?
• What errors and debug logs do you have?
the
last version can
i upgrade the ^14.0.0-dev.1648339713-520f471
can't
no error
the command not work
i trying the help
no response
i use this is ok
this is not work
Its retun bigint
And when i set commands giving error j can't resolve bigint
prefix cmds not working in djsv14
it will not work ?
Show the code and the error
They can, but it’s not recommended, discord introduced a new intent on gateway v10 which discord.js v14 uses, you now need the guild_messages and message_content intents
yes
idk why
last dev version ok
14.0.0-dev.1648339713-520f471 this is new version
prefix not work and no error in the console
You need the message content intent
And make sure it’s also enabled on the bots application dashboard
But fair warning, prefix commands aren’t recommended, and you should switch to slash commands
so prefix cmds not work on unverified bots ?
They do, but they aren’t recommended, and you need message intents for them
So I recommend switching to slash commands/application commands for the most capabilities, and they’re less annoying to use and develop
How to loading slash fast
guild slash commands are instant, global can take up to an hour to appear
You put smth weird or incorrectly in an ActionRowBuilder
This is the code
You can't send SelectMenuBuilder, you need to put it into ActionRow
Show the row too
It prob doesn't take an array
use spread syntax or just pass separately
Yea I did it and it fixed, thanks
can u send me this intent
GuildMessages
is this also includes in djs v13
its GUILD_MESSAGES in v13
ok
then I added already
I add all intents to my bot :-)
Message content intent isn't guild messages intent
??
GUILD_MESSAGES isn't the same as the privileged message content intent
that is added in v10, or will be, i'm not sure but it's a separate intent
ah, never knew that
You still can receive messages without message content intent but the content property will be null
Yeah, afik you will have to explicitly specify that intent for message content
InteractionCollector
extends CollectorCollects interactions. Will automatically stop if the message (messageDelete or messageDeleteBulk), channel (channelDelete), or guild (guildDelete) is deleted.
Will this behaviour remain the same in v14?
yes? why not
Didn't really go through source but thought it might be affected by the removal of Message#deleted
not at all
Thanks, and my bad I was looking at the Collector file for the listeners. Should've checked what the name was
this?
Yes
Correct now you need the message intent, it is 1 << 15
Some1 pin that maybe^
I mean, why would you use 32_768 instead of 1 << 15
What is js SelectMenuOptionrenamed to?
const options = categories.map(category => ({
label: category.name,
value: category.name,
})
)
const menu = new SelectMenuBuilder()
.setCustomId('help')
.setPlaceholder(`Choose a category`)
.addOptions(...options);
const row = new ActionRowBuilder()
.addComponents(menu)
message.channel.send({ components: [row] })
Why this doesn't work?
SelectMenuOptionBuilder
okay
@velvet jasper
I think select menu options needs description
No?
.addOptions(
categories.map((cmd) => {
return {
label: cmd.directory,
value: cmd.directory.toLocaleLowerCase(),
description: `Commands from ${cmd.directory} category`,
};
})```
Even this doesn't work
Are modals already on the dev version?
Not working for me too
yes
I think yes
What is the class called
Ahh thanks
Why not use the data object instead of relying on builder for this? Just a suggestion if you want to quickly resolve.
It's just like this:
MANAGE_GUILD => ManageGuild
ModerateMembers ?
yeah
ok thanks
what about this please help
this is my code
addOptions takes rest parameters, not an array. ...categories.map()
Hi, a question, why the error? I'm on version 14 of d.js
That's basic JavaScript. Nothing to do with discord.js
also change MessageEmbed() to EmbedBuilder()
I am trying to use the new modal, but when i try to use <ModalBuilder>.addComponents(<ActionRowBuilder>) it gives me the error that it is an invalid input
This is not directly correlated with v14 but kinda is in a sense as I plan on using it.
I have a bot I plan on containerizing across multiple vms due to I can buy multiple cheaper vm's
and in the end gain more resources than one expensive vm.
Anyways I want to centralize all cache on one VM so it can be accessed
from all other containers. What better way to do this than redis.
However DJS's current cache implementation is synchronous redis is
asynchronous. So intercepting the makeCache will only break everything I presume.
Is there any "easy" "drag and drop" implementation for this, or should I just fork and modify to
my needs?
I apologize if this is not the correct place to put this, but I felt it may exceed normal help a bit.
If there is a more correct channel to place this in please point me there 🙏
I need help
Is there another way to know if it is waiting or not with the "communicationDisabledUntilTimestamp" ??
Documentation suggestion for @warm spade:
<:_:874573924988518500> GuildMember#isCommunicationDisabled()
Whether this member is currently timed out
hm nop
yep
When discord modals will be supported??
It already is...?
Probably means in stable release
When it's released then
What will the main changes in DJS v14 be?
theres a wip updating guide in the pins
If I use the .addAttachmentOption then how do I get it?
<ChatInputCommandInteraction>.options.getAttachment()
Ok thanks
Is there any way to show modal in messageCreate listener without using any other component?
Modals are only for interactions
Yeah because modals arent a component, theyre an interaction response type
How do I get the numeric values for SUB_COMMAND, STRING, INTEGER, etc.?
for the data in client.application?.commands.set(data) when specifying type
Import ApplicationCommandOptionType from discord.js
ApplicationCommandOptionType.String
ApplicationCommandOptionType.Subcommand
ApplicationCommandOptionType.Number
ah, thank you
would like to update my bots nickname every 30min using discord.js. My old technique was to set username every 30-ish min and that would automatically set the nickname along with it but it doesn't seem to be setting nickname automatically. Anyone have context on this? Btw, you can think of my code as running a loop of 'instantiate client then setUsername"
What's even weirder is that when I check the bot nickname on my iphone Discord app the nickname is correct. It's on my desktop that the nickname doesn't appear correct.
I don't think it is related to djs@dev in any way
Yeah that worked but now the embed doesn't edit when I choose a category.
What shud I change?
then it's about how you set up your collector and handle interactions
I used to do the same thing in v13 and it worked. Idk what is wrong now
how to get the maximum upload limit for a guild?
by checking the premium level ig
Where do you access command options!? There is nothing on the docs to say that.
Documentation suggestion for @river harbor:
<:_:874573879153160212> ChatInputCommandInteraction#options
The options passed to the command.
Why does getString do not exists ????
It is literally defined in CommandInteractionResolver
CommandInteraction is for Context Menu too
try to define it as ChatInputCommandInteraction
why latest discord.js prefix command not work
(Message Content Intent (in dsc dev app dashboard ) is enabled)
you need to also add it to your client constructor
how to do?
The same way you added the other intents
idk the full name
(resolved)
MessageContent?
There is a way the edit the initial interaction if it's ephemeral?
For example:
ChatInputCommandInteraction reply with menu and I want to edit the ChatInputCommandInteraction reply
Now it's only .get then .value
this is wrong
getString does exist still, just that the type should have been ChatInputCommandInteraction
as the user has been answered a while ago \😕
Oh
yes interaction.editReply works
and <SelectMenuInteraction>.update too
ty
if I'm doing update I can't show modal what can I do with this?
Yeah there's no way to defer showing a modal
What does this mean?Can anyone explain
have you read the linked articles?
I did but I didn't understand what it means does it mean I should use enums from discord.js instead of directly using numbers in slash command option types.
But I understand, isn't it my bot.
Ohk
Thanks for explaining
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
],
presence: {
activities: [
{
name: '/help',
type: 'LISTENING'
}
]
},
restTimeOffset: 0,
makeCache: Options.cacheWithLimits({
GuildEmojiManager: { maxSize: 0 },
GuildStickerManager: { maxSize: 0 }
}),
});
Why the status doesn't show up for my bot?
Use ActivityType enum instead of string
Ok thanks
Has pr 7649 been merged yet?
you can check it yourself, it's publicly viewable
and no, it's not
Is dev branch broken?
Suddenly my bot stopped working even tho the v13 one works fine
It's fine
Any idea why my bot suddenly stopped working then? It doesnt reply to prefix commands
I have no information to answer that question
What do you want? messageCreate event is enuf?
do you have the privileged message content intent enabled?
yeah
It means I can't tell you what's wrong with your code if you don't provide it
now in v10, it's required
no error also
no like enabled on the dev portal and on your code?
const client = require("../index");
const { EmbedBuilder, Util } = require("discord.js");
client.on("messageCreate", async (message) => {
if (
message.author.bot ||
!message.guild ||
!message.content.toLowerCase().startsWith(client.config.prefix)
)
return;
const [cmd, ...args] = message.content
.slice(client.config.prefix.length)
.trim()
.split(/ +/g);
const command =
client.commands.get(cmd.toLowerCase()) ||
client.commands.find((c) => c.aliases?.includes(cmd.toLowerCase()));
if (!command) return;
try {
await command.run(client, message, args);
} catch (e) {
const embed = new EmbedBuilder()
.setTitle("An error has occured.")
.setDescription(`\`\`\`js\n${e}\`\`\``)
.setColor(Util.resolveColor("DarkPurple"));
message.channel.send({ embeds: [embed] });
client.channels.cache
.get("954704896848986132")
.send(
`**An error has occured**\n**Server - ${message.guild.name}** \`(${
message.guild.id
})\`\n**Time -** <t:${~~(message.createdTimestamp / 1000)}:f> <t:${~~(
message.createdTimestamp / 1000
)}:R>\n\`\`\`js\n${e.stack}\`\`\``
);
return console.log(e);
}
});
messageCreate event. None of the prefix commands work
lemme check on portal
show your client definition too
i don't think you quite understood what i said and confused with the other message intents
ill be back in 5 mins
const { Client, Collection } = require("discord.js");
const client = new Client({
intents: 32767,
});
module.exports = client;
yeah no that doesn't include the new intent, right?
I just copy pasted some files from my v13 bot and tried to change it to v14, but it suddenly stopped working
what is the new intent?
and you don't need all of them, enable the ones you only need
the MessageContent intent
How to enable that particular one?
enable the ones you need, then you can just ad the intent to the array
so MessageContent intent is a must now
if you want to read the content.. yes?
what all will I need, as I have been using this number since a while?
and idk how to make the ones I need in an array, I just know how to use the number thing
What is the number that also has the new intent?
Use the Intents object instead of hardcoding numbers
how to do that?
just like in the example:
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
My bot has not even reached 100 servers, so its already enabled on dev portal.
const { Client, Collection, GatewayIntentBits } = require("discord.js");
const client = new Client({
intents: [GatewayIntentBits.Guilds],
});
module.exports = client;```
Only this much?
• Websocket intents limit events and decrease memory usage: learn more
• See what intents you need here
read up on the guide, see which ones you need
But where is the MessageContent one as u said?
const { Client, Collection, GatewayIntentBits } = require("discord.js");
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages],
});
module.exports = client;```
Is this enough for the latest dev version?
if those are what you use, then along with MessageContent, yes
why do you have some of the intents there twice though?
Omg tysm @urban belfry! My bot works now
Also how are you kept updated on the latest changes in dev version because I dont find anything related to this in the v14 docs
check out the recent pr
const buffer = Buffer.from(request.data.split(',')[1], 'base64');
const attachment = new MessageAttachment(buffer, `${validURL}_screenshot.png`);
Can we make a http-interaction-bot using discord.js
djs wouldn't be that much of help
but discord-api-types would
Ok thanks
how are you sending the attachment? you have to use the files option, e.g. { files: [attachment] }
Whenever i try to add components to my modal with the ActionRowBuilder that contains the TextInputBuilder, i still get this error:
Argument of type 'ActionRowBuilder<TextInputBuilder | MessageActionRowComponentBuilder>' is not assignable to parameter of type 'ActionRowBuilder<TextInputBuilder> | APIActionRowComponent<APITextInputComponent>'.```
v10 ?
api version 10
Hi there, was just wondering if there was any way to wait for the response of a modal?
Listen to interactionCreate event or construct new InteractionCollector
alr
How would I acknowledge the modal or something so this error doesn't happen? https://cdn.polar.blue/iK5Fg9gZIl0huK61.png
you respond to the interaction
sure, or update original, if prompted from a button
depends on how that all works
wdym update original
If for example they clicked a button and then you presented the modal, then you can update the original message with the buttons iirc
but afaik modals don't work currently since a bug (that is fixed in PR #7649) makes it crash
I see, also I have another question, how would I make an interaction collector? I currently have a MessageComponentCollector but I'm pretty sure that won't work for a modal
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...)
const prev = new ButtonBuilder()
.setEmoji('◀️')
.setCustomId('previous')
.setStyle('SECONDARY')
```
How to fix this?
setEmoji takes an object
Like setEmoji({id : '❓'})?
It's not mentioned anywhere
😑
the docs
<:_:874569335308431382> ButtonBuilder#setEmoji()
Sets the emoji to display on this button
name instead of id
and i think you can find it in main branch commits on github
I am talking about the changelog section in guide.
Ok thanks
How do I set a character limit in a string option ?
When I'm building an embed with EmbedBuilder, how would I now go about accessing the length getter? With MessageEmbed / Embed there used to be this useful util getter length that returned the combined length of the embed with all of its fields etc, but this property doesn't exist on the builder anymore. I thought about doing something like (new Embed(embed.toJSON()).length (where embed is an embed builder), but that just gives a TypeError as Embed has a private constructor (and even then that just seems like a very unpretty workaround). Is there a way of accessing it still or will I have to compute it manually?
There’s a new util method that takes both an embed or embed builder that gives you the length. Let me find it
It’s a called embedLength(embed)
Where can I access that method? On 14.0.0-dev.1648339713-520f471 it doesn't appear to be exported directly nor be on the Util class
Hmm I think it’s exported by builders, probably should be re-exported from djs as well
I might just add .length back to the builders. Mainly bc it’s more of a utility method rather than an actual embed property.
Alright, thanks for the help :)
hi modals and attachment are out in djs@dev?
yes
Yes
is there any guide 👀
pins 👀
oh okay and also modals is only available in v14 or its our for v13 too ?
modals will be in v13.7
okay tnx
Getting TypeError: createComponent is not a function when trying to submit a modal, am I doing anything wrong?
#7649 in discordjs/discord.js by ImRodry opened <t:1647136333:R> (approved)
types: fix regressions
📥 npm i ImRodry/discord.js#types/fix-regressions
dude 16 days ago
npm i ImRodry/discord.js#types/fix-regressions throws an error for me:
npm ERR! npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! npm ERR! Unsupported URL Type "workspace:": workspace:^
you can't install prs because its monorepo
ah, so ill have to wait for it to be merged with main?
yes
any timeline for that or no?
Nop

16 days is nothing
🙏
just some more info
Thanks!
Why isn't my bot reading message content?
(i have the intent enabled from the portal)
I think you need to provide MessageContent intent in your client contructor.
ah, ok
Was someone able to use the changes from PR #7649 and can tell us how to do it ourselves? I don’t want to ask for eta or whatever but I am really excited to start building with modals and therefore would be willing to jump through some loops to make it work 
Use fetchReply at first reply
No
Like this interaction.reply({embeds: [embed1], fetchReply: true})
ok
not work
still no response
why i not see error in this and not edit
idk why
Absolutely, everyday I hope for the stable release 😄 I have some exciting ideas
With the latest two development snapshots my bot is unable to read message content, even with the intent enabled.
Is this a known issue?
Thanks
Ok, thanks for your prompt response.
Is the GuildMessages intent still a thing?
YES
Ok
without Message Intent music request channel will work ?
Yes if the bot dont need to receive messages
like if user type song name in request channel so bot will receive without Message Intent ?
my bot in 99 servers
No
I dont think it matters
ok thanks i will apply for Message Intent
ok
Without the privileged intent you only receive message content if your bot was mentioned.
like i disabled message intent in discord portal and i enabled intent in discord client
then it working
after idk after bot verify it will work or noot
Theres no message intent in dev portal its message content intent
yes sorry for naming mistake
It likely won't be approved if that functionality can use Slash Commands
They probably work exactly the same like the messageCreate event
No intent, no content
Wouldnt make any sense otherwise lol
why is this happening?
Code:
client.on('interactionCreate', async i => {
if(i.isCommand()) {
if(i.commandName === "obfuscate") {
// await i.deferReply();
const file = i.options.get('file').attachment;
const { data: fileBuffer } = await axios.get(file.url, { responseType: 'arraybuffer' });
const ObfuscatedCode = obfuscate.js(fileBuffer);
const Attachment = new Discord.MessageAttachment(Buffer.from(ObfuscatedCode), file.name);
const Embed = new Discord.EmbedBuilder()
.setTitle('This File Have Been Obfuscated Successfully.')
.setColor("DarkGreen")
.setThumbnail(i.guild.iconURL({ forceStatic: true }))
.setFooter({ text: `Requested By: ${i.user.tag}`, iconURL: i.user.displayAvatarURL({ forceStatic: true }) })
.setTimestamp(new Date(Date.now()));
await i.reply({ ephemeral: true, embeds: [Embed], files: [Attachment] });
}
}
})
#7649 in discordjs/discord.js by ImRodry opened <t:1647136333:R> (approved)
types: fix regressions
📥 npm i ImRodry/discord.js#types/fix-regressions
is this for me?
The problem isn't solved yet.
Read the message from Clyde
Also this is for @dev use #djs-help-v14 or #943190505720786985 for v13 questions
i did, the message is on a guild
this is V14
anyone got a solution?
Anybody?
i can't log the entire interaction
it is not because of the code i think
Then use some console.logs to see where the code stops running
i can't log the whole event
client.on('interactionCreate', async i => {
console.log(i)
that doesn't log anything
Log above the event to make sure it's being registered
ok
when i created the command it logs the command, so the command is ok
but i can't handle the interaction
But is the listener actually getting registered?
btw, i changed the bot user to check if this is a user problem but i got no progress
how can i check this?
Yes
it logs
Can you log new Error().stack above the event?
ok
Error:
at Object.<anonymous> (c:\Users\mmgam\OneDrive\Desktop\ismmTeamBot\ismm.js:48:13)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Do you have a ready event listener?
yeah
Does it run?
yeah
Can you show the code for it?
client.on('ready', async () => {
console.log(`Logged in as ${client.user.tag}!`);
await client.guilds.fetch();
client.guilds.cache.forEach(async guild => {
await guild.commands.set([])
for(const _command in commands) {
const command = await guild.commands.create(commands[_command]);
for(const perm of ismmConfig.Settings.Perms) {
command.permissions.add({
permissions: [
{
id: perm,
permission: true,
type: 1
}
]
})
}
console.log(command)
}
})
});
That's an easy way to hit the rate limit for creating new commands
;-;
any solution?
Deploy globally instead in an isolated script (not in the ready event)
how?
The permissions stuff is fine, given the current sucky system we’re stuck w/ for the time being
Deleting all commands then creating it isn't
<:_:862626783890636830> discordjs.guide results:
• Interactions: Registering slash commands
You only get 200 new command creations per day. The rate limit is only counted toward commands that are added (identified by its name). Note that deleting then creating also counts toward this ratelimit. However, updating the description of a command doesn’t count.
ok now my command register is this:
;(async () => {
try {
const guild_id = "", clientId = "";
await rest.put(
Routes.applicationGuildCommands(clientId, guild_id),
{ body: _commands }
);
console.log("Successfully registered commands!");
} catch(e) {
console.log("Failed to register commands!");
console.error(e)
}
})()
now i have the same error
Are Embeds broken on ~dev?
EmbedBuilder
Oh
@idle galleon?
How did you do it? When manually pulling the pr version I get husky error messages.
Maybe you can roughly tell me what you did?
Huh?
Which version did you install? Pr or discord.js@dev and manually do the pr changes?
lol that was too easy. Thank you!
Next question though.... How can we reply after receiving the modal submission?
await interaction.reply({ embeds: [lbEmbed], ephemeral: true });
throws
Uncaught DiscordAPIError DiscordAPIError[10062]: Unknown interaction
in the guide i can only find how to extract the modal data, but not how to interact with the user based on this.
You reply to expired interaction
<ModalSubmitInteraction>.reply() or deferReply()
no
Are permission names changed?
They're CamelCase now
no they're not, they're PascalCase. not camelCase
btw discordjs's Embed SlashCommand and all those builders typings are missing
they don't who up in VScode's intellisense
you mean EmbedBuilder and SlashCommandBuilder?
yeah, in the latest v14 dev all builders now have the Builder suffix. so EmbedBuilder, ActionRowBuilder etc
Embed is still a thing, but if you're trying to build an embed then you need to use EmbedBuilder
but Embed still works
Embed returns from API
EmbedBuilder to build your embed
just the intellisense
because those methods aren't on Embed anymore
unless you're on an earlier version of the dev, in which case I have no idea what the issue is and I probably can't help
latest@dev version
what do you see when you do npm ls discord.js
text
oh, I thought you were saying you didn't have it. are you saying that you can't set the properties on EmbedBuilder?
bro, VScode intellisense don't show the props
for EmbedBuilder
Anyone?
I also had this same error when I was converting my js code to ts code.
node_modules/discord.js/typings/index.d.ts:1572:42 - error TS2344: Type 'MappedInteractionTypes<Cached>[T]' does not satisfy the constraint 'MessageComponentInteraction<CacheType>'.```
Putting `"strict": true,` in the *compilerOptions* of `tsconfig.json`, fixed it for me.
https://thykeis.gay/i/2q0dehj4 Known issue?
Might need to be changed to createComponentBuilder()
npm ls discord.js, show me the output
I fixed it, just needed to change a line of code in the DJS package
any idea???
Hello, are the voice channel text chats included in dev branch at the moment ?
It's not documented by Discord yet
Sadness, thanks you
whats this error mean https://paste.md-5.net/kasaxosite.js
zoderror ?
show ban.js line 35
How can i make new ButtonBuilder().setEmoji() work with custom emojis?
new ButtonBuilder().setEmoji({id: "customID"}) crashes with components[0].components[1].emoji.id[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
Where can i find the docs/guide of how the modals work?
pins
Oh i see
can i add modals more than 5 ?
whats the role data property hoist thing does?
can you rephrase that?
can i do somethink like page system
in modals? no, though pagination is something that has been requested a lot and discord has on their radar of possible extensions for the feature
my bot is private bot
i do not see how that matters
will more things be added to modals in the future?
e.g. select menus
hi! what changes brings djs 14?
Refer to the pins "Why are you changing X to Y"
<@&839912195994812420>
hm
you prefer this tick? ._.
What does "When it's ready" mean - a few weeks, months, or half a year? I'd like to update soon, but I don't want to run for months on unstable code.
I don't want to run for months on unstable code
Then don't use bleeding edge versions
v14 is no where near becoming stable and is bound to change drastically before it does
Here are the current milestones for v14 https://github.com/discordjs/discord.js/milestones/discord.js v14
Ok
ok, thanks
What is another way to get modal submits? Cause I know with buttons you can use .createMessageComponentCollector instead of using the interactionCreate event, but I was wondering if there is a such thing with modals too yet?
There's the InteractionCollector
How do I use that? Do you have a guide to it or can you explain it?
sorry if this is spam but like literally anyone??, it gets buried in an instant every time
they work the same way as normal message component collectors, the docs explain it better than I can
So this way? ```js
let mymodal = await interaction.showModal(modal)
const collector = mymodal.createMessageComponentCollector();
collector.on('collect', async i => {
// ...
})
thats a message component collector, I again suggest you look at the docs
const collector = new InteractionCollector(client, options)
options is an object
When I submit my modal, it throws this error: TypeError: createComponent is not a function from discord.js\src\structures\ModalSubmitInteraction.js:43:54 ?
const client = new Client({
intents: ['DirectMessages', 'Guilds', 'GuildMembers', 'GuildMessages'],
rest: { version: '9' },
});
client.on('messageCreate', (message) => {
console.log(message.content);
});
Should this not work, on @dev, to view message content until the 30th?
MessageContent is its own intent
Oh. Damn. Cheers
Should this not work, on @dev, to view message content until the 30th?
Version 14 uses API version 10. This is already in effect
Alright, it looks like I'm gonna have to use 13 for this small project. Thanks guys. 😛
IIRC, v10 of the API enforces the priviledged intent already. So if I specify it, without having it, it will not connect.
It's a unique case and we don't need anything super fancy. We own a large bot and have recently acquired the company that happens to own the bot that was our competition. We've merged all features from both bots onto our own and plan to discontinue theirs (now ours).
We've asked Discord to transfer all priviledged intents and they have. Their bot still uses standard !commands, and no longer has message intents, so we're going to respond to these commands, until message content intents are enforced, encouraging them to migrate to the other bot.
Why my bot never ready? (Include client.login & Using replit)
Tag suggestion for @civic topaz:
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
client
.on("debug", console.log)
.on("warn", console.log)
• Note: if you initialize your Client as bot or other identifiers you need to use these instead of client
• If the output is too long to post consider using a bin instead: gist | hasteb.in | sourceb.in | hastebin
Bruh why isn't this pulled? It's been ready for days now... https://github.com/discordjs/discord.js/pull/7649
is there a limit for how many actionrow can be present in a modal?
5
SHOW_MODAL_ERROR: An error occurred when showing a modal. DiscordAPIError: Interaction has already been acknowledged.
at RequestHandler.execute (C:\Users\ubanp\Desktop\Root\Coding\.Development\Rato\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\ubanp\Desktop\Root\Coding\.Development\Rato\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async showModal (C:\Users\ubanp\Desktop\Root\Coding\.Development\Rato\node_modules\discord-modals\src\structures\ShowModal.js:49:9) {
method: 'post',
path: '/interactions/958639816730357760/aW50ZXJhY3Rpb246OTU4NjM5ODE2NzMwMzU3NzYwOnBpUzRnSHlhUGFxaDQ1RlRIU2FNVTZNOTJFT3U3OFBvMlNaQ216QzNYVDFSVkZnR0E2NFloQjVFN2laeVdVRDhZZXd0SW1GMHZDa1QxbUViNEF6QlJrdWNtNENvU0JQZWtmN3FrV29wQ0RJQ1JrTXBRaURrYW1qRm9uWDlrZ3BY/callback',
code: 40060,
httpStatus: 400,
requestData: { json: { type: 9, data: [Object] }, files: [] }
}``` help?
The interaction was already acknowledged.
Ellaboration?
I mean, could you kindly ellaborate cause I usually get this and don't know how to fix it.
The one iv add isnt working
we dont write code for you, no.
We can help you fix your code tho, if you provide enough information
Yh pls do
Either provide information about the problem you are facing, or not.
const { ActivityType } = require("discord.js");
await client.user
.setActivity(`Your Status`, { type: ActivityType.SomeType })
Ty
message.reply({
embeds: [embedMessage("Select an activity from the following:")],
components: [
new ActionRowBuilder().setComponents([
new ButtonBuilder().setCustomId("something").setEmoji({ id: "an id" }).setLabel("Label").setStyle(ButtonStyle.Primary)
])
]
})
UNHANDLED TypeError: component.toJSON is not a function
at /root/shoukaku/node_modules/@discordjs/builders/dist/index.js:537:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (/root/shoukaku/node_modules/@discordjs/builders/dist/index.js:537:35)
at /root/shoukaku/node_modules/discord.js/src/structures/MessagePayload.js:135:30
at Array.map (<anonymous>)
at MessagePayload.resolveBody (/root/shoukaku/node_modules/discord.js/src/structures/MessagePayload.js:134:49)
at ChatInputCommandInteraction.reply (/root/shoukaku/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:106:56)
at Object.execute (/root/shoukaku/src/commands/activities/activities.js:8:17)
at handleNewInteraction (/root/shoukaku/src/handlers/interaction.js:23:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Client.<anonymous> (/root/shoukaku/src/bot/bot.js:81:7)
it should be working tho
setComponents takes rest parameters, not an array
Can you give me an example? Should I just give the buttons pure JSON format or an objectified one
the format of the buttons doesn't matter, it's about how you pass them to setComponents. Currently you are wrapping them in an array, all you have to do is omit the brackets
Has the bug been reported?
/mnt/c/Users/Kay/Desktop/KayBotTypeScriptJDA/node_modules/discord.js/src/structures/ModalSubmitInteraction.js:43
this.components = data.data.components?.map(c => createComponent(c)) ?? [];
^
TypeError: createComponent is not a function
🤔
known bug yes
https://github.com/discordjs/discord.js/pull/7649
Hey, I'm getting the following error. Why is this?
Argument of type 'ActionRowBuilder<TextInputBuilder | MessageActionRowComponentBuilder>' is not assignable to parameter of type 'ActionRowBuilder<TextInputBuilder> | APIActionRowComponent<APITextInputComponent>'
const modal = new ModalBuilder()
.setTitle('Suggestions')
.addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setLabel('Title')
.setPlaceholder('Testing')
.setMaxLength(256),
),
new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setStyle(TextInputStyle.Paragraph)
.setLabel('Suggestion')
.setPlaceholder('Testing')
.setMaxLength(2000),
),
);
how do i add a random color for embedbuilder? can't find it in Colors.
Util.resolveColor('Random')
i am just waiting for modals to be released as soon as possibe :D
will v14 have http interactions?
so far it doesnt, but who knows. imo it doesnt fit in the discord.js package
okay
what parameter should i put in .setEmoji for buttonbuilder? it says object
.setEmoji({ id : ''})
how about for custom emoji?
it takes an emoji object containing name, id and animated. name is a string and required, id is for guild emojis and is nullable and animated is a boolean
so a custom emoji would be something like { name: 'custom_kek', id: 'emoji ID here', animated: true/false }
oh thanks
whys this happening
see pins, builder classes got renamed
I updated discord.js and now it's giving these errors, is it a bug? I used yarn remove discord.js and then I used yarn add discord.js@dev...
what exactly are the errors?
I was already using the development version, but I went to update and this happened
so what are the errors
if you are sure you are on the Dev version restart the TS server, typings are cached
Yes, i'm on dev
I restarted the complete vscode, because only the tsserver didn't solve, now it worked, thanks!
im getting very weird ratelimits from d.js
Discord Client was RateLimited
Timeout: undefined
Limit: 5
Method: get
Path: undefined
Route: /channels/:id/messages/:id
im not fetching anything, the bot is running on idle
clearly there is a ratelimit logged. It won't magically log a ratelimit if u aren't limited.
why is path undefined
wait did they change the ratelimit log, lemme look it up
also im not receiving message content anymore, except in dms and when the bot is pinged
yes i have message content enabled on the bot page
Thats not enough, you also need the intent in the client constructor now afaik
thank you
is there any way I can access the AuditLogEntryTarget type
const restartEmbed = new Embed()
.setDescription(
`**Slash Commands:** :check: **|** Deployed
**MongoDB:** :check: **|** Connected
> **Node Information:** ${process.version}
> **Platform Information:** ${process.platform} ${process.arch}
> **Memory:** ${(process.memoryUsage().rss / 1024 / 1024).toFixed(
2
)} MB RSS + ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(
2
)} Heap
> **discordJS version:** v${discordjsVersion}
**Time:** <t:${(new Date() / 1000).toFixed(0)}:R> (<t:${(
new Date() / 1000
).toFixed(0)}>)
> Loaded in ${ms(
ms(Math.round(process.uptime() - client.uptime / 1000) + "s")
)}`
)```
`TypeError: (intermediate value).setDescription is not a function`
am I supposed to do `.addDescription`?
<:_:874569296821501952> EmbedBuilder (extends UnsafeEmbedBuilder)
Represents a validated embed in a message (image/video preview, rich embed, etc.)
It takes rest parameters
rest parameter
How?
.addFields([{ name: 'Canal', value: `${oldChannel}` }])
I'm doing this
it takes multiple objects instead of an array
.addFields({ name: 'Canal', value: `${oldChannel}` }, { name: 'Object 2', value: 'The Value' })
Like this?
yes
How can I get the attachment from a interaction
interaction.options.getAttachment('name')
<:_:874573924988518500> CommandInteractionOptionResolver#getAttachment()
Gets an attachment option.
How do I switch to v14 and is there any major differences that might affect my code
Check the pins
Oh and last question
Discord says on their API embeds have a. Video type but embedding a video never works
but bots cannot send youtube links or whatever as an embed?
no way possible?
thats what i meant lol
what would i put if i wanted all guild member intents?
Theres only one and youd put that intent
Neither do I, using a single number is a really dumb approach
i agree
u have to add the numbers or smth
<:_:874573855715385394> IntentsBitField (extends BitField)
Data structure that makes it easy to calculate intents.
whats the name
Whatever you called that option
did they change it
"MessageEmbed"
as it no work anymore
Yes, see guide in pins
on my main discord bot which is verified i am not gonna switch to discordf js 14 its a pain, they make so many little painful changes every update for some dumb reason
it breaks all code until the person fixes it or just sticks to an older version
Well, what do expect by installing an unstable dev version of the next major release
Yeah I feel like you've missed the whole point of a development build 🤷♂️
.addChoices([
['Choice 1', 'choice_1'],
['Choice 2', 'choice_2'],
['Choice 3', 'choice_3']
])
When I add choices to the SlashCommandBuilder as above, I'm getting the below error, now I'm confused what an array even is anymore 😭
uncaughtException: [
{
"code": "invalid_type",
"expected": "object",
"received": "array",
"path": [
0
],
"message": "Expected object, received array"
}
]
It wants multiple objects, not an array of arrays
Wait, it's the other way lol, it wants an object
haha yeah sorry I just read the error message properly
Hi, do already have a base template for discord.js v14 to take a look and practice the new changes?
No, there is not that many changes to the basic layout of a bot. Most important change is the use of enums now, as described in the pinned guide.
alright, i tried, and i tried enough.
ZodError: [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [],
"message": "Required"
}
]
const { SlashCommandBuilder, ModalBuilder, TextInputBuilder, ActionRowBuilder } = require('@discordjs/builders');
const { TextInputStyle } = require('discord.js');
const StaffAppsModal = require('../Components/Modals/Staff Application.js');
module.exports = {
slashCommand: {
name: "apply",
builder: new SlashCommandBuilder()
.setName('apply')
.setDescription('Apply with our forms!')
.addSubcommand(s => s
.setName('staff')
.setDescription('Apply for our Staff Team with this command!')
)
.setDefaultPermission(true)
,
on: async(client, i) => {
const sub = i.options.getSubcommand();
if(sub === "staff") {
i.showModal(StaffAppsModal);
}
}
}
}
then modal builder:
https://srcb.in/Bi7n4nxuMP
First of all, addComponents takes multiple objects and not an array of objects
noted
Secondly I'm pretty sure 5 actionrows are the maximum
But I have no idea what exactly triggers that error. Can you show the full error please
sobbing rn, but alright, and i think i figured it out
.addComponents doesnt take an array im dum 🐌
Yeah that was pointed out already lmao
edit: all this just to be unable to use modals 
since I code my bot mainly for enjoyment, should I update to v14 right now to save myself future headache?
it doesn't look like there are any massive changes as of right now, so it should be better to prepare early for when they do drop, right?
Thats fully up to you, the dev version can break at any point, if its not already broken
cough modals cough
const c = message.mentions.channels.first()
How to check if the channel is voice or text?
<:_:874573924988518500> Channel#isText()
Indicates whether this channel is a [TextChannel](<https://discord.js.org/#/docs/discord.js/main/class/TextChannel>).
<:_:874573924988518500> Channel#isVoice()
Indicates whether this channel is a [VoiceChannel](<https://discord.js.org/#/docs/discord.js/main/class/VoiceChannel>).
if (channel.isCategory)
return message.channel.send({
embeds: [
new EmbedBuilder()
.setTitle("Invalid channel")
.setDescription("Please mention a **text** channel")
.setColor("DarkPurple"),
],
});```
This sends the embed even if the channel is text channel
channel.isCategory isn't a thing
so I shud add ()?
isCategory()is a method- it's for categoryChannels
Thanks @vague coyote that worked
(these)
how to check if channel is voice or text
- checks for category channel
Its all similar, I just wanted how to check for them
linked above
see PermissionBitField
ah, the PermissionFlagsBits class
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_VOICE_STATES] });
^
TypeError: Cannot read properties of undefined (reading 'FLAGS')
at Object.<anonymous> (G:\Test Bot\bot.js:10:47)
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 Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
Node.js v17.1.0
have discord.js removed flags?
See pins
bug?
see pins

thanks for helping
is it required for non verified bots to use slash commands?
it is not "required"
Im trying to set permissions for my slash commands, I get this output for my fullPermissions logging, no error but it doesnt set the permissions. Here is my code: https://sourceb.in/gbfZfh4Me2
This exact code works for me in v13, but not in dev version
.setEmoji('📃')
sends this error when trying to add it to a button
ZodError: [
{
"code": "invalid_type",
"expected": "string",
"received": "null",
"path": [
"id"
],
"message": "Expected string, received null"
}
]
at new ZodError (G:\Test Bot\node_modules\zod\lib\ZodError.js:80:28)
at handleResult (G:\Test Bot\node_modules\zod\lib\types.js:115:21)
at ZodObject.ZodType.safeParse (G:\Test Bot\node_modules\zod\lib\types.js:191:16)
at ZodObject.ZodType.parse (G:\Test Bot\node_modules\zod\lib\types.js:172:27)
at ButtonBuilder.setEmoji (G:\Test Bot\node_modules\discord.js\node_modules\@discordjs\builders\dist\index.js:593:42)
at ButtonBuilder.setEmoji (G:\Test Bot\node_modules\discord.js\src\structures\ButtonBuilder.js:19:20)
at Object.execute (G:\Test Bot\commands\btickets.js:16:7)
at Client.<anonymous> (G:\Test Bot\bot.js:313:18)
at Client.emit (node:events:402:35)
at InteractionCreateAction.handle (G:\Test Bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:76:12) {
issues: [
{
code: 'invalid_type',
expected: 'string',
received: 'null',
path: [Array],
message: 'Expected string, received null'
}
],
format: [Function (anonymous)],
addIssue: [Function (anonymous)],
addIssues: [Function (anonymous)],
flatten: [Function (anonymous)]
}
pretty sure its now sole object
try .setEmoji({ name: '📃'})
Is there a ephemeral component collector?
Hi guys !
I do develop a web application, in this, new users need to be members of our Official Discord Server. Therefor, I'd like to get my guild members list, to verify if the user's Discord input exists in this list. I do not want to create a complete bot for that, only asking the A.P.I but I am a bit lost tbh...
Technologies that I use : Angular/NestJS
collectors do collect ephemeral replies
How would one set one up? via channel or await the reply then spawn a collector on the reply
not different at all as what you normally do with normal replies
no code change needed
I normally use the message, can I do that?
You are asking that on the wrong server then, for discord.js you need a bot.
sure why not
let msg = await ctx.interaction.reply({
...
})```
returns undefined
fetchReply: true on your reply option
aight
worked thank you
still undefined
hello i get this error when pressing submit in a modal
G:\Test Bot\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 G:\Test Bot\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43:54
at Array.map (<anonymous>)
at new ModalSubmitInteraction (G:\Test Bot\node_modules\discord.js\src\structures\ModalSubmitInteraction.js:43:45)
at InteractionCreateAction.handle (G:\Test Bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:69:25)
at Object.module.exports [as INTERACTION_CREATE] (G:\Test Bot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (G:\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (G:\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (G:\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
at WebSocket.onMessage (G:\Test Bot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:390:28)
Node.js v17.1.0
apparently i have fixed it
The ModalSubmitInteraction.js was in structures
and Components.js was in utils
if anyone want to fix modals
There is already a pr for it but k
ye i know but its for some people who doesn't know what to do
also can anyone help me with this, iam trying to update channel perms```
G:\Test Bot\node_modules\discord.js\src\util\BitField.js:168
throw new RangeError('BITFIELD_INVALID', bit);
^
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: VIEW_CHANNEL.
at Function.resolve (G:\Test Bot\node_modules\discord.js\src\util\BitField.js:168:11)
at PermissionsBitField.remove (G:\Test Bot\node_modules\discord.js\src\util\BitField.js:105:33)
at Function.resolveOverwriteOptions (G:\Test Bot\node_modules\discord.js\src\structures\PermissionOverwrites.js:130:15)
at PermissionOverwriteManager.upsert (G:\Test Bot\node_modules\discord.js\src\managers\PermissionOverwriteManager.js:100:50)
at PermissionOverwriteManager.create (G:\Test Bot\node_modules\discord.js\src\managers\PermissionOverwriteManager.js:124:17)
at G:\Test Bot\bot.js:192:39
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'BITFIELD_INVALID'
}
Node.js v17.1.0
isn't it VIEW_CHANNELS?
Wait no it's ViewChannel
things have really changed in v14
how do i make changes to the Modals? i tried .reply and nothing happens
any help on this?
so the ModalSubmitInteraction refers to the interaction where the modal was submitted? then if i do .update, the command response (for example) should change?
TypeError: interaction.channel.createReactionCollector is not a function
collector.on('end', async ended => {
const areuSure = await interaction.followUp("**هل أنت متأكد حيال ذلك ؟**", { fetchReply: true });
await areuSure.react("✅");
await areuSure.react("❌");
const filter = (reaction, user) => reaction.emoji.name === '✅' && user.id === interaction.user.id;
const collector = interaction.channel.createReactionCollector({ filter });
collector.on('collect', (reaction, user) => {
collector.stop()
});
collector.on('end', async collected => {
interaction.followUp("انت متأكد نايس")
})
});
Did you import/require it?
The createComponent bug has been fixed?
Whenever i try to add a component to my modal, this error pops up. Is there a fix for this?
typescript? you gotta specify what component type an action row contains
like ActionRowBuilder<TextInputBuilder>
Ooh like that alright
pretty sure reaction collectors r on messages not channels
it works sometimes, it doesn't sometimes, this interaction is a button btw
you need to reply to the interaction within 3 seconds
yes
but it doesn't defer the reply
even within a second
and that's the exact reason i even included the line on top
Thx
btw this works on a smaller bot, on the bigger bot i used to test it, it gives me this error
is it because i'm sharding?
while the shards are spawning this error occurs more usually than when all its shards are online
client.on("messageCreate", async message => {
console.log(message)
})``` Any idea why the bot doesn't see the message in dm ?I use the Intent (GatewayIntentBits.DirectMessages) and I don't see a direct message intent
you need the Channel partial
thx
Why do I get this error, Im. using ActionRowBuilder from @discord.js/builders@dev
What is the diff between Embed and EmbedBuilder? Also ActionRow and ActionRowBuilder?
okie
Hey there, I keep getting this error with the following code. https://h.inv.wtf/lapesuxiya.ts
Anyone have any clue why this is happening and how to fix it?
I was told that to make that error go away I should reply to the modal, one method of which being editing the message the modal is for, but that's what I'm doing and I'm still having this error.
You need to reply to the interaction deferReply() or reply()
so defer the modal and when I edit the message the modal will go away?
no, you cannot defer modals
clicking submit sends a new interaction, that one you need to respond to
I thought you can't update/deferUpdate modal submit interactions but you can
the submit button yes, the modal itself, no
What would I respond with?
I'm trying to use modals for an interaction menu, so I want to edit the original message every time.
well, then do that?
<:_:874573924988518500> ModalSubmitInteraction#update()
Updates the original message of the component on which the interaction was received on.
button press -> immediate modal (cannot defer this)
submit press -> update message button was pressed on to prompt the modal (this can be deferred)
um, what is wrong?
restart typescript server maybe
Hey, were you able to fix the ZodError Thing? 😄
If not try to add the title and the id to the modal instance
const Modal = new ModalBuilder()
(...)
.setTitle('modal Title')
.setCustomId('modal_id')
Also I noticed this bit:
new TextInputBuilder()
.setLabel("test")
.setValue("test")
.setCustomId("test")
.setMaxLength(2)
.setMinLength(1)
.setPlaceholder("13")
.setRequired(true)
.setStyle(TextInputStyle.Short)
In your TextInputBuilder - this will throw an error since your set value 'test' exceeds the maximum allowed length.
Try changing it to 4 or more, or adapting the value 🙂
not working
ok fixed it
don't even know how lmao
can i still use hex color (string) in EmbedBuilder?
i think there is a bug in discord.js v14 the content of a message is always empty
<ref *1> Message {
channelId: 'CHANNELID',
guildId: 'GUILDID',
id: 'MESSAGEID',
createdTimestamp: 1648755666293,
type: 0,
system: false,
content: '',
author: User {
id: '588670754233516032',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 256 },
username: 'xKingDark',
discriminator: '8923',
avatar: '9308dec2f48695f5182964e47908d9bc',
banner: undefined,
accentColor: undefined
}
}
You need to enable the message content intent in the client
no no i have already figured it out ts Util.resolveColor(<CorolResolvable>)
i don't think there is MessageContent in the intents
There is
there is GuildMessages
G:\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:254
throw new Error(GatewayCloseCodes[error.code]);
^
Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
at WebSocketManager.createShards (G:\Test Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:254:15)
at async Client.login (G:\Test Bot\node_modules\discord.js\src\client\Client.js:231:7) {
[Symbol(code)]: 'DisallowedIntents'
}
Node.js v17.1.0
It has to be enabled in the bot application page too
found it thank you
Hey! I'm trynna send a message once my modal has been submitted, but as soon as I show my modal with await interaction.showModal(modal), I get this error: TypeError: Cannot read properties of undefined (reading 'channels') from this line: const collector = new InteractionCollector(), but I don't know why?
you need to pass your client instance as first parameter when constructing new InteractionCollector
Can I do that with const collector = new InteractionCollector(interaction.client) ?
yes
aw what's that
Do I need anything else?
no
it is about me or djs?
Thanks! How do I respond to a modal submit then? Cause I tried interaction.reply() but I'm getting an error: TypeError: createComponent is not a function?
it's a bug
Well apparently someone found a fix (xKingDark) so it works now. I have one more question; You get the text input value with Nvm i found out, needed .datai.fields.getTextInputValue(), but how do I get the modal title and how do I get the modal labels?
You could just check the customId of the interaction in the collector
collector.on('collect', (i) => {
if(i.user.id !== interaction.user.id) return;
if(i.customId !== 'test_modal') return;
doStuff();
});
Yeah, I didn't supply a customId or Title for the modal itself
Can I get the slash command ID that invoked the modal submission?
no
no i was saying why change just how its worded that willl break code for no reason when they release
lol
Does that get the ID of the slash command and not the message with the buttons?
<ModalSubmitInteraction>.message does not exist for me, though
Property 'message' does not exist on type 'ModalSubmitInteraction<CacheType>'
It’s not done for “no reason”, it’s not even part of the same package in v14.
Modals also can be triggered by slash commands...?
It seems that the typings are missing the message property altogether
DM souji
I think you can use showModal() on slash commands
Oh, yep sorry that one
Aha, wait
ok
if (interaction.inCachedGuild() && interaction.isFromMessage()) {
return;
}
// Still does not exist...
interaction.message
That's odd
Oops
Still the same when fixed
you return if its from a cached guild
Yep, my bad. But are there any plans to add isFromCommand?
If that's even possible
if it isn't from a message then its from command
Not necessarily. There's also select menu interactions
I'm not sure if those can open modals, though
But it'd also be great if we could get the original command same as the original message
Select menus are message components so its from message
Yeah, but they have their own interaction class, right?
Alright, I see! That clears up my questions
Appreciate it
.setThumbnail is not a function ..?
This error is plain english... .setThumbnail isn't a function
ok well how are embeds made?
new EmbedBuilder()
let embed = new require("@discordjs/builders").EmbedBuilder like that?
yes
The Subcommand doesn't work for me, I'm looking at the guide and it's supposed to go but it doesn't
help?
Guys, how can i send a message in another channel based on a command?
i tried to use
const board = await interaction.client.channels.fetch('channel_id');
board.send(`<@${interaction.user.id}> published a mission!`);
but it is complaining about
Property 'send' does not exist on type 'AnyChannel'.
Property 'send' does not exist on type 'CategoryChannel'.ts(2339)
ow forget it, i use a // @ts-ignore and it worked, but i think it should be typed right?
its a normal channel, it should be like a TextChannel?
ooo nice
thnx
what is v14 message.guild.verificationLevel
Documentation suggestion for @carmine bridge:
<:_:874573879153160212> Guild#verificationLevel
The verification level of the guild
hi
in V13
i require intents like this:
global.client = new Client({ intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_BANS', 'GUILD_EMOJIS_AND_STICKERS', 'GUILD_VOICE_STATES', 'GUILD_MESSAGES', 'DIRECT_MESSAGES'], partials: ['CHANNEL'] });
and dont use Intents.FLAGS.GUILDS in v14 can i do it or what ? (i read the doc but didnt seen any part about global.client)
GatewayIntentBits
intents: Object.values(GatewayIntentBits).filter(e => typeof e === "string"),
you can use this
this is all intents
Read the pinned guide, it mentions how to pass intents and partials in the dev version
i read it but you didnt understand my question !!
in V13 we have 2 way to define intents
1.
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
const { Client } = require('discord.js');
const global.client = new Client({ intents: [GUILDS] });
now in dev version which one should i use?
1.
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
const { Client } = require('discord.js');
const global.client = new Client({ intents: [Guilds] });
i know 1 is correct but i want to know can i use 2 or no?
no
Well GUILDS isn't even defined, so there's that, netiher is Guilds
Also no idea how "global" is relevant to the method
Its just an unrelated bad practice
Probably, but you shouldn't and it doesn't include all the intents now either way
i dont want to use it, i just want to know it tnx <3
to send a message with webhook am i need GuildWebhooks intent??
Nope
tnx
You need the intent for the webhook events, anything else I am not aware of
But I know it isn't needed to execute the webhook
If you feel like you want to explore on your own, you can take a look at the route djs is using for a method, from that go to discord's developer docs and then see if it mentions anything on intents
Yes. You should have intellisense helping you with confirming that
okay tnx
GUILDS will be Guilds, just change all like that
I tried it worked for me maybe coz i was using a constructor
Is the Embed problem gonna be fixed in the released v14 or do we have to use builders?
what embed problem?
What embed problem do you mean
You can't construct it Embed is what you receive from the api
It is and will be EmbedBuilder
but EmbedBuilder from discord.js only has .setColor method
How'd you define EmbedBuilder?
@vague coyote??
Not even one minute to read 
ye sorry but I only get setColor ;_;
How'd you define EmbedBuilder?
Or rather import
And on what djs version are you exactly
dev
And what version of builders do you have installed?
it works like this tho?
theres many dev versions
^14.0.0-dev.1648515273-ac4bc3a
oh..
It could be that there's an older version of builders installed
ok now Im getting this error on dev version 14.0.0-dev.1648515273-ac4bc3a
You're using your own variables and functions, show their types
They're in the second attachment..
toSend as well
let toSend: WebhookMessageOptions = { embeds: [loggingEmbed] };
It seems like the type for your ActionRow is the issue here, the TextInput part of the type specifically
hm any fix?
Well you wouldn't pass the TextInput type to the ActionRow type or cast it as specifically the row to the non-textinput-type later on
Also if I may ask, why even make these methods? Why not just use the builders themselves? This is just complicating it more
in case if something changes, I don't have to change them all in every file
If you're using vscode, there is search and replace,
yes but I dont know im more comfortable like this 
Can't argue with that I guess
I don't know how you'd get out of it exactly, maybe you can make the actionRow function a generic that passes on either TextInputComponentData or MessageActionRowComponentData to the type
and that doesn't work..
The error is coming from the builder
not the type of client.util.actionRow()
um aight ig
Yes, right
That's not what's happening
the toSend expects only an ActionRow that has the components type, I don't know what terms I should here but basically anything other than an ActionRow where the TextMenu type wasn't used
And your function returns an actionrow that includes the type of textmenus and the components
Is ButtonComponent still a thing?
no
ButtonBuilder right?
It's still a thing but you use the ButtonBuilder to actually instantiate one
Short explanation: The ButtonComponent is the type for data you receive from the API. The builder is for the type that lets you create your own one.
SelectMenuOptionBuilder
see the update guide preview in pins
The Subcommand doesn't work for me, I'm looking at the guide and it's supposed to go but it doesn't
solution?
add a type?
Is it no possible to put selectmenus inside a modal?
It's privileged, so both on the dev portal and on your Client
You are still missing MessageContent
you need message content intent
no, thats for receiving messages on guilds, I'm talking about MessageContent
if you cant find it, its probably not in the import you are using, you have to import from discord-api-types v10
Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.
If you are using the GUILD_MEMBERS or GUILD_PRESENCES intents, you need to enable them in the developer portal:
• Developer Portal > Your app > Bot > Privileged Gateway Intents
I've obviously checked that,
MESSAGE CONTENT INTENT
This intent will not be enforced until after April 30, 2022.
will be enforced doesn't mean its not usable
It works normally on the older versions though
you still have to check that one if you want message content
older versions dont use api v10 ;)
Ah, alright.
do you call toJSON on the builder when passing it to the api call?
Anyway no one answered me
why would you use a magic number when discord.js resolves an array of flags?
Is slash command localization already in discord@dev?
I installed the latest djs (dev) version. I already knew MessageActionRow was changed to ActionRowBuilder, but I'm getting Property 'addComponents' does not exist on type 'ActionRowBuilder<any>'.
you have to specify the type you want to include in the actionrowbuilder
"any" is definitely not one of them
And where can I find the types?
If you have to ask you probably should not be using TS
I'm looking for a djs type...
and no... my ide isn't helping me
hey guys, i have a doubt.. im using modals with select menu, how do i defer the select menu? when i'm defering the select menu using await interaction.deferUpdate(); the modal is throwing an error This interaction is already deferred or repleid to.
modals are an initial reply, you cannot defer and show a modal
but the select menu is show as Interaction Failed
not if you show a modal within 3 seconds
i see, does modals also have defer? like deferReply
you can defer a ModalSubmitInteraction, yes
alright ty
Modal typings seem off
Describe it, it's more helpful
for example:
interaction.components[0].components[0] says the type is ActionRow<TextInputComponent> when it actually logs a TextInputBuilder
I could be wrong but I think there was a pr which made it so that stuff like that should return non-builders meaning they're immutable, if you want to modify it you have to do something like js TextInputBuilder.from(interaction.components[0].components[0])
that's not what I'm saying
I'll have to test it myself, could you show a code snippet that reproduces this real quick?
I simply used console.log(interaction.components[0].components[0]);
what type was interaction?
ModalSubmitInteraction
It should not log a TextInputBuilder
I was asking for reproduceable code to make it faster for me to check
my code is spread out through files



google 