#djs-help-v14
78874 messages · Page 37 of 79
moving a single channel moves many
because the rest are reorganized
you can build some kind of debouncer so it only executes once
is there a way to stop the spaming
since if i move this up one or down one it logs 10 times 🤣
yeah channel position in discord is calculated weirdly
i assume there no fix?
debouncer ?
you can look it up, it's not a djs thing
so just a timeout thing
that's one way of making one yeah
remaking one for my v13 bots that still work like meant to but when updating to 14 it just does that
My bot sends like 5000 messages in the same channel daily responding to users. Now I want it to send a message in that channel when a user sends a message in a different channel, so I use: const c = await client.channels.fetch("1230464136366784532"); but it can't find the channel?
For some reason c is null
that should never be null though
if it couldn't find the channel it'd throw
unless you meant fetch(...).catch(() => null);
I have this:
let ch = await client.channels.fetch("1230464136366784532");
if (!ch) ch = channel;
And it's resorting to sending in the current channel
guess it could, if you specifically cache null as value for that id
nvm I'm actually stupid
does discord remove commands from both users and guilds if they're not included in the rest api request
that depends on what api request, the bulk update route will overwrite all commands with the ones you supply and remove all that are not present
I have made a slash command for users app, but it don't works in dm is it normal ? I put dmPermission to true but it don't work on dm only on a server :/
you need to set the context for that
I put chatInput, is it that ?
SlashCommandBuilder#setContexts() discord.js@14.21.0
Sets the contexts of this command.
v10: InteractionContextType - PrivateChannel
read more
and BotDM if you want it available in the bot's dm as well
tyy
i see ty
so if i want to update commands for all the guilds my bot is in is it fine to use the deploy script in the wiki on all the ids? the bot will probably only be in 5 servers max
deploy it globally
much simpler and with less api requests
do all the guild commands get updated with the Routes.applicationCommands() function?
i'm under the assumption that it only affects user installs
that is for deplying globally, like Amgelo said
if you deployed guild commands they'll stay if that's what you meant
no, global deploys have been available well before user installs were a thing
they can be used to deploy a command in every guild
i need all the commands for both user and guild installs to be the same
oh cool!
loving this 15 second slowmode 🙃
If I use a user command on a server, is it possible to have informations of the server like the id or the name or more ?
I tryed and I didn't get any informations
ChatInputCommandInteraction#guild discord.js@14.21.0
The guild this interaction was sent in
ah, wait what do you mean exactly with "user command"
a user installed command or a user context menu command?
is there an api or library that allows fetching pinterest images?
you can google the question, not discord.js related
maybe there is, not djs related though
if my 3 discord bots (same code, different environments, but that's sort of unrelated) are out of sync, I realise I'll have to unregister and re-register the commands, but is there a "best way" to do that? Curious
skip the unregistering and just deploy the new state as bulk overwrite
How to disable buttons after a time when they are in a container?
Bascially the same as usual - make a change to the button to disable it and edit the message
user installed
then what was linked is correct
though if the interaction comes from a guild that your app doesn't have a bot in, you won't have full guild data
I have 0 guild data, I don't need the full but a little
what does "0" mean
0 data, like nothing
ok but where
or from where
yeah guild seems to be null if the bot isn't in the guild
"0 data" didn't sound like "null", so didn't even think of that
yep definitely not the best way to put it lol
/**
* Indicates whether or not this interaction is received from an uncached guild.
* @returns {boolean}
*/
inRawGuild() {
return Boolean(this.guildId && !this.guild && this.member);
}
figures
Hi everyone, I’m building a Discord bot from scratch and looking for an experienced developer to help.
It will use discord.js, dotenv, and mongoose, with features like forms, buttons, logs, role management, and automated channels.
If you’re interested, DM me and we can go over the details.
this isn't a recruitment server
this is support server for discord.js, if you have some particular issue with its usage or questions about it
Thanks for the heads up, I really appreciate it.
I understand this server is for support only and not for recruitment.
I’ll make sure to follow the rules and only ask technical questions here in the future.
Thanks again for your guidance
if (!message.inGuild())
This works if checking for user sending a message to the bot in dms?
it should yeah
You can also directly check message.channel.type
is there a way to mention someone in a container (or in general components V2 message) without notifying them (only for a specific message)? If so how?
documentation suggestion for @lapis plover:
MessageFlags#SuppressNotifications discord.js@14.21.0
This message will not trigger push and desktop notifications
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"] } }
oh thats what they meant
oh, well it depends on what you exactly mean by notifying
supress notifications indeed is for not notifying (desktop/app notification) but it's possible you meant to not ping
in which case it'd be allowedMentions
^
Do you think creating additional text channels and distributing the threads among them would resolve the issue?
Why does a components V2 section need a thumbnail?
Do you think creating additional text channels and distributing the threads among them would resolve the issue?"
Because that's what distinguishes them from just a text display
shouldn't it rather be split by a seperator
but I guess that's how it is lol
Not sure what you mean
actually im trolling, if there were no thumbnails a section would be no different like you said lol
maybe, honestly only discord can tell, you can ask them
tag suggestion for @wide elk:
We are not Discord, just some nerds who develop Discord bots!
- /report appeals and age updates
- /howtoreport reports (harassment/hacking/spam/abuse)
- /support anything Discord related
- /billing payment/nitro
- /feedback feedback/feature requests
anyone know of the best way to send a message simultaneously across all servers the bot is in all at once? Been using promise.all and just wanted to know if that was the most efficient method
I mean. The best way would be to post in your own announcement channel so that server owners can follow it if they want. Promise.all would be a good way to make sure they all resolve before proceeding, if that's something you need
Or use a webhook that pushes the message out
You sending a message to every individual server is not going to scale upwards at all as your bot grows
hintSending.jsreads the following (in my ēvents folder!):
// all of my imports and stuff
module.exports = {
name: Events.MessageCreate,
async execute(interaction) {
// code
if (interaction.channel.name === 'command log') {
//code
}
}
and index.js reads:
// Require the necessary discord.js classes
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
global.mainPath = __dirname;
// Create a new client instance
const client = new Client({ intents: [ GatewayIntentBits.MessageContent] });
client.commands = new Collection();
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
global.latestDaSubmission = "";
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
// Set a new item in the Collection with the key as the command name and the value as the exported module
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
// Log in to Discord with your client's token
client.login(token);
my issue si that i'm simply not receiving my MessageCreate event at all. when is end a message, i don't get a console log that i wrote, it doesn't seem to be receiving any messages at all. have confirmed i have messagecontent intent on
Quick question, Is discord.JS rest able to unban users? Or would i have to use just regular discord.js
bro what has discord done to my formatting
what's unbanning is the API
whatever lib you use, or whatever language you use, it's the same API anyway
you can even unban with curl from your terminal
Hm, So if im unbanning a user it would just be rest.delete(Routes.guildBan(guild_id, user_id))
You need the appropriate intents in order to receive the event
if that's what the discord api docs tell you to do
what am I missing? i've added Guilds just now
GuildMessages/DirectMessages depending on what you're trying to listen to
ahhh thanks
Using Gateway: Gateway - List of Intents
read more
This details which events require which intents in order to receive them
sorry, i'm back again :(
i'm now receiving the message but can't access the embeds.
module.exports = {
name: Events.MessageCreate,
async execute(interaction) {
console.log('Received message!')
if (interaction.channel.name === 'command-log') {
console.log('Received message!')
const message = interaction.message;
const command = message.embeds[0].description.split('`')[1];
const moderator = message.embeds[0].description.split(' ')[0].split(':')[0];
if (command.startsWith(':log hint')) {
//code
}
}
error:
TypeError: Cannot read properties of undefined (reading 'embeds')
at Object.execute (/Users/florentine/Desktop/Code/Rose/log-integration/events/MessageCreate.js:15:37)
(15:37 is the command variable)
Why do you have it called interaction?
should it be something else 😭
ah, is it passing the message to interaction?
Yes, ideally message, because that's the thing the event emits with; a message, not an interaction
thanks for being patient with me :')
Is it possible to get the same order as a discord server for the channels?
This is what my server looks like https://kathund.wtf/kzmofnge.png
My drop down isn't really matching that order https://kathund.wtf/o5aqa76v.png (using Channel#rawPosition)
https://kathund.wtf/x6hzq40m.png (using Channel#position)
I have tried both Channel#position and Channel#rawPosition and they both show up differently in my list
const channels = await guild.channels.fetch();
channels
.filter((channel) => channel !== null)
.sort((a, b) => a.rawPosition - b.rawPosition)
.forEach((channel) => parsedData.channels.push({ id: channel.id, name: channel.name, type: channel.type }));```
Ah i see ok. Could you explain a bit more why it woudln't scale well? is it because of rate limits or something similar
Does the bot have the guilds intent?
Just rate limits
i see. if i made a webhook for each channel then sent messages through those i would sort of circumvent that?
Well yes. You’ll just have to manage them
i see thank you for your help
Yes? I'm creating client like this
this.client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages
]
});```
is discord.js's current release up to date with how "pinning messages" is now separate from "managing messages"? and if so, how is it structured/listed as, or where/how can i find it?
djs doesn't support undocumented features/changes
the documentation for that was just opened in a pr less than 12h ago
what i'm hearing, in short; is no. fair enough.
yeah in short no
wanted to argue why though, djs is waiting on discord if anything
i cannot recall but can i do separated images in a v2? like
image - button
image - button
nope, but can only be placed under an image as of now
you could do
<Image/>
<Button/>
<Separator/>
<Image/>
<Button/>
thats what i meant i used "-" as "with a" but ty for clarifying
how can I kill a specific shard by id on command while keeping respawn in the sharding manager set to true without it booting back up for debugging purposes
Hey, how can I create container from a old message? I have already sent a message with a container and now I would like to fetch and edit it. I have already tried
const container = new ContainerBuilder(ogmessage.toJSON().components);
And various other ways to retrieve the old container in JSON, unfortunately nothing worked for me
message.components[0].toJSON()
does discord not like it if i send 9000 characters as base64 for image embed
over webhook, that is. it is a 77kb file but when i get the base64 data for it, it is about 9000 characters
thats pretty small
wait sry 90000 characters
well fuck it, imma just convert them to links and then send it
so im trying to do a disabler and having a issue with select menus im trying to spawn a row fea each chunk hit it has considering i have 69 commands trying to spawn on one menu causing a error, i am trying this: but all im getting is the panel but no menus
const chunkSize = 25;
const commandChunks = [];
for (let i = 0; i < commands.length; i += chunkSize) {
const chunk = commands.slice(i, i + chunkSize)
.filter(cmd => cmd.id !== '1407308767447748639')
.map(cmd => ({
label: cmd.name,
value: cmd.id,
description: `ID: ${cmd.id}`
}));
commandChunks.push(chunk);
}
const selectMenus = commandChunks.map((options, index) => {
return new ActionRowBuilder().addComponents(
new StringSelectMenuBuilder()
.setCustomId(`command_select_${index}`) // Unique ID per menu
.setPlaceholder(`Select command group ${index + 1}`)
.setMinValues(1)
.setMaxValues(1)
.addOptions(options)
);
});
selectMenus.forEach(row => {
container.addActionRowComponents(row);
});```
nice

there is no problem if you send base64 attachments
i mean i could go modal mode and just spawn a list of ID's to disable stuff ig it would be easier
thank you
how long has modals had a cancel button? i dont rememebr them having one
Always. I don't remember a time when you could not cancel a modal
I think they just changed the design of the Cancel text to be a button now
I have a bot for saving and retrieving "canned messages" to provide guidance to people seeking help in another server, similar to what the bot here does when linking to the documentation
every time a canned message is retrieved, I'd like to provide a way for the person providing the help to ping the help seeker directly in the reply, through the bot
the problem is, because the bot has to search its database for the response, it's ideal to .deferReply(), but then we can't notify/ping the help seeker, as the mention will come from an .editReply()
how can I work around this?
you could use .reply() and include the ping inside, and then later edit it to have the message
my bad I should have made this clear in the original question but it could also be the case that the retrieval from the database fails (e.g. the canned message the user tried to retrieve doesn't exist). when that happens, I'm currently deleting the original deferral and doing an ephemeral followUp(). if the deferral is replaced by an instantaneous ping, this deletion would leave the help seeker with a confusing ghost ping
I wonder if that's an acceptable compromise though
should be
Hi!
hello
if you're just here to say hi, please take it to #archive-offtopic
if you're looking for help, please describe your issue #how-to-get-help
I mean, I plan to continue, but, it got resolved.
Actually, in this v14, ContainerBuilder's side colour can be none if we set, like they are not giivng any colour for it like embed. Just to discuss about it and more.
are you asking how to set it to no color?
yeah if you don't give any color to your container it will match the color of the container background itself
if you do give a color, it looks like that same colored vertical bar on the left like embeds have
No. Just wondering that they changed this, which is very much better. Just views!
Any colour on background? Like if someone has light/day mode(probability not much people have it really), will it really camouflage or it will show black line?
no, if no color is set with the container you won't see a line at all!
Ohh. Got it. Thanks!
does the discord container have a message limit like the embed object?
Since text display components are the only components to display text (apart from select menu and button labels) the total amount of characters in all text display components may not exceed 4000 characters in a message
if you really close to that limit (lets say 4006 characters) you can check if you can replace the \n (2 characters) with a new text display component (max 40 components per message)
if you make 3 text display components out of 1 component that uses \n 2 times, you saved yourself 4 characters
is that possible to only show the slash command to one user only?
Server mods can do so through the integration settings
why isnt my bot editing the reply even when i tripe checked my cript and everything was perfectly working
i didnt get an error it just stuck on the deffered state
and i think its a djs issue i tried on other bots it worked every command i have that uses editreply does not work
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Displays the bot\'s latency to Discord.'),
async execute(interaction) {
await interaction.reply({ content: 'Pinging...', ephemeral: true });
const sent = await interaction.fetchReply();
const latency = sent.createdTimestamp - interaction.createdTimestamp;
await interaction.editReply({
content: `**Pong! Latency: ${latency}ms, API Latency: ${Math.round(interaction.client.ws.ping)}ms**`,
ephemeral: false,
});
},
};
heres an example its not deffered but uses edit reply and the reply does not edit
npm ls discord.js and show the output please
what is the difference between PermissionFlagsBits and PermissionsBitField
PermissionsBitField discord.js@14.21.0
Data structure that makes it easy to interact with a permission bitfield. All GuildMembers have a set of permissions in their guild, and each channel in the guild may also have PermissionOverwrites for the member that override their default permissions.
Is there a way, where Slashcommandpermissions are checked based on global user perms (on like a role level) instead of a channel level?
what do you mean?
Can I force my slash commands to only look at the set of permissions that come by default with a role? and ignore the permissionOverwrites? Lets say some user has the "manage channel" permission in their own "private" channel in a guild, id like for that user to not be able to access the commands i've labeled as "manage channel". He could Only have access to that command if he has "manage channels" in the entire guild
I dont know if that makes sense
Why can't i put drop downs in a modal?
Where can i read about how to inplement the components v2 in my bot?
Can you somehow detect if a user clicks on an emoji or any element in an embed? Id like to create a settings menu, but buttons are way too inflexible for that
Because that is not supported by Discord
guide suggestion for @untold skiff:
Popular Topics: Display Components
read more
No
that feature is coming soon.
Is there a PR for it. Bc that would be exciting to get more components for modals
I want to kill my jank settings channel and replace it with a nice clean modal
damn ok ty
I meant for the Discord API but this is cool, can't wait
https://github.com/discordjs/discord-api-types/pull/1321
there is no PR for discord-api-docs yet
That is unfortunate. I hope they make one soon I would like to use them
wait so I would assume
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
is fine to use?
or does it have to be
.setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild)
The two are equivalent. PermissionsBitField.Flags is PermissionFlagsBits
check, just got confused, thanks
bro nobody answered
Mark responded to you and you didn't do what he suggested
mark did
i dont have acess to my terminal
how so?
its jexactly hosting when i type in it it it just sends to console and does nothing
but you aren't coding the bot in your host's panel are you?
well no ofc i do it on replit
and isn't it possible to execute the command there?
Its good to develop and test locally first where possible
will it work when i add it to the host's panel
add what?
the updated version
npm ls lists your installed versions
We cant really provide support for how various hosts may or may not do things
it doesn't update
what's the actual output
the compass isn't pointing north but we're not looking for north either
preach, brother
this is very strange it works for my friend but not me
@rose tangle
add .catch((e) => { console.log(e); }); behind your reply method call
okay
i got
client.on('guildScheduledEventCreate', async (event) => {
seems to not be firing?
okay
are you subscribed to the corresponding intent?
Does djs v14 support using ESM?
yes
Awesome, Thanks!!
ah
const client = new Client({
partials: [Partials.GuildMember, Partials.Channel],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.DirectMessages,
]
is it intents or partials
partials wouln't make sense for create event
also monbrey said intent, so didn't relaly mean partials
Its intents, and no, you dont have GuildScheduledIntents
for components v2 is there a way to kind of make inline fields like a traditional embed
no
aw darn. I really like how components v2 look but i don't think there's enough flexibility yet
container is not an embed
so there's not gonna be such "flexibility"
Inline embed fields are a mess on mobile anyway. 
Is guild tag documentation added in discordjs guide/docs?
it will be added to the docs in the next update
welp, I've exhausted my troubleshooting abilities.
I'm trying to listen to new messages to see if any of them say a specific phrase in order to reply to them, but it just doesn't fire.
I gave my bot the intents and perms, and added them to index.js, so whatever is going wrong is in the event file, I just don't know what, (my javascript college course was pretty basic). And I've stared at it long enough it looks like squiggles.
const { Events } = require('discord.js');
module.exports = {
name: Events.wish,
execute(client) {
client.on('Events.messageCreate', async (message) => {
console.log(`Received message: ${message.content}`);
if (message.author.bot) return;
if (message.content.toLowerCase().includes("i wish")) {
await message.reply("Is that the Wish that will make your soul gem shine?");
}
});
}
};```
Events.MessageCreate should not be in quotes and the "M" should be capitalized
still not getting anything
Can you show the new code and the client constructor?
Oh. You should probably not be attaching the listener inside your execute function
Maybe that's correct, but different than how most people set things up based on the guide
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});```
```js
const { Events } = require('discord.js');
module.exports = {
name: Events.wish,
execute(client) {
client.on(Events.MessageCreate, async (message) => {
console.log(`Received message: ${message.content}`);
if (message.author.bot) return;
if (message.content.toLowerCase().includes("i wish")) {
await message.reply("Is that the Wish that will make your soul gem shine?");
}
});
}
};```
Where/how are you calling the execute?
i dont know, I just kinda copied the boilerplate from ready.js, lemme try something actually...
The name of your object will also be undefined if you're relying on it for anything
should I just toss all this in a standard eventlistener?
Creating Your Bot: Event handling
read more
I would just follow our section in the guide regarding event handling, since that seems to be what you're attempting to create
its like the first thing I read but ill give it another try
Yea, but the guide shouldn't be telling you about Events.wish, because that's not an event that exists. It also doesn't tell you to nest a client.on(...) listener inside your event handler's execute() function, so there seems to be a few steps you're skipping/not understanding
i thought I was just naming it, like a command
okay yeah no I just have terrible reading comprehension
thanks for the help, works
Is it possible to get this as a file using a bot
Yes, that is just an attachment with extra properties
client.on('guildScheduledEventCreate', async (event) => {
event has creator: null, what is this about?
I do get creatorId:
Creator wasn't in cache
And event likely doesn't provide enough data to cache it, or you have that cache disabled
ok
also can I do:
event.guild.channels.cache.get('achannelid');
or event has not such manager?
meaning i'd need to cache guild, then cache/fecth channel
Guilds should always be cached, so that's fine. But so should the channel. Not sure why you'd need to get that manually
You said it was creator that's missing
i meant just wondering if this event has same options as an interaction
documentation suggestion for @frosty epoch:
GuildScheduledEvent discord.js@14.21.0
Represents a scheduled event in a Guild.
thats what the event emits
If i log(event) it does not give .guild (unless it's like implied)
its a getter, these dont show up when you log it
thats why the documentation exists :P
client.on('guildScheduledEventUserAdd', async (scheduledEvent, user) => {
this is not firing at all (when clicking interested) bot is admin
do i need another intent for it?
even guildScheduledEventUpdate doesnt fire
but guildScheduledEventCreate works
no it should be all covered with the GatewayIntentBits.GuildScheduledEvents intent
then why it is not firing 😄
Hey, so, any way to detect when a thread got autoarchived? the ThreadUpdate event doesn't seem to catch that and <thread>.archived returns as false.
i have absolutely no idea how it doesn’t
actually I do get the guildScheduledEventUpdate(tho it doesnt fire if somebody clicks interested)
but still not getting guildScheduledEventUserAdd
hopefully someone else can tell you why
nvm all of a sudden i get the event
maybe discord had to wake up
probably user wasn't cached, should emit if you have the User partial enabled
new Client({
partials: [Partials.GuildMember, Partials.Channel],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildScheduledEvents,
],
that'd be Partials.GuildMember?
No, it would be Partials.User
the event doesnt emit with a guild member object
always learning something
Anyone got any idea on how to at least check if the thread was autoarchived?
All "autoarchive" does is remove it from the sidebar in the UI. There is no actual change to the channel, everyone can still read and write. What you can check is the timestamp of the last message sent and compare it to the autoArchiveDuration of the parent channel
Alr then, thank you
Please any one fix it
How to hide thread so that no one including admin can see it
if you pay me I will fix it for you
if not you have to do it yourself with the advice I give you
you don’t, use a group DM for that
I don’t have a money
people with Administrator permissions have access to every channel
no baby, I use thread for ticket
@steel trail
it was a joke, this channel isn’t meant to place your code and say “fix it”
we are not working for you
#rules 5 and also #how-to-get-help
I'm not an English learner, so I'm short of myself
that doesn’t change my point
But looks like you tried to use a section without an accessory
yeah, use a text display component instead if you don’t need any accessory
A section needs an accessory. If you just want a textdisplay then don't put it in a section🐌
Popular Topics: Display Components
read more
use this if you need assistance for any cv2 components ^^
Thank you for new information
Can anyone help me write it without an section?
the guide can
Any guides on the containers and seperaters etc everything
@wraith cedar
Thank you
Is it possible to filter a userSelectMenu such that only specific users show up in that menu
No
nope, use validation after the select menu interaction or use a string select menu
Failed to send dynamic message: TypeError: section.addTextDisplayComponents(...).setSelectMenuAccessory is not a function
you cant add select menus to a section
Ohh. Got it!
how i can add role in private thread?
const thread = await msg.channel.threads.create({
name: تذكرة-${msg.author.username},
autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek,
type: ChannelType.PrivateThread,
reason: "فتح تذكرة"
}).then(async (thread) => {
await msg.channel.send({ content: <#${thread.id}>})
});
i want create ticket in thread system
by mentioning the role inside the thread, I commend you set invitable: false as well in the threads.create() method
YES
if added the user in thread, how give perms?
"The thread is read only"
await thread.members.add(i.user.id);
threads don't have their own permissions
give users permissions in the parent channel (ticket channel in your case) to send messages in threads
thats a seprate permission, you don’t need the “Send Messages” permission itself
addAttachmentOption for the slashCommand
Can i upload txt files, or only media?
When i run shortly after the bot boots:
const guild = await this.client.guilds.fetch(guildId);
if (!guild?.channels) {
this.logger.error(`Guild ${guildId} not found`);
return;
}
return await guild.channels.fetch(channelId);
This error gets thrown every time. The bot is in the guild. Why does it error?
Is it because of caching? Should I use force? What implications will that have (if any)
this.client is of type Client, by the way
What error exactly
There’s basically no reason to fetch a guild, and little to no reason to fetch a channel. Guild.channels will never be null/undefined either unless you did something wrong
Try it, I think you can though
Guild <id> not found
Where do you run this?
How do you propose I fetch a channel
It's run when an API endpoint is called, so let me put it this way
Say when I fetch /hello, I want the bot to say "Hello" in a specific channel in a specific server, I need to fetch that channel, now what's the best way to do that
client.channels.fetch, or just client.channels.cache.get, if you have the Guilds intent and the channel isn’t some thread channel then you can use the cache
Is there a method to create tables within a message?
Tables?
Rows and columns data structure in a message
Nothing djs can help you with, gotta make those yourself
😛 Suspected that. Alr, thanks
But imo I just wouldn’t since it’ll be super hard to do
So instead of fetching a guild and then a channel from the guild, just fetch the channel from the client?
Yh, but again if you got the guilds intent and it’s not a thread channel there’s no need to fetch. But fetch does check the cache first
I don't remember the maximum number of components you can have in a ComponentsV2 message... What is it?
40? I think, idk
Alrighty, thanks!
If the cache is empty, does it then automatically fetch from the API instead of returning undefined?
yes
fetch never returns undefined or null
if the resource doesn't exist it throws
a cache get does return undefined since it's just a map
i can remove in mention add user to thread?
yep, using <ThreadChannel>.members.remove()
i want prevent if user mention
set invitable to false on thread creation as I said before: #djs-help-v14 message
if that is set to false only users with moderation permissions can add users to the private thread
thanks
"moderation permissions" only administrators?
I have to say I have actually no idea to what permission that is bound, but if I had to make a guess I would say users with "Manage Threads" permission
Can someone help me understand what the heck is going on here??
I have a command that is setup in the exact same way as all of my other commands, and it DOES appear in the command list, and it even says its refreshing and reloaded 6 application commands. However, when I try to run the command, it says it wasn't found, and it says a WARNING when I deploy saying its missing "data" and "execute"
My deploy code is basically 1 to 1 from the guide, and all my other commands have gone in fine.
well how does your cancelMatch.ts file look like?
@dense jackal posted it
can you add like a console log statement inside the if statement block when data or execute is not present?
aka wherever you have console.log("[WARNING] ...") please console log the command object as well
Sure, one sec
nvm, I managed to fix it, I guess I was running code in the wrong order
cool!
I've added some new commands to my bot but they are only showing for myself and not others
They also don't show in the integrations no matter what
Anyone could help?
could be a caching issue, ask them to reload discord by using CTRL + R
Already tried that many times
I've done most of the basic debug things
is it a user installed app? those don't show up in the integrations tab of any server
and ofc won't show up on anyone else their account except yours as you installed it on your account
Nope, server one, it already has plenty of commands previously aswwell and wwhen I first added these new commands it did output that they registered
but if they don't show up on the integrations tab then it didn't register them
weird
can you show like screenshots
First screenshot is my view, second one is from an alt which has administrator perms
Integrations tab just has all the previously registered commands that were added back in like 2024 except these new commands
can you show the integrations tab overview of your "Lakeside" bot too
does the command actually work from your end?
yep
hm sorry then I have no idea, maybe someone else knows what's happening here
for anybody else if they are gonna help: i kicked and re-added the bot and that didn't fix anything
Do you have your bot user-installed too? How many bots are on the server in question?
i had the bot user installed aswell as server installed which then made the commands disappear, so i think its something to do with that
and there are 7 bots
i also added an extra command and it appeared in dms, but not the server so it's def something to do with that
what contexts and integration types?
uhhh i dont knoww what that means
which is probably why it's behaving like it's behaving
i mean i've added commands before and never had this issue
Hello, on discord.js there is a possibility that the bot recognizes the tag that a user has and then gives a role for example.
in the next release of discord.js
don't crosspost
thx
can you try to log the command object of punish
yet again i'm sounding dumb, how? 😭
you don't, its just a very weird situation where you only be able to use a slash command that works like normal but doesn't show up on the integrations tab OR for other users
and since you have never heard of contexts or integration types as you said earlier, I doubt you have changed those two -- but we have to confirm that so I ask you to share the full command object of the punish command
they might not have changed
but discord defaults them to certain stuff
like integration types default to enabled install scopes
but its weird if they said the app is both user and server installable
.
yeah but that would mean they turned off server install
i only turned it off since it's a private bot
yeah don't do that
there is an option made for that, called "PUBLIC BOT" (Developer Portal > Bot tab)
if you turn that off no one except you can add the bot to servers
there is a date for the next update
no
could it possibly be due to how i register commands
it is due to how you register commands, but since you never changed the context or integration types I thought that wouldn't be the issue
but now you said you turned off "server install" which you shouldn't have done
if you want to make your bot private you only have to disable the "Public Bot" toggle I talked about earlier
so i basically set the punish command to unregister, then i set it to register again after a restart, which then somehow fixed it?
i also had to enable server install too
that should fix it yeah, as long as you have ticked "Server Install" on the dev portal (and saved changes)
How does one extract options from subcommands? The docs specify how to create subcommands, but not how to get options from them
Slash Commands: Advanced command creation - Subcommands
read more
Slash Commands: Parsing options - Subcommands
read more
So switch on which subcommand, and then extract options like normal?
That will work, correct
how do i properly extend Client and ensure it actually gets passed around (such as when accessing it from an interaction)? does this already happen under the hood, and typescript just can't represent it?
i see this note in the guide, but not sure exactly how to go about this without casting or augmenting (as it seems to imply you can):
For TypeScript users, we recommend extending the base Client class to add this property, casting, or augmenting the module type.
yeah it gets passed around
you can cast safely
so it does need casting? as said, that section of the guide seems to imply typescript can infer this somehow but i'm not seeing how that can happen. or maybe i'm misunderstanding it
You can do
declare module "discord.js" {
interface Client {
db: ReturnType<typeof drizzle<typeof schema>>;
}
}
As an example
We highly recommend you extend the Client structure properly instead of just attaching custom properties like .commands to the regular discord.js Client instance.
- Using typescript, you might want to consider casting or augmenting the module type
Second link I believe
that's module augmenting, right? if it's that simple i can look into that for sure
I believe so
yeah I think it's badly worded, it can't infer that
Heya, does this bring the guild tags now?
what is "this"?
14.22?
If so yes, those are "user guilds" in the API - silly naming I know
😂 why that's very weird, is there an event for them?
Like a user equipping the user guild
GuildMemberUpdate
Not that I know of. Might fall under a GuildMemberUpdate
What is the reason property mentioned in latest core release? Is this for audit log only for actions like archive thread?
Yes
Ty 🙏
Guild tag are also documented in this version right ??
whats user collectibles?
the thing thats on ur avatar
avatar decoration?
thats one of them yes
Umm how means which module?
?
npm install discord.js@latest
I dont know how you translated that haha
use the docs if needed
Na I mean Which event to use for this?
its the user object
Please keep user apps out of here, stick to #app-commands if you must
if a role has a hex color now. does it mean the role primary color is always populated with the roles hex color?
correct
yeah seems to be the case, because it didn't make sense to me either how it could, i thought i was missing something haha
well, i set up the augmentation and it seems to be working at a glance, so thanks to you both!
so why does role hexColor still exists
what?
To... provide the colour in hex format?
Why would we remove that?
but hexcolor is always the primary color right?
It provides the primary colour in hex string format, yes
ok thanks
What is userguilds?
tags
What do you mean?
MQHW
your MQHW tag is a userguild
-# can someone edit the announcement to replace "user guilds" with "server tags"
no
But maybe in addition to, explain it
Ohh
done
userguild is UserPrimaryGuild?
yeah
Is any documenation available for the role gradients?
what it means identityEnabled, i didnt know u could disable or enable your guild tag from showing?
yeah, discord docs have it for couple weeks now -- its on the role object
Role#colors discord.js@14.22.0
The colors of the role
or this just means if user has a guildtag or not?
I mean thats what the docstring says
"Whether the user is displaying the primary guild's tag"
if you look at the docs you can see what each property means
Though I dont know how to control that
I had to go looking for where you even set the tag, Ive never bothered to find it lol
was just confused with the primary naming that it could mean a specific guild
It does?
I think the name "primary" is because you selected one specific guild (server) out of all guilds you are in to be present next to your name in the form of a server tag
How'd you edit it?
I didnt, the author did
i mean if i want to check if a user has my guild tag i can check with identityEnabled?
Ohh okay
I'm not sure I understand the question, that seems like the least important prop to compare
did you read the description on the docs
I mean it makes sense they want to know if their users are rocking out their guild on their profile
if (guildId === identityGuildId)
no need for the identityEnabled property whatsoever
whether the user is displaying the primary guild's server tag. This can be null if the system clears the identity, e.g. the server no longer supports tags. This will be false if the user manually removes their tag.
So no, users cant decide on their own to show it or not
But can be null if the guild removes the tag while users have it selected as primary
I would have thought if the user removes the tag, the other props would also be removed
uh im just gonna test out and see
is there any guide for the latest features of version 14.22.0?
the docs has everything you need. there's no need for a guide for that
if you have any questions related to the latest update, don't hesitate to ask
is there an equivalent of resolveColor() but number to hex?
We wouldnt bother, its just <number>.toString(16)
oh ok thanks
Hello! I'm trying to use the new user.primaryGuild feature. Even after using user.fetch(true) on a user who has a server tag visible on their profile, the property is always null.
// This is the code I'm testing with:
const user = await client.users.fetch('500293365494054932', { force: true });
console.log(user.primaryGuild); // Always logs 'null'
If your bot isn't also in that guild, the guild wont be in your cache
You will have access to its ID, and you may be able to fetch some minimal public data about it
Is there any way for the bot to set the image as a 'thumbnail' when creating the topic?
with 14.22 it should be <role>.colors right?
Role#colors discord.js@14.22.0
The colors of the role
Correct, it's colors with an s. color still exists but is deprecated
Forum posts don't have a thumbnail attribute. That should just be set by an image sent in the initial message of the forum post
node:30836) DeprecationWarning: The ready event has been renamed to clientReady to distinguish it from the gateway READY event and will only emit under that name in v15. Please use clientReady instead.
(Use node --trace-deprecation ... to show where the warning was created)
[2025-8-20 21:55:22] WARNING: DeprecationWarning : The ready event has been renamed to clientReady to distinguish it from the gateway READY event and will only emit under that name in v15. Please use clientReady instead.
what does this mean
It means except what it says. The ready event has been deprecated for the clientReady event It still works in the current library but will stop working in version 15
exactly as it says. the "ready" event will be renamed to "clientReady" in the next major version of discord.js
so it's best to migrate your code to the new event name now to prevent issues in the future when the next major version is released
so I should rename ready.js > clientReady.js?
No ...
no
your event name, not the file
though, you can do that if you want
oh alr
it won't change the way the event functions
its just a name change, same functionality
hi
hello! if you need help, please look at #how-to-get-help. otherwise, please use #archive-offtopic
So i am new to node js and tried with gpt to make saphire commands but idk how to make correct
this is the discord.js server
that provides support for the discord.js library
what do you need help with?
so basically it will keep saying that until version 15 comes out?
I want run command on node js but its dosent work
No ... Just change your Event.Ready to Event.ClientReady
no, you change your code to what the warning says to make the warning disappear
k
like for example "npm install @sapphire/framework discord.js@14.x"
please be more elaborate on your issue #how-to-get-help
Once v15 happens, your code will break if you don't change it. That's what a deprecation is
We do not offer support on Sapphire Framework, just Discord.js (which Sapphire uses under the hood)
as i previously stated, this is the discord.js server. the sapphire support server is listed in #useful-servers
But how i dowloand djs v14
From node js text -> "Welcome to Node.js v22.18.0.
Type ".help" for more information.
npm init
npm should be run outside of the Node.js REPL, in your normal shell.
(Press Ctrl+D to exit.)
"
in your project's directory, npm i discord.js
._.
npm should be run outside of the Node.js REPL, in your normal shell.
I suggest you brush up on how to write a node application, if you don't know how to install a package
This falls well into the fundamentals we expect you to know
Im lowkey and im new to development
I'm well aware
the guide also explicitly says you should first know that, and some resources in case you don't
wdym
with what?
npm should be run outside of the Node.js REPL, in your normal shell.
Yes. Do not run node
Use npm in the terminal
But like i want make costume command for saphire that requires, djs 14 , node js even sapphire framework!
Yes
Those program need be installed how bruh
i search up for 3 hours and find nun
The way you've been told multiple times, and seem intent on arguing with instead of following 
which project directory...
Your code folder
uh
do you know how to navigate the terminal to change directories?
if not, we cannot help you further
#resources has places you can go to learn the fundamentals...if you try and skip that, you're going to have a bad time
you mean in c desk or in node?
Definitely not in node
Get out of node
You do not run commands in node
So?
So you open a terminal, such as command prompt or powershell, navigate to your project folder in that terminal, and run commands
This is likely the first thing almost any Node.js application tutorial would teach you, and I'm going to ask you one last time to go and follow one instead of wasting the time and patience of our volunteers
1 question that my english broke down
It might seem like you are being unable to get it about what exactly people are endeavouring to mean to.
If you are already in NodeJS repl then type in that input ".exit" to terminate the repl and you will be available to access your terminal again. Then you have to run:
# If you have not initiated
npm init --yes
npm install <packages>
I cant even understand terminal..
that is the first step to learning how to program
so please do your best to learn how to use the terminal before you do anything programming related
Im so stupid
So
no you're not. you just need to put in some effort into learning this
I found Command promp and says Your environment has been set up for using Node.js 22.18.0 (x64) and npm.
C:\Users\my name>
[DATABASE] Connection established, but the state is not 'connected'.
how to fix that
correct or no
not d.js related
do you know how to change directories or even create one? this isn't nearly close to being discord.js related either
if you don't, we cannot help you further im sorry
was this ever fixed
I think i know
then you can figure out how to enter your projects directory, then proceed to install discord.js via npm
so i have testing bot.. and now i want to figured out how to clear old slash commands and made the new im testing appear
like this command is old one and the new one doesnt appear
If you rest.put, it will add, update, and delete slash commands all in a single request
Make sure to restart your discord client after deploying commands for them to appear (Ctrl+R)
So i have this problem and idk what do next
@junior sentinel
Soooo I have a question, will the userUpdate event also be fired when a user changes their server tag now?
I would presume so, per Discord's documentation:
Sent when properties about the current bot's user change. Inner payload is a user object.
how I can refresh the hash to get new attachment?
By fetching the source message again to get a new attachment url
or - not using discord for file hosting
try {
const bannerUrl = member?.banner || member?.user.banner;
if (!bannerUrl) {
await interaction.reply({
content: "This user doesn't have a banner.",
flags: MessageFlags.Ephemeral,
});
return;
}
const mediaGallery = new MediaGalleryBuilder().addItems(
new MediaGalleryItemBuilder()
.setURL(bannerUrl)
.setDescription(`Banner of ${member?.user.username}`),
);
I have a user that has a global but not server-specific banner, how can I gracefully fallback? 🤔
Here's my "member" btw
const member = options.member || interaction.member;
I keep hitting the early return message for users that do have a banner, just not server-specific
member.displayBannerURL() returns the members banner url, if they have one. Otherwise the global user banner.
null if they dont have one
Doesn't look like I have access to the property
what is member defined as
Here's full context, apologies
import {
type ChatInputCommandInteraction,
ContainerBuilder,
MediaGalleryBuilder,
MediaGalleryItemBuilder,
MessageFlags,
} from "discord.js";
import {
type CommandOptions,
type CommandResult,
createCommandConfig,
} from "robo.js";
export const config = createCommandConfig({
description:
"Fetch the server banner of the specified member, defaults to self",
options: [
{
name: "member",
type: "member",
description: "The member to fetch the banner of",
required: false,
},
],
} as const);
export default async (
interaction: ChatInputCommandInteraction,
options: CommandOptions<typeof config>,
): Promise<CommandResult> => {
const member = options.member || interaction.member;
if (!interaction.inCachedGuild()) {
await interaction.reply({
content: "This command can only be used in a server.",
flags: MessageFlags.Ephemeral,
});
}
try {
const bannerUrl = member?.banner || member?.user.banner;
if (!bannerUrl) {
await interaction.reply({
content: "This user doesn't have a banner.",
flags: MessageFlags.Ephemeral,
});
return;
}
const mediaGallery = new MediaGalleryBuilder().addItems(
new MediaGalleryItemBuilder()
.setURL(bannerUrl)
.setDescription(`Banner of ${member?.user.username}`),
);
const container = new ContainerBuilder();
container.addMediaGalleryComponents(mediaGallery);
await interaction.reply({
components: [container],
flags: MessageFlags.IsComponentsV2,
});
} catch {
await interaction.reply({
content: "This user is not in the server.",
flags: MessageFlags.Ephemeral,
});
}
};
put the const member =... below the inCachedGuild check
otherwise the member can be an APIInteractionGuildMember
ahh
I think the library I'm using types it as an APIInteractionGuildMember, I'll see if I can cast it
djs does that if you didn't use any typeguards
Does anyone know how I can get any message my bot sends weather it's ephemeral or not?
Because I want to make a system where I can just have a collection of message ID's and their respective interactable components inside it so I can check if weather or not that message ID and their components are valid or not (Like a timer before the component can be interactable or not)
No idea, you're asking in the wrong place
You can't fetch ephemeral messages by regular means, you can only access them via their interaction
:O
hello my brothers
do you have the documentation to understand how to get an USER TAG ?
Like, if i have DRGN TAG, i receive role.
User#primaryGuild discord.js@14.22.0
The primary guild of the user
make sure to update d.js, the release with this feature was 11 hours ago
I'm still having trouble when trying to fallback to their global banner 🤔
and what's what you have trouble with then?
with just code I can't really provide help
thanks bro
for this advice.
Discordjs Voice is nice?
Can i do speak the bot?
Is there a perfered way to manage these interactions? Cuz doing smth like setting the customId to like newId_{interaction.user.id}_{Date.now()} just feels wrong, and is more work imo
Like idk I feel like there is a better way than to rely on sketchy code
What are you trying to capture?
And what makes that "sketchy" exactly?
The expected result of this command is to show the users server-specific banner or if they don't have one but do have a global banner, show that instead. For users with neither (non-nitro users or nitro users without a banner) show a graceful error message. My current issue is that nitro users with a global banner set (not guild specific) hit the same generic "You don't have a banner set" as non-nitro users.
I want to have a system that handles the button or Menu dropdowns, etc that runs back to my module.export in my commands js file so i don't have to think about all the messy interaction between
I followed the DiscordJS guide for setting up a basic project that uses the uh commands and events folders to run the commands and initialize them and what not, and I want to just add onto the async execute idea they put into it, so I can like receive all my button interactions in that js file itself, so its all contained in the same area.
like checking every interaction component that is ever ran through customId checks to see if contains the right format, and if it does then just reroute it based on the information or whatever
cuz I don't want to have to remember the formatting for a customId and just get confused why my interaction won't work
btw sorry if its confusing rn im just tired and im slowly processing information rn 🥀
on power save mode fr
did you console log member to see whats actually present in there?
back to square one: your question is how to get any message from an interaction of both buttons and select menus, no matter its base message is sent ephemeral or not
every button interaction and select menu interaction has the message property, so you can get the message from there
Well yeah I know that, but I am trying to then get that interaction back to the command structure it was sent from
So in my case, if I use /test and it sends a button component and then I click it, from InteractionCreate it should detect what command it was sent from and then require the JS file to then send the appropriate function call, so I don't have to worry about random Interaction garbage that isn't even related to the button component I'm trying to check for
But now thinking about it, might it be easier to just really filter garbage? ugh idk
The only reason I wanted it to be clean was I was adding a Page System class so I could have clean pages with the new ComponentsV2 Containers
But detecting button interaction for that specific page instance is annoying to consider because you need to think about the Items in the page, and the information needing to be updated dynamically when editing the message and what not.
is that button component in between /test and the correct function call needed? why not skip that whole button part?
or am I misunderstanding something
This can work fine if you include the command name in the button id, but you risk losing any context of the previous interaction if you dont also include that
Well it's from a ContainerBuilder so I don't have direct access to it unless I de-structure it into variables to have CollectionEvents or smth
Here is like an example of what Im trying to achieve basically ig
So you have the exampleButton being set in ButtonAccessory and then from the InteractionCreate event it should then call the onButtonInteraction function back into the command.js
So I don't have to care about the small stuff
I'd suggest using interaction ids as reference data and storing what you need alongside those
so your saying it's normal to store information in the customId?
ye
Small amounts yeah
It just feels wrong to me 😭
A custom id like command_id_action is fine
If you need to store more information id do command_button_<unique id here> or whatever that I can then lookup in a Map
alr I guess I'll keep this in mind ty
Also whats the difference from Map and Collection, and why would map be better?
It wouldnt, Collections are extended Maps
collection extends map afaik
Map is the core useful part allowing you to .get(id)
oh so it just has some extra funky functions
yeah
peak, ty again ❤️
Collections are a hybrid Map/Array basically, extending Map as the base structure
Hey all, quick question, since which version was .setDMPermission for the SlashCommandBuilder deprecated?
Dont know exactly but a while ago, why?
Ever since discord deprecated it in the API and contexts and integration types were introduced
Installation contexts became a thing so it is now obsolete
I've been out of bot development, and just noticed it in one of my commands. Does any of you happen to know where I can find more information on these integration types and installation contexts?
Developing A User-Installable App - Step 2: Setting Up Commands
integration_types lets you control which installation contexts a command is supported (user, guild, or both). For example, the /link and /profile commands we'll be creating are only available when the app is installed to a user.
read more
Creating Your Bot: Creating slash commands
Integration with the Discord client interface.
read more
I think our guide is updated too
I'll take a look, thanks!
I imagine it's undefined or null. I can't get an answer for you right now, but it's falsy hence it hitting the conditional which it shouldn't (in theory)
but I can't help you with just code and assumptions or imaginations, I need concrete values from a log statement
let member: GuildMember | null = null;
if (interaction.inCachedGuild()) {
member = options.member ?? interaction.member;
console.log("Member found");
}
console.log("Member:", member);
banner: undefined
banner information is not sent in user/guild member events
You need to force fetch the user
ahh yeah i forgot
await guild.members.fetch(userId, { force: true });
Hey i got a quick question, When retriving the payload from a componentv2 container, How would you edit the specific field using the ID that's set on it
Or is that even possible by chance
Can someone recommend the best strategy when I have periodic updates to perform in a status message embed on several hundred servers?
How do I best deal with potential rate limiting on one guild without blocking the update on others, for example?
Message edit rate limits are per channel I believe, not per guild
Yes, I know that 👍
But if for some reason one create or edit is rate limited, what is a good architecture to prevent that from blocking everyone else?
its per channel so doesn’t matter?
A "good architecture" wouldnt do this at all, since thats not what the Discord platform is really designed for
Hey monbrey do you possibly know if components/containers can be fetched via payload in a thread
If a loop over all messages that need editing encounters a rate limit the call will then return with a sync/await and block until it can continue, that's why I ask for a general architecture on how that could be done better🙂
But it is what a lot of people request and want to do in gaming communities anyway
I'm not sure what you mean by "fetched via payload". You can fetch messages by ID
Trust me I know, half my job is telling people why what they're requesting to do is a bad idea
Like say for example, I sent a container in a thread and want to edit that container by changing the color of it, removing the buttons and a specific field in that thread, Sort of like normal embeds, Would that be possible by just doing the normal message.edit whole deal or is there a function to edit a specific thing
There is no compliant architecture which will avoid Discord rate limits. Webhooks are the only alternate rate limits available
Yeah you just edit the message with new components
And that would overlap correct?
Overlap? It will replace the old components with the edit, yeah
not good to edit tons of messages within the same channel anyways..
host a website dashboard or anything if you need to send out updates regularly on a big scale
And there's no way to preserve those old components at all
You include them in the edit payload
though how would i do that, unless i retrieve the original content
By retrieving the original content
That's what fetch is for
and could i do that with getting the payload of the components or no
Yes, components are included in the message payload you can fetch
So then if i take a interaction from the button interaction, and then do interaction.client.channels.fetch(thread.id)
and then take the payload from the top message of that channel, it should supply me with everything in that payload
Then when i am editing it, all i do is use a new containerBuilder to basically overlap it
if the button is on said message you don't need to do that step it'll be in the inner interaction message from the button press
Yeah but i want to make sure that the buttons get removed after the interaction p much from inside the container*
then you respond to the button press with an update and supply the components you want to be present after the edit
You can pass an old container to a new container builder
I think is what you're asking?
Yeah like passing most of the content from the old container, to the new container and just editing:
- One of the fields that i want to edit
- Changing the color of the container
- Removing the buttons from the container
that's all i want to do
what the upload size limits
same as for regular users or members
oh so in lvl 3 boost server 100mb
yeah
is it possible to get more than 100
no
why would a bot even send 100MB+ files
gif +150 mb
150mb gif??
buy nitro
but bots can't do that
so they cannot send that
case closed
thx
use some compression on the gif lol
yeah i will
how high quality gif you have for it to be 150 mb
i create rocket crash game and using frames up to 1000 frame then convert it to gif , between each frame 150ms
the frames depends to multiple
a game in discord? you really should use Discord Activities instead
nope i need a bot
then compression it is 
yes i will
pretty sure those aren't mutually exclusive things
wtf is this?
so yeah thx guys
screnshot. #archive-offtopic
stake's crash thing?
stop
huh what?
not a channel for such questions
k
This is not a job board, please take it somewhere else
Is there a method for looking up the mutual servers/guilds between a user and the bot? Or should I just call GuildMemberManager:Class#fetch in every guild the bot is in?
Fetching user banner...
discord:event - Event received: interactionCreate
discord:event - Received slash command interaction: /user server banner
User banner fetched: null
If I try to use force I'm getting this in my IDE
ah my bad, should be fetch({ user: member.id, force: true });
mixed up the client.users.fetch() with this fetch method
-# idk why thats even different in params but sure
This is a use case for oauth2. Your suggested method is spammy
OAuth2 is not applicable for my use case/context
The mutual guild lookup would only be run on a specific interaction, so not regularly per se, I'd imagine caching does a lot of work as well (possibly with Redis in front)
If you have the guild members intent, you could fetch members once, then the cache would be populated and updated as new events are received
Default d,js cache is memory based right?
Did container can send in private message, i mean flag 64
-# on interaction.
discord:event - Received slash command interaction: /user server banner
(node:50491) Warning: Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.
(Use `node --trace-warnings ...` to show where the warning was created)
User banner fetched: null
discord:event - Event received: messageCreate
discord:error - Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
Now apparently I'm replying twice (one instance)

cv2 styled messages can be sent anywhere
DiscordAPIError: Interaction has already been acknowledged[InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
You have already replied to the interaction.
- Use
<Interaction>.followUp()to send a new message - If you deferred reply it's better to use
<Interaction>.editReply() - Responding to slash commands / message components
👍
that's the only one
hello How to make a nameplate into an image like a banner?
@wary coral i appreciate the attempt to point me to documentation, but in my case I haven't yet sent a reply or deferred so I can only imagine I'm hitting the 3 second interaction window? Did you look at my source beforehand?
without the full error stack + the user object + a screenshot of the user having an actual global user banner I still can’t help you
if you catch your errors properly with stacktrace we could pinpoint where
but now its just a lot of guessing

that's fair - apologies I'm cut short for time, thanks nonetheless
hi i need many bots in my server but i keep hitting rate limit i want to ask what is the rate limit how long it lasts and how many bots i can create in 24 hours
That's not related to d.js, you can try asking in ddevs
okay thx
Is it possible to connect bot in dms call ?
no
thx
Hi :) I'm having some trouble sending new container components with d.js and i get this error:
data.components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).```
This turns up whenever I try to put a container in a components argument (it seems like it's expecting only action rows still?) I've tried `npm update discord.js`
sounds like you're not sending the IsComponentsV2 flag
btw DiscordAPIError means that discord itself sent the error, not djs
it's usually a payload issue, not something in djs side (eg an outdated version)
Yeah I assumed so which only made things more confusing (:
what is this flag i need to send
v10: MessageFlags - IsComponentsV2
read more
send it on flags: in your message options
Popular Topics: Display Components - Container
read more
the example shows exactly how
It works :D thank you
https://robojs.dev/discord-bots/sage#deferred-replies- maybe? also I'm not sure if you're forwarding from robojs' support server but that'd definitely be the best place to ask first
I've got it semi working, it's odd, looks like a timing issue
well it explicitly says "auto-defer your replies if things are taking longer than 250ms"
so indeed, it's a matter of timing
I'd recommend reading the docs I linked
and asking robojs' support their recommendations and whatnot
but it's working consistently after the first use since bot startup
yup i've opened a thread there, just awaiting
i apologise, you were right I guess the user fetch was taking time, all I had to change was to followUp 🫡
you could just disable that feature or use it like it's intended to be used
Anyone know of anything going on with discord at the moment? I keep getting errors indicating my application didn't respond, but I verified the bot is up and running.
Network instability? Doesn’t have to be discords side but who knows, if there’s nothing on the status page then no
Yea, status is showing green. A few users have tried and it's not responding for anyone. I'll try and keep debugging, thanks.
Just reply quicker
can you add images via the mediaGallery in sections side by side?
not to be confused with multiple images in the same gallery
i want two instances of the mediaGallery next to each other basically
why? multiple images in the same gallery show side by side
there's no way to do what you're asking but it sounds like it's not necessary
The layout I want (ideally) is a banner and a profile picture in a 3/4 1/4 layout
[-----] [--]
it isn't possible
Hey guys, Is it possible to get the guild tag from the guild ID?
eh if the bot is in that guild then yes
otherwise you have to get it from the user object
lol what I can't find it on the guild object
seems reasonable to have that there as well but sure, then its only accessible through the user object
I mean I can probably check if "identity_guild_id" matches my guild id, then it should mean they probably have my guild tag active?
more information on this... it's not documented on the Guild object from discord yet
it is however available in the api
<3
ahh gotcha
if (i.channel.isThread()) {
await i.channel.members.add(member.id);
}
error:
uncaughtException: DiscordAPIError[50001]: Missing Access
at handleErrors (C:\Users\shong\m92-ticket\node_modules\@discordjs\rest\dist\index.js:749:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\shong\m92-ticket\node_modules\@discordjs\rest\dist\index.js:1150:23)
at async SequentialHandler.queueRequest (C:\Users\shong\m92-ticket\node_modules\@discordjs\rest\dist\index.js:981:14)
at async _REST.request (C:\Users\shong\m92-ticket\node_modules\@discordjs\rest\dist\index.js:1294:22)
at async ThreadMemberManager.add (C:\Users\shong\m92-ticket\node_modules\discord.js\src\managers\ThreadMemberManager.js:115:5)
at async Client.<anonymous> (file:///C:/Users/shong/m92-ticket/index.js:619:13) {
requestBody: { files: undefined, json: undefined },
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
why?
bot does not have the “Manage Threads” permission in that channel
bot have perms
how do you know?
bot have administrator
and "ManageThreads" in a parent channel
administrator doesn't override the implicit permission checks
Popular Topics: Permissions (extended) - Missing permissions
read more
make sure that all the cases in that guide are covered
uncaughtException: DiscordAPIError[50001]: Missing Access
at handleErrors (C:\Users\shong\m92-ticket\node_modules@discordjs\rest\dist\index.js:749:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\shong\m92-ticket\node_modules@discordjs\rest\dist\index.js:1150:23)
at async SequentialHandler.queueRequest (C:\Users\shong\m92-ticket\node_modules@discordjs\rest\dist\index.js:981:14)
at async _REST.request (C:\Users\shong\m92-ticket\node_modules@discordjs\rest\dist\index.js:1294:22)
at async ThreadMemberManager.add (C:\Users\shong\m92-ticket\node_modules\discord.js\src\managers\ThreadMemberManager.js:115:5)
at async Client.<anonymous> (file:///C:/Users/shong/m92-ticket/index.js:621:13) {
requestBody: { files: undefined, json: undefined },
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/channels/1408213624505372726/thread-members/805456030582439936'
}
I gave it permissions but it doesn’t work.
Well then no, you didnt
It does not have permissions
What should I give it?
Missing Access usually implies not having permissions over the thread at all, suggesting its the parent channel
can you console.log(i.channel.permissionsFor(i.guild.members.me).serialize()) and show the output
how would i get the number of bots in my server?
you'd need to fetch all members and filter in the resulting collection
GuildMemberManager#fetch() discord.js@14.22.0
Fetches member(s) from a guild.
// Fetch all members from a guild
guild.members.fetch()
.then(console.log)
.catch(console.error);
{
CreateInstantInvite: true,
KickMembers: true,
BanMembers: true,
Administrator: true,
ManageChannels: true,
ManageGuild: true,
AddReactions: true,
ViewAuditLog: true,
PrioritySpeaker: true,
Stream: true,
ViewChannel: true,
SendMessages: true,
SendTTSMessages: true,
ManageMessages: true,
EmbedLinks: true,
AttachFiles: true,
ReadMessageHistory: true,
MentionEveryone: true,
UseExternalEmojis: true,
ViewGuildInsights: true,
Connect: true,
Speak: true,
MuteMembers: true,
DeafenMembers: true,
MoveMembers: true,
UseVAD: true,
ChangeNickname: true,
ManageNicknames: true,
ManageRoles: true,
ManageWebhooks: true,
ManageEmojisAndStickers: true,
ManageGuildExpressions: true,
UseApplicationCommands: true,
RequestToSpeak: true,
ManageEvents: true,
ManageThreads: true,
CreatePublicThreads: true,
CreatePrivateThreads: true,
UseExternalStickers: true,
SendMessagesInThreads: true,
UseEmbeddedActivities: true,
ModerateMembers: true,
ViewCreatorMonetizationAnalytics: true,
UseSoundboard: true,
CreateGuildExpressions: true,
CreateEvents: true,
UseExternalSounds: true,
SendVoiceMessages: true,
SendPolls: true,
UseExternalApps: true
}
what should i filter by though? as in on the GuildMember?
.filter(member => member.user.bot)
and who are you trying to add? a regular member? the owner?
regular member
maybe they don't have permissions to be in the thread?
no idea how that works
you could ask in ddevs #useful-servers given it's more of an api question
why is it saying bots are 0 when there are bots?
you need the GuildMembers intent
i do have it
please show that you do
Why are you doing .values.length? Did doing .size return 0?
.values() is also a method but you didn't use it as such, that code should have returned undefined
-# you also should just fetch on ready and use the cache data because it still be updated with new events. Discord recently announced a stricter fetch ratelimit for that endpoint
No, it should return 0 - the length property, when accessed from a function reference, returns the number of parameters in the function definition.
Which would explain why they see 0 even if they do have the intent.
Oh, I'm certainly no js expert 
Anyway, using the size property would be better
modal fields headers can only be 45 chars long?
The API docs should list any relevant limits
Learn more about modal limits at the Discord Developer Documentation
such a short limit is a crime
guys what different bytown
interaction.isChatInputCommand()
and
interaction.isCommand()
Pretty sure isCommand() includes context menu commands.
the former is for slash commands, the latter is for both slash commands and context menus
also entry point commands
is there a place where I can see what error types are thrown for example, when a guild doesn't have an icon? A source of truth for error return types
there's no error? it just returns null
hm i see
what about a generic permission error from the user side trying to use a command that their permissions are too low for
there's no error for that either, it just doesn't show the command
assuming you mean the default permissions you can set from the slash command builder/data
i didn't even know that was a thing, i kept my permission logic bundled with the command logic, that's neat
anyway my aim is to throw my own errors similar to discord to then catch them in a global error handler that replies with generic error messages
if they're your own then that's entirely on your side to handle
You'll probably find that JS isnt a particularly good language for doing that in
what path do you suggest for global error handling in that case?
djs doesn't have an error handling system if that's what you're asking, apart from the Client#error event which is a thing inherited from the (async) EventEmitter
ah i see, thank you
Catching errors locally and passing them off to some utility, like logger.handleError or whatever, then you can pass your own info object to it also
hm I see. This could work well, in my head I'd have some sort of map that takes error types as I mentioned and replies with messages based on the incoming error
a prime example, "This is not your interaction" for button interactions
you're free to do whatever implementation you'd like
i'm just seeking second opinions while im here really
ClientUser#primaryGuild discord.js@14.22.0
The primary guild of the user
@sudden grove please use #app-commands or the hide option for personal docs usage
sorry i couldnt find it
wrong channel?
i was about to answer, you're in the right place for that err
the guild id you put is not an actual id. did you put the id as a number or a string
i put the guild id as a string
can you show that you did?
const { Routes } = require('discord-api-types/v10'); // You'll also need this for the Routes class
const { clientId, guildID, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');
const commands = [];
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
const rest = new REST().setToken(token);
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();```
what did you put as the guildID in your config.json?
cuz i did so
that's not what i asked
i was asking what you put
i put the guildID in config.json
i see the problem
you misspelled it
where is it?
one is guildID, one is guildId
Oh
your import is probably incorrect, so check your config.json to see what you defined it as
i just fixed it already
just a minor fix you should do,
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v10');
these should be one import directly from discord.js as shown,
const { REST, Routes } = require('discord.js');
i just fixed to prevent being mispelled
i changed it const { REST, Routes } = require('discord.js');
looks good
to add on this: discord is working on adding text display components in modals (and select menus in modals too), so do know you will have more freedom within the near future
I'm running into a strange problem currently where my bot seems to be connecting to voice channels and playing sounds correctly, however, when I try and test it myself it appears that the bot is giving an error when connecting to the voice channel. Any idea what could be going on? This is pretty strange.
I'm just getting this: Connect Error: {}
The issue appears to occur in both the latest @discordjs/voice version and the one before it. For reference, I upgraded to @discordjs/voice and the latest discord.js and then reverted cause I thought that the update caused the problem but then I notice it was occuring on an untouched build as well.
what does "test it myself" mean here
your bot works and doesn't work at the same time?
In the logs for my bot, I am seeing that most of the requests for audio playback are succeeding. However, it appears that it is only failing when I am running it myself.
Like I'm not getting any user complaints about audio playback failing, yet when I run it myself in voice channel it is not working the same way
@loud quartz I suppose to rephrase for simplicity. Bot was joining the voice channel and playing audio just fine on commnand trigger. Now randomly, despite no code changes, that has stopped working.
Apologies, I figured out the issue, was not Discord related 👍
Hey how do I send a embed directly in an interaction reply again? Any help appreciated very much
14.22.0
Popular Topics: Embeds
read more
Nice red squiggly line, whats the actual error?
Looks like a version mismatch. Can you please run npm ls discord-api-types and show the full output
yup. .2 and .21
We might need to fix that
Let me get back to you on that
ok thx
when delete node_modules and bun i
Thats just plain wrong. Might need to restart the editor/TS server
thx it fix
Can you copy + paste that code here please
import { REST, RESTPostAPIChatInputApplicationCommandsJSONBody, Routes } from "discord.js";
import config from "./config";
import { readdirSync } from "node:fs";
import { Command } from "./utils/Discord";
const rest = new REST({ version: "10" }).setToken(config.token);
let commands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
let commandsDev: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
readdirSync(`${__dirname}/commands`).forEach((folder) => {
readdirSync(`${__dirname}/commands/${folder}`)
.filter((file) => file.endsWith(`.js`))
.forEach((file) => {
const CommandClass = require(`${__dirname}/commands/${folder}/${file}`).default;
const command = new CommandClass() as Command;
if (command.getOwner()) {
commandsDev.push(command.applicationCommands().toJSON());
} else {
commands.push(command.applicationCommands().toJSON());
}
});
});
console.log(commands);
console.log(commandsDev);
const clientId = atob(config.token.split(".")[0]);
rest.put(Routes.applicationCommands(clientId), { body: commands })
.then(() => console.log(`Successfully registered ${commands.length} application commands`))
.catch(console.error);
rest.put(Routes.applicationGuildCommands(clientId, config.guild_dev), { body: commandsDev })
.then(() => console.log(`Successfully registered ${commandsDev.length} application commands for dev guild`))
.catch(console.error);
Can you nuke your lockfile and node_modules and install again? I think the error will go away
oh, it can fix
Is there anyway to have a button collector last forever? Like when I turn off the bot and turn it on again the button collector will still be able to collect?
yes, its called the interactionCreate event xD
may I introduce to you: gateway events
Alright let me have a look into them, thank you very much btw
you probably using them already in ur project
client.on(“interactionCreate”, () => { … }); is a gateway event listener
How do I detect if a person wears the server tag
User#primaryGuild discord.js@14.22.0
The primary guild of the user
How would I use them for button collection?
use the interaction.isButton() typeguard
so you know that only button interactions go through, you can then filter on custom id
if (interaction.customId === “myButton”)
stuff like that, you’re basically free in how you approach it
use the docs if you need assistance with button interactions
ButtonInteraction discord.js@14.22.0
Represents a button interaction.
do messageUpdate events fire for pins as well
#1255120502239006781 message states otherwise but its been a year so...
it's pretty trivial to check yourself
you'll have the most up to date information
Anyone know a way to not have the commands button be shown in bot dms?
can we fetch a servers's tag (the guild tag) info?? to check if its enabled or not (pls reply with a ping)
that's absolutely not something users can change
if you're in dms with a bot, discord just shows that button by default first
literally all there is to it
pain