#djs-in-dev-version
35223 messages · Page 14 of 36
For what? Is this dev/v14 related?
yeah discord.js@dev
do i have to do ephemeral: true } in reply if only the user can see it?
Yes
thank you so much for helping i learned a lot today 🙂
where can i see all TextInputBuilder options? like .short or paragraph ?

lamo sry
if required is a boolean it can be true or false but how do i do it?
like .setRequired (false) or wat
huh? .setRequired() takes true or false
yea so it was correct or not?
.setRequired (false)
yes
So ?
I don't think anything changed
It is no longer a DM | GuildChannel
ok? and why does that metter
It's like that in version 13 too
Mmh
Okey
Is there a change somewhere in V14 list? I didn't find any in the guide
It's in the pinned messages
Oh Thx
With the Modal Code from the Guide i get this Error
npm ls discord.js
how ModalBuilder is defined as?
Problem solved, reinstalling djs fixed the problem
// on command interaction, create this modal:
const modal = new ModalBuilder().setCustomId("profileEditor").setTitle("Profile Editor - Description");
const descriptionInput = new TextInputBuilder().setCustomId("descriptionInput").setLabel("Your new profile description").setStyle(TextInputStyle.Paragraph).setMaxLength(800).setRequired(true);
const actionRow = new ActionRowBuilder().addComponents(descriptionInput);
modal.addComponents(actionRow);
// show it
await interaction.showModal(modal);
// filter looks nice
const filter = (modalInteraction) => modalInteraction.customId === "profileEditor" && modalInteraction.user.id === member.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 180000 });
// but it never gets collected
collector.on('collect', i => {
const desc = i.fields.getTextInputValue("descriptionInput");
eb.setDescription("Input: " + desc);
interaction.channel.send({ content: member.toString(), embeds: [eb] });
});```
Not sure what I'm doing wrong here. I also tried listening to it through the interactionCreate event but have had no success so far. Am I overlooking something?
Why .getAttachment() returns an ephemeral attachment?
Because it is ephemeral
Modals arent message components
So they'll never be collected by a message component collector
Man that makes sense
I found InteractionCollector, is that what I'm supposed to be for/into?
yeah, or I think theres an interaction.awaitModalSubmit
Not sure if merged
I don't think that was merged
Huh, so there's no way I can get the attachment data.
You can
Its ephemeral because it was sent to you
and only to the bot
const filter = (modalInteraction) => modalInteraction.customId === "profileEditor" && modalInteraction.user.id === member.id;
const collector = new InteractionCollector(client, { filter, time: 180000, guild: interaction.guild, maxUsers: 1, max: 1, componentType: ComponentType.TextInput, interactionType: InteractionResponseType.Modal });```
Is this not a valid use case? Doesn't seem to trigger the collect event
Dont set component type
It cant be both a component and a modal
Ah okay
Otherwise looks okay
Thank you, will give it a try without the component type
Still doesn't fire the collect event
I'll log the filter actually and see if it's false for some reason
I think it went through but logs an empty line in here: js collector.on('collect', i => { const desc = i.fields.getTextInputValue("descriptionInput"); console.log(desc);
Despite of it having the same id: js const descriptionInput = new TextInputBuilder().setCustomId("descriptionInput").setLabel("Your new profile description").setStyle(TextInputStyle.Paragraph).setMaxLength(800).setRequired(true);
and you did put something it it? I have to ask lol
Yes 
I'm expecting "Test desc"
Could you log i.fields.fields
In collected or end? Or both?
collected
though it should be essentially the same thing
Yeah it's also empty
There's a way to put prefilled text in the text boxes right? Placeholder or the other one, I'd have to check Value, that's the one
Maybe I could add that to it and submit it without modifying it and see if it changes anything
Empty log after submitting
Wow I'm griefing both of us. I forgot I wrote an unfinished log line there 
So the collect event doesn't trigger at all
huh
I'd debug your filter then
Is there another way besides getting it through the message as a interaction's reply?
uhh... no? thats the only way to get interaction options
Whats the issue?
I found https://discord.js.org/#/docs/discord.js/main/class/InteractionCollector?scrollTo=users but i.users returns undefined
hey @uncut kelp, can you confirm what you mean?
think we've got a misunderstanding here!
Nono, no problem, thanks anyway for the info, my estimated.
umm hello, how can i fix this error? 
temp fix is to pass an empty object to ButtonBuilder constructor
/home/runner/vtt/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown interaction
at RequestHandler.execute (/home/runner/vtt/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/runner/vtt/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async ModalSubmitInteraction.deferReply (/home/runner/vtt/node_modules/discord-modals/src/structures/interfaces/InteractionResponses.js:12:5) {
method: 'post',
path: '/interactions/964036933992992800/aW50ZXJhY3Rpb246OTY0MDM2OTMzOTkyOTkyODAwOnpXa1ZHWWoyeGZHUTh6aTdjUnRwV2l1OVd4b29SYUNTRmYxNlNlZVJQWFROMTY5QnRSTnN0RDh0NXNNRWYyeGI5enJ4YXBhUXhYOXVMMElmNGp1dFExZWVQVzBJSE1DdWM0MngxSVVDaXQyY29lbmIyWnRTT2ZOYjRJeWZxbUZq/callback',
code: 10062,
httpStatus: 404,
requestData: { json: { type: 5, data: { flags: 64 } }, files: [] }
}
an issue with discord-modals no?
why would you need to fetch an emoji for get his id?
is there a known bugs or permanently with pass an empty object? 
It's a known bug and a fix pr is already there
oh okay, thx for the information 
I will wait until @dev is updated again 
what is the "message" property of a modal interaction?
The message it launched from, if it was from a button/select menu
{
type: 1,
components: [
{
type: 3,
custom_id: 'gender',
minValues:1,
maxValues:1,
label: 'gender',
placeholder: 'select',
options:[
{label:"XY",value:"male",description:"XY"},
{label:"XX",value:"female",description:"X"},
],
required: true
},
],
},
- data.components[1].components[0]: The specified component type is invalid in this context
where exactly am i going wrong and how can i fix it?
shouldn't be min_values and max_values ?
but i have to do it accordingly
Then you should be using customId
I checked is correct
What did you use the select menu in?
Modal
It's just weird to mix camel case w/ pascal
You can't use select menu in modal
Only text fields
but it appears in the documentation
modals only support text inputs for now
Pretty sure Discord docs doesn't say you can use other types in modals
ok thank you very much
🙏🏻
constructor({ emoji, ...data }) {
^
TypeError: Cannot destructure property 'emoji' of 'undefined' as it is undefined.
I'm getting this error when creating ActionRow with Buttons
@acoustic temple
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('excluir')
.setLabel('Deletar')
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setCustomId('cancelar')
.setLabel('Cancelar')
.setStyle(ButtonStyle.Danger)
);
Code
I don't quite understand what you mean by that
new ButtonBuilder({})
Oh Thank You
Guild directory support, guild ban pagination and the modal builder from discord.js should be in the next dev release (43 mins from now)
and this will be fixed? ^
What's wrong with that code
^
without an empty object it gives this ^
Man, should have said that first lol
Looks like https://github.com/discordjs/discord.js/pull/7788 fixes it. It's not merged yet
so not in the next dev release?
Dev releases don't publish other people's branches
It publishes the main branch
in v13 if we disable GuildMember cache, Message#member and will return null. but shouldnt it return partial member instead? (discord sends raw member payload in Interaction#membermessageCreate and gateway events) will this fixed in v14?interactionCreate
about interaction, it return partial guild member
Those resolve from the cache. I don't view it as an issue. I don't think it'd be a good idea to store those values on the class itself as it wouldn't be updated if edited by other means
well user may want to check member permissions only. but dont want to cache the member itself. with partial GuildMember you still able to check member permissions
what about Messages not received through messageCreate?
we don't have different structures for each case where they implement it differently and i don't think we should be storing duplicate data (on the cache and on the class)
did you mean like user created their message class?
Message class is private already, user cant even using it (especially on ts, in js still can use it 🤷 )
not at all, other message related events, and messages accessed by other stuff, like reactions
Does anyone happen to know why this isn't working?
Cannot destructure property 'options' of 'undefined' as it is undefined```
The error shows the first line in the image
Found a solution
You can just pass an empty object, there's already a PR pending btw
Passing an empty object still gave an error
well you still receive member payload in reactions. just filter the property stuff? just like in interactions
not really, you're mistaking the members
the one given in reaction creation is the member by whom, the reaction was created
and message.member only exists when you get it by messageCreate and update
Hey any body have an idea how it works? Cant set the property by myself on PermissionsBitField.
i write in typescript, thats my error Property 'has' does not exist on type 'string | Readonly<PermissionsBitField>'. Property 'has' does not exist on type 'string'.ts(2339)
thats my code if (slashCommand.userPerms || slashCommand.botPerms) { if ( !interaction.member.permissions.has( PermissionsBitField.Flags[slashCommand.userPerms] || [] ) ) { const userPerms = new EmbedBuilder() .setDescription( `🚫 ${interaction.user}, You don't have \`${slashCommand.userPerms}\` permissions to use this command!` ) .setColor('Red') interaction.reply({ embeds: [userPerms] }) }
try using the interaction.inCachedGuild() type guard
what if match payload member id with message author id? if it does not match return null
we're getting derailed, the point was that no, there's no point in duplicating data and storing it in multiple places, if you disabled the cache, it's gone, done
the error happens when compiling or when running the slash command ?
that error is because interaction.member can be either a djs GuildMember or a raw api member object
the latter of which doesn't have the permissions.has, .permissions there is a string
ohk
if you say that, isnt APIMember in interaction is also duplicating data?
this is turning into #archive-library-discussion than djs dev
or general
and no, i don't know how that'd happen
why does this error still appear even with type guard?
Compilling
can't reproduce, restart ts server
So any solutuion for it
yes i already answered you 🤨
use the inCachedGuild type guard
it'll make sure interaction.member is a GuildMember
no difference
discord.js@14.0.0-dev.1649937833-b01f414
could you send your entire listener up to that point then?
might be because ts thinks its a string or smthing
exactly, it thinks .permissions is either a permission instance or a string as i've said above explaining why
you can just put a type check
if(typeof (interaction.member.permissions) === "object") { /*do whatever*/ }
also
how do you use TextInputBuilder in a slash command ?
i mean what is it used for
TextInputBuilder === modeal input
oh
not necessary, again just use the built in type guard :(
Ok ty
I found https://discord.js.org/#/docs/discord.js/main/class/InteractionCollector?scrollTo=users but <Interaction>.users returns undefined
okay what's what? you sent InteractionCollector and you accessed an interaction?
Yes
and you don't see what's wrong with that?
they're two separate distinct things
Ah I must've overlooked that, thank you. However;
// collector looks like this:
const collector = new InteractionCollector(client, { filter, time: 10000 /*180000*/, guild: interaction.guild, maxUsers: 1, max: 1, interactionType: InteractionResponseType.Modal });
// I listen like so
collector.on('end', i => {
console.log("Ended. Custom ID:" + i.customId + ", user ID: " + i.user);
// Ended. Custom ID:undefined, user ID: undefined```
I'm trying to figure out why it's not triggering my collect event properly so I'm trying to get details from the end event but it's not exactly helping
(event) InteractionCollector#end
Emitted when the collector is finished collecting.
look at the type, is i an interaction.. or a collection? or is it specifically a collection of interactions?
Ah, a collection of collected elements
modals included at v14?
When is discord.js v14 coming out?
@urban belfry I'm just getting started with typescript. I like it very much. Sometimes I don't understand the explanations though. English is also not my main language. I think I understand what inCacheGuild does, but I don't understand where to put it in my code. https://sourceb.in/eNUcYYxax0
if (!interaction.isCommand()) return
``` you already used the isCommand type guard, the usage is the same
ah ok check! But then i get error on Property 'commandName' does not exist on type 'Interaction<"cached">'.ts(2339) and Property 'reply' does not exist on type 'Interaction<"cached">'.ts(2339)
brb hold on
during which you should change to using isChatInputCommand instead of isCommand for slashies specifically
I will keep it in mind
@tropic karma so isCommand means the interaction is a Command interaction, as of right now there can be two types of command interactions, slash commands(referred to as chat input commands) and context menu commands
and if you want specifically slashies, isChatInputCommand, and there is one for context menus too
so that's why i recommend that
as for your issue, hover around the part where you access to .reply, the part of the error and see if the type is a ChatInputCommandInteraction<"cached"> or anything close because idr
if not you did something wrong and show me the code
and before all this, make sure you have the latest dev version of course and try restarting the ts server
please make this readable, received more errors
shapeshift overides util.inspect, if you catch the error and log it it should tell you the wrong input
the difference between setFields and addFields??
set replaces, add pushs
so which is best to use?
depends on if you want to keep existing fields
hmmm
oh wait, i misread that 😳
uhhhh
this is correct then right?
seeing as you got an error from validators it's probably not correct
what is wrong?
i don't get it, i checked the docs too
it sounds correct
console.log the error, it's probably name or value being null which is not allowed
should it be undefined then>
no, it has to be a string
thanks, did everything
i mean for no value
fields always have both a name and a value
so it is a must to have a name?
then i found my error!
hi Zayn
Until it's fixed you can downgrade to discord.js@14.0.0-dev.1649505803-3c0bbac
(or use the empty object solution ofc)
it's fixed
that's a different error than the one in #769862166131245066
😵💫
anyone in here knows how i can get the titel from a modal from interactionCreate into messageReationAdd?
why don't you add all the information you need to the modal's customId? you have up to 100 chars which should be enough
let joiner = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator,
});
```Type 'InternalDiscordGatewayAdapterCreator' is not assignable to type 'DiscordGatewayAdapterCreator'
??
isn't that fixed
Is there a way to listen to a button interaction ? other than listening to interactionCreate and check the customId etc. I want a collector like messages and reactions collerctors etc.
Documentation suggestion for @regal mason:
Message#createMessageComponentCollector()
Creates a message component interaction collector.
thx
when interactionCreate Modal Submit
can i read the modal name ?
@velvet jasper The problem is that there's no way to create the collector on the reply of an command interaction
There’s is you have to set fetchReply in the reply options to true
In the future you won’t have to use fetchReply but for now that’s required
In the reply options of the interaction ?
Yes
When I defer it ?
When you follow up
My use case is for editReply, that's the same ?
I don’t think you need to fetchReply on edits
Then, how I can listen to button interaction from edits ?
Refer to the guide on interaction collectors
@velvet jasper\
you can get the customId
Current version giving me TypeError:
Cannot destructure property 'components' of 'undefined' as it is undefined. at new ModalBuilder (/home/bots/QABot/node_modules/discord.js/src/structures/ModalBuilder.js:11:17)
Reverting to older version and works flawlessly again
can you show your code?
One second
So thats full error, .ts file and .js
why isn't this working anymore?
var CronJob = require('cron').CronJob;
module.exports = async (client) => {
client.on("ready", () => {
const stringlength = 69;
console.log("\n")
console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.yellow)
console.log(` ┃ `.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.yellow)
console.log(` ┃ `.bold.yellow + `Discord Bot is online!`.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length-`Discord Bot is online!`.length)+ "┃".bold.yellow)
console.log(` ┃ `.bold.yellow + ` /--/ ${client.user.tag} /--/ `.bold.yellow+ " ".repeat(-1+stringlength-` ┃ `.length-` /--/ ${client.user.tag} /--/ `.length)+ "┃".bold.yellow)
console.log(` ┃ `.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.yellow)
console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.yellow)
console.log(` [ONLINE] `.yellow + `Logged in as: `.green + `${client.user.tag}`.yellow);
let counter = 0;
var job = new CronJob('0 * * * * *', function () {
console.log(" [Status Update] :: ".bgCyan.red + String(counter).bgCyan.brightRed)
switch(counter){
case 0: {
try{client.user.setActivity(`www.kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 1: {
try{client.user.setActivity(`Best Bots | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 2: {
try{client.user.setActivity(`botlist.kooje.me - SOON`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 3: {
try{client.user.setActivity(`Best Bots of 2022`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 4: {
try{client.user.setActivity(`Over ${client.guilds.cache.reduce((a, b) => a + b?.memberCount, 0)} Members!`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 5: {
try{client.user.setActivity(`Best Bots on Discord | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 6: {
try{client.user.setActivity(`Order Today! | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter=0;
}break;
default: {
try{client.user.setActivity(`Free Bots | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter = 0;
counter++;
}break;
}
}, null, true, 'Europe/Berlin');
job.start();
});
}
There's currently a PR to fix this, for now the workaround is to do new ModalBuilder({}) instead of new ModalBuilder()
when tf will v14 be out 😭
Ah alright thanks
It’s most likely not gonna be any time soon
Why does it need to be "out" if its usable now anyway
const otherText = new TextInputBuilder({
label: "IGN of punishing staff member",
customId: "other",
minLength: 3,
maxLength: 16,
required: true,
style: TextInputStyle.Short,
});
const otherRow = new ActionRowBuilder<TextInputBuilder>({components: [otherText]});
const otherModal = new ModalBuilder({
title: "Other Option",
customId: "ticketStaffOtherModal",
components: [otherRow] // error here
});
Type 'ActionRowBuilder<TextInputBuilder>' is not assignable to type 'ActionRow<TextInputComponent> | ActionRowData<TextInputComponentData>'.
Type 'ActionRowBuilder<TextInputBuilder>' is missing the following properties from type 'ActionRow<TextInputComponent>': type, equals
ts error, works fine if i ignore it
internal issue?
Thats fair, but if we rush one that will compromise it's stability
@velvet jasper thoughts on this one?
How would i do this with the new embeds from the latest version? message.embeds[0].setDescription()
As it's now an Embed() and don't have any function in it
It needs a needs a generic parameter
which one does
EmbedBuilder.from()
Thanks
the modal?
how do i use the new embeds
import { EmbedBuilder } from "discord.js";
export class JoewyEmbed extends EmbedBuilder {
public constructor(timestamp?: boolean) {
super();
this.setColor("White");
if (timestamp !== false) {
this.setTimestamp();
}
}
}
I’ll need to look at it later the code is pretty non-legible on mobile
ive got this class but but it is erroring
Why are you extending the builder?
because i want it to set the color automatically
Your constructor needs to be compatible with the constructor from the superclass
and uh
how would i go about doing that
But in all honesty a factory function is simpler than extending the class
okk
how do i just use the normal EmbedBuilder
It’s the same as builder process as the old one
well no
the only method i see is the set color
Try installing the latest builder dev
look at @discordjs/builders docs
thanks, i was importing from discord.js not @discordjs/builders
so how do i use text input?
check channel pins
discord.js reexports it from builders so you can import it from discord.js, the documentation is just incomplete
Why can't i use [new ActionRowBuilder()] in <messageOption>.components ?
you gotta declare what component type that action row contains too
for example ActionRowBuilder<ButtonBuilder>
How to make the client status -> mobile phone if djs version is v14
same as you do in v13, nothing changed
Whats changed with intents in V14? its not allowing me to use the flags without throwing error, but then if i dont have the intents.flags its not define
see pinned message guide
i saw! Thanks! 🙂
var CronJob = require('cron').CronJob;
module.exports = async (client) => {
client.on("ready", () => {
const stringlength = 69;
console.log("\n")
console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.yellow)
console.log(` ┃ `.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.yellow)
console.log(` ┃ `.bold.yellow + `Discord Bot is online!`.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length-`Discord Bot is online!`.length)+ "┃".bold.yellow)
console.log(` ┃ `.bold.yellow + ` /--/ ${client.user.tag} /--/ `.bold.yellow+ " ".repeat(-1+stringlength-` ┃ `.length-` /--/ ${client.user.tag} /--/ `.length)+ "┃".bold.yellow)
console.log(` ┃ `.bold.yellow + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.yellow)
console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.yellow)
console.log(` [ONLINE] `.yellow + `Logged in as: `.green + `${client.user.tag}`.yellow);
let counter = 0;
var job = new CronJob('0 * * * * *', function () {
console.log(" [Status Update] :: ".bgCyan.red + String(counter).bgCyan.brightRed)
switch(counter){
case 0: {
try{client.user.setActivity(`www.kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 1: {
try{client.user.setActivity(`Best Bots | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 2: {
try{client.user.setActivity(`botlist.kooje.me - SOON`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 3: {
try{client.user.setActivity(`Best Bots of 2022`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 4: {
try{client.user.setActivity(`Over ${client.guilds.cache.reduce((a, b) => a + b?.memberCount, 0)} Members!`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 5: {
try{client.user.setActivity(`Best Bots on Discord | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter++;
}break;
case 6: {
try{client.user.setActivity(`Order Today! | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter=0;
}break;
default: {
try{client.user.setActivity(`Free Bots | kooje.me`, {type: "PLAYING"})}catch(e){console.log(String(e))}
counter = 0;
counter++;
}break;
}
}, null, true, 'Europe/Berlin');
job.start();
});
}
why isn't this working anymore inv14??
what error
no error
just not working that's the problem
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?
try putting a console.log to see if it actually runs?
does it log the other stuff btw
i already have aka console.log(" [Status Update] :: ".bgCyan.red + String(counter).bgCyan.brightRed)
and it's logging but no status
https://cdn.protyo.live/images/cmd_fe2d37zZqG.png
But no status
client.user.setActivity(hi, {type: "PLAYING"})
anything wrong with that?
yes
what
client.user?.setActivity({name: 'hi', type: 'PLAYING'})
client.user?.setPresence({status: 'online', activities: [{name: 'asd', type: 'PLAYING'}]})
why user? what's that supposed to mean?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
not sure why that's important to setting the activity/presence correct, but hey
how many max choices can a slash command have?
25 iirc
what?
he said 25?
slash command can have 625 choices
i had a zod error something along the lines of only 25 in array so i thought only 25 choices
25 per option ._.
option can have 25 choices, slash command can have 625
wait
we know, there;s no need to confuse users, just say 25 per options that support it
me are confusion
lemme process this
options like string options and the number options can support up to 25 choices
choices are a choice in option only for strings and numbers
options are options in slash commadns
ohh
so slash commands can have 25 options and those options can have 25 choices so 625 choices for 1 slash command
am i right?
yes 25*25 is 625
ah
pins
didn't get
just;
how to remove role from the member?
<GuildMember>.roles.remove()
I'm using
const user = client.users.cache.get(message.author.id)
user.roles.remove(role)
but giving error
roles are on members, not users
Despite sounding similar there is a distinct difference between users and members in Discord:
• User: global discord user data (global avatar, username, tag, id)
• GuildMember: user data associated to a guild (guild, nickname, roles, voice, guild avatar, etc.)
• Conversion: User ➞ GuildMember | GuildMember ➞ User
if you have the message already, why not use message.member directly?
pass an empty object to the button builder constructor, it's a known issue
can someone give me docs of v10 discord api
isn't the only one that is documented?
i see docs of v9 in discord.com/developers/docs
v10 docs aren't up, the v9 docs are 99% the same as v10 anyways
nothing really changed in v10 except message content intent is enforced to read message content
but how djs implemented it
we didn't do anything special, bc v9 is almost identical to v10
ok
.addComponents(
new SelectMenuBuilder()
.setCustomId('select')
.setPlaceholder('Nothing selected')
.setOptions([
{
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',
},
]),
)```
what's wrong?
Isn't it addOptions?
they are different methods, addOptions doesnt work too
@fiery widget ^
it didn't work, that worked:const row = new ActionRowBuilder() .addComponents( new SelectMenuBuilder({ options: [ { 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', } ] }) .setCustomId('select') .setPlaceholder('Nothing selected') ) but i dont really like this solution
tried that before:
.addComponents(
new SelectMenuBuilder({})
.setCustomId('select')
.setPlaceholder('Nothing selected')
.setOptions([
{
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',
},
]),
)```
may i need to use addOptions instead?
new SelectMenuBuilder({})
.setOptions(…)
ah wait
typeError: Cannot read properties of undefined (reading 'map')
I dunno how to solve that sorry
setOptions takes a rest parameter
wdym?
.setOptions({ ... }, { ... })
oh i see, thanks!
What's the latest dev version??
check the npm page
seem like the rateLimit or informational event in general isnt there anymore?
what was it replaced with in v14?
14.0.0-dev.1649937833-b01f414
Any bugs in that version??? Or is it fine
dev version = has bugs
bugs can always be there in dev verison, use with your caution
Ik ik
But like any big bugs??
yeah there is currently a known bug, and its always gonna have bugs, its not any near to ready
there are quite a few, look at the PRs and Issues on the repository to see if any affect you
Ok
what should i pass here?
label: 'You can select me too',
description: 'This is also a description',
value: 'second_option',
emoji: '🚗'
}```
instead of the emoji string
got this error: ValidationError: Expected a string primitive
emoji: { name: ':red_car:' } doesnt work too
What is this error?
TypeError: makeURLSearchParams is not a function
I'm trying to updated channel creation for djs v14. I've updated permissionOverwrites from Permissions.FLAGS.VIEW_CHANNEL to ViewChannel, but it looks like I still need to update the type. Are we only allowed to use the API integers now? I believe this int should be 0 based on the API docs.
const newChannelId = (await guild.channels.create('new-channel', {
reason: 'new channel',
type: 'GUILD_TEXT',
position: 0,
permissionOverwrites: [
{ type: 'role', id: guild.roles.everyone, deny: ['ViewChannel'] },
],
}).catch(console.error)).id;
Make sure you're on the development version of /rest
yes, use the ChannelType enum
I reply an interaction, after I edit this reply, and after I send followUp to this
Re-read the message you replied to
I didn't understand
hum, I"ll check
@uncut kelp Version ^14.0.0-dev.1649808570-01a423d
Can I update this by npm i discord.js@dev?
You need to install @discordjs/rest's development version
It has the @dev tag like discord.js
So I use npm i discordjs/rest@dev?
In this case, what would it be? I'm having trouble finding the documentation on it
ChannelType.GuildText, it's an enum from discord-api-types
Thank you. I appreciate the guidance
How can I check if the user executing a slash command has a specific permission, like the ManegeMessage Permsission
ChatInputCommandInteraction.member.permissions.has('ManageMessages')
Thank you
Are there any advantages of using the EnumResolvers rather than just importing them from discord-api-types
no, it's meant as a way to resolve strings while transitioning, enums should be the preferred method
all enums are re-exported from d.js btw, no need to import from dapi-types
i see, thanks
What am I doing wrong with the footer attachment here? My thumbnail embed works out fine.
const thumbnail = new MessageAttachment('./assets/gn.png', 'gn.png');
const footerImage = new MessageAttachment('./assets/gm.png', 'gm.png');
const helpEmbed = new EmbedBuilder()
.setThumbnail(`attachment://${thumbnail.name}`)
.setFooter({ text: 'gm', iconURL: `attachment://${footerImage.name}` });
return interaction.reply({
embeds: [helpEmbed],
files: [footerImage, thumbnail],
});
iconURL accepts only URL
try footerImage.url
Thanks! Can you suggest how I could look this up on my own? I feel like I’m asking dumb questions that I should be able to discover on my own. 🙏🏼
didn't get ._.
that is from a 3rd party lib, not d.js
how do I check if a message was sent in a server by anyone, anywhere
So footers no longer accept attachments? footerImage.url returns undefined
listen to the messageCreate event and check if <Message>.guildId === 'your guildId'
use <Message>.guildId
seems like an issue with the validators
I dont' think this is right according to the API
Can I maybe get a code example?
I just sent it?
Hey, trying to create a channel with permissions, trying to do that gives me an error: permissionOverwrites: [ { allow: 'VIEW_CHANNEL', id: interaction.user.id }, ]
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: VIEW_CHANNEL.
ViewChannel
thanks!
How do I get the customid from a ButtonBuilder
try new ButtonComponent(ButtonBuilder.toJSON()).customId
I opened an issue in the github. Seems like someone already found the bug 👍
works! thanks
client.user.setPresence({ activities: [{ name: '/help',type: 'WATCHING' }], status: 'online' });
Can someone tell me why this no longer works in v14? Or am I doing something wrong?
use the ActivityType enum instead of WATCHING
ah thanks
node:events:368
throw er; // Unhandled 'error' event
^
TypeError: Cannot read properties of undefined (reading 'filter')
at Client.<anonymous> (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\others\status_role_system.js:38:39)Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:251:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21)
it's not working anymore in v14
seems like the fetching in line 36 failed, don't silently ignore errors, at least log them
i mean it worked in v13 so what could should i do ?
log the error, find out why it fails
so console.log(aM)
aM is undefined
no need to log it
then log what
the error you get in line 36. currently you do catch(() => {}) which just ignores the error and returns undefined
yes so i do console.log() and log what?
catch gets called with the error as the first argument
i don't understand anything you are saying me sir, so log what? like it has to be an error with fetching but am i suppose to log? the guild?
Promise.prototype.catch()
The catch() method returns a Promise and deals with rejected cases only. It behaves the same as calling Promise.prototype.then(undefined, onRejected) (in fact, calling obj.catch(onRejected) internally calls obj.then(undefined, onRejected)). This means that you have to provide an onRejected function even if you want to fall back to an undefined result value - for example obj.catch(() => {}).
ah so i catch it and do
console.log(error)
yes
that would work, yes
Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
at Timeout._onTimeout (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\managers\GuildMemberManager.js:462:16)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
[Symbol(code)]: 'GUILD_MEMBERS_TIMEOUT'
}
do you have the GuildMembers intent?
nope i i think it's fixxed now
Promise.prototype.catch()
The catch() method returns a Promise and deals with rejected cases only. It behaves the same as calling Promise.prototype.then(undefined, onRejected) (in fact, calling obj.catch(onRejected) internally calls obj.then(undefined, onRejected)). This means that you have to provide an onRejected function even if you want to fall back to an undefined result value - for example obj.catch(() => {}).
Hey, for some reason when im trying to fetch messages from a channel, it wont let me see the content of the messages, i just get a blank string..
https://cdn.discordapp.com/attachments/824411059443204127/964621458250793030/unknown.png
you need the MessageContent intent
thanks! how i could know tho? i mean, i didnt see it here (https://discord.com/developers/docs/topics/gateway#presence-update)
and btw, for some reason after changing the version to v14, the bot status doesnt work anymore, is there a new syntax?
Yea
djs dev uses v10 api which enforced the message content intent
show the code
client.user.setPresence({ activities: [{ name: 'with discord.js' }] });
(from v13)
Type not set?
``` doesnt work too
use the ActivityType enum
still xD client.user.setPresence({ activities: [{ name: 'with discord.js', type: ActivityType.Watching }] });
Is there an intent for activity/presence, or maybe an issue with that?
guild presences
but not for setting, for receiving
oh i see
well setActivity works but setPresence doesnt
show your code, are you using both at the same time?
//client.user.setActivity(`sdgsdf`,ActivityType.Watching )```
how'd activities turn into activity?
mb
which one do you have?
activities
tried to change the status with the same setPresence method too and it didnt work
works fine for me
is it possible to use this with a bot?
The custom status, and the buttons.
bots cant have a custom status
what is ActivityType.Custom then?
It's part of the api but Bots can't use it.
But fetching a user informations could return a Custom ActivityType
Can someone help me with this error?
Code:
const Option1 = new Discord.SelectMenuOptionBuilder().setLabel('s0').setValue('s0').setEmoji("🤖")
const SelectMenu = new SelectMenuBuilder().setCustomId('setup-menu').setMinValues(1).setMaxValues(data.length).setOptions(Option1);
Error:
Error: Received one or more errors
at ObjectValidator.handleStrictStrategy (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@sapphire\shapeshift\dist\index.js:998:70)
at ObjectValidator.handleStrategy (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@sapphire\shapeshift\dist\index.js:910:47)
at ObjectValidator.handle (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@sapphire\shapeshift\dist\index.js:951:17)
at ObjectValidator.parse (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@sapphire\shapeshift\dist\index.js:114:88)
at SelectMenuOptionBuilder.setEmoji (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@discordjs\builders\dist\index.js:867:42)
at SelectMenuOptionBuilder.setEmoji (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\SelectMenuOptionBuilder.js:18:20)
at Client.<anonymous> (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\ismm.js:478:97)
setEmoji takes an object
array?
{ name: "" }
oh
Thank you, it worked
why discord.js need to make many not useful changes?
maybe its small change for you but big change for mankind
The changes we make are all useful
What this error means ?
you have not provided an error

pass {} to constructor for temporary fix
don't work
show how you do it
ButtonBuilder({})
Different error
a
Do what KagChi showed
It worked
thanks
What are these errors?
What's your TS version?
@empty tapir what mon asked
and show us the versions of discord-api-types adn djs
Yes
Versions in package.json?
yea
what? we asked for your typescript version
I'm not at the computer now, then I'll throw it off.
English
Good morning, will there be a "collector" for modals without using events?
Sorry I still haven't slept just taking RedBull
for now, use the InteractionCollector class for modal collectors
probably there will be
Do you have any idea how it will work?
.createModalCollector?
Something like that?
ButtonInteraction#awaitModalSubmit()
Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
Ok
Thank you very much, it really helped a lot
how do i do it now?
use the ChannelType enum from discord-api-types
Hey, is it possible to force the user to stay on a modal and complete the inputs?
and is it possible to close the modal if the awaitModalSubmit event finished without any interaction?
code:
interaction.awaitModalSubmit({ filter, time: 15000 })
.then(interaction => console.log(interaction))
.catch(console.error)```
don't have it on discord.js? Do I have to install discord-api-types?
@woeful pollen
discord-api-types is already installed with discord.js
you dont receive an interaction if they cancel nor can you force cancel the modal
Thanks
so what can i do if the user cancels the modal? and if the time passed while the modal still on the user's screen and he complete the inputs & send? it will just say the interaction errored
catch the error and respond with time exceeded or something
oh sounds good, a new modal will replace the current?
When I created the category the permissions were not placed
no, I believe if the current modal times out then you can catch the error and do whatever, and you cannot know if they cancelled so
You have any idea what can I do? if the time pass and I cant close the modal or show another with an error or smth, it will just keep the current one :/
just catch the error and send a message in the channel that the time exceeded
oh oke thanks!
and is it possible to make showModal works after a reply already sent? like editReply works?
nope, showModal is an initial response
@woeful pollen 🙂
pretty sure its permissionOverwrites not permissionsOverwrites
Ok
hey, is it possible to check if an interaction already replied? or catch the "already replied" error?
and is it possible to receive the modal inputs fields as an array or convert the map to an array instead of using the getTextInputValue func?
Documentation suggestion for @fiery widget:
ChatInputCommandInteraction#replied
Whether this interaction has already been replied to
yeah mb just did what i wanted, didnt notice the replied bool before.
thanks!
still stuck on it
ModalSubmitFieldsResolver#fields
The extracted fields from the modal
it'll be a collection @fiery widget ^
😄
yeah ik, im trying to convert it to an array but its just stuck without any error
tried to do that:
console.log(Array.from(interaction.fields))
console.log(Array.from(interaction.fields(keys)))
console.log(Array.from(interaction.fields(values)))
interaction.fields.toJSON()
or Array.from(interaction.fields.values())
it's interaction.fields.fields
ModalSubmitInteraction.fields => ModalSubmitFieldsResolver
ModalSubmitFieldsResolver.fields => Collection
well i just fixed what he tried to convert coll to arr
interaction.fields.fields.toJSON() worked, thanks!
that's all, you didn't install discord-api-types?
no
try install it then
nah, reinstall djs
@woeful pollen
pass an empty object to the constructor of ButtonBuilder, it's a current known bug
so new ButtonBuilder({})
the same
ok, this occurs with all?
@woeful pollen
most of the builders, yes
got it, thanks, I'm enjoying playing with this version, I was very excited
The collect event never gets triggered
const modal = new ModalBuilder().setCustomId("profileEditor").setTitle("Profile Editor");
// add some components here, then show the modal with await interaction.showModal(modal)
const filter = (modalInteraction) => modalInteraction.customId === "profileEditor";
const collector = new InteractionCollector(client, { filter, time: 3000, guild: interaction.guild, maxUsers: 1, interactionType: InteractionResponseType.Modal });
// this never gets triggered
collector.on('collect', i => {
console.log(i.fields.fields);
});```
you sure you replied within 3s as specified?
Submitting the modal you mean? Yes
I tried it with 3 minutes as well, same result
try supplying less coll option and recheck
Sorry could you rephrase that please?
<Interaction>.fields.fields.toJSON() returned [] as well
<Interaction>.fields.toJSON()
It returned nothing
what are you trying to get? the embed fields?
Any data to try and get the collection event to trigger
It's returning nothing in the end event so I'm trying to figure out why it's not working
show me your code
[removed code snippet]
Hmm
Had to strip some stuff cause of the char limit but most of the code in between are unrelated to DJS anyways
if you try to get the data from the collector
try console.log(collector)
see what you get
I'm trying to create a simple select menu but i get this error:
constructor({ options, ...data }) {
^
TypeError: Cannot destructure property 'options' of 'undefined' as it is undefined.
at new SelectMenuBuilder (P:\Discord\voting-bot\node_modules\discord.js\src\structures\SelectMenuBuilder.js:12:17)
at PollCommand.<anonymous> (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:120:35)
at step (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:48:23)
at Object.next (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:29:53)
at P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:23:71
at new Promise (<anonymous>)
at __awaiter (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:19:12)
at PollCommand.closePoll (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:189:16)
at PollCommand.<anonymous> (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:60:22)
at step (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:48:23)
at Object.next (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:29:53)
at P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:23:71
at new Promise (<anonymous>)
at __awaiter (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:19:12)
at PollCommand.execute (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:91:16)
at CommandRegistry.<anonymous> (P:\Discord\voting-bot\src\bot\command\CommandRegistry.ts:33:21)
CODE:
const secondOption = new SelectMenuOptionBuilder().setLabel('Option 2').setValue('two')
const selectMenuBuilder = new SelectMenuBuilder().setCustomId('testMenu').setMinValues(1).setMaxValues(1).setOptions(firstOption, secondOption)
// @ts-ignore
await command.reply({components: [selectMenuBuilder]})
you cant pass a selectmenu directly to message payload without it being in an actionrow
about your q, it's a known bug. temp fix is to pass an empty obj to the constructor (like SelectMenuBuilder({}))
@chilly zephyr
change InteractionResponseType to InteractionType.ModalSubmit
ahh yea ^^^^
Oh wow that seemed to have fixed it
Thanks a lot you two this has been bothering me for a while now 
i added the action row and the empty object but i get another error: ```
P:\Discord\voting-bot\node_modules\discord.js\src\structures\SelectMenuBuilder.js:15
options: options.map(({ emoji, ...option }) => ({
^
TypeError: Cannot read properties of undefined (reading 'map')
at new SelectMenuBuilder (P:\Discord\voting-bot\node_modules\discord.js\src\structures\SelectMenuBuilder.js:15:26)
at PollCommand.<anonymous> (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:122:35)
at step (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:48:23)
at Object.next (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:29:53)
at P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:23:71
at new Promise (<anonymous>)
at __awaiter (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:19:12)
at PollCommand.closePoll (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:189:16)
at PollCommand.<anonymous> (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:61:22)
at step (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:48:23)
at Object.next (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:29:53)
at P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:23:71
at new Promise (<anonymous>)
at __awaiter (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:19:12)
at PollCommand.execute (P:\Discord\voting-bot\src\bot\commands\PollCommand.ts:91:16)
at CommandRegistry.<anonymous> (P:\Discord\voting-bot\src\bot\command\CommandRegistry.ts:33:21)
pass { options: [] }
works! thanks
what does the manager do?? i just get undefined when i call it
what manager
ApplicationCommand#manager
The manager that this command belongs to
this?
yea
Btw is this a discord error?
update @discordjs/rest
ahh
ok
Why event in my eventHandler is not a function
one of your files doesn't have a default exported function
all events have
clearly not
you know what, do this
right before that line
if(typeof event !=== "function") console.log(dir, file)
```if it's not a function, log the file path
what line?
14?
the line that errors of course
Nothing show in console @urban belfry
and it still errors?
yes and it was crashing with an error in the file that was taken into the //
Hi how can I get message id of response message from modal interaction?
Error
DiscordAPIError[50035]: Invalid Form Body
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
Code
let page = 0
// a button to paginate forward in a array of embeds
page = page + 1 < embedslist.length ? ++i : 0;
message.edit({
embeds: [embedslist[page]]
});
// a button to paginate backward in a array of embeds
page = page > 0 ? --page : embedslist.length - 1;
message.edit({
embeds: [embedslist[page]]
});
what is embedslist
a array containing embeds
new Embed().setTitle(`Total Whitelisted Users : ${data.whitelist.length}`).setDescription(`${temporary.map(e => `\`${nom++}\` | ${ctx.interaction.guild.members.cache.get(e).user.tag} | <@${e}>`).join("\n")}`).setColor(0x2F3136)
``` contains this
you can't construct Embed unless you use old dev version
gotta use EmbedBuilder
Why do i get that error?
which error?
code?
you need to reply to interactions
const { ApplicationCommandType } = require('discord.js');
const { Modal, TextInputComponent, showModal } = require('discord-modals');
module.exports = {
name: 'redeem',
description: "Redeem your license key!",
type: ApplicationCommandType.ChatInput,
cooldown: 3000,
run: async (client, interaction) => {
const modal = new Modal()
.setCustomId('redeem-key')
.setTitle('Reedeming - License Key')
.addComponents(
new TextInputComponent()
.setCustomId('redeem-input-key')
.setLabel('Some text Here')
.setStyle('SHORT')
.setMinLength(4)
.setMaxLength(10)
.setPlaceholder('Insert license key here')
.setRequired(true)
);
showModal(modal, {
client: client, // Client to show the Modal through the Discord API.
interaction: interaction // Show the modal with interaction data.
})
}
};
we dont provide support for 3rd party packages
i dont know how to do it via the normal way
which type do i need to use?
@copper jetty i get this
you cant destrucutre undefined it dont have any properties
what do you mean by that, and how would i fix that
how is Collection named in v14?
same as v13?
no?
r u sure
Collection
where can i see the new names like MessageEmebed is now EmbedBuilder ?
don't destructure undefined
let messageCollection = new Discord.Collection();
TypeError: Cannot read properties of undefined (reading 'Collection')
so it's not same
Discord is undefined
const { Discord, ButtonBuilder, SelectMenuBuilder, ActionRowBuilder, TextInputBuilder, EmbedBuilder, ButtonStyle, Collection } = require('discord.js');
if i only do Collection same error comes
Discord isn't discord.js class
there are no exports named Discord lol
Collection still Collection
did you mean const Discord instead const { Discord }
where is the difference
const Discord means you import all module, const { Discord } means you only destructure Discord export. but there are no exports named Discord
so i just do const Discord and then do Discord.Collection right?
yup
if you have any destructure, const Discord, { Client }
as i see in your code. you already imported Collection. why dont use it instead?
i tryed it but idk the error came so i just use Discord.Collection now it's kinda ugly then but at least it's working
var user;
try {
user = await GetBot(message, args);
} catch (e) {
return message.reply("ERROR: " + e);
}
if (!user || !user.id)
return message.reply(
" Did not find the BOT ... ERROR | Usage: `,invite @Bot` / `,invite BOT NAME` / `,invite BOT ID`"
);
message.reply({
embeds: [
new Discord.EmbedBuilder()
.setColor(client.config.color)
.setTitle(`Invite link for: ${user.tag}`)
.setThumbnail(user.displayAvatarURL())
.setDescription(`📯 Invite link:\n
> [Click here](https://discord.com/oauth2/authorize?client_id=${user.id}&scope=bot&permissions=8)`),
],
});
}
CombinedError: Received one or more errors
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:1471:23)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:114:88)
at EmbedBuilder.setFooter (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@discordjs\builders\dist\index.js:264:25)
at Client.<anonymous> (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\commands.js:7229:16)
at Client.emit (node:events:402:35)
at MessageCreateAction.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketShard.onPacket (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22)
at WebSocketShard.onMessage (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\WebSocketShard.js:304:10)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:251:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21) {
errors: [
ExpectedValidationError: Expected values to be equals
at LiteralValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:675:76)
at LiteralValidator.run (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:103:23)
at UnionValidator.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:1466:32)
at UnionValidator.parse (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@sapphire\shapeshift\dist\index.js:114:88)
at EmbedBuilder.setFooter (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules@discordjs\builders\dist\index.js:264:25)
at Client.<anonymous> (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\modules\commands.js:7229:16)
at Client.emit (node:events:402:35)
at MessageCreateAction.handle (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\Simon Stark\Desktop\kooje-web-botmanager\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31) {
validator: 's.literal(V)',
given: undefined,
expected: null
},
ValidationError: Expected a string primitive
what in jesus name
is it because the footer?
this error isnt referring to this code
to what then
this erros shows up when i try this command
yes it was because of the footer
but i didn't send the full code so yea
my bad
Typeerror : cannot read property isChatInputCommand of undefined
i dont destruct anything?
it's a method
send your code
const { ApplicationCommandType, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
module.exports = {
name: 'redeem',
description: "Redeem your license key!",
type: ApplicationCommandType.ChatInput,
cooldown: 3000,
run: async (client, interaction) => {
const modal = new ModalBuilder()
.setCustomId('redeem')
.setTitle('Redeeming - License Key');
const favoriteColorInput = new TextInputBuilder()
.setCustomId('favoriteColorInput')
// The label is the prompt the user sees for this input
.setLabel("What's your favorite color?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Paragraph);
// An action row only holds one text input,
// so we need one action row per text input.
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput);
// Now we need to add our inputs into the modal
modal.addComponents(firstActionRow, secondActionRow);
await interaction.showModal(modal);
}
};
its ping.js file?
jup
it was called like that, but i renamed it to redeem.js
it is a bug?
try reinstalling discord.js and @discordjs/builders
interaction is undefined
The order of function parameters must match between definition and function call.
function execute(client, message, args) { ... };
execute(message, client, args);
• mismatch! you pass a Message where the client is expected
• mismatch! you pass the Client where a Message is expected
perhaps ^
@scarlet tangle
but whu ,my code is correct .it should work
@copper jetty
i get that error when launching my bot
(intents)
Code:
i.update({ components: i.message.components.map(f => {
if(f.components.find(s => s.customId === "claim_ticket")) {
return { ...f, components: f.components.map(s => {
if(s.customId === "claim_ticket") return new Discord.ButtonBuilder(s).setDisabled(true).setLabel(`Ticket Claimed`)
return s
})}
}
return f
})
})
Error:
Error: Cannot properly serialize component type: undefined
at createComponentBuilder (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@discordjs\builders\dist\index.js:511:13)
at c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@discordjs\builders\dist\index.js:524:46
at Array.map (<anonymous>)
at new ActionRowBuilder (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\@discordjs\builders\dist\index.js:524:35)
at new ActionRowBuilder (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\ActionRowBuilder.js:12:5)
at c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\MessagePayload.js:135:84
at Array.map (<anonymous>)
at MessagePayload.resolveBody (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\MessagePayload.js:135:49)
at ButtonInteraction.update (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:222:56)
at Client.<anonymous> (c:\Users\mmgam\OneDrive\Desktop\ismm_Projects\Tickets\ismm.js:623:25)
What's the problem guys?
the problem is that you try to send an action row object (not a class instance) with received components inside. there was a pr to allow builders in such a case but received components need to be inside an actionrow
Where can I see the new names in v14 like EmbedBuilder() and stuff like that
should be in the preview updating guide which is pinned here
just add Builder at the end to builders
so i have to do "toJSON()"?
that should work
@copper jetty i keep on getting this
known bug, pass {} to builder constructors
which builder constructor
ModalBuilder in your case
you can see it in the stacktrace
alr did
new ModalBuilder()
where do you pass {} to it?
here?
how would you pass it when importing it?
now i get this, am i doing something wrong?
it was correct before you removed the parentheses
you just had to pass an empty object to the constructor
like this?
U need some basic js knowledge first
no it is just a weird way to call it, since i am an og v12 coder and never did v13/14
He said pass an empty object to the constructor not a string
If u know js then you can use any version. There is a bug in v14 and u just need to pass an empty object to the constructor to fix it.
a bug will decrease my knowladge of javascript?
not my fault that there is an bug i am not aware of, does not mean i need basic js knowledge
sorry mr i am good at english
I don't wanna argue with u but I'm just saying u need to understand what an empty object mean
if i say this; je moet het gene tussen de haakjes aanpassen aan de functie / object zelf die je oproept
do you understand it then? cause function / object is an international word, that's how my brain functions when it comes to explanations in english
object is {} <--- this
how would i react to the same message and open the modal? (to prevent Interaction has already been acknowledged.)
you can only either reply or open modal, not both, or at least you cant open the modal after replying
How would i prevent the message, Application did not respond?
well, reply to the interaction
opening a modal is a kind of reply
true, but i want for example that it replies: In progress… then it opens the modal
that is not possible
the user doesnt really see messages anyway when you open the modal
is there an option to add a button to the private interaction, when he clicks one open the modal, otherones kills the interaction, and from there retrieve data and maybe edit the alr sended interaction?
DiscordAPIError[50035]: Invalid Form Body
data.components[BASE_TYPE_REQUIRED]: This field is required
data.custom_id[BASE_TYPE_REQUIRED]: This field is required
data.title[BASE_TYPE_REQUIRED]: This field is required
at SequentialHandler.runRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:488:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:201:11)
at async ChatInputCommandInteraction.showModal (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
at async Object.execute (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\commands\configuration\set.ts:105:4)
at async exports.default (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\events\basic\interactionCreate.ts:18:4) {
rawError: {
code: 50035,
errors: { data: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'post',
url: 'https://discord.com/api/v10/interactions/964976235803463761/aW50ZXJhY3Rpb246OTY0OTc2MjM1ODAzNDYzNzYxOjBFbW13aVlOSGtjN1I5OXpKOXVCZlppbE9hUVo5UERicW1lYWN5d2hjMFdXSGRiVUFpMTFUQkRMcnZxOWNZdjlsVXlnM2NSQmI1cFRieVQyeFRVU2hNVG5CbzFPZHBIQkhsbms3allVZ3dGZnZUdTRpRWNZZExGV09FMkhpSERx/callback',
requestBody: { files: undefined, json: { type: 9, data: [Object] } }
}
Someone knows what to change / add because I don't know literally why it doesn't work
whats modal.execute()
I changed it to showModal but still nothing so I did as copilot told me
Current code @forest elm
you arent using the latest dev version
update
youll need to pass an empty object to the ModalBuilder constructor because of a bug once you update
Hello, ive read the docs 5 times now, and it mentions nothing about a change to "MANAGE_MESSAGES" Does anyone know what could be causing this?
its ManageMessages
Let me change them all rq see if that fixes all
all permissions are pascal case
Using
ok, and how did it go
this is only for ButtonBuilder and ModalBuilder?
nice thanks
any updates?
did you make an issue for it on github?
they said they’ll do ._.
"I would make" is an encouragement for you to do it
Hi, Is it possible to make the user upload an image in an input model?
no
Is anyone else seeing when clicking on the slash command response? Seems to only happen when a slash command is used to initiate a modal. Seems more likely to be an issue on the Discord API side.
Nothing in the Discord client is related to discord.js
Hi guys
With the latest few Discord.js developer releases I am receiving errors about emojis when attempting to create buttons using the button builder.
I'm not able to get the full error right now but will post it as soon as possible.
Got it.
Can you or anyone else tell me what the expected output there is supposed to be? Just the slash command input? Or the entire modal response? I haven't been able to find any documentation on it.
I'm not familiar with GitHub
TypeError: Cannot read properties of undefined (reading 'map')
at new SelectMenuBuilder (/root/ObitoInteractions/node_modules/discord.js/src/structures/SelectMenuBuilder.js:15:26)
at Object.execute (/root/ObitoInteractions/commands/context-menus/Social.js:22:5)
at Object.execute (/root/ObitoInteractions/events/interactionCreate.js:56:31)
at Client.<anonymous> (/root/ObitoInteractions/Structure/Client.js:48:37)
at Client.emit (node:events:526:28)
at InteractionCreateAction.handle (/root/ObitoInteractions/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketShard.onPacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketShard.js:447:22)
at WebSocketShard.onMessage (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketShard.js:304:10)
Social.js:22:5 => new SelectMenuBuilder({})
{ options: [] }
thanks
Can you help me beacuse I have still problem with modalBuilder even though I gave an empty object to the modalBuilder constructor
Error:
DiscordAPIError[50035]: Invalid Form Body
data.components[BASE_TYPE_REQUIRED]: This field is required
data.custom_id[BASE_TYPE_REQUIRED]: This field is required
data.title[BASE_TYPE_REQUIRED]: This field is required
at SequentialHandler.runRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:488:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:201:11)
at async ChatInputCommandInteraction.showModal (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
at async Object.execute (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\commands\configuration\set.ts:105:4)
at async exports.default (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\events\basic\interactionCreate.ts:18:4) {
rawError: {
code: 50035,
errors: { data: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'post',
url: 'https://discord.com/api/v10/interactions/965007997573148722/aW50ZXJhY3Rpb246OTY1MDA3OTk3NTczMTQ4NzIyOlFYbkVUc3M3bGdUQ2tRcUZrTW1wS3FYZ3EzYzRYYkhJWGxYYk9rQVQ5RGI0V2o5UU91Tm00b2d6Vkpna3NDRnI3R1hsWVpNbVY0U1ZLMGpNR3h0SDVxTWVmWnk2VmdadERJUnJncXh3MFZQWXl2V2wyeko2cEExcmpCQU1TbHBh/callback',
requestBody: { files: undefined, json: { type: 9, data: [Object] } }
}```
**`Version:`**
discord.js: 14.0.0-dev.1649937833-b01f414
@discordjs/builders 0.13.0-dev.1649937819-b01f414
**`Code:`**
} else if (subCommand === 'reklama') {
const modal = new ModalBuilder()
.setCustomId('setAdModal')
.setTitle('Ustaw reklamę')
const modal2 = new TextInputBuilder()
.setCustomId('adContentModal')
.setLabel('Treść reklamy')
.setStyle(TextInputStyle.Paragraph);
const firstActionRow = new ActionRowBuilder().addComponents(modal2);
modal.addComponents(firstActionRow);
await interaction.showModal(modal);
}
},
} as Command;
try new ModalBuilder({})
still the same problem
I misread nvm
You also need to put MessageContent intent in your Client
Try
const modal = new ModalBuilder({})
modal.setCustomId('setAdModal').setTitle('Ustaw reklamę')
Enabling in the dev portal does nothing if you dont request it in your code
Yeah its a separate intent
do same thing with modal2?
This isnt that error
Yes, you need to create the modals first and then set the properties after
I think it's a current issue
Making this change worked for me
Is that interaction.showModal definitely line 105 of your command
Its a bug with Buttons, not modals to my knowledge
Yes I'm completely positive
Something like this?
No it does not cover that
Have you tried it? I believe it should work
Unverified bots in fewer than 75 servers are not affected at all.
Not actually true, there's just no restrictions applied to enabling the intent. Same as they did with Guild Members
Ohh error
data.components[BASE_TYPE_REQUIRED]: This field is required
data.custom_id[BASE_TYPE_REQUIRED]: This field is required
data.title[BASE_TYPE_REQUIRED]: This field is required
at SequentialHandler.runRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:488:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:201:11)
at async ChatInputCommandInteraction.showModal (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
at async Object.execute (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\commands\configuration\set.ts:105:4)
at async exports.default (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\events\basic\interactionCreate.ts:18:4) {
rawError: {
code: 50035,
errors: { data: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'post',
url: 'https://discord.com/api/v10/interactions/965015305615183892/aW50ZXJhY3Rpb246OTY1MDE1MzA1NjE1MTgzODkyOk53cnB0QzMyQlNCc282QlNpNmxTYjVkbW9SRGsyNjVLaXhGWGFrMThvb2NhUWNucVBYM1ZYU3FjTUFsUzRROGk2TGNCbzNIYUt5Mk9xNmpHNFIzYXZpcWRTdkNLcHFRMkJ2bzRGcmhSNlBtSVJkUHhoaFNsSnNhNW1rcWxFSEVH/callback',
requestBody: { files: undefined, json: { type: 9, data: [Object] } }
}
Same error still
How button?
You do on API v10, which is what v14-dev runs
yea
No idea why they've failed to document it - we do in our docs
Anyone have a different idea?
whats line 105 of your code? definitely that modal?
before that it was a modal now even in my code I don't have 105 lines and now it shows that the error is there
okay show the current error stack
data.components[BASE_TYPE_REQUIRED]: This field is required
data.custom_id[BASE_TYPE_REQUIRED]: This field is required
data.title[BASE_TYPE_REQUIRED]: This field is required
at SequentialHandler.runRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:488:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:201:11)
at async ChatInputCommandInteraction.showModal (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:243:5)
at async Object.execute (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\commands\configuration\set.ts:105:4)
at async exports.default (C:\Users\lubid\OneDrive\Pulpit\Analytics-main\src\events\basic\interactionCreate.ts:18:4) {
rawError: {
code: 50035,
errors: { data: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'post',
url: 'https://discord.com/api/v10/interactions/965016477067517972/aW50ZXJhY3Rpb246OTY1MDE2NDc3MDY3NTE3OTcyOjJXSDhNTUN5eE9BRTNRbnBnUmF2a296Yk9iM05YUDFoWjhYSHl1RXdiOU5JdzJ2cFFFQ0hjTnNBajRLaGpkV3dYNWZNTVl3WTVlSjhPd0V3VFdHbWhHdEVmOFlxczd3ZnJxTGxJN0pFSGZja3Q0ZlpaZWZPcGhLYWRwRkRiOTNW/callback',
requestBody: { files: undefined, json: { type: 9, data: [Object] } }
}
Well the error is thrown from line 105 of set.ts
have you saved and rebuilt your code
Ahh I forgot I off auto save XDD
I am so sorry for that
It’s a known bug right now, the current workaround is to pass an empty object into the builder constructor
how to solve this error?
using modal
Well it didn't receive a response in time
And you didn't catch the promise rejection I guess
how do i create a sink for the modal?
I don't understand, how do I do that?
A... Sink?
You haven't shown your code yet
how to create one collector for modal
const filterModal = (interaction) => interaction.customId === 'test';
const collector = new InteractionCollector(client, { filterModal, time: 10000, guild: interaction.guild, interactionType: InteractionResponseType.Modal })
collector.on('collect', interaction => {
console.log(interaction)
})
this is my doubt
filterModal is not the right property name
It's filter
Looks fine otherwise
You probably want to set max: 1 too
truth, I hadn't even seen this error, the correct one is filter: filterModal
Ok, I'll see
@knotty plover
const filterModal = (interaction) => interaction.customId === 'test';
const collector = new InteractionCollector(client, { filter: filterModal, max: 1, time: 5000, guild: interaction.guild, interactionType: InteractionResponseType.Modal })
interaction.showModal(modal);
collector.on('collect', interaction => {
console.log(interaction)
})
when i send nothing is returned
5 seconds isnt very long for them to reply but that looks right
I put 1 minute, but as it's for testing, I think it doesn't matter
I just wanted to know why the collector doesn't get anything when I submit
@knotty plover
I said it looks right, pinging me isnt going to change that
change InteractionResponseType.Modal to InteractionType.ModalSubmit
Thank you so much, it helped me a lot ❤️
how to get who submited a modal?
modalsubmitinteraction#user
MODALS work in v13 too?
v13.7, soon™️
Can we rename the "Submit" button in the modal?
no
ty
How to make the modal return a custom error?
throw new Error("something")
like that
You can't
damn
It's possible to add context menu in the modal ?
no
and it will never be possible probably
context menu in modals? 
@knotty plover can you help?
maybe dont ping and wait for help
nah no idea
Code:
if (message.author.bot) return
// if (message.channel.type !== 'GUILD_TEXT') return
if (!message.content.startsWith(prefix)) return
const args = message.content.slice(prefix.length).trim().split(/ +/g)
const cmd = args.shift().toLowerCase()
if (cmd.length === 0) return
let command = client.commands.get(cmd)
if (!command) command = client.commands.get(client.aliases.get(cmd))
if (command) {
if (command.cooldown) {
if (cooldown.has(`${command.name}${message.author.id}`))
return message.channel.send({
content: `You are on \`${ms(
cooldown.get(`${command.name}${message.author.id}`) - Date.now(),
{ long: true }
)}\` cooldown!`,
})
if (command.userPerms || command.botPerms) {
if (
!message.member.permissions.has(
PermissionsBitField.Flags[command.userPerms] || []
)
) {
const userPerms = new EmbedBuilder()
.setDescription(
`🚫 ${message.author}, You don't have \`${command.userPerms}\` permissions to use this command!`
)
.setColor('Red')
return message.reply({ embeds: [userPerms] })
}
if (!message.guild.me.permissions.has(command.botPerms || [])) {
const botPerms = new EmbedBuilder()
.setDescription(
`🚫 ${message.author}, I don't have \`${command.userPerms}\` permissions to use this command!`
)
.setColor('Red')
return message.reply({ embeds: [botPerms] })
}
}
command.run(client, message, args)
cooldown.set(
`${command.name}${message.author.id}`,
Date.now() + command.cooldown
)
setTimeout(() => {
cooldown.delete(`${command.name}${message.author.id}`)
}, command.cooldown)
} else {
if (command.userPerms || command.botPerms) {
if (
!message.member.permissions.has(
PermissionsBitField.Flags[command.userPerms] || []
)
) {
const userPerms = new EmbedBuilder()
.setDescription(
`🚫 ${message.author}, You don't have \`${command.userPerms}\` permissions to use this command!`
)
.setColor('Red')
return message.reply({ embeds: [userPerms] })
}
if (!message.guild.me.permissions.has(command.botPerms || [])) {
const botPerms = new EmbedBuilder()
.setDescription(
`🚫 ${message.author}, I don't have \`${command.userPerms}\` permissions to use this command!`
)
.setColor('Red')
return message.reply({ embeds: [botPerms] })
}
}
command.run(client, message, args)
}
}
})
error:
Overload 1 of 2, '(event: "messageCreate", listener: (message: Message<boolean>) => Awaitable<void>): Client<boolean>', gave the following error.
Argument of type '(message: Message<boolean>) => Promise<Message<boolean>>' is not assignable to parameter of type '(message: Message<boolean>) => Awaitable<void>'.
Type 'Promise<Message<boolean>>' is not assignable to type 'Awaitable<void>'.
Type 'Promise<Message<boolean>>' is not assignable to type 'PromiseLike<void>'.
Types of property 'then' are incompatible.
Type '<TResult1 = Message<boolean>, TResult2 = never>(onfulfilled?: (value: Message<boolean>) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<...>) => Promise<...>' is not assignable to type '<TResult1 = void, TResult2 = never>(onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<...>'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type 'Message<boolean>' is not assignable to type 'void'.
Overload 2 of 2, '(event: never, listener: (...args: any[]) => Awaitable<void>): Client<boolean>', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'never'.ts(2769)```
i'm to stupid! if i set message: any i have no fails but my command didnt work with my prefix
do message: Message
Overload 1 of 2, '(event: "messageCreate", listener: (message: Message<boolean>) => Awaitable<void>): Client<boolean>', gave the following error.
Argument of type '(message: Message) => Promise<Message<boolean>>' is not assignable to parameter of type '(message: Message<boolean>) => Awaitable<void>'.
Type 'Promise<Message<boolean>>' is not assignable to type 'Awaitable<void>'.
Type 'Promise<Message<boolean>>' is not assignable to type 'PromiseLike<void>'.
Types of property 'then' are incompatible.
Type '<TResult1 = Message<boolean>, TResult2 = never>(onfulfilled?: (value: Message<boolean>) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<...>) => Promise<...>' is not assignable to type '<TResult1 = void, TResult2 = never>(onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<...>'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type 'Message<boolean>' is not assignable to type 'void'.
Overload 2 of 2, '(event: never, listener: (...args: any[]) => Awaitable<void>): Client<boolean>', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'never'.ts(2769)
same
It's trying to install a monorepo repository, strange should install correctly
BUG
new bug alert
really? can't reproduce
I saw someone get the same error trying to install rest in #djs-help-v14
yes
discor.js@dev?
discord.js@dev*
still can't reproduce
try install discord.js@dev or @discordjs/rest or update it
i did
i can reproduce
try it after this message on windows mashine
on linux all is fine
@urban belfry
linux update it
- discord.js 14.0.0-dev.1649937833-b01f414
+ discord.js 14.0.0-dev.1650197065-b94a876```
but on windows not
nvm now it works on Win too ^^
I see talk of workspace issues but I'm not managing to reproduce them?
jiralite@MacBook-Pro-2021 Soulobby % npm i discord.js@dev @discordjs/builders@dev @discordjs/rest@dev @discordjs/voice@dev @discordjs/collection@dev
added 14 packages, changed 2 packages, and audited 308 packages in 6s
93 packages are looking for funding
run `npm fund` for details
2 vulnerabilities (1 high, 1 critical)
To address all issues, run:
npm audit fix
Run `npm audit` for details.
me neither, even cleaned the cache
some peoples can't install stable version of rest too
There is no stable version of rest
lobster means the default
discordjs/rest
without @dev
can reproduce on the latest versions (not dev)
Seems I can only reproduce with /rest
jiralite@MacBook-Pro-2021 test % npm i @discordjs/builders
added 7 packages, and audited 8 packages in 3s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
jiralite@MacBook-Pro-2021 test % npm i @discordjs/rest
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:^
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jiralite/.npm/_logs/2022-04-17T13_20_46_572Z-debug-0.log
jiralite@MacBook-Pro-2021 test % npm i @discordjs/builders
up to date, audited 8 packages in 427ms
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
jiralite@MacBook-Pro-2021 test % npm i @discordjs/voice
added 7 packages, and audited 15 packages in 7s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
yeah tbf rest was the only one i tried
It was thrown here for discord.js, not sure of the conditions though
cant reproduce, probably caused by /rest somehow
can reproduce on rest
Hey
Why is it sending the message "Spatiu." more then 1 time
You didn't check if <Message>.author.bot is true probably
yea now i saw ty
How to check if the bot is sending the msg cuz is not working like that
if someone responds pls ping me
change || to &&
you can just do if (msg.author.bot) return;
ye but with that i will use to if conditions'
working didn't know that
what intents are needed for the guildMemberAdd event be emitted?
GuildMembers
thx
Is it possible to interaction.editReply() after interaction.showModal()?
I'm using an InteractionCollector to collect responses and I'm trying to reply to the end timeout. Is my only option to send a fresh message?
no
So I have to send a fresh message? I guess I'll have to remind the user what slash command they used
What means that?
Type 'Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused" | "getMentionable" | "getRole" | "getAttachment" | ... 10 more ... | "_getTypedOption">' is missing the following properties from type 'CommandInteractionOptionResolver<CacheType>': _group, _hoistedOptions, _subcommand, _getTypedOption, and 12 more.ts(2345)
how to use .addChoices() in v14?
can't you use followUp()?
Ah, forgot about that! Thanks
Hey, what happened to "restTimeOffset"
And where can I find all the "Constants" please?
thank you
Module '"discord.js"' has no exported member 'CommandInteraction'.ts(2305)
what instead?
Hmmmm, there's a Constant for "ActivityType" but there's none for the client status.
CommandInteraction => ChatInputCommandInteraction
ah nvm ty
Heads up to everyone, if you have builders installed manually, you should go ahead and remove the installation via:
npm uninstall @discordjs/builders
or
yarn remove @discordjs/builders
Discord.js ships with all of the builders. Having both packages installed at the same time can cause confusion because of conflicts between both classes existing. This can cause auto-imports to give classes you might not expect.
yay!
ActionRowBuilder now requires a generic
No
either MessageActionRowComponentBuilder or ModalActionRowComponentBuilder
intellisense should help you
I don’t understand
Well as I said you should remove /builders it’s not needed if you have the latest djs installed
it does now
everything is being re-exported
?
wonder when they're release the full version
Is there a list of known bugs somewhere? I know about builders but is there more known bugs?
Property 'reply' does not exist on type 'ChatInputCommandInteraction<CacheType>'.ts(2339) ?
Okok
code? I updated my bot and didn't encounter this one
return interaction.reply({
content: reply,
ephemeral: this._instance.ephemeral,
})
} else {
let embeds = []
if (Array.isArray(reply)) {
embeds = reply
} else {
embeds.push(reply)
}
return interaction.reply({
embeds,
ephemeral: this._instance.ephemeral,
})
}
}
try restarting tsserver, can't reproduce it
code?
new ActionRowBuilder<MessageActionRowComponentBuilder>
you need the generic
dont work thats my complete code. i'm to stupid i think https://srcb.in/HgFuWsHS4X
that code works perfectly fine for me (at least the part in question)
make sure you are on latest dev, that bug was fixed
with todays release
is there a way to run editReply of the original interaction when I receive a buttonInteraction?
so like a user runs /something
and on the response, there are buttons.
I am not using .awaitMessageComponent, but I have a seperate event listening for interactionCreate
when the button gets pressed I want to edit the message of the original response to /something
using buttonInteraction.message.edit does not work (Missing Access)
use ButtonInteraction#update
oh that exists?
ty
u mean me?
why i get this error then Property 'reply' does not exist on type 'Interaction<CacheType> & ChatInputCommandInteraction<CacheType>'.ts(2339)
because it doesn't exist on Interaction. not sure why it's typed like that for you, I thought you had interaction: ChatInputCommandInteraction in your code
Property 'reply' not exist on 'Interactione & ChatInputCommandInteraction
const modal = new ModalBuilder('finder')
.setCustomId('redeem')
.setTitle('Server Build - Finder');
const favoriteColorInput = new TextInputBuilder()
.setCustomId('favoriteColorInput')
// The label is the prompt the user sees for this input
.setLabel("What's your favorite color?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput);
modal.addComponents(firstActionRow);
await interaction.showModal(modal, {ephemeral: true})
how would i log for example my input?
it just don't understand it
you need to collect the response with an InteractionCollector
so await InteractionCollector
in theory
no, its not a promise
i know but in theory
Im not sure if awaitModalSubmit is merged yet
Yea that got merged
cool, interaction.awaitModalSubmit
const collector = message.createMessageComponentCollector({ componentType: 'BUTTON', time: 15000 });
collector.on('collect', i => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} clicked on the ${i.customId} button.`);
} else {
i.reply({ content: `These buttons aren't for you!`, ephemeral: true });
}
});
collector.on('end', collected => {
console.log(`Collected ${collected.size} interactions.`);
});
this right?
is what you mean with an collector*
CommandInteraction#awaitModalSubmit()
Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
sort of yes, though a MessageComponentCollector wont work since modals arent message components
where else?
We are in the version 14 category
#7751 in discordjs/discord.js by suneettipirneni merged <t:1649776427:R>
feat(modal): add awaitModalSubmit
i just don't understand it
i feel so dumb
refer to this @sharp pine
i alr did
before even asking
omg yess I didn't see this was merged
theres a code example on that
where?
.
update to the latest dev version
yes but what do i need to put in the brackets because of (options)
use the example
there is no example
oh bruh
didn't knew examples where an option
theres no typings for it thats all
how would i retrieve the filled in data?
interaction.fields.getTextInputValue(customId)
thanks!
1|snake | TypeError: Cannot read properties of null (reading 'id')
1|snake | at ButtonInteraction.update (/home/clauz/snake/main/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:235:108)
1|snake | at processTicksAndRejections (node:internal/process/task_queues:96:5)
1|snake | at async InteractionCollector.<anonymous> (file:///home/clauz/snake/main/built/commands/infos/help.js:214:13)
recently updated djs and im getting this error when editing a button interaction, what is causing this? (i changed nothing in my code)
without seeing code it'd be hard to say, did you update from v13 to the v14 dev? or was it just a small update within v14?
i was alr on v14
Seems to be having an issue with creating the InteractionResponse
Can you show your code?
for some reason the function is only typed on message component interactions
oh I see. I haven't messed with it with yet, the collector does fine for what I need
yeah theres a bug
What errors are you getting? Could be different
code?
dont return that
return nothing on the next line