#djs-help-v14
78874 messages · Page 61 of 79
you can only acknowledge/reply once
after that you can only followUp or editReply
if you try to use two of these for the same interaction it won't work, and will result in the error you just sent
oh, I see :)
tysm [hard to choose an emoji]
export const data = new SlashCommandBuilder()
.setName(`ping`)
.setDescription(`Replies with bot latency`)
.setContexts([InteractionContextType.BotDM, InteractionContextType.Guild, InteractionContextType.PrivateChannel]);
export const execute = async (client: Client, interaction: ChatInputCommandInteraction) => {
await interaction.reply({
embeds: [newEmbed().setDescription(`Current latency is ${Date.now() - interaction.createdTimestamp}ms.`)],
flags: MessageFlags.Ephemeral,
});
};
I have a simple command that I want to use in dms using the bot as an installable app for accounts, but despite having deployed it like this and having refreshed multiple times, the ping command does not seem to show up in my account, what am I doing wrong?
SlashCommandBuilder#setIntegrationTypes() discord.js@14.25.1
Sets the integration types of this command.
You might also need to set this
Hello, i have discord bot with 15 slash command but the bot don't have slash commands tag what i need to do?
the commands need to be global for the
to show
how do I update an channel's parent, that has been created by the bot?
Do you want to move a channel to another category? Or edit the parent channel's properties?
move it to another category
GuildChannel#setParent() discord.js@14.25.1
Sets the parent of this channel.
// Add a parent to a channel
message.channel.setParent('355908108431917066', { lockPermissions: false })
.then(channel => console.log(`New parent of ${message.channel.name}: ${channel.name}`))
.catch(console.error);
tysm!! btw what is lockPermissions?
Or in the create call itself you can pass parent:
SetParentOptions#lockPermissions discord.js@14.25.1
Whether to lock the permissions to what the parent's permissions are
Default value: true
I see tysm!!
okay. I am still a bot confused so here is my code
if (customId === "report") {
type = "report";
openingMessage = `
thank you for wanting to report someone and keeping chonsa safe!
Before continuing please select one of the following buttons:
for reporting owners : please dm holly (yejin.luvs)
:tedz: : reporting staff (all roles except owner)
:cinnabuun: : reporting members
_ _
`;
const reportButtons = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("report_staff")
.setEmoji("1440509194477502525")
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId("report_member")
.setEmoji("1440509196083921017")
.setStyle(ButtonStyle.Secondary)
);
const channel = await interaction.guild.channels.create({
name: `${type}-${interaction.user.username}`,
type: ChannelType.GuildText,
parent: '1440591960116166767',
permissionOverwrites: [
{ id: interaction.guild.id, deny: ['ViewChannel'] },
{ id: interaction.user.id, allow: ['ViewChannel', 'SendMessages', 'ReadMessageHistory'] },
{ id: '1442258475408294061', allow: ['ViewChannel', 'SendMessages', 'ReadMessageHistory'] },
],
});
await interaction.reply({
content: `Your **${type}** ticket has been created: ${channel}`,
ephemeral: true
});
await channel.send({
content: `<@${interaction.user.id}>\n${openingMessage}`,
components: [reportButtons],
});
return;
}```
if (customId === 'report_member'){
await interaction.reply(`Thanks for selecting member! Now in your own words please describe the reasoning behind your report and any proof you may have.`)
}
if (customId === 'report_staff'){
await interaction.channel({
parent: `1442207807393890374`,
permissionOverwrites: [
{ id: interaction.guild.id, deny: ['ViewChannel'] },
{ id: interaction.user.id, allow: ['ViewChannel', 'SendMessages', 'ReadMessageHistory'] },
{ id: '1442258475408294061', deny: ['ViewChannel'] },
],
})
await interaction.reply({
content: `Ticket moved`,
ephemeral: true}),
await channel.send({
content: `Thanks for selecting staff! This ticket has been moved to the founder section so only they and owners can view. Now in your own words please describe the reasoning behind your report and any proof you may have.`
})
}
}
},
};
interaction.channel()?
interaction.channel is the channel, not a method. You need to call .edit() on it
OH EDIT
tysm
it's now saying channel isn't defined but it is? no?
No, you never defined a variable by that name
interaction.channel is
so how would I send the message?
By using 👆 instead of just channel
oh okay ty
Ok
guys
is there a way to check whether a user is wearing a server tag of a specific server
documentation suggestion for @simple coral:
User#primaryGuild discord.js@14.25.1
The primary guild of the user
Heya, I cleared my sqlite db and now when I run my commands, it says "The Application did not respond" but if I run the command again, it then works as intended. Why is this?
What's the code?
Of?
Of your program
Of the command, of the db? What exactly lol
of your command, that's the one replying to the interaction
My code tree:
https://sourceb.in/URPb3kov0N
My "unwarn" command:
https://sourceb.in/YGlCvZYTmP
My db.js code:
https://sourceb.in/iNQ0Iwq730
I changed the db from sqlite to json since I was having issues with multiple things when I added AI support into my Ticket System.
you're most likely getting an unknown interaction error
but there's no way to tell since you catch errors and ignore them when replying
you should not do that, and defer at the beginning so you can modify the db and not worry about the interaction lifetime
Mhm; may I have a quick question on how message fetches works? I lost my database (silly me, I didn't do backup) and I am trying to fetch every message in the server which is fairly small (around 280k messages), and I did the command 3 times but weirdly enough it always stops at 80k messages.
is not possible to display custom emojis in embed footers? it appears raw
not possible
You're probably rateLimited then. Fetching all messages is indeed not advisable. But if it was possible for the indeed rather small amount of messages you face here then it would take quite some time, waiting for the rateLimits to pass. Depending on how your command works internally you either abort when rateLimited or simply didn't wait long enough
What is the advisable amount to wait? And How long does ratelimits need to take to pass?
Ratelimits are dynamically assigned by the API based on current load and may change at any point.
- The scale from okay to API-spam is sliding and depends heavily on the action you are taking
- Rainbow roles, clock and counter channels, and DM'ing advertisements to all members are all examples of things that are not okay
The first sentence is what I intended to show you. Djs handles the waiting for rateLimits to pass for you. You don't have to add any wait yourself to do so
But ultimately is... it won't stop right? It will be hold (paused) if I understood you correctly?
Yes, I have checked now, it was hold, silly me, I thought it stopped.. I am so stupid. Oh well, 4th and last time to do the command.
Hi 👋
In my command, I create a modal with text inputs whose values will be included in an embed post. Now I also want to give users the option to notify certain roles with their post. As far as I can see, I can't ping any roles within embeds, and no role suggestions appear when I type @ in the text inputs. So I guess the only way to ping roles in the resulting post is to pass roles as command options, so they can be included in the post content (instead of embed)? Or am I missing a better approach?
when using embeds any mentions with the intent to send push notification must be in content
Alright, thank you! 👍 Now I'm just trying to figure out an user-friendly way to pass the roles to the content. Is there a way to enter roles within text inputs (with role suggestions and autocomplete support when @ is typed), or do I have to rely on my command options (ApplicationCommandOptionType.Role)? I'm just trying to make my command/modal as easy to use as possible.
Use a role select menu
My modal already has 5 inputs, which is the maximum amount of input a modal can have as far as I know. So I guess I have to somehow split up my inputs into 2 modals so I can add the role select menus
Hi, do you know if the use of number input components is available yet? Or has it not been officially released yet?
It that case I would recomed that you add is as a command option then pass it to the modal like in the custom id or via an other method
If that is a real image it is not documented by discord
What would be the method for using it? If you know, could you please help me?
Ya that looks like a concept image and not real
p sure thats a concept image from the discord api docs PR for more modal components
Yes, I saw it on GitHub and I thought it was documented.
It was not. The GitHub discussions are all community posts. That image is a concept image from many years ago when they asked for more modal components. It does not exist
There's only TextInput, FileInput, and SelectMenu components
I understand, thank you very much for the information. 😉
button ids can't be tampered with, right? I guess theres any server side checks. Because I'm doing a report system and it saves the report id in the button to be accessed from buttoninteraction but I'm not sure at all if a user can just tamper it with devtools or something weird
okay thanks
you can by just getting message with another bot i think. overall i wouldnt store sensitive data in discord ids
i'd assume they mean changing the ID to have a different report id, instead of just finding out the id
if thats the case, no, others cant edit someones else message
just remembered that I asked about this exact thing on DDevs
can repost the link if you want, i'm not enitrely sure why that filter was in place but prob. connected to some scam/phishing shenanigans
yep
okay thanks you, also to bake. I kinda hate not being able to react
is that to me?
did you try to post a link that was caught in our filters? if so, maybe, if not, probably not
oh okay sorry, I didn't understand the message firstly so I was a bit out of my place
how do I extend modal reply time? becasue deferUpdate already closes it
yes, that's intended. the modal should get closed as soon as the submission is received
you still get 15 minutes after your defer
oh okay, thanks
Hello, I was coding a config that change my bot avatar. The code was working but now it isn't working (it's the same code that i used before). Does anyone know what is the problem?
without seeing your code and knowing what "not working" means: no
The problem isnt the code because its the same that worked before
module.exports = {
data: new SlashCommandBuilder()
.setName("config")
.setDescription("Configures the bot")
.addStringOption((option) =>
option
.setName("username")
.setDescription("Defines bot username")
.setRequired(false)
)
.addStringOption((option) =>
option.setName("avatar").setDescription("Sets the bot avatar")
)
.addStringOption((option) =>
option.setName("activity").setDescription("Defines bot activity")
)
.addStringOption((option) =>
option
.setName("status")
.setDescription("Sets bot status")
.addChoices(
{ name: "online", value: PresenceUpdateStatus.Online },
{ name: "idle", value: PresenceUpdateStatus.Idle },
{ name: "donotdisturb", value: PresenceUpdateStatus.DoNotDisturb },
{ name: "invisible", value: PresenceUpdateStatus.Invisible }
)
),
async execute(interaction: any) {
const username = // Leave the "??" otherwise code won't work
interaction.options.getString("username") ??
interaction.client.user.username;
const avatar =
interaction.options.getString("avatar") ??
interaction.client.user.avatarURL();
const activity = interaction.options.getString("activity");
const status = interaction.options.getString("status");
await interaction.client.user.setUsername(username);
if (!avatar) {
await interaction.client.user.setAvatar(avatar);
}
await interaction.client.user.setActivity(activity);
await interaction.client.user.setStatus(status);
},
};
that code never could've changed your avatar. so I definitely doubt that
Why it worked then?
remove the !in your if and it might
also please don't use any, why use typescript at all then? in your case you'd want ChatInputCommandInteraction as type
If i remove the ! the if won't do anything, I use TypeScript because I always used it and the thing is that my code isn't the problem because it worked, I cloned my repo with all the last modification that worked and it won't work, so its just strange because the code worked and then it stopped working
like Qjuh said, you'd need to share what "not working" means
does it error, does it not change the avatar, does it change when it shouldn't...
what my code is doing is: when you do nothing it doesnt change the avatar because if you leave the option blank it put the same image but reload it, so if you use the command in a limited time, there is gonna be an error like youre changing the avatar too fast, but if you put an image link, then the image will change
and what is it supposed to do?
also that doesn't sound like what it does, it's always setting the avatar, regardless of whether you did input something
Like i said change the avatar if you put a link to an image but if you leave it blank then do nothing
Yeah so if you leave the option blank it reload
you said this is what your code is doing
you meant "what my code is supposed to do"?
I've said what its supposed to do but my code is actually doing nothing
maybe you're ratelimited then?
and I told you why. read your code again. it is wrong
also is that command supposed to change the global settings?
given there's now per guild avatar
maybe that's what you wanted instead?
My code was working btw
I dont really know but when you change the avatar with my code your app keeps the old one and the bot gets the new one
You only ever call setAvatar with a falsey value. So no, that code CAN'T work. And typescript would even tell you so if you didn't silence it with any. Good luck arguing your errors, I'm out
If i see the new one on my bot its working
it seems weird to me to let other people change the nick or avatar of your bot
Youre crashing out alone because I said that it was working, ok
but if that's what you want then you do you ig
I'm not doing the persmissions rn but the actions
permissions like what?
if you mean discord permissions then I could just invite your bot to my guild where I'm admin
and I can now change your bot's avatar and nick
and status
If normal member can do it or not
Do you want to test?
and what would a "normal member" be
I mean that code doesn't do any permission check, I know that'll work
I want to know whether you coded what you wanted
Like everyone and not a specific member with specific perms
I know but ive said that i dont care about that rn
if only a specific member can then yeah that makes sense
well anyways if nothing seems to be working, place some logs and see where it stops
then you can find the root of the issue
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn more
To change the avatar of the bot if a link is in the avatar option but if nothing is there then just do nothing
Thx
if you don't want it to do anything if they don't set anything then just don't do the ??
otherwise it'll always be something
also you want if (avatar) then, not if (!avatar)
otherwise it reads "if they didn't choose an avatar, set the avatar", the opposite of what you want
what is the best way to reset the options previously picked in a selectmenu
by editing the message again with the same contents
if youre working with embeds you can also do suppress embeds to false
(replying to deleted message) #1081585952654360687 or #archive-offtopic
How can u edit a container without it showing "edited"?
you can't
I swear I seen @astral prism do that after you click "solved". It makes the "solved" button disabled and it doesnt show edited
It varies between app clients
the button isn't disabled, the thread is just closed
you can't click buttons on a closed thread
But in essence they are edited
is deleting messages 1 by 1 faster than channel.bulkDelete(msgIds)?
What do you mean by faster?
Bulk message is a API endpoint that allows the deletion of up to 200 messages from with single request
Deleting individually is more likely to run into rate limits since it’s multiple requests
You will get rate-limitted if you try to delete too many messages
I remember reading here that we should delete 1by1 instead of channel.bulkdelete, could be wrong
The only cases you can’t use bulk delete is when the message is too old or ur in DMs
it was probably this #1440394647854780476 message , nvm then
documentation suggestion for @shy marsh:
Embed discord.js@14.25.1
Represents an embed.
how can I check a message in messageCreate is came from a DM?
by checking channel type or if in guild
what should be the channel type?
theres DM and GroupDM
documentation suggestion for @main axle:
BaseInteraction#inGuild() discord.js@14.25.1
Indicates whether this interaction is received from a guild.
can't get messages from group dms on messageCreate
oh okay good to know
setChannelSelectMenuComponent doesn't have a setdefault/setvalue?
documentation suggestion for @median ferry:
ChannelSelectMenuBuilder#setDefaultChannels() builders@1.13.0
Sets default channels for this auto populated select menu.
the thing is that the s kinda confuses me
it takes an array of channel ids
oh, so I can select multiple channels?
yup
ohh okay thank you
note that you have to set you min and max values accordingly with it
okayy. I guess max is 1 by default because I can't select multiple yet. Also, if the default channel doesn't exist it just ignores it or it will throw an error?
you can easily test that out
yea I was about to say that, it was kinda a stupid question...
it wont throw errors it just wont include it
I have a question about what we receive from member.presence The documentation says that only desktop, mobile, and web, but I checked the console log (member.presence.clientStatus) and it showed me that there is also { embedded: "online" }, What is this?
It's generally known that embedded is for those using Discord through gaming consoles such as Xbox or PlayStation. Discord themselves have not documented that value though so thus d.js will not document any support for it either until then
the executor of moving a user from vc it just shows the member that was moved it doesnt seem to show executor
Hello I want to know is it possible to use yt dlp to stream music to a voice channel?
no, that would be against tos
Oh so discord js does now allow it?
it’s discord that doesn’t allow it
I did not realise that becuase it works on discord py so i assumed I could use it for my private discord js bot
How come it works for discord py but I cant get it to work for discord js, if supposedly its discord that doesnt allow it?
it’s not that it won’t work, it’s discord that doesn’t allow you to stream youtube, which breaks the tos.
we won’t help you here with that, sorry
But what I am trying to say is that I have literaly done it with my own discord python bot
Ok I understand
Hey I have seen in many bots that we can edit the icon and description of that bot in a special guild, so can anyone tell me how is work and How should I put it in my bot
guild.members.editMe(…)
GuildMemberManager#editMe() discord.js@14.25.1
Edits the current application's guild member in a guild.
So my bot will be able to edit its own avatar, description for any specified guild?
Yes
do buttons have a maximum customid length
all components that use custom_id have a maximum length of 100 characters
Hey When I change the bot's nick, an issue arises.
TypeError: Cannot read properties of undefined (reading 'emitWarning')
Also bio or avatar is not being edited using ``guild.members.editme().
Show the full error w/ stack trace
I’d guess it’s coming from a member.edit(…) or member.setNickname(…) where you are trying to edit the bot’s nickname
Not sure why you don’t have emitWarning of undefined tho
if (sub === "bio") {
const bio = args.slice(1).join(" ");
if (!bio) return message.reply("⚠️ | Please provide a bio text.");
await guild.members.me.edit({ bio: bio }).catch(err => {
return message.reply("❌ | Bio update failed.\n```" + err + "```");
});
return message.reply(`✅ | Bio updated!\nNew Bio: **${bio}**`);
}
if (sub === "avatar") {
let imgURL =
args[1] ||
(message.attachments.first()
? message.attachments.first().url
: null);
if (!imgURL) {
return message.reply("⚠️ | Provide an image URL or attach an image.");
}
try {
const buffer = await DataResolver.resolveImage(imgURL);
await guild.members.me.edit({
avatar: buffer
});
} catch (err) {
return message.reply("❌ | Avatar update failed.\n```" + err + "```");
}
return message.reply("✅ | Avatar updated for this guild!");
}
if (sub === "banner") {
let imgURL =
args[1] ||
(message.attachments.first()
? message.attachments.first().url
: null);
if (!imgURL) {
return message.reply("⚠️ | Provide image URL or attach image.");
}
try {
const buffer = await DataResolver.resolveImage(imgURL);
await guild.members.me.edit({
banner: buffer
});
} catch (err) {
return message.reply("❌ | Banner update failed.\n```" + err + "```");
}
return message.reply("✅ | Banner updated for this guild!");
} ```
And error = ❌ | Unable to update nick.
TypeError: Cannot read properties of undefined (reading 'emitWarning')
Add console.error(error) in the catches
You should be using guild.members.editMe(…), not .members.me.edit(…)
That should fix your errors. If not, the logs should give a full error w/ stack trace
Not sure why ur using DataResolver.resolveImage tbh
You can pass direct URLs to the banner
For the 1st error
You should be using
guild.members.editMe(…), not.members.me.edit(…)
You should also convert the bio Promise.catch to a try catch block
You will otherwise be sending a fail and success message when it fails
Fixed , thankyou sirrr
I am still a bit concerned that process is undefined. Are you using bun or smth that isn’t node.js?
bun
That baseballs
It’s just a bun problem then
You should’ve gotten a warning that appeared in console instead of the emitWarning error
Hello is it difficult to implement a command into my bot that generates apexcharts.js spline graphs to output to the chat based on user provided datahttps://apexcharts.com
this sounds more like a question about apexcharts.js than discord.js, but whether it's difficult or not depends entirely on you
if you have a specific question about making a command, receiving user input, or sending a response, feel free to ask it
but questions aobut apexcharts.js should be directed towards their support
Ah ok I see, yes I was thinking about what my first steps should be to implement this into a discord js command, just was looking for a little guidance
if you're unfamiliar with how to create commands in general, feel free to check out the guide https://discordjs.guide/legacy/app-creation/creating-commands
but we'll be unable to guide you with using apexcharts specifically
What is CombinedPropertyError?
Validation failed on multiple properties
I can tell you what it means if you provide the full error with stack trace and code
yea I think value: null or value: undefined will get this error
What's the difference between setting rest.url to proxy URL that's running @discordjs/proxy vs setting rest.agent like here?
The former expects the url to point at an API that respond to all endpoints like Discord does. The latter uses any proxy server to simply relay the request to the actual discord.com API
Thank you!
My bot is not responding to any commands, what could be the issue?
My file structure:
https://sourceb.in/FDrD6etvRA
file structure wont tell us much. did your commands work in the past? and whats your error message?
Yes, the commands worked in the past and there is no error in my terminal. I provided my file structure so you guys would know what files exists if any needs to be provided.
are you catching any errors?
or can you see in the console youre receiving the interaction?
I don’t see anything in my terminal
No errors no nothing
might be a stupid question then but is your bot even online then?
Yes, it is.
Is your bot receiving events at all? Can you add a console.log to the beginning of your interactionCreate event listener to see if it's logging at all?
If it doesn't log, then there's something wrong with your script to load event files
It gets logged perfectly fine in the console.
What's your code for interactionCreate event
on line 7, before the whole try block, add a console.log('interaction received') and see if anything shows up when you use a slash command or button
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn more
Yes, it gets logged when I use a command.
then keep adding in checks at each step of your event's logic - if statements, etc
find out where it's stopping
It stops at line 11-14:
if (command) {
await command.run(client, interaction);
}
return;
It doesn't find the command which is the issue
is it intentional that you pass client to your command functions?
it's probably not loading your commands correctly then, or you don't have a command file for that command name
if your commands worked in the past then it should be easy to find out what you changed that broke it
Ye, it was looking for client.SlashCmds but I was setting commands to client.slashCommands
but unless you do define client.SlashCmds somewhere, that should've thrown an error
and if you do define them, why have two properties with very similar names but different purposes
Hello, is /applications/{application.id}/emojis implemented in Discord.js?
Like directly in the client
documentation suggestion for @ivory plinth:
ApplicationEmojiManager discord.js@14.25.1
Manages API methods for ApplicationEmojis and stores their cache.
that's on client.application.emojis ^^
I'm a bit confused about spliceComponents. If I want to replace a component, should deleteCount be 0 or 1?
E.g. spliceComponents(2, 1, newComponent) or spliceComponents(2, 0, newComponent) to replace the component in index 2?
it should be 1. to delete one component starting at index
Got it
I am getting this error but I don't see any files with the same name, what could be the issue?
https://sourceb.in/iVqmcYnTx7
My file tree:
https://sourceb.in/Wka9UF9Ys4
check your command names, the file tree doesnt reveal what you named your commands as
hey people, I have a button and when the user presses it, I would like to ask for some additional information (a simple string input), would prefer it to be "private"
afaik I could either use
- a modal to retrieve this
- use dm's to handle this
is there a way I am missing?
I feel like it would be simply prompting the user a question and getting the answer 
A modal would be the best way to get that additional string input
hmmmm, I would have somehow hoped I could maybe trigger a slash command from the interaction, or send an ephermal embed that has some kind of input?
but I guess neither those things exist 
modal seems a bit "aggressive" for the use case is the only reason really, but might be the best choice
i dont think you would want something as triggering a slash commands. modals are the best way for that
alright thanks guys 
Well, you could use a </command:id> mention instead of a button, when they click that they get the slashcommand in their ChatInput.
that sounds like a cool thing to explore, any chance you got a link to the docs or something i can take a look at? I have never seen something like this there 
or an example, whatever really
I only found this
https://discordjs.guide/legacy/popular-topics/formatters#mentions
thanks guys I will give it a try and see if that works 
Hello, I have a rather strange problem!
I'm using FileUploadBuilder in a modal to allow users to upload files. But when uploading a large file, instead of just one, I can get multiple identical messages with files and an error after the Nth one.
const message = await channel.send({content: `...`, embeds: [embed], components: [row]});
const proofs = interaction.fields.getUploadedFiles('proofs');
if(proofs && proofs.size>0){
try {
const attachmentsToSend = Array.from(proofs.values());
await message.reply({
content: `Proofs (${attachmentsToSend.length}):`,
files: attachmentsToSend
});
} catch (error) {
console.error(error);
await message.reply({ content: ":x:" });
}
}
DOMException [AbortError]: This operation was aborted
at new DOMException (node:internal/per_context/domexception:53:5)
at AbortController.abort (node:internal/abort_controller:395:18)
at Timeout.<anonymous> (/root/discord-bot/node_modules/@discordjs/rest/dist/index.js:715:47)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
In this case, it sent proofs three times, and then triggered an error.
I hope someone can help me with this, maybe they've encountered this before? Thanks in advance!
discord.js@14.25.1
You probably want to use nonce to make sure discord dedupes those messages in case an upload takes that Long that it causes an abort error while still succeeding in sending. Which is probably what happened here
It didn't work, or I misunderstood.
const nonce = Date.now().toString();
try {
const attachmentsToSend = Array.from(proofs.values());
await message.reply({
content: `Proofs (${attachmentsToSend.length}):`,
files: attachmentsToSend,
nonce: nonce
});
}
catch (error) {
console.error(error);
await message.reply({ content: ":x:" });
}
Sorry for late responds, thx it finally worked
I don't understand why this problem is occurring?
i tried my best to get how it works but it still the same
with old versions of discord.js it works perfectly
Youve enabled an entry point command in the dev portal, but arent providing one when deploying commands
This is a Discord API error and would happen no matter which version of discord.js you use
so what should i do now ?
Do you intend for your bot to have a primary entry point to launch an activity?
yeah maybe
Then you need to define a Primary Entry Point command
Its not really a "maybe" kinda question though
can i show you what i did for the command Event ?
...is it a command or an event?
I suspect the correct answer here would have actually been "no", so I'm not sure why you enabled activities
command
so idk why but this is the stupidest problem I've ever seen.
when i changed the c.user.id to c.application.id it worked
hmm, I have an embed and the embed has a placeholder for a lobby code (some arbitrary string)
I use a button + modal to provide the lobby code some time after the embed was sent
I just realized: how am I getting the lobby code into the embed?
the embed uses "a lot of data" which I don't have at the point where I react to the button / modal
is there a reasonable way to replace a placeholder in an embed, or should I just create a second, simpler embed below and "repost" that one?
you can just edit the embed again. theres EmbedBuilder.from() for that
That is kinda weird but glad it's fixed
oooooooooh
is there some form to uniquely identify an embed (buttons etc. have custom ids), or am I just doing message.embeds[0]
oh that's great, I might just use the footer for the code 
well with message.embeds[0] you already identify if its an embed so not sure what you mean
yessir
question was
should I be doing message.embeds.find(embed => [what am I putting here?])
or is embeds[0] just the way to go
is there more than 1 embed?
cause I dont see any id for embeds, or way to set them
is there more than 1 embed?
no
then [0] is fine, theres nothing else to find it from
thanks that was my question 🙏
how do I make my bot say "made by yejin.luvs"??
where do you want to do that exactly?
in the activity like these
check this faq thread https://discord.com/channels/222078108977594368/1142187561729658942
it says unknown
click it
ah ok ty
I am getting this error
Seems like you're trying to set the presence before the client is actually logged in
You can either:
A) Move that code into an event listener that would emit when the client is ready
B) Use the presence option in the Client constructor instead to specify the presence to have upon login
Alright! I'll give that a go!
uhhh now it's saying client not defined
Hi, anyone else had issues where subtext (-#) in an embed description seems to randomly truncate on some occasions - not always?
It just cuts off so far through the text, and not always at the same position and sometimes not at all. It’s as if the embed is sometimes being sent before it’s fully created (I know this won’t be the issue but just helps to understand what’s happening)
sounds like one of the embed bugs going on. you should ask in dev server
if thats the actual error, it should be pretty easy to figure out how to solve that
by defining client
right
but just confused on why it's undefined that's all
you said it wasn't defined, not undefined
Ok will do, cheers
same thing sorry lol
its not
can you show your code please?
const { ActivityType, Client } = require('discord.js');
const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
] });
client.user.setPresence({
activities: [{
type: ActivityType.Custom,
name: "made by yejin.luvs",
state: "💕"
}]
})```
i thought you said the error says "client is not defined" ?
just put the presence inside the client constructor
I did
either you didn't save your code, or something else is wrong
But i fixed it after you told me to define it 😭
sorry I'm new to discord.js so i am confused
how?
like this?
const { ActivityType, Client } = require('discord.js');
const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
setPresence({
activities: [{
type: ActivityType.Custom,
name: "made by yejin.luvs",
state: ":two_hearts:"
}]
] });```
ClientOptions#presence discord.js@14.25.1
Presence data to use upon login
Default value: {}
huh? Sorry that confused me more
ClientOptions is the things you put in the new Client() constructor. presence is just a new value you can add, and the docs show you what is allowed there
replace setPresence with presence: {...}
Tyyyy
you also put setPresence in the intents array. which would cause issue
okie
const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
presence: {
activities: [{
type: ActivityType.Custom,
name: "made by yejin.luvs",
state: ":two_hearts:"}
] });```
you set the presence inside the intents array
move it outside the array
ohhhhhhh I am so stupid
so it would be
const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
]
presence: {
activities: [{
type: ActivityType.Custom,
name: "made by yejin.luvs",
state: ":two_hearts:"}]}
});```
try it
you forgot a comma after the array
this is really basic js stuff
sorry I am really new to coding 😭
thanks so much tho 😭
Are you using Integrated Development Environment(IDE) like VSCode?
Yes normally I do, but I am coding inside of my hosting service rn as I am on my friend's pc and they don't have it
hmm, do mentions not work in embed footers?
const fixedEmbed = EmbedBuilder.from(embed).setFooter({
text: `✅ ${lobbyCode} - setup by <@${interaction.user.id}>`
});
they do not
bummer 
ty
You may want to look at containers and components. V2 if embeds are not working the way you want.
Display Components
While you might be familiar with embeds in Discord, there are more ways to style and format your apps messages using display components, a comprehensive set of layout and content elements. To use the display components, you need to pass the IsComponentsV2 message flag (in docs: MessageFlags) when sending a message. You only need to use this flag when sending a message using the display components system, not when deferring interaction responses.
thank you, I just found the doc page about it, yea, I am gonna ditch the footer and just make a simple text display component instead and replace it once the lobby id is being set, thanks 
I assume mentions work there 
Yes mentions work in Text Display components.
You can also use subtext(-#) markdown in the Text Display to get a footer like text
is there a way to only have 2 inline fields next to each other?
I was looking through the display component doc expecting to find a solution there, but didn't 👀
I need to display 5 elements and showing 2 next to each other would like nice, while 3 looks awful
Inline field do not exist in components V2
hmm and embeds probably can only do 3 in a row?
correct also they are not displayed in line on mobile at all
thanks for the help 👍
I cheated the system by inserting empty inline fields as 3rd element
somewhat works
{
name: ' ',
value: ' ',
inline: true
}
What is this error due to;
DiscordAPIError[50035]: Invalid Form Body
components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
can you give the full error trace
your missing the cv2 flag
add flag 'IsComponentV2' ig
Thanks :)
that did not send like I wanted but IDK it is MessageFlags#IsComponentsV2
One more thing, does pinging a role inside of a component ping the members and if so how do you disable it again? 
You can control which entities receive notifications via the allowedMentions option. You can:
- Set a default on the client
- Set for a specific message
- Use the
repliedUserkey to disable in-line reply mentions
{ ..., allowedMentions: { parse: ["users", "roles"] } }
Thanks again
Why can't I use the send method on a channel I fetched?
include "as TextChannel" if u using typescript
I did
Ideally don't do that - use the proper typeguards
documentation suggestion for @tiny condor:
BaseChannel#isSendable() discord.js@14.25.1
Indicates whether this channel is sendable.
am using it lol
Well no I just used isTextBased, however there is no send method on the channel apparently
const rewardChannel = await client.channels.fetch(config.rewardChannelID);
if (rewardChannel && rewardChannel?.isTextBased()) {
await rewardChannel.send();
}
Yea, and that'll break as soon as you get a channel that's not actually a TextChannel - you're effectively lying to TS
It just says .send doesn't exist
Because group DM channels are text-based channels, yet bots/apps cannot send messages to them

ohh <3
oh ok
its good rn?
nvm i fixed ts
I'm confused about this, so if I don't provide an allowed mention and ping a role will it not ping it?
if you mean setting empty object. no it wont ping anything. if just not specifying allowedmention, it will mention
so I need to specifically set it to empty for it not to reply
if you dont want to mention anything you do an empty object yes allowedMentions: {}
thanks guys
why we didnt think about ts
WAIT, can a bot wear a guild tag? 😭
no
awe
nah bro 💀
getchannel has an override getChannel('name', false, [ChannelType.GuildText, ChannelType.AnnouncementThread])
What was the format to mention a command again?
will it return null or something if its not the channeltype?
I don not know it can return null tho
It'll throw an error of CommandInteractionOptionInvalidChannelType
im lazy to read the whole docs lol
Is MessageManager#fetch() able to get more than 100 at once or not?
thats the max limit. but this might be helpful for you https://discord.com/channels/222078108977594368/1202608431685566464
Alright, ty
I can't figure out why I'm getting can't send empty message error - I'm sending a component and I've sent component only before. Log also shows that I have a component when using console.log
const selectedGuide = interaction.options.getInteger('search');
const componentOutput = getComponentsV2Output(guides[selectedGuide]);
console.log(componentOutput);
await interaction.reply({
conponents: [componentOutput]
, flags: [MessageFlags.IsComponentsV2]
});
},```
```function getComponentsV2Output(data) {
const container = new ContainerBuilder().setAccentColor(3890348);
const guideText = new TextDisplayBuilder().setContent(data.output);
const guideButton = new ButtonBuilder().setLabel(data.name);
guideButton.setStyle(ButtonStyle.Link);
guideButton.setURL(data.output);
const guideSection = new SectionBuilder().addTextDisplayComponents(guideText).setButtonAccessory(guideButton);
container.addSectionComponents(guideSection);
container.addSeparatorComponents(separator => separator.setSpacing(SeparatorSpacingSize.Large));
const feedback = new TextDisplayBuilder().setContent(`-# If you have any questions, feel free to ask in https://discord.com/channels/332595657363685377/400499160094212097\n-# If you have any suggestions, feel free to leave one in https://discord.com/channels/332595657363685377/1060257606217773057`);
container.addTextDisplayComponents(feedback);
return container;
}```
conponents
I’m not sure if you’re aware, but n looks an awful lot like m
thanks haha
Is it possible to fetch a user's bio? Turns out they aren't exposed in the API to a bot
That is correct
actually you can fetch user bio but...
make ur bot request https://discord.com/api/v9/users/<ID>/profile with GET method (need user token, not BOT token)
and discord will return ts
{'user': {'id': '1412061438088056884', 'username': 'ui3gyyruiwhebr', 'global_name': 'strange', 'avatar': 'cf4aa61698971c1f92a81845aaa32a9c', 'avatar_decoration_data': {'asset': 'a_74b145b3ce94b0a728ee24d1724848b1', 'sku_id': '1441168457424048150', 'expires_at': None}, 'collectibles': None, 'discriminator': '0', 'display_name_styles': {'font_id': 10, 'effect_id': 2, 'colors': [16095292, 15031015]}, 'public_flags': 0, 'primary_guild': None, 'clan': None, 'flags': 0, 'banner': None, 'banner_color': None, 'accent_color': None, 'bio': 'nothing here.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ngo away'}, 'connected_accounts': [{'type': 'domain', 'id': 'nstore.lol', 'name': 'nstore.lol', 'verified': True}], 'premium_type': 2, 'premium_since': '2025-11-10T22:50:21.886422+00:00', 'premium_guild_since': '2025-11-10T22:52:26.570000+00:00', 'profile_themes_experiment_bucket': 4, 'user_profile': {'bio': 'nothing here.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ngo away', 'accent_color': None, 'pronouns': '', 'profile_effect': None, 'banner': None, 'theme_colors': None, 'popout_animation_particle_type': None, 'emoji': None}, 'badges': [{'id': 'premium', 'description': 'Subscriber since Nov 10, 2025', 'icon': '2ba85e8026a8614b640c2837bcdfe21b', 'link': 'https://discord.com/settings/premium'}, {'id': 'guild_booster_lvl1', 'description': 'Server boosting since Nov 10, 2025', 'icon': '51040c70d4f20a921ad6674ff86fc95c', 'link': 'https://discord.com/settings/premium'}, {'id': 'quest_completed', 'description': 'Completed a Quest', 'icon': '7d9ae358c8c5e118768335dbe68b4fb8', 'link': 'https://discord.com/discovery/quests'}], 'guild_badges': [], 'widgets': [], 'mutual_guilds': [{'id': '1341051489233403944', 'nick': None}, {'id': '684293554918391815', 'nick': 'YunaSoCool'}, {'id': '1432362610052829297', 'nick': None}, {'id': '806501704702754846', 'nick': None}], 'legacy_username': None}
and you can get the user bio rn
No? you I'm saying your bot cannot get it. That will require a user token thus it's not a bot
yh, cause im thinking u need a way to fetch user bios so i giv ts
(my english bad sorry)
This is also against Discord's developer ToS which does not allow any sort of automation of user accounts their tokens
yh no selfbot allowed but i didnt see any bans from discord about selfbot
This is my code and this is what I get
if (customId === 'other'){
type = 'other';
openingMessage = 'Thank you for opening a ticket! Please state the reason for you opening this ticket.';
const channel = await interaction.guild.channels.create({
name: `${type}-${interaction.user.username}`,
type: ChannelType.GuildText,
parent: '1440591960116166767',
permissionOverwrites: [
{ id: interaction.guild.id, deny: ['ViewChannel'] },
{ id: interaction.user.id, allow: ['ViewChannel', 'SendMessages', 'ReadMessageHistory'] },
{ id: '1442258475408294061', allow: ['ViewChannel', 'SendMessages', 'ReadMessageHistory'] },
],
});
await interaction.reply({
content: `Your **${type}** ticket has been created: ${channel}`,
ephemeral: true
});
await channel.send({
content: '<@${interaction.user.id}>\n${openingMessage}',
components: [closeButton],
});
return;
}```
That doesn’t make it okay
bro change '' to ``
You have to use backticks in the content
oooh mb
thx smmm!
umm sorry I just got this massive error
You provided an invalid value for setDefaultMemberPermissions
Don’t wrap the Permission/BigInt in an array
ohhh damn okay tysm!!!
Use the pipe (binary or operator) if you want to combine multiple
alrighty!!!
also my deploy-commands.js won't deploy this command for some reason
const {
SlashCommandBuilder,
PermissionFlagsBits,
} = require('discord.js')
module.export = {
data: new SlashCommandBuilder()
.setName('mail')
.setDescription('send mail to the mail channel')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption((option) => option.setName('content').setDescription('what do you want to send as mail?').setRequired(true))
.addUserOption((option)=> option.setName('staff').setDescription('who is sending the mail?').setRequired(true)),
async execute(interaction) {
const client = interaction.client;
const channel = client.channels.cache.get('1445290740640120902');
const content = interaction.options.getString;
const staff = interaction.options.getUser;
await interaction.reply({
content: `message sent!`,
ephemeral: true,
})
await channel.send({
content: `
# :1000049622: NEW MAIL
${content}
Thank you,
${user}
[<@&1441432047934509186>]
`
})
}
}```
Is there an error?
no it just keeps reloading my other 2 and not including this new one
oh wait nvm there is
You misspelled exports
module.exports = …
ohh my god, i feel stupid. I am so tired... tysm again 💕
ummm help 😭 I didn't wanna come back but whatttt
waittttt is it cus i am missing js interaction.reply()
u use or u want bot reply u use interaction.reply not use send in channl
``` content: "t"
oh okk
I want it to send to a channel but reply with what the options are
use interaction.reply send message to u
use channel.send send message to select channl
I know that but I want the options to be in the response but I got this instead
exaple:
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to use for broadcasts")
.setRequired(true)
)
.addUserOption((users) => users
.setName('staff')
.setDescription('who is sending')
.setRequired(true)
),
execute(...) {
const chatInputInteraction = interaction as import("discord.js").ChatInputCommandInteraction;
const channel = chatInputInteraction.options.getChannel("channel") as TextChannel
const staff = chatInputInteraction.options.getUser('staff')
}
Sorrryyyyyyyyyy
but tysm 😭
it still didn't work 💀

What is it doing vs what you actually want it to do? What's your current code?
const {
SlashCommandBuilder,
PermissionFlagsBits,
ChatInputCommandInteraction,
} = require('discord.js')
module.exports = {
data: new SlashCommandBuilder()
.setName('mail')
.setDescription('send mail to the mail channel')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption((option) => option.setName('content').setDescription('what do you want to send as mail?').setRequired(true))
.addUserOption((option) => option.setName('staff').setDescription('who is sending the mail?').setRequired(true))
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("where is the mail going?")
.setRequired(true)
),
async execute(interaction) {
const client = interaction.client;
const content = interaction.options.getString;
const staff = interaction.options.getUser;
const chatInputInteraction = interaction;
const channel = chatInputInteraction.options.getChannel("channel")
await interaction.reply({
content: `message sent!`,
ephemeral: true,
})
await channel.send({
content: `
# :1000049622: NEW MAIL
${content}
Thank you,
${staff}
[<@&1441432047934509186>]
`
})
}
}```
my current code and what it's doing
I just want it to send a message to the mail channel and reply with the options
You aren't calling the methods
You're doing it for getChannel, so I don't know why you wouldn't also do it for getUser and getString
oh cus @short granite helped me
you fix getChannel('...') getUser('...') getString('...')
💌 NEW MAIL
Hello
Thank you,
@User
@MailRole
yh I got it tysm
sorry for the trouble 😭
How can I track user voice time every minute?
wdym by user time
Track user voice time every minute
Discord doesn't send when they joined a voice channel if they left that channel so you'll need to track it on your own logic
documentation suggestion for @flint pier:
(event) Client#voiceStateUpdate discord.js@14.25.1
Emitted whenever a member changes voice state - e.g. joins/leaves a channel, mutes/unmutes.
Is creating a Guest Invite to a voice channel not allowed for bots to do at all?
(status 400 Bad Request): {"message": "Invalid Form Body", "code": 50035, "errors": {"flags": {"_errors": [{"code": "GUILD_INVITE_CANNOT_CREATE_GUEST_INVITE", "message": "Cannot create a guest invite for this server"}]}}}
I use interval and see which user is on voice then add to map like that but it is not optimized
You can use voiceStateUpdate to hold when they joined a channel and when they leave you use that data to calculate how long they were in that channel
should be, as long as it's available for the server
The bot has invite permissions, and I am able to create guest invites myself. The bot however can't
https://discord.com/developers/docs/resources/channel#create-channel-invite
Looks like the flags option isn't even there
very sad, redundant limitation
oh, that's not temporary, right
guest immediately removes them when they leave the VC?
Yesss, that's the one
what's the precondition for that to be available anyways? don't think that ever rolled out widely
It also prevents them from reading any @ everyone channels, which is very enticing and a very cool feature overall
The idea is to give members a guest invite bot so I don't have to give them full invite permissions
what's that looking like in the ui?
Filter: Server does not have a vanity URL and Server member count is in range 1 - 200
i see
Invite as Guest. It only shows up when you invite someone directly to a voice channel
wait, but my test server should have that 
My plans foiled by the API once more 
ah, now i can repro, yeah, indeed, seems to be disabled for bots
what a shitty error
love how you cannot tell in the UI either...
Tried something to no avail, seems to literally only work on the Discord client itself. TRASH
Oh well, trashing that idea :3
or how it generates an invite when you just open the menu and then generates another one if you click on edit invite
i would've thought this has become less jank over the past.. what... 3* years since i looked into invites in depth

Yeah you always end up with double invites, dumb. Anyway thanks for the talk have a nice day <3
Hey, I'm still having this problem. Has anyone encountered a similar issue or knows how to fix it?
dont think theres just a fix for this. you have to avoid working with such large file uploads
djs v15?
You also need enforceNonce: true
Doesn't exist yet, what was your question?
nvm im not a good reader, i opened the guide with an old link and it launched v15 page
wow we have djs v15 before gta6
please keep unnecessary comments to yourself
Now nothing has been sent at all...
The problem only occurs with large files.
const nonce = Date.now().toString();
try {
const attachmentsToSend = Array.from(proofs.values());
await message.reply({
content: `Proofs (${attachmentsToSend.length}):`,
files: attachmentsToSend,
nonce: nonce,
enforceNonce: true
});
} catch (error) {
console.error(error);
await message.reply({
content: ":x:"
});
}
[AbortError]: This operation was aborted
at new DOMException (node:internal/per_context/domexception:53:5)
at AbortController.abort (node:internal/abort_controller:395:18)
at Timeout.<anonymous> (/root/discord-bot/node_modules/@discordjs/rest/dist/index.js:715:47)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
What’s the total size of all files when it does this?
1 file - 90MB
Does the guild have lvl 2 boost?
Yes, I can upload up to 100 MB
You could increase the timeout in ClientOptions.rest.timeout
Default is 15000 ms (15 seconds)
new Client({…, rest: { timeout: … } })
It worked, thank you so much ❤️
?
Is there a way to track user's primary guild changes? Like a event or something like that
userUpdate event
Alright thanks
<@&839912195994812420>
Working with the messageUpdate event and I see it often doesn't emit on old messages. I found that it will only emit for messages that were sent AFTER the bot started.
I'm guessing this is something with caching and the partials but is there any way I can get around this restriction?
I know discord doesn't send message data unless explicitly fetched unfortunately so I think my options are really slim, but that would be a massive turn off if you restart the log bot and then you miss a bunch of edit events, even some potentially important ones for moderation
To clarify, I don't care if oldMessage is not in cache, I just want to know IF a message was updated
partials are how you get around the restriction
Ah, thought those were only used for missing data, like messages in DMs lol
well you have missing data, the old one
That's fair lol
Odd question but what event triggers first on a user ban in a guild, guildBanAdd or guildMemberRemove?
Generally speaking there isn't a "first"
Event sequencing isn't a guaranteed thing
Ah, hmm, is there a rate limit for fetching the banned users list from a guild? Noticed its not cached.
Everything has rate limits, yes
But the GuildBanManager does have a cache, so you should only need to fetch once
hey am I doing something wrong here? https://pastebin.com/4bjW2xNZ
its not seeming to detect a user equipping or unequipping a tag accurately
Do you have User partials enabled? discord.js wont always know the previous state of a user's tag (and wouldnt know in a partial either, but at least it would emit)
I do have it indeed
Should I change something about how I check it?
The only reliable, complete user object you have is the new one
So if they change it you should know what its set to, but not what it was before
I do have it saved as a value on my database so I could just check if they have it claimed already ig
Okay thanks didn't actually know that
You'd only know what it was pre-update if the user was previously cached
So you need to consider that in your checks
I'll just check the new user and compare it to my data
I've made my app user installable, and I've set a command to be used within a DM, as such:
builder.setContexts(InteractionContextType.Guild, InteractionContextType.PrivateChannel, InteractionContextType.BotDM)
However after installing the app at the user level, I can't see any commands when interacting with it via DM
Oh nevermind, it's because the command is not global, but rather scoped to a specific guild
Do I need anything else other than setting the GatewayIntentBits.GuildMembers intent and enabling it in the developer portal in order to receive guildMemberUpdate events?
the Guilds intent
and I think that's about it
also partial if you didn't have the member cached beforehand
in case you want to know what intents are needed for other events, https://discord.com/developers/docs/events/gateway#list-of-intents comes in handy. it shows all the events that each intent is associated with.
If the old user isn't cached a change in guild tag will emit a GuildMemberUpdate, not a UserUpdate (because djs won't be able to determine it's the user that got changed, not anything guild specific)
i have a question about userselects in interactions in a guild are those getting fetched automatically or could they be just partially there ?
Discord sends resolved data along the interaction like that
ohh so that's why some people said it's guild event alr thanks guys
[EVENT] guildMemberAdd error: SocketError: other side closed
at TLSSocket.<anonymous> (/home/container/node_modules/undici/lib/dispatcher/client-h1.js:701:24)
at TLSSocket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'UND_ERR_SOCKET',
socket: {
localAddress: 'IP',
localPort: 46922,
remoteAddress: undefined,
remotePort: undefined,
remoteFamily: undefined,
timeout: undefined,
bytesWritten: 56546,
bytesRead: 19794470
}
djs module errors
http client error for discordjs
Nothing caused by discord.js
did you fix it ?
ye
Which sharding is good for discord jsv14v?
Internal sharding is good to start out with because you don't really have to change your code, but traditional sharding is recommended when your bot gets to 10k guilds because of the resources needed
Does someone know how to make the bot "on mobile"? I know it never was documented, but does someone know how?
I am creating bot using mobile
no it's not that
d.js doesn’t support undocumented stuff, and we do not provide support/help for it here too
you need to find out yourself or ask elsewhere
i mean the mobile status
It is against Discord's tos to have a bot/app appear with the mobile status
How come
It is incorrect uses of the API
Therefore it is left it undocumented and unsupported by discordjs
0 bots got banned because of that
That is not relevant. To where djs supports it.
discordjs use it tho
Errors such as ECONNRESET, ConnectTimeoutError, SocketError: other side closed indicate a network issue
- Free or shared hosting providers often come with significant limitations
- Another indication of these issues are 'Unknown Interaction' errors.
Is there an alternative to learning to DJs?
Can you rephrase that question?
The alternative to learning would be not learning but then you won't know how to use djs
sorry, thanks for the response
Hello guys, i want to ask how can i get member about me
That information is not available to the bot api
so even with REST?
it’s not available in the api at all
ok, thanks bro
But like it says, the other side closed connection
Not discord.js
how to view the tag of user
like mine is GOAT
documentation suggestion for @mellow frigate:
User#primaryGuild discord.js@14.25.1
The primary guild of the user
How can I track post creations in a **forum ** channels? Is it the thread create event or channel create or none
(event) Client#threadCreate discord.js@14.25.1
Emitted whenever a thread is created or when the client user is added to a thread.
wdym with most post creation? "channels" in forum channels are threads so that falls under the threads category
forum channels are not threads, they're channels that hold threads
So all the posts in a forum channel are treated as threads? Thanks
Yes
It is possible to use ChannelSelectMenuBuilder in a specific guild ?
you mean only channels from that guild? no. you can only set the channeltypes from current guild
an alternative is using a StringSelectMenu to allow the option to choose channels (as a string) from a specific guild
Yeah but there is a limit :/
you cannot provide channels to the channel select
you could always just use the ChannelSelectMenu in the server in question rather than in another server / DM
it's auto populated
with channels from the current context - the guild it's used in
at best you can specify the channel types
Yeah, it was to be sure
I'm getting an error when using interaction.awaitModalSubmit:
TypeError: undefined is not an object (evaluating 'next.components.forEach')
Code:
const modal = buildFilterModal(type, currentFilters);
await interaction.showModal(modal);
const modalSubmit = await interaction
.awaitModalSubmit({
filter: i => i.customId === `filter_add_${type}`,
time: 900_000, // 15 minutes
})
Am I doing something wrong? Modal shows correctly, but it breaks when I try to click "Submit"
what does your modal look like and what djs version are you on
npm ls discord.js
14.22.1
the new modal components were supported on 14.23.0
update to latest
I assume you're using them
Yes. Thank you, lemme try
also in case buildFilterModal uses @discordjs/builders (since you can't import them from djs, labels don't exist on your version), you should import from discord.js instead
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
[0;31mnpm [0;0muninstall discord-api-types @discordjs/rest @discordjs/builders
[0;34myarn [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
[0;33mpnpm [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
@rose tangle updating the package fixed the problem, thank you! Now I get different errors, but they actually make sense so time to fix my code 😄
would anyone know why my context menu command works in all channels but one for my server? i have ensured that its allowed under the integration permissions for that channel, but when my users go to use it, it just says "no commands available"
Did you deny the "use application commands" permission on that channel?
No, but let me try granting it specifically
^ that worked! not sure why it matters for only that channel,,,
Probably because you either allow it on those others directly or at category level or because you deny it for that channel or category for some role they have (could also be everyone role)
Hi
I have a interaction.reply like this
const replyMessage = await interaction.reply({ content: GreetingHelper.generalChannelGreeting(interaction.channel as TextChannel, interaction.user, interaction.targetMessage), embeds: embeds, files: files ?? [], components: [row], withResponse: true, });
I'd really like to add a space between the content and the embed. I've tried adding a new line (\n\n) to the string returned from generalChannelGreeting, and also tried adding the newline directly to the end of the content: property using string interpolation with no joy.
is it possible to ping a role every 6hrs (example a revive ping)??
Why wouldn't it be possible?
Not sure just wanted to double check
Sounds annoying as fuck but its possible
How would I do this? Also how come would it be annoying?
Just start an interval that sends a message to ping the role
I would hate being pinged every 6 hours just because I have a role
I'm not sure I can explain why being pinged every 6 hours would be annoying if that isnt already completely obvious to you
4 pings a day, I'm going to be sleeping for at least one, working during at least one
Oh it's a revive role that you can get... it's optional and tbh yh maybe 6hrs is bad. 12hrs could be better or every 24hrs
Keep in mind that notification fatigue is a real thing. If you get pinged consistently you're eventually going to stop caring about said ping. It's an issue with most "reminder"-type things in software.
ah okay. This was a valuable lesson. thanks! Maybe I won't use it then :3
I'm not sure I understand the "revive role" concept, is it a way to like, force people to talk?
if its opt in then I guess its their own doing and its fine?
I'm guessing it's like, pinging people in a chat to "revive" it if it's been dead for a while. But me personally I would not start chatting somewhere just because a bot pings me
Yh a revive role is where you have it, you get reminded to revive the chat
Sometimes it works great
in that case it might be better to just set a wait period in the chat itself, like if no message has been sent for x amount of hours, then send the ping. Otherwise the bot might ping people when it's not needed.
Interesting, I feel like it would just encourage low quality chat rather than there being something interesting that I want to engage in
Anyway while I'm here. Would it be possible to create a command to delete a channel and send a transcript to the person who opened it without options
Should be, yeah
OHHHH THAT'S POSSIBLE?!?!
Most things are possible, it's just about implementing them in a way that makes sense within the borders of Discord
and abiding by rate limits and such
Okay! I am guessing it would include variables?
I mean... every program does?
Well yeah sorry I meant custom
Depends. If it's just for your own server you can hardcode values. If it's per-server you'd need some kind of database to store server settings that can be changed.
Alright! If it's just for my own server. How would I do it. This is how it works so far:
- when a button is pressed a channel is created (ticket system)
- includes a close button
- includes a close slash command which sends a dm with transcript (only the person who opened can use)
However I want to make a close command that staff can use to close the ticket with a reason --> then sends the transcript and reason for closing the ticket to the person who opened it
I mean you basically described the implementation yourself. A command that takes a reason as an argument, extracts a transcript and then sends said transcript along with the reason to the person. Keep in mind that if the person has disabled DMs from the server your bot won't be able to DM them either.
Yh that's not a problem. I just don't know how to send it to the person w/o using the user option
You'll need some way for the bot to remember who created the ticket then. Either store the ID/User object in a map with the channel ID, or if you want persistence, use a database.
database?
Some way to store data outside of your bot's code/memory. Like MongoDB or PostgreSQL.
Otherwise the data will be lost when your bot restarts. But I'm assuming you're a beginner, so a database might be a foreign concept and hard to grasp initially.
Basically if you want to save data persistently in any program, a database is the way to go. Technically you could just use files to read and write to, but that's a very unstable way of doing it. Databases handle a lot of things for you like concurrency, data validation and corruption prevention.
Yh I'm like 100000000x beginner lol
Oh okay so like when a ticket/channel created it stores the user Id which then the new command can grab
Yes, so on a very basic level it'd be something like
// when the user creates a ticket
storeCreator(channelId, userId);
// Maps channel ID and user ID somehow
// ...
// when an admin closes the ticket
const creator = getCreator(channelId);
// send a DM to the creator...
ahhh tyyyysm!! So all I would need to is setup a database?
You can give it a shot. I'd recommend either MongoDB or SQLite since those are fairly easy to wrap your head around. SQLite maybe even more since it's just a file and doesn't require another service to run alongside your bot.
But it takes time to learn and understand, it's not something you'll totally get right away or within a week
oh okayyy my hosting service I have also has this?
No idea what that is, but maybe
also would this go in the button command or a new file?
Up to you
oki
oh so it don't matter where I put the store thingy
I mean it doesn't matter where you put anything in your code, it's just about structure and intent
alr
tysm again --> you've been a big help 💕
sorry me again..
would this be correct?
const creator = getCreator(channelId);
await channel.delete(creator);```
there's no channel.delete
and what is "creator"
what are you trying to do exactly?
oh okay
^^^
i thought channel.delete cus of interaction.channel.delete
or well, there is but it doesn't take a "creator"
it deletes the channel
on that message you quoted there's a lot of things, I'm not sure which part you're doing
trying to use database to grab userID who created the ticket so staff can close ticket and still send transcript to them
and where would this be in that process
what exactly are you trying to achieve with that code, so I can suggest whether it looks right
delete the channel created and send transcript to who opened the ticket
lemme grab my whole command so far
djs doesn't do transcripts
you'll need some other package for that
no I added smth
onst { SlashCommandBuilder, AttachmentBuilder } = require('discord.js');
const creator = getCreator(channelId);
module.exports = {
data: new SlashCommandBuilder()
.setName('close')
.setDescription('close current ticket')
.addStringOption((option) => option.setName('reason').setDescription('What is the reason of closing?')),
async execute(interaction) {
const logChannel = interaction.client.channels.cache.get('1442221654343417918');
const user = interaction.user;
const messages = await interaction.channel.messages.fetch({ limit: 100 });
const transcriptText = messages
.reverse()
.map(m => `[${m.createdAt.toLocaleString()}] ${m.author.tag}: ${m.content ?? '[No content]'}`)
.join("\n");
const attachment = new AttachmentBuilder(Buffer.from(transcriptText), {
name: `transcript-${interaction.channel.name}.txt`
});
await logChannel.send({
content: "New Transcript:",
files: [attachment]
});
await user.send({
content: "Here is your ticket transcript - from chonsa~",
files: [attachment]
}).catch(() => {
console.log("User has DMs closed.");
});
await channel.delete(creator);
}
};
is that copied incorrectly or why is the const creator at the top
nope I put there
I am used to putting const at tops 😭
that doesn’t make sense because channelId isn’t defined in that scope
neither is getCreator
plus you'd only want to get the creator when the command is executed, not when that .js file loads
that is defined in index.js
ah okay so i'll put it into the command 🙂↕️
you have to import that. it doesn’t define itself
oh oki
how would I do that 😭
I'd recommend defining it in another file and then make both depend on that
I know how to do it when it's not in a folder bu this file is
ah oki
otherwise your index.js may depend on that file, but that file depends on index.js, so it's a circular dependency
you mean how to go one folder up?
you add a ../
if up means back then yh
I'm not sure whether you wrote that code yourself since you seem to be lacking js/node fundamentals, we don't advise writing bots without knowing that or you'll have a hard time
I wrote some of it myself. Some was with help of a tutorial
if you know js/node and a bit of djs you should be able to write that command without the need of one
Having a good grasp of js and node basics is really essential before writing a bot, otherwise you're just going to guess your way to a half-working solution and you won't understand most answers given to you here.
Alrighty!
they said it's MySQL btw :3
What databases are good for Discord.js?
any
Whatever db is good for your project
I use sqlite for dev and MySQL for prod, so yeah, anything is good
okay, thanks
The database you choose doesn't depend on discord.js, it depends on what kind of data you're going to be storing and how your app works.
hi is there a link to a repo with the template from the guide including the handler and everything?
it’s on github
but you can easily follow the guide on event and command handling
i'm looking at the monorepo but it just seems to be the webpage source
not even
it’s been archived
it’s best to follow the guide since that is the most updated
i see, thank you
i don’t know why it’s been archived to be honest, but i guess i’ll find out at some point
yeah only archived very recently
got a general idea when v15 might get a stable release?
could be related if that's expected soon
what's the messages.fetch count limit, 100?
i thought it was archived because the guide is part of the discord.js monorepo now
https://github.com/discordjs/discord.js/tree/main/apps/guide
yes, the maximum number of messages that can be fetched in a single request is 100
Messages Resource - Get Channel Messages GET channels/{channel.id}/messages
Retrieves the messages in a channel. Returns an array of message objects from newest to oldest on success. If operating on a guild channel, this endpoint requires the current user to have the VIEW_CHANNEL permission. If the channel is a voice channel, they must also have the CONNECT permission. If the current user is missing the READ_MESSAGE_HISTORY permission in the channel, then no messages will be returned.
splendid thank you x
that’s why, thanks

nvm
you defined that inline function but you're not calling it
and that isn't related to djs
oops really mb
typically speaking...if something is not logging at all, then it's a JS issue, not a DJS issue
DJS does not silently error in any way...you will always get some kind of error message if something goes wrong
what if my djs is shy
Buy it dinner
I'm new to this if Ive created script for a bot how exactly to I get it onto my discord server?
guide suggestion for @topaz birch:
Adding Your App
After you set up a bot application, you'll notice that it's not in any servers yet. So how does that work? Before you're able to see your bot in your own (or other) servers, you'll need to add it by creating and using a unique invite link using your bot application's client id.
I don't know how to find that or get a bot token
Then go back one page on the guide
I'm trying to figure it out lol first timer.
context menu commands don't take options like slash commands do right?
you have to build action rows in the reply of context menu commands
so if I already have logic for a slash command (handling the options part), I would need to re-make that for the context menu command
You can also show a modal instead of replying
yes, so I need to handle the inputs separately (as in can't re-use my slash command code)
Yea
how to create embed like this?
Display Components
While you might be familiar with embeds in Discord, there are more ways to style and format your apps messages using display components, a comprehensive set of layout and content elements. To use the display components, you need to pass the IsComponentsV2 message flag (in docs: MessageFlags) when sending a message. You only need to use this flag when sending a message using the display components system, not when deferring interaction responses.
a container with no accent color
text component (heading, code block markdown)
separator
section with text + disabled button (secondary style)
media gallery with 1 image
separator
text component (subtext markdown)
separator
actionrow with link button
const sound = await guild.soundboardSounds.fetch(targetId!).catch(() => null);
console.log(sound);
if (sound) {
await sound.delete(
`Shield - Unauthorized SoundBoard Sound Creation by ${executorId}`
).catch((err) => { });
};
doesnt work
catch your errors and see what they say
You're going to need to elaborate on doesn't work. Could you please provide the error that occurs?
TypeError: sound.delete(...).catch is not a function. :/
put it inside a try catch block then
if (sound) {
try {
await sound.delete(`Shield - Unauthorized SoundBoard Sound Creation by ${executorId}`);
console.log('Worked');
} catch (err) {
console.log(err);
};
};
response:
Collection(6) [Map] {
'1429181132556996760' => SoundboardSound {
soundId: '1429181132556996760',
available: true,
name: 'bombo'.......
Worked
I think the fetch function is broken :/
Because 6 data are coming, all the sound panels on the server are rotating, there is a type error as far as I understand
your sound is a collection, not an individual SoundboardSound
collection does have a delete method, but it's not async, thus your error
solved, the targetId was coming as null in the audit log, which was ridiculous. I got the id from the changes section.
Your ! assertion here tells you why
Don't assert something as non-null if you don't 100% know it isn't. Else it leads to things like these
But shouldn't the soundId be redirected as targetId as well?
Your code tells me nothing about how targetId is defined, so can't really answer that
While I can get the id value from targetId in all other operations, why do I need to get it from the changes section in the sound panels?
async SoundBoardCreate(entry: GuildAuditLogsEntry<AuditLogEvent.SoundboardSoundCreate>, guild: GuildType) {
await ClusterService.whitelist.inc(entry.executorId!, 'SoundBoardCreate');
const {
executor,
executorId,
targetId,
changes
} = entry;

how would i check if a user has no avatar because displayAvatarURL will always show url. do i use user.avatar instead?
yes
thanks
its probs been asked but will the display name style be accessible? or will it come with V15?
As of right now, the intention of v14 is to support all API features when able
We will provide it if/when Discord documents it in the API
How many nested sub commands can you have in a command?
Can you do this:
Command
Sub1
Sub1.1 fieldA fieldB fieldC
Sub1.2 fieldX fieldY fieldZ
Sub2
Sub2.1 fieldA fieldB fieldC
Sub2.2 fieldX fieldY fieldZ
```Or does it only extend to 1 sub-command
you can use subcommandgroups
command
- subgroup
- subcommand
- options
but nothing more than that
That's fine, that's what I'm showing above, I'm pretty sure, and that's all I'll need. ty
Can bots check something on GuildMember to get the info about if they agreed to the server rules popup? is it something i can get with djs?
that would be the member flag CompletedOnboarding iirc
GuildMemberFlags#CompletedOnboarding discord.js@14.25.1
Member has completed onboarding
hello i am creating a trascript for ticket, using discord-html-transcript. and how can i mention a member that created the ticket after closing the ticket channel?
i have tried memberOverwrite.username but it sent a undefined. and without it, it is a object.
const overwrites = channel.permissionOverwrites.cache;
const memberOverwrite = overwrites.find(po =>
po.type === 1 && // 1 = Member (User)
po.allow.has('ViewChannel')
);
const rawTranscript = await discordTranscripts.createTranscript(channel);
const container = new ContainerBuilder()
container.addTextDisplayComponents(
new TextDisplayBuilder().setContent(`${interaction.user.username} has closed ${memberOverwrite}'s tเᥴkꫀt.`),
new TextDisplayBuilder().setContent(`— thank you for᥉hꪮρρเᥒg @ kᥲᥣkᥡ’᥉ !`)
)```
i'll try with that one, thanks
have you tried memberOverwrite.user.username? because i think it returns member object not user
yes i have tried it, its sending me an error that username does not exists.
also youd usually wanna work with a db for these kind of stuff (the overwite wont exist if user leaves for example)
got it, i will try to use my sql and just cache it so i wont fetching it outside everytime. thank you
for mention ig u should try allowedMention
ok thats on channel's perms right?
ok ive looked and overwrites dont contain member or user objects. you can get user/role id from it and then find it in the guild
you want mention in message...
ohhh thank you lemme try that.
You need their user ID, not their username
userMention discord.js@14.25.1
Formats a user id into a user mention.
oh i see lol
ohhh thank you @tardy sable, its working now.💝 
const overwrites = channel.permissionOverwrites.cache;
const memberOverwrite = overwrites.find(po =>
po.type === 1 && // 1 = Member (User)
po.allow.has('ViewChannel')
);
const channelOwner = interaction.guild.members.cache.get(memberOverwrite.id);
channelOwner.user.username
@clear garnet @warm charm thanks for the assist too.
but overall i wouldnt get the ticket creator from the channel overwrites since user can leave and the overwrite will be gone. save the ticket creator id in a db or if you dont want to use a db perhaps in the channel description
got it, i'll just create a table named data for the channel creator such as member's username and id. thank you
for sql im using supabase right now.
Hi everyone, I am calling client.user.setPresence but that isn't setting the presence of the bot. I also tried calling setStatus and setActivity individually but same outcome there aswell.
client.user.setStatus(PresenceUpdateStatus.Online);
client.user.setActivity({
name: `${answeredCount} answered, ${remainingCount} remaining`,
type: ActivityType.Watching,
});
the bot shows up as offline no matter what
im using presence and its working for me, try this.
client.user.setPresence({
activities: [{ name: "Maxwell", type: ActivityType.Listening }],
});
client.user.setPresence({
status: "online",
activities: [
{
name: `${answeredCount} answered, ${remainingCount} remaining`,
type: ActivityType.Watching,
},
],
})
nope
Is there a error on logs? You can remove the status, when the bot has logged on. Its automsticaly set to online.
nope, no error but the bot continues to work
but this bot is only for personal usage so I guess I can deal with offline status
If you don't share a server with the bot you can't see it's status afaik, so if It's only like a user app it's normal
ahh then it makes sense. Thanks
Hi,
i want to use a Button in a followUp message.
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction, SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder().setName('test').setDescription('neuer Unsinn'),
async execute(interaction) {
await interaction.reply('Frosch?');
const butt = new ButtonBuilder().setCustomId('b1').setLabel('ClickMe').setStyle(ButtonStyle.Secondary);
const row = new ActionRowBuilder().addComponents(butt);
response = await interaction.followUp({content: "Hi" ,components: [row], withResponse: true, });
const collectorFilter = (i) => i.user.id === interaction.user.id;
try {
const confirmation = await response.resource.message.awaitMessageComponent({ filter: collectorFilter});
await interaction.deferUpdate();
if (confirmation.customId === 'b1') {
await interaction.followUp( "Ho" )
}
} catch (error) {
console.log(error);
}
},
};
When klicking the Button i get this Error
at Object.execute```
response = await interaction.followUp({content: "Hi" ,components: [row], fetchReply: true});
did you try fetchReply
fetchReply is deprecated
withResponse is the good way
got the same Error 😔
Create the collector directly on the InteractionResponse object
InteractionResponse#awaitMessageComponent() discord.js@14.25.1
Collects a single component interaction that passes the filter. The Promise will reject if the time expires.
You should refer to the docs to see what properties and methods actually exist
sorry, i am new and work mostly with the guide
I am running a DIscord Bot on an AWS server that only has ip v6. I am aware that I can not directly connect to Discord with my bot using only v6. I have been using warp (which is working) but looking for something lighter. I am going to create a cloudflare tunnel for handling tcp traffic using socks5. Would I modify the client as follows:
const discordProxy = new SocksProxyAgent('socks5://127.0.0.1:4000');
const httpsAgent = new https.Agent({
keepAlive: true,
lookup: discordProxy
});
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
rest: {
agent: httpsAgent
}
});```
Hello, any help would be greatly appreciated. TIA.
I'm currently writing a verification modal that will send a message to a selected channel, however I've come into an issue where the targeted channel.send() is not a function.
code:
await interaction.showModal(verifyMessage);
const filter = (interaction) =>
interaction.customId === `${interaction.guild.id}-verifyMessage`
interaction
.awaitModalSubmit({ filter, time: 600_000 })
.then(async (modalInteraction) => {
const verifyValue = modalInteraction.fields.getTextInputValue(`${interaction.guild.id}-verifymsg`);
const verifyEmbed = new EmbedBuilder()
.setAuthor({ name: `${interaction.guild.name} | Verification System`})
.setColor('Green')
.setTimestamp()
.setFooter({ text: `${interaction.guild.name}`, icon: interaction.guild.iconURL })
.setDescription(`${verifyValue}`)
const sendVerify = modalInteraction.fields.getSelectedChannels(`${interaction.guild.id}-verifychannel`);
console.log(sendVerify);
modalInteraction.reply({ content: `Verification message sent.`, flags: MessageFlags.Ephemeral })
});
Logging the sendVerify shows the collection map, but I can't get past this part.
Assuming you're only allowing one channel in the select menu (and therefore only one entry in the Collection) you can get the channel with <Collection>.first()
Hey I'm a bit confused on something, can I efficiently check if a user's guild tag was updated without having to check my database if they had it previously or not?
Apparently it emits both guildmemberupdate and userupdate, depending on if the user is cached, but sometimes the old user's tag can be null eitherway, so how am I supposed to know if they had my tag and removed it
Thank you,
When you sent this I had already found a solution of some sorts. I mapped the id, turned it into a string and had it send through that.
You can check if the old user was partial, but if it was then you do have to rely on a database to get old object data and compare
So if I listen to both the events, will only one fire on a tag change depending on the state of the user?
UserUpdate would fire. I'm not sure whether GuildMemberUpdate does as well but it would be redundant at best
GuildMemberUpdate doesnt fire this event
^
I am not getting consistent results with user update, neither with guildmemberupdate
I have a command people can run if the bot didn't detect them but for the majority I want it to be automatic
Can you expand on the inconsistency? Both events have the same limitation that old data is pulled from the cache. It's not provided by the API
Well it just doesn't fire sometimes, I have only used UserUpdate and tried GuildMemberUpdate once, user update is more consistent but isn't firing all the time, guild member update didn't fire in any of my tests
I would also rather not checking my database twice for one user because both events fire together
I see that above you said you have the User partial. Do you have the GuildMember one as well?
Can anyone point me to the documentation for using a proxy in front of Discord's API? Or code examples? I tried to go to this link but it just redirects: https://discord.js.org/docs/packages/proxy/stable
I do indeed I have both
I'm not sure why neither event would emit if you have the right intents and partials. As far as handling your database, you could dedupe requests or cache your responses
Redirects to where?
Also, you probably want a guide: https://discordjs.guide/legacy/additional-info/proxy
Thank you! I'll take a look at that 🙂
Component discord.js@14.25.1
Represents a component
please stay in your thread until someone else can help you
Hey, I need to reference a channel "from earlier" and I am saving the ID to find it again
I would do a client.channels.fetch() and be done with it, but from what I read, the channel should be in some kind of cache?
Should I just execute fetch because it will look into the cache, or do I have to use some other method?
I am using the "Guilds" intent, whatever that means, but I read cache is somewhat related to that
Can it a thread channel?
Particularly an archived one
No this is only going to be an actual channel
client.channels.cache.get(…) is sufficient
Thanks, I am not sure yet if I will need it, but if it was a thread, I should fetch it instead then, I gather?
I plan on creating a thread but not sure if I need to reference it later, don't think so from the current design
Only DMs/Group DMs and archived threads aren’t guaranteed to be cached
Other guild channels are guaranteed to be cached upon ready w/ Guilds intents
Thanks
is it possible for a bot to pause invites for a server with discord.js?
documentation suggestion for @vocal garnet:
Guild#disableInvites() discord.js@14.25.1
Sets whether this guild's invites are disabled.
ohhh thank youu
I also think setIncidentActions can be used but am unsure
tysm ill try it
if (guild.iconURL()) {
container.addMediaGalleryComponents(mg =>
mg.addItems(
new MediaGalleryItemBuilder()
.setURL(guild.iconURL({ size: 128}))
)
)
}```
is there a way to get this guild icon to act as a thumbnail like in an old embed, like move it to the top right corner or something
guide suggestion for @stiff plover:
Thumbnail
A Thumbnail is a display component that is visually similar to the thumbnail field inside an embed. Thumbnails are added as accessory inside a Section component, support alt text for accessibility, and can be marked as a spoiler. You can use the ThumbnailBuilder class to easily create a Thumbnail component: For more information about using attachments in components refer to the guide on attaching images in embeds.
omg 💔 thanks
why is it that the guildmemberadd event sometimes get triggered twice? i know theres also still the bug with dupe discord system welcome messages. is there a way to prevent this anyway?
@steel trail even though guild member doesn't have the tag property, are you sure GuildMemberUpdate event fires if the user isn't cached and changes their tag?
or if anyone else knows, but he is the only one that said that
Final version hopefully? https://pastebin.com/t9bZem9q
Is this accurate or am I missing anything to check for the guild tag
It seems to work fine apart from the fact that it still doesn't detect the first update or maybe some
you'd need the GuildMember partial, but yeah that'd make sense to me
djs's userUpdate event isn't the same as the gateway user update, but rather is extrapolated from other events such as guildMemberUpdate, the event by which discord sends updates to member's user objects
so as qjuh mentioned, if it isn't previously cached, djs won't know the user was updated, so only guildMemberUpdate emits
I got the same code under both the events
we cannot emit the before state if we don't have it cached, discord just sends the "after update" state
if you opt into member (and potentially user) partials that should make those instances emit (but obviously still won't have the before data)
How many textInput I can attach to a Modal? Not sure where to find the limit on the documentation
5
Yeah I opted into both, I just check if the user is partial and instead check my own data to see if the user had their reward already, should be fine hopefully, I have a /tag command just in case for users to update their own status
And the limit can be found here: https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
there is a MessageCreate listener
when user mentions a user
the message content should be <@userid> or <@!userid>?
it is <@userid>. idk what ! does?
https://discordjs.guide/legacy/additional-features/cooldowns
Can someone explain this part for me "The previous user check serves as a precaution in case the user leaves the guild."
I believe it's referring to if (timestamps.has(interaction.user.id)) in this snippet:
const expiredTimestamp = Math.round(expirationTime / 1_000);
return interaction.reply({
content: `Please wait, you are on a cooldown for \`${command.data.name}\`. You can use it again <t:${expiredTimestamp}:R>.`,
flags: MessageFlags.Ephemeral,
});
}
timestamps.set(interaction.user.id, now);
setTimeout(() => timestamps.delete(interaction.user.id), cooldownAmount);```
Deprecated Discord formatting for users
User mentions with an exclamation mark are deprecated and should be handled like any other user mention.
- message formatting in Discord docs
oh ok i thought silent pings or something
cool, thx :D
it does but idk either why it says its a precaution in case the user leaves guild. maybe if you thought of setting member object in the timestamp or whatever?
Can ban user ip?
no
Regular bans are supposedly IP bans though
they are, but it's completely managed by discord without any way to access it directly, and only applies to joining. mildly annoying when you need to unban an ip
Overnight, all the bots are somehow different! And they're giving lots of errors! Has something happened?
you def. need to elaborate on that
"different" and "lots of errors" does explain absolutely nothing
Yes, somehow none of the buttons work, none of the slash commands work, interactions no longer work... Even though everything shows green via pm2 logs.
I am using discord.js 14.17.3
once more: what does "not work" mean
what are said errors?
Good morning, I come asking questions.
I am building a Modal that'll collect 3 channels and 2 roles independently from labels (reference screenshot).
Is it possible to collect and pull the channel IDs and role IDs respectively, in one collector, in order to add it to a db for per-guild configurations? or will I be mapping per label?
It will be a single modal submit interaction
hi, did ComponentV2 have timestamp feature
Something like this?
yeah
Not a dedicated field but you can have one yourself using a divider like they showed ^
alr ty
^^
and you too (for the exampl.)
const mainContainer = new ContainerBuilder()
.setAccentColor(0x0099ff)
.addTextDisplayComponents(
new TextDisplayBuilder().setContent(`
${new Date().toLocaleString()}
`)
);
await interaction.reply({
flags: MessageFlags.IsComponentsV2,
components: [mainContainer],
});
It's as they told you, just add a separator and a TextrDisplay.
That's not a discord timestamp though. Use time() instead
<t:${Math.round(Date.now() / 1000)}:F>
im using this 💀
time discord.js@14.25.1
Formats a date into a short date-time string.
btw thanks yall for the help
Yes, but I got used to it, but I'm still improving certain things. 🙁
🙂
hello, does anyone know how can I set rules channel to another existing ( or newly created ) channel? because when I try to do so, newly created channel gets yeeted and nothing changes
and don't blame me, cause methods djs provides seems to not work at all
Channel overwrites
Permission overwrites control members' abilities for this specific channel or a set of channels if applied to a category with synchronized child channels. As you have likely already seen in your desktop client, channel overwrites have three states: - Explicit allow (true, green ✓) - Explicit deny (false, red X) - Default (null, gray /)...
dude, i meant community channels
The difference is that discord timestamps will adapt to the local time of the one viewing the message. Yours won't
.addSectionComponents(
new SectionBuilder()
.addTextDisplayComponents((textDisplay) =>
textDisplay.setContent(
`${target.user.displayName || target.user.globalName || target.user.username} has **${netInvites}** invites
>  Joins: **${inviteData.joins || 0}**
>  Left: **${inviteData.leaves || 0}**
>  Fake: **${inviteData.fakes || 0}**
>  Bonus: **${inviteData.bonusInvites || 0}**
>  Rejoins: **${recentRejoins}**`
)
)
.setThumbnailAccessory((thumbnail) =>
thumbnail
.setURL(target.user.displayAvatarURL({ size: 512 }))
.setDescription(`${target.user.displayName}'s avatar`)
)
)```
can i do smth about the gap in bw?
by not using quote text markdown for non quoted stuff
or just use >>>, if u really need to
that won't fix the gap
yeah that didnt
so, any idea?
is it even possible to set a rules channel using the API, ah yes it is
if not then why tf is it documented?
anyway it doesnt seem to work :>
cause if i want to delete an old one i get this
error: Cannot delete a channel required for community servers
even tho i set channel for it
i just want to do damn backup loading which involves clearing all channels including (old) community ones and then setting them back
is that discord API issue or mine, cause im beginning to wonder
well if you set a different channel to be the rules channel it should be obvious as the icon next to the channel name in the channels list will become a book instead of a #
if that happened and on deletion it still throws that error then you should report it as bug on the discord-api-docs github page
Guild#setRulesChannel() discord.js@14.25.1
Edits the rules channel of the guild.
// Edit the guild rules channel
guild.setRulesChannel(channel)
.then(updated => console.log(`Updated guild rules channel to ${guild.rulesChannel.name}`))
.catch(console.error);
You're using this one?
yep
yep, tried even guild#edit(), doesnt work either
the thing is it doesnt do anything, even on test command
can you use this code snippet
including the .then()
Can you clarify on "doesn't work"? What happens, what does that log, what do you get from cache or force fetching those channels afterwards, ...
it just keeps old channel never changes to channel which you parse
new channel name is temp-rules
@steel trail
i do not force fetch anything nor read cache cause i dont need to, i want just two problematic channels to be cleared, retrieve them from database where all of necessary data was saved and set everything back as it was b4 backup
looks like im all by myself with that
Then how can you check if it works in API data terms if you don't check cache nor API data by force fetching. That was meant to help with identifying the root cause
then snippet is kind of useless i guess 
oh LMFAO it doesnt work with community enabled 
i have to disable community feature for this methods to work, hillarious
so basically what i need to do for backup load to work is
- disable community
- let backup module do its thing
- set back channels which had their respective meanings
- prompt user to enable community feature manually
im gonna laugh so hard if it will work
Can I have /invites as root command then add and remove subcommands so /invites, /invites add, /invites remove
no, you can not see Discord Docs Subcommands and subcommand groups for details
Application Commands - Subcommands and Subcommand Groups
For those developers looking to make more organized and complex groups of commands, look no further than subcommands and groups. Subcommands organize your commands by specifying actions within a command or group. Subcommand Groups organize your subcommands by grouping subcommands by similar action or resource within a command. These are not enforced rules. You are free to use subcommands and groups however you'd like; it's just how we think about them.
Your bot can disable/enable community too, if it has the right permissions. And did you try changing the rules channel manually in discord, does that work? If yes: bot API issue; if not: issue with the discord guild or it's settings
How can I easily check the resource type of an ID; user, role, channel etc
What do you mean? From the object snowflake alone?
It cannot, manual changing does work, separate command with method specified works only when community is disabled
I'll investigate further with new guild once im back to my PC
where can i find specfic log types and what i can recieve from them
how to make this appear on my bot
if it says unknown, click it and it will take you to the channel
Custom status type
documentation suggestion for @jagged rock:
ClientEvents discord.js@14.25.1
Guys I am getting UND_ERR_CONNECT_TIMEOUT error. Is there a fix?
Sorry - yea, just from the Snowflake ID alone
Then, no you can not determine the type based on the Snowflake
tag suggestion for @olive torrent:
Errors such as ECONNRESET, ConnectTimeoutError, SocketError: other side closed indicate a network issue
- Free or shared hosting providers often come with significant limitations
- Another indication of these issues are 'Unknown Interaction' errors.
Ah, shame, I see tyty
You can make educated guesses. By trying to fetch by that id and see if the API knows a resource of that type by that id
this doesnt show evertything detail i can fetch from an event
nm
click the events and see what they all contain
Hey all, I'm sure I'm making a simple mistake but I could really use some help.
I've just created a new bot and added it to my guild.
config.serverID is defined (confirmed by the error in logs).
There's no "Could not find the specified guild!" but I still receive:
Failed to push commands: DiscordAPIError[10004]: Unknown Guild
What am I doing wrong?
const pushCommands = async () => {
try {
const guild = await this.#client.guilds.fetch(config.serverID);
if (!guild) {
throw new Error("Could not find the specified guild!");
}
// Set all commands to the specific guild
await guild.commands.set([...guildCommands, ...developerCommands]);
console.log(`All commands have been registered to "${guild.name}"`);
} catch (error) {
console.error("Failed to push commands:", error);
}
};
Failed to push commands: DiscordAPIError[10004]: Unknown Guild
2025-12-06 16:12:32 at handleErrors (/app/node_modules/@discordjs/rest/dist/index.js:762:13)
2025-12-06 16:12:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2025-12-06 16:12:32 at async SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/dist/index.js:1163:23)
2025-12-06 16:12:32 at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/dist/index.js:994:14)
2025-12-06 16:12:32 at async _REST.request (/app/node_modules/@discordjs/rest/dist/index.js:1307:22)
2025-12-06 16:12:32 at async GuildManager.fetch (/app/node_modules/discord.js/src/managers/GuildManager.js:276:20)
2025-12-06 16:12:32 at async pushCommands (/app/dist/Structure/Classes/Handler.js:74:31) {
2025-12-06 16:12:32 requestBody: { files: undefined, json: undefined },
2025-12-06 16:12:32 rawError: { message: 'Unknown Guild', code: 10004 },
2025-12-06 16:12:32 code: 10004,
2025-12-06 16:12:32 status: 404,
2025-12-06 16:12:32 method: 'GET',
2025-12-06 16:12:32 url: 'https://discord.com/api/v10/guilds/1437478894725894314?with_counts=true'
2025-12-06 16:12:32 }
Your bot is not able to fetch the guild
So it's two options that come to mind for me. Either your bot is not able to fetch the guild information or your ID is wrong
I'll try to look more into this, brb, ty
Wow. I must have copied the wrong server's ID. Completely stupid mistake
Thank you
I need to set a member's roles using <guildmember>.roles.set(), but I'm getting an error because some members have roles like “booster.” If a member has a “booster” role or an unmanaged role, is there a way to set their roles without touching those roles?
I forget which but you either need to filter them out of the ones you're trying to apply, or make sure they're in the list you're trying to apply
It might be the second one, make sure they're still in the set, so it doesn't try to remove them and error
cant you use <guildmember>.roles.add()?
oh nvm you want to specifically set them
yep
alr i'll try it thx
