#djs-help-v14
78874 messages · Page 59 of 79
wdym same?
youre also still silently catching errors. remove all catching beside your try catch block and see what your error message says
What's consoel
Not console
consoel
where
In your code
The one you just added
What's leading up to this code
okay and what does your error message say now
also just immediately console log the error. dont make another try catch inside the error catch
how to fix (node:4352) Warning: Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.
(Use node --trace-warnings ... to show where the warning was created)
node:events:486
throw er; // Unhandled 'error' event
^
Error [GuildMembersTimeout]: Members didn't arrive in time.
console.log(await interaction.guild.members.fetch);
Discord introduced a rate limit on requesting all guild members (source)
-# Despite the announced 01/10/2025 rollout date, it only took effect recently.
- Apps may only request all members once per 30s per guild.
- You will have to update your code accordingly to make sure this doesn't affect your app.
- Look for instances of
guild.members.fetch()with no user ids.
-# We are working on making theGuildMemberManager#fetch()call reject if we receive this rate limit after requesting members. This will likely land in the next release.
-# If you confirmed this cannot be the reason, you can find other caveats in our guide
.
Good bot
is there any docs for all rate limits?
discord doesn't document them except for a few hard limits (member fetch, channel name/topic edits)
Can anyone help me with the editMe function I got the nickname to change successfully but the Avatar never changes, also is there an option for bio too
Show code
Yes
I don’t see where you call editMe
not sure how it works
Oh, ur making a manual call
guild.members.editMe({…})
GuildMemberManager#editMe() discord.js@14.24.2
Edits the current application's guild member in a guild.
Alright lemme see rq
You can set avatar, nick, and bio all at once
When using file uploads, is it safe to keep using the original upload urls to further access the image (or does that url expire)? or should I make my bot reupload the image and keep using the url from that?
(I had a response before I hadn't noticed which is why I'm resending this which was that discord is not my cdn, I am asking whether I can pass the image into another message and actually expect it to show up for people who see the message a couple of hours later)
the url you get from file uploads is ephemeral so you need to repost the attachment
right, if I pass the url to say a container, will it automatically refresh then? since the version of the url I get as ephemeral has access query, or do I have to download and reupload it?
essentially, I assume you mean reupload with repost? or
reupload it as an attachment
alright
the CDN link will expire, as in literally stop existing, trying to use the link after that will 404
👍
yea this is what i meant - sorry for the confusion
thanks :)
Oh actually one addition to my question, if I then reupload the images into a mediagallery in a container and then want to edit the container message later - is it fine to just copy the urls I find in the interaction.message? or would I realistically have to reupload again? they shouldn't be ephemeral and should just work fine there right?
if the attachments stay in the message, they stay in the message
you can edit it just fine without touching that
Do buttons automatically disappear now?
No?
Oh? I just used a command and after a while they just got removed from the message.
is it your bot?
check what youre doing in your code then
Lmao it is, my bad.
Is it a good practice to remove them after a while though?
If I leave them, will they work forever?
yes
each new button click is a new interaction your bot will receive regardless of how old the message is
whether you want to leave them or not is up to you and your design choices
Great, I don't want that. Thanks!
Also, are rate limits handled by Discord or am I supposed to? For eg. if someone decides to spam some buttons will they get rate limited, or my bot?
If you are making API requests or any complex code then you should add a rate limit
Discord does add their own as well
there is a rate limit if someone is spam clicking a button from discord ^ yeah
So how do you deal with them? I mean from what I've made so far, interactions aren't the fastest thing I've seen.
Make a cooldown?
Cooldowns
Spam is something you generally want to avoid, especially if one of your commands require calls to other APIs or takes a bit of time to build/send. This section assumes you followed the Command Handling part of the guide. First, add a cooldown property to your command. This will determine how long the user would have to wait (in seconds) before using the command again. In your main file, initialize a Collection to store cooldowns of commands: 1. now: The current timestamp.
Oh, that's a thing now? But from what I see, cooldowns are static numbers and they will always be applied. I don't know if I want to add a few second cooldown for every interaction. Seems kinda bad UX wise.
It's not for every interaction, you decide if an interaction should have a cooldown and for how long, the cooldown then is specific to that interaction
Exactly! That's what I meant. Although now that I think about it it's not the worst idea. I'll look into it, thanks!
Pretty much most major bots have cooldowns, it's your bot, make it however you want

Hi there -- quick question on sharding. Does ShardManager "rebalance" periodically?
is there a better way to work around the new discord rate limits for fetching all guild members than making a command have a 30 second cooldown?
The bot runs on a relatively small server (few hundred people)
then i dont see any reason for you to fetch all guild members every 30s? Use the cache instead
No
Worked thank u
Is it possible to preset/default an option/autocomplete option in a command link?
nope
Aw heck, ok thanks 
what's a command link
A mention that auto fills a command when you click on it
what is this used for
suggest commands
can we do it here? like as an example someone mentions a command
"use </docs:788838056144142346> to search in djs' docs"
Ohhhh
that's pretty neat, thanks
Holy 08:00 ping

ooh you mean like if I don't edit the files property it'll be fine?
also - is there a recommended way of running both a deployed version of a bot and a testing version while working on the bot code? (as in to keep the bot up but also be able to test without the deployed version highjacking my testing interactions)
Using ephemeral embeds, are ** type of texts not a thing
they are 🤔
Guys ive a question does someone have an example code for managing subscriptions with the new Subscription Api of discordjs ?
weird, they don't work for me for some reason
just as a sanity check could you show that bit of code?
await panel.pin();
return interaction.reply({
embeds: [
successEmbed(
interaction,
` VoiceMaster setup complete!\n` +
`⚠️ Run **/voicemaster reset** if you want to reset VoiceMaster.\n\n` +
`Voice channel: <#${joinToCreate.id}>\n` +
`Interface: <#${interfaceChannel.id}>`
)
],
ephemeral: true
});
}```
And the successEmbed function?
function successEmbed(interaction, description) {
const embed = new EmbedBuilder().setColor(COLOR.success);
applyDescription(
embed,
`${EMOJI.success} ${description}`
);
return embed;
}```
You need a function just to call setDescription?
Or does it do smth else?
just does things like this
why not just use embed.setDescription() is what he means
Show applyDescription
function applyDescription(embed, text) {
embed.setDescription(safe(text ?? " "));
}```
That’s warningEmbed, not applyDescription
my bud just told me to do it this way so i did
What is safe?
Is it escaping markdown?
yup
Then that’s why
then how do you expect the ** to work lol
wait oh my god im so slow
happens dw about it :)
😭 thanks i completely forgot about that
You should generally only use safe on input you want to be escaped
Not apply it to all descriptions
will do
ima bump this now 👉 👈
Keep them on different bot tokens
do you mean use a completely separate bot for testing? I'm confused
Yea
Assuming I'm understanding correctly: No, if an interaction is created, it's emitted to all gateway connections for the app associated to that interaction
Hopefully ur test code doesn’t reply to it
Or you have it somehow sorted out by guild id
hmm I suppose I'd have to somehow tell the deployment version that I'm testing and make it wait whether the interaction gets claimed (e.g. in a certain guild)
Yea, I wouldn’t put testing and prod on the same bot account/token
alright, thanks for the recommendation I somehow never thought of just using another bot for testing lol
you'd kinda quickly figure that out when you'd start sharding 
I honestly have no idea since I have never made a large production bot :v
Sharding twice just for testing sounds painful to get working
cannot have more than 2500 guilds on one shard - ws connection
how is sharding usually set up for discord bots?
oh damn, so really big bots are forced to have an actually insanely large amount of shards??
so you either run single shard as dev env and it doesn't even login cause it's not sharded, or you would have to spin up several shards just for dev env which is easy way to run out of identifies
yeah
damn
but so how is sharding usually handled setup/code wise?
ShardingManager handles it for you by spawning 1 process for each Shard
(You have to set it up tho)
oh found the docs page for it :P
And then shards can only communicate with each other using JSON encodable messages
^ as provided via the ShardingManager
you can however implement any way of communication between them as you want. internal REST api that all shards use, or a some MQ or pubsub solution, or whatever else you'd want
Or completely isolated function that only have access to client and any json encodable arguments you provide
I see
damn thanks though, never knew about this lol
is there a way to make my optional sub commands not try and prompt the user (so they don't have to backspace the options to run the command without subcommands)
you cannot run command that has subcommands without those subcommands
what is this then? these are optional
those are options
2 options
to the /bomb command
oh, I was misinformed then, either way, is there a way to not prompt the user for the options?
these are 2 subcommands to the bitfields command
ah gotchu
make them optional?
don't have them at all?
idk what you really want
That's not what I mean, I mean they are currently optional, but when I type /bomb, it automatically puts the options into the chat, and I have to backspace them to run the command as the default command. I swear ive seen a way to make it so it doesn't fill them until you hit tab.
then they aren't optional
go ahead, try to use </docs:788838056144142346>
see how only query gets put there since that's a required one
and there's a +3 more next to it
alternatively:
that's a command that has no requried option, and the optional one doesn't get put in on its own
it doesn't do that for me for whatever reason
then we cannot do anything about it as it's completely not under our control
try restarting or updating or something
ah alright, I was just wondering if it was a djs thing
this is behavior of the client you're using as human, not your bot or the API
alright, thanks.
I just checked, it is the client, don't know why I didn't realize. Sorry for the trouble.
Indirectly yes
You need a Label in between
I guess that’s still inside
When I try to retrieve the uploaded image, it always says "Undefined".
FileUploadBuilder
@stable sun
Gonna need to ask yet another question about attachments and urls 😭
So I have a user upload an image in a modal, which I then put into an ephemeral container (the user can add more images, edit text, etc.), and then in another separate interaction I send the container without being ephemeral, does this mean I'll have to download and reupload the images twice (at upload and at public send)? or just at public send? or just at original upload? (I'm asking since when I'm editing the container later I do not see the images with the attachment:// protocol but as links to /ephemeral-attachments/)
Provide your code
The code is large
Only provide the relevant code for getting the image from the modal submission interaction
const modalCustomId = `warnModal_${message.id}_${interaction.user.id}`;
const modal = new ModalBuilder()
.setCustomId(modalCustomId)
.setTitle('تحذير بائع');
const fileLabel = new LabelBuilder()
.setLabel('دلائل')
.setFileUploadComponent(
new FileUploadBuilder()
.setCustomId('image')
.setMaxValues(10)
.setMinValues(0) // غير مطلوب
.setRequired(false)
);
modal.addLabelComponents(fileLabel);
// 🔹 **معالجة الملفات المرفوعة من المودال بشكل صحيح**
const uploadedImages = [];
// حاول جلب الملفات من حقل الملف في المودال (المسار المعياري عند استخدام FileUploadBuilder)
try {
if (typeof interaction.fields?.getFileUpload === 'function') {
const f = interaction.fields.getFileUpload('image');
if (f) {
if (Array.isArray(f)) {
f.forEach(file => { if (file?.url) uploadedImages.push(file.url); });
} else if (f.url) {
uploadedImages.push(f.url);
}
}
}
} catch (e) { /* ignore */ }
// Fallback: بعض البيئات قد تعرض files مباشرة على الـ interaction
if (uploadedImages.length === 0 && interaction.files) {
if (typeof interaction.files.forEach === 'function') {
interaction.files.forEach(file => { if (file?.url) uploadedImages.push(file.url); });
} else if (Array.isArray(interaction.files)) {
interaction.files.forEach(file => { if (file?.url) uploadedImages.push(file.url); });
} else if (typeof interaction.files.values === 'function') {
for (const file of interaction.files.values()) { if (file?.url) uploadedImages.push(file.url); }
}
}
// 🔹 **تحديث الخريطة لتشمل الصور المرفوعة**
warnMap.set(interaction.customId, {
...stored,
uploadedImages: uploadedImages
});
console.log("Modal files:", interaction.files);
console.log("Field file upload:", interaction.fields.getFileUpload?.("image"));
@waxen walrus
I'm pretty sure the function is getUploadedFiles, not getFileUpload
and I'm going to bump this :P
Is the opus package not maintained anymore?
when I set the context of a slashcommand to guild how can i type or infer the interaction of it so i dont need to use inCachedGuild() guard all the time
what makes you ask
it has deprecated dependencies
and that's an issue because?
im just asking
does it work for you or not
no i dont even need it
not everything needs to have weekly updates
i want it to
then maintain entire ecosystem that works just fine without any need for continous updates
anyway, this is getting offtopic
that is intended.
no, working software does not need an update for the sake of an update
i love updates... sorry...
hi Bro.. is opus package needed for Lava Link
no idea, this is not lava link support
does it Have any purpose if it works without the opus package
what are you even trying to ask now
you know this is a server (for support) about discord.js
I am learning about Voice stuff
we don't have anything that would point you to lava link
i mean Does discordjs tell Me when i need opus for something to work, does opus change Anything or optimize anything
yes, we would tell you if you needed it, in docs and/or the guide
https://discordjs.guide/voice | https://discord.js.org/docs/packages/voice/main
if you have specific questions about using voice, there is the #998942774994927646 forums
we still won't be able to help you with specific other libraries, like lavalink
if all my stuff works without opus, theres no change when i install it right?
if you don't need something, why would you need to install it
it's the same as with the updates 5 minutes ago
it says it improves performance or whatever
I suppose this is a great moment to point out that switching to voice on the guide redirects to voice docs?
i just complained about that in #internals
great
is that the case
When I was installing the newest discord.js version, I got warns saying of an unsupported engine. Is there a way to uninstall engines?
What version of node do you have installed? Because it sounds like you just need to update node
let me check
it would rather be that you're on too old node, not too new
v20.12.2 is my node version
The currently maintained version of v20 is 20.19.5. but I would recommend updating to version 24.11.1 which is active LTS
yet more questions - if I copy the images from a non-ephemeral message and put them in another message (copy as in use their links), will they stop working if the original message/its channel gets deleted?
using link will only ever point to where the link points to
which would be the ephemeral message which will be gone soon, along with whatever it had
non-ephemeral
doesn't really change what i said
okay
not existing still aplies
dismissing ephemeral in this case is indistinguishable from deleting a message
damn approval systems 🥀 I need to reupload this image 3 times
how would I do that?
You go to node's website and download the newer version
k
I was trying to make something similiar with the first image, and I just can't make it right like the first image. How do I actually remake it?```js
new EmbedBuilder()
.setColor('Grey')
.setTitle('📜 Syarat dan Ketentuan')
.setDescription(
'Syarat dan Ketentuan Jasa Rekber\n\n1. Keamanan Transaksi\n- Pastikan untuk tidak membagikan informasi pribadi Anda kepada pihak ketiga.',
),
The first image appears to be a container using components V2 not an embed
guide suggestion for @pearl roost:
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.
I have tried it, and the result are just the same I think```javascript
const exampleContainer = new ContainerBuilder()
.setAccentColor(0x808080)
.addTextDisplayComponents(textDisplay =>
textDisplay.setContent(
'📜 Syarat dan Ketentuan Jasa Rekber:\n\n1. Keamanan Transaksi:\n- Pastikan untuk tidak membagikan informasi pribadi Anda kepada pihak ketiga.',
),
);
await interaction.reply({
components: [exampleContainer],
flags: [32768, 64],
});
And the cloudflare is down lol
I had to break it down a little bit. Which part are you having difficulty with?
Something with this
Works fine if its a content
📜 Syarat dan Ketentuan Jasa Rekber:
- Keamanan Transaksi:
- Pastikan untuk tidak membagikan informasi pribadi Anda kepada pihak ketiga
Then it should work fine in the text display
And that is the issue I was facing right now. I did not know why it don't be the same like content
you need to add spaces after the newline but before the new line in your code
textDisplay.setContent(
'**📜 Syarat dan Ketentuan Jasa Rekber:**\n\n1. **Keamanan Transaksi:**\n - Pastikan untuk tidak membagikan informasi pribadi Anda kepada pihak ketiga.',
)
Ahh the empty space
Its now just look like I wanted. Very thank you
np
yes actually. you know what i should do?
implement it
thats not what i mean. but ok. thanks
what do you mean then?
Has <guild>.members.fetch() been restricted via DiscordJS?
restricted how?
When you use it 2 times in a row, the second one throws an error after a certain time.
Error [GuildMembersTimeout]: Members didn't arrive in time.
Discord introduced a rate limit on requesting all guild members (source)
-# Despite the announced 01/10/2025 rollout date, it only took effect recently.
- Apps may only request all members once per 30s per guild.
- You will have to update your code accordingly to make sure this doesn't affect your app.
- Look for instances of
guild.members.fetch()with no user ids.
-# We are working on making theGuildMemberManager#fetch()call reject if we receive this rate limit after requesting members. This will likely land in the next release.
-# If you confirmed this cannot be the reason, you can find other caveats in our guide
.
updated that to reflect the new release | members didn't arrive in time
Discord introduced a rate limit on requesting all guild members (once per 30s per guild).
- You will have to update your code accordingly to make sure this doesn't affect your app.
- Look for instances of
guild.members.fetch()with no user ids. - Starting in version 14.25.0, discord.js rejects the returned Promise and exposes details in
error.data.
-# If you confirmed this cannot be the reason, you can find other caveats in our guide
.
(i recommend updating, makes handling much more straight forward)
how do i share RPC in modern discord versions?
discord-rpc with:
const rpc = new Client({ transport: 'ipc' });
rpc.on('ready', () => {
console.log('Discord RPC connected');
rpc.setActivity({
details: 'test',
state: 'test',
largeImageKey: 'test',
largeImageText: 'test',
instance: false
});
});
rpc.login({ clientId: DISCORD_BOT_ID }).catch(console.error);
this does not seem to work
nothing changed in regards of that. Nor is it djs v14 related . Make a post in #986520997006032896
I've been running into a technical quirk with discord.js-v14 and wanted to see if anyone else has encountered this.
I'm working with embed compV2 the newer structured embed system in discord.js. the idea is to build embeds directly inside my JS file. But here the weird part: whenever i define an embed directly in JS! discord.js treats it like plain text not an actual embed.
the funny thing is as soon as i move the embed to an external json file and import it into js, everything works perfectly, the embed renders correctly.
this works fine for small projects (: . but in large projects, complex bots managing every embed in separate json files becomes a real headache and isn't practical at all.
I'm curious is this normal behavior for embedbuilder-v2? is discord.js just sensitive to how embeds are constructed inside js files? or is there a known trick or best practice to make embeds work properly without relying on json?
any insights from people who dealt with this would be hugely appreciated, because it feels ridiculous to have to separate every embed into json just to get it to render in large-scale projects.
embeds and components are not the same
Show your code. This page-long explanation doesn't actually tell us anything about what you're doing wrong
wait min
index.js :
const { Client, GatewayIntentBits } = require('discord.js');
const messageData = require('./embed.json');
const key = 'your_token_bot';
const PX = 'prifx';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
client.on('ready', () => {
console.log(`Done ${client.user.tag}!`);
console.log(`Prefix: ${PX}`);
});
client.on('messageCreate', async message => {
if (message.author.bot) return;
if (message.content.startsWith(PX)) {
const args = message.content.slice(PX.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'test') {
try {
await message.channel.send(messageData);
console.log(`Command !${command} executed using data from JSON file.`);
} catch (error) {
console.error(`Error executing !${command}:`, error);
await message.reply('Error file json... go back to the file and check the code... if you have any qustions contact me on discord: @.7___');
}
}
}
});
client.login(key);
embed.json :
{
"components": [
{
"type": 17,
"accent_color": null,
"spoiler": false,
"components": [
{
"type": 10,
"content": "test"
}
]
}
],
"flags": 32768
}
@steel trail
Isn't this your working code?
yeah
Well... what's the point of showing us that
Show us what you tried that failed
You know, when it converts everything to a string when you don't use a JSON file
And try to do it without pinging me three times in a row, thank you
ok so im tryna make all my embeds the same size and im pretty sure the best way to do that is put an image that is 1 pixel tall but idk the length to make the image bc if it's not long enough, the text will be longer and make the embed longer if that makes sense
does anybody know what size the image should be or something im missing
the image length has to be the same not height
Show. Your. Erroneous. Code. Less words, more code
The one that "doesn't work"
yeah that's what im meaning. I'll put the same image in each embed (1 pixel tall by whatever length) but idk the length so i was wondering if anybody knew or knew a better way to do it
just use a container with dividers if you want something more aesthetically pleasing
Don't. It'll look shit on mobile. Take care of the content. Leave layout to discord
mobile has set embed sizes anyways doesn't it?
pretty sure pc is the only one with dynamic sizes
But adding an image without wanting an actual image but just to act as a sizer will make it look weird
/**
* Checks whether the bot has send access to a specific channel.
*/
export async function hasSendAccessToChannel(
guild: Guild,
channel: GuildTextBasedChannel | ChannelId,
bot: GuildMember,
): Promise<ChannelSendAccessInfo> {
log.info(`Channel we're fetching for: ${channel}`);
// TODO: Can `ChannelManager.fetch()` throw an exception?
const properChannel = typeof channel === "string"
? await guild.channels.fetch(channel)
: channel;
if (properChannel === null) {
return { access: SendAccessType.INACCESSIBLE };
}
if (!isGuildTextBasedChannel(properChannel)) {
return { access: SendAccessType.INVALID };
}
// NOTE: This also checks if the bot has permissions to EDIT messages in
// the channel.
// if (perms.has(PermissionsBitField.Flags.SendMessages)) {
if (
properChannel.permissionsFor(bot)
.has(PermissionsBitField.Flags.SendMessages)
) {
return {
access: SendAccessType.SEND,
channelUrl: properChannel.url,
};
}
return {
access: SendAccessType.NO_SEND,
channelUrl: properChannel.url,
};
}```
When `channel` is passed as a `ChannelId` (which is just a branded type on top of a string), `properChannel.permissionsFor(bot).has(PermissionsBitField.Flags.SendMessages)` errors with `TypeError: Cannot read properties of null (reading 'has')`
hi quick question is it possible or how can i get badge image url to put on my site from flags array like this:
[ 'HypeSquadOnlineHouse3', 'ActiveDeveloper' ]
i found that its cdn.discordapp.com/badge-icons/ but how can i get that image hash?
const sequelize = new Sequelize('database', 'username', 'password', {
host: 'localhost',
dialect: 'sqlite',
logging: false,
storage: 'database.sqlite',
});
do i replace username and such with the actual things?
this isnt djs related
it is, its in the guide
If the channel is not cached it really only can be a ThreadChannel and those don't have permissions
In the guide !== djs
bruh
i dont think image urls of user badges exist in the api
afaik there is no documented means of fetching a badge's icon through the api
furthermore not all flags correspond to badges, and not all badges have a flag
feel free to open a post in #1081585952654360687
alr thx!
should I use guild.channels.cache.get() instead?
does Discord API allow handling button interaction in DMs if the bot and user don't have any mutual servers? (the message with components was sent when they still had one).
that's a question for ddevs in #useful-servers
The better question is: where does that channel id come from and how do you make sure it is an actual channel where checking permissions makes sense?
basically, my bot feature is to send embeds in a channel, and update them when a corresponding template message is edited. when the bot detects that the template message is edited, it fetches the relevant embed's information from the database, and gets the id of the channel where the embed was originally posted. it then checks to make sure it still has send permissions in that channel, before actually editing the embed
can you log properChannel before that error happens?
yeah one sec
yo is there in discord.js any way to check if user is "premium" i mean if he has nitro?
Not definitively
Best you can do is check if they have an animated avatar.
hmm okay thx for answer
it is on the API user as premium_type but I dont see that on the user object
Is that available with the bot api?
Afaik, that requires OAuth
ah, looks like your right cant find that noted in the Discord Docs but found a GitHub issue on their repo talking about it. It does note that you get it with identify OAuth scope but not that it is unavailable to bots
In which edge case may ChatInputCommandInteraction#channel be null?
When the channel is not cached. For example with no bot user in the guild or a user installed app in DMs
Peak, thanks!
Is there a utility in d.js that checks the snowflake number for correctness?
I need this for my api so I don't have to make a bunch of requests and hit the Discord rate limit from incorrect IDs.
Wdym by correct? Like valid? The only way to check is to fetch that thing. But it depends what it is, most channels are cached for example so you can just check the cache. Depends what it is though
I often have this in relation to users, but there are also guilds.
If you have the Guilds intent all guilds are cached, so you can check the cache for Guilds. For users, not really. Best to just rate limit the api route tbh. I believe there’s a util function to check when the snowflake was generated? Since snowflakes are also generated using time I believe
It just happens that the user enters an ID that is too short and so on, but I know that the snowflake is assembled in some special way, so I would like to write some kind of function to check the snowflake
best you can do is check length then
Snowflake discord.js@14.25.0
A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z.If we have a snowflake '266241948824764416' we can represent it as binary:64 22 17 12 0
000000111011000111100001101001000101000000 00001 00000 000000000000
number of milliseconds since Discord epoch worker pid increment
There’s some snowflake util class, but yh checking the length is best
user id is always 17 length?
I created my own function for checking that checks the length of the discord date from the moment it was created and checks the bits of the remaining parts of the snowflake. If there is a class in d.js that has already implemented this, I would probably like to use it.
no
that's why I asked
I think it’s part of another lib that snowflake util class, I thought it was part of djs
Idk if this is still valid
There’s only code to construct and deconstruct snowflake
Can you get the time the snowflake was created from it?
Yea, just use SnowflakeUtil from d.js or the sapphire package
Why don't I implement a snowflake check in the library itself before making API requests to avoid making incorrect requests?
My idea was using that and checking if the creation time is something stupid. That would make sure people don’t hit like /users/1234
Generally speaking, you're not going to have users inputting snowflakes. In most projects if ever
Well, or like 10000000000000000001
There’s too little benefit to maintain the check imo
I don't know if this bug still exists on Discord phones. When I specified a user in a team, it said it was incorrect, but everything worked fine with the ID.
If you are letting users input ids, you should be validating it anyways
That's why I'm asking if this check has already been implemented somewhere.
I was answering why it isn’t in the lib
I thought you’ve alr figured that this check doesn’t exist natively in d.js
yes
guys my bot can't start anymore after updating to the newest version.
What errors are you getting? What version did you come from and go to?
Are you logging the REST rateLimited event?
If you're having an issue with this, please provide the code, values used, and the output
Does anyone have any information about the status of v15, if there will be many breaking changes, etc? Looking to start a v14 tutorial series but don’t want it to be immediately obsolete
There is no ETA on v15. It will be released when it's needed and there's currently no need for it as v14 has 100% compatibility with the current Discord API
I didn’t ask about ETA :/
At this point I expect GTA VI first
there is no status of v15 because there is no v15 yet
there is a v15 milestone on github, but it's pretty meaningless since there's no timeframe
Does the milestone have any meaning? Or is it just a distant goal
it's pretty meaningless since there's no timeframe
when there's a need for a new major version, you'll see an announcement about when it releases
our guide will always have the most up to date information as videos and such become outdated quickly with discord's ever changing api
My goal is to continue to release updated videos but I’d have to make an updated series if there was a new breaking version is all 😂
all versions of discord.js can be viewed on the releases page of our github or you can look at #announcements
Did they add the voice channel status update feature in DJS 14.25.0?
Right now, I’m updating it using a manual REST call.
this is not documented by discord as of this time, so to answer your question, no.
discord.js does not support features until they are officially documented.
While there might be a way for these features to work, it can change at any time without any notice
oh thnx
How do I get the id of InteractionResponse<true> if conditionally I have StringSelectMenu bound to the components of the message as interaction.reply({ embeds: [...], components: [...] }) and after sending when interacting with StringSelectMenu?
Im not sure I'm following the question
If you get a response it will have an id
I use redis and pure customId so instead of some information in customId I pass through redis the keys that refer to the id of the interaction/message etc.
yeah sure but Im still not sure I understand why youd have trouble getting the id of the response
InteractionResponse#id discord.js@14.25.0
The id of the original interaction response
reply action:
...
const reply = await interaction.reply({
embeds: [...],
components: [new ActionRowBuilder<StringSelectMenuBuilder>().setComponents(component)],
});
await cache.set(
`staff-add-branch:${reply.id}`,
{ targetId: target.id, executorId: interaction.user.id, branch: mainRow.branch },
15 * 60
);
interaction select menu handler:
...
const state = await cache.get<StateProps>(`staff-add-branch:${interaction.id}`);
if (!state) {
await interaction.update({
embeds: [...],
components: [],
});
return;
}
...
If you iterate select menu, that interaction.id or interaction.message.id will not be the same as reply.id for it is InteractionResponse<true>.
sorry I asked the question without context, so I need to get this reply.id from the select-menu interaction.
The interaction id will be different, yes, but the message id is the same
Updating a message doesnt change it
StringSelectMenuInteraction#message discord.js@14.25.0
The message to which the component was attached
Message#id discord.js@14.25.0
The message's id
that's what you want instead, not interaction.id
Doesn't InteractionResponse<true> have a separate id or is it the same message.id
well the response is the message
then why when I search for state by interaction.message.id from StringSelectMenuInteraction<true> I don't find it and the id in redis cache is different?
make sure they both come from the same message, otherwise you could specify withResponse just in case, but they should still be the same id
The fetchReply option when replying to an interaction will be removed in v15.
- {..., fetchReply: true}
+ {..., withResponse: true}
```This returns an [InteractionCallbackResponse](https://discord.js.org/docs/packages/discord.js/stable/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
this is how you get the message with withResponse
Okay, that fixed it, thanks.
Guys whats this? ( embed or container )
where is it?
i found this thing in marvel rivals server
can you share a link to the message in dm
Ok
or here, I don't think it'd be forbidden
looks like an embed
Its called rich embed
yeah but that's the only kind of embed you can send
so we usually only refer it to as "embed"
Okk
Where did <Channel>.MessageCollector Go?
I'm not sure if that was a thing in v12 or earlier
but that has never been a thing in v13 or v14
the equivalent to await messages would be to check that the channel is text-based, and then use createMessageCollector on it
BaseChannel#isTextBased() discord.js@14.25.0
Indicates whether this channel is text-based.
it was <channel>.awaitMessages
yeah that's also only a thing on text-based channels
then you can await or create a collector on it (<textchannel>.createMessageCollector())
Ahhhh, Ok
ah nvm, Message#channel is already a text-based channel, which makes sense otherwise you wouldn't get a Message lol
you were just typing the function wrongly
I knew it felt weird, It was just type issues
Appears message.channel is just a channel with no specific typing to it for some reason
that doesn't sound right, can you hover over message.channel and show what it says?
If I dont TypeCheck it to set as SendableCHannel
should be (Guild)TextBasedChannel
well I guess it's correct in a way
it doesn't need to be sendable technically, but the only thing that sendable filters from that union is partial group dm channels
thought it would be a sendable channel by default because how does one have a message in a category channel 😭
on which you can't listen for messages, so the message collector would be useless
the name isn't really straightforward, not sendable means that you (the client) can't send messages on it, not that it can't be sent messages (by anyone)
not like there isn't much other options to name it anyways (that aren't too verbose)
not like verbosity has been a problem before 
I think that's semi-reasonable since it's not directly touched by users
though you can still find other examples that are directly touched by users and can't be read at all
but anyways, sendable is a good middle ground imo
my apologies, yeah i'm logging properChannel and it's printing an object to the console
Show that log. If you want us to be able to further help
Does the Message object have a function to retrieve the user ID, and not just the one mentioned?
like
message.mentions.users.first()
Only user mentions can be retrieved:
!mycmd @subtle girder arg1 arg2
I want to get 898836485397180426 from the message
!mycmd 898836485397180426 arg1 arg2
you should use slash commands
they have options where you could use a string option to put in the user id, which the bot can use after the command is sent
Hey there,
A container can have up to 10 Components if I was reading the guide correctly.
Does this apply to nested components? So if I have a section with 3 text displays inside the container, are 4/10 used or just 1?
you have read the guide incorrectly or it isn’t updated
any cv2 flagged message can have up to 40 components in total, nesting components count
if you log your components in JSON format you can count how many times you have ”type” in your JSON, that’s the amount of components you have
merging text display components is the easiest way to lower the component count, as two text displays right below each other is basically the same as adding \n
And one container? I am planning to do a staff list. I have 11 roles and want to separate them using separators. Am I able to do this within one container? Using sections for example?
container is just a type of component
so 40
-1 (container)
-1 * 11 (text display)
-1 * 10 (separator)
= 18 components left
Thank you very much. That's making things clear. Thanks
what if I still want to keep message commands?
not 100% sure about this tho, as section accessories have “type” in them as well iirc but do not count as separate component
Alright, but your calculation has helped me a lot. Thanks again :)
then you have to use message.content that returns a string and then String.split(“ “) to have all content split up in an array
oh ty
Message commands are no longer a supported use case, and you'll be mostly be by yourself above is how you would do possibly but it starts to drift into regular js
if you would do that to your example the array would be
[ “!mycmd”, “898836485397180426”, “arg1”, “arg2” ]
yea
then check is digit and fetch user
Would be <@userid> so you need to handle that too
oh i thought it was about putting in the user id as text in the message already and then getting that user id
oh right missed it since I am at class
@subtle girder if it is about how to get from “!command @dense jackal stuff” the user id of @dense jackal you could do message.mentions.users.first().id
ik
I'm trying to make the command also support using user ID.
ah cool, then use that split() i said earlier
yea
With slashcommands that would also be builtin with a UserOption. Nothing to implement yourself in that regard
hey guys .. i wanna create a section in my component. How many buttons can I set inside a section when a text is also in there
1 accessory (thumbnail or button) per section
perfect, thank u
Aoba
{
name: "Delete Message",
name_localizations: undefined,
type: 3,
contexts: [ 0 ],
default_permission: undefined,
default_member_permissions: undefined,
dm_permission: undefined,
integration_types: undefined,
}
It used to be worked but now I got an error
err: {
"type": "DiscordAPIError",
"message": "Invalid Form Body\nredirect_uris[4][BASE_TYPE_REQUIRED]: This field is required",
"stack":
Error: Invalid Form Body
redirect_uris[4][BASE_TYPE_REQUIRED]: This field is required
....
idk what's wrong
what's the full error
err: {
"type": "DiscordAPIError",
"message": "Invalid Form Body\nredirect_uris[4][BASE_TYPE_REQUIRED]: This field is required",
"stack":
Error: Invalid Form Body
redirect_uris[4][BASE_TYPE_REQUIRED]: This field is required
at handleErrors (/Users/zeing/Documents/github/bot/node_modules/@discordjs/rest/dist/index.js:762:17)
at async runRequest (/Users/zeing/Documents/github/bot/node_modules/@discordjs/rest/dist/index.js:1163:29)
at async queueRequest (/Users/zeing/Documents/github/bot/node_modules/@discordjs/rest/dist/index.js:994:25)
at processTicksAndRejections (native:7:39)
"requestBody": {
"json": [
{
"name": "Delete Message",
"type": 3,
"contexts": [
0
]
}
]
},
"rawError": {
"type": "Object",
"message": "Invalid Form Body",
"stack":
"code": 50035,
"errors": {
"redirect_uris": {
"4": {
"_errors": [
{
"code": "BASE_TYPE_REQUIRED",
"message": "This field is required"
}
]
}
}
}
},
"code": 50035,
"status": 400,
"method": "PUT",
"url": "https://discord.com/api/v10/applications/xxxxxxxx/commands"
}
here u are
i thought redirect uris are for oauth... what's the code you're using to deploy the commands?
I use this function to deploy
commands: (ContextMenuCommandBuilder | SlashCommandBuilder)[]
): Promise<ApplicationCommand[]> => {
const response = await discordRestClient.put(Routes.applicationCommands(constants.CLIENT_ID), {
body: commands.map((command) => command.toJSON()),
})
return response as ApplicationCommand[]
}```
i'm not sure, sorry. hopefully, somebody else will be able to look at the error and your code and have more knowledge
Do you have any redirect_uris configured in dev portal > your bot > OAuth2?
Yes I have
btw It works now I didn't do anything
You probably had an invalid entry as fifth URI there and it's now removed
i see , tysm
Does d.js have a util function to escape @ mentions in text?
no but youll usually prefer setting the allowedMentions
What about them do you want to escape? Not have them ping or literally show as <@123456789>
For example, consider this: https://www.instagram.com/p/DNUBQCuz-ye/
This account's handle is literally @ here. The native Discord embed seems to render the @ here chip but properly ignores it
Yeah, that's allowedMentions
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"] } }
Ah that's insanely handy, thanks
I was on the route of replacing @s with @ and an invis char after it to trick the client. This is just better
You could just escape the @ with a \ In front
Unfortunately, that still highlights, which is weird behavior to say the least
or maybe cleanContent() ?
The allowedMentions flag seems to be the right move
One unrelated bug seems to be this: @here.kyoto
The hyperlink doesn't like the @ here and fails to parse it
That won't change here or everyone mentions at all
Hello, can someone help me with the cv2 ?
I use typescript
what do you need help with? #how-to-get-help
import {
ContainerBuilder,
TextDisplayBuilder,
MediaComponentBuilder,
SeparatorBuilder,
SeparatorSpacingSize,
EmbedBuilder
} from "discord.js";
client.on('guildMemberAdd', async (member) => {
const channel = member.guild.channels.cache.get('1434575458439135264');
if (!channel?.isTextBased()) return;
const role = member.guild.roles.cache.get('1434575518920872017');
if (role) await member.roles.add(role).catch(console.error);
const welcomeEmbed = new EmbedBuilder()
.setColor('#0048ff')
.setFooter({ text: 'Welcome System' })
.setThumbnail(member.user.displayAvatarURL())
.setTimestamp();
const container = new ContainerBuilder()
.addComponents(
new TextDisplayBuilder()
.setType('text')
.setText(`👋 Welcome ${member.user.username}!`)
.setStyle('primary')
.setBold(true)
.setColor('#ffffff')
.setSize(32)
)
.addComponents(
new SeparatorBuilder()
.setSpacing(SeparatorSpacingSize.Small)
.setColor('#0048ff')
)
.addComponents(
new TextDisplayBuilder()
.setType('text')
.setText(
`Please read our [#1434578891082694787](/guild/222078108977594368/channel/1434578891082694787/) carefully to familiarize yourself with the rules and gain access to the rest of the service.\n\n` +
`We wish you a wonderful day and hope you find what you're looking for! 🍀`
)
.setStyle('secondary')
.setColor('#ffffff'
)
.addComponents(
new SeparatorBuilder()
.setSpacing(SeparatorSpacingSize.Medium)
)
.addComponents(
new MediaComponentBuilder()
.setType('image')
.setUrl('https://cdn.discordapp.com/attachments/1435737959486980187/1439659888304455911/welcome.png?ex=691b5340&is=691a01c0&hm=f3da4319e9c373254f9087df75b69c74912275481b9c48ecd87367ec7059fdcb&')
);
await channel.send({ embeds: [welcomeEmbed], components: [container] });
});
I have this code but it didin't work.
I don't know how can I use cv2
what do you mean by "didn't work"? like was there an error or something? (if so please send the error)
there are a lot of thinks underline
components can be added to the container builder with their specialized methods, so dont use addComponents but their own method like addTextDisplayComponents etc
Looks like a lot of that code is invalid anyways. Like you can't see the color of a separator. And you can't set the type of a text display
Is this AI generated (like Copilot)?
documentation suggestion for @clever hinge:
ContainerBuilder#components discord.js@14.25.0
The components within this container.
oop, wrong thing, disregard this
All that underlined code is just things that don't exist
Yes, bacause i can code bot's and so on but I don't know cv2
I'd say look at the ContainerBuilder documentation to see the valid methods. It will allow show the return types of those methods so you can see the other builders too
guide suggestion for @clever hinge:
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.
(also, you cant have an embed and component v2 stuff in the same message, consider merging them into the same container)
Oh ya. That too
const { REST, Routes } = require('discord.js');
const TOKEN = '';
const BOT_ID = '';
const rest = new REST({ version: '10' }).setToken(TOKEN);
rest.put(
Routes.applicationCommands(BOT_ID),
{ body: [] },
).then((data) => console.log(`Registered ${data.length} commands.`));
Why is this code snippet throwing an error when redirects are configured? (Isn't that completely independent?)
DiscordAPIError[50035]: Invalid Form Body
redirect_uris[3][BASE_TYPE_REQUIRED]: This field is required
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
redirect_uris: { '3': { _errors: [ [Object] ] } }
}
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/.../commands'
Do you have any redirect_uris configured in dev portal > your bot > OAuth2?
Yeah
but 3 and not 4
Then it would seem the fourth one is incorrect or invalid in some way
That's not a d.js error though as the library doesn't have much to do with oauth2, you could ask in ddevs if you need more help
Yeah, it looks like smt is wrong with Discord. I'll play a little around with the settings at the portal and if I can't get it to work I'll ask there
thanks for the quick reply!
ModalSubmitFields#getUploadedFiles() discord.js@14.25.0
Gets file upload component
Is there docs for on how to update your bot's avatar, bio, banner, nickname per guild?
documentation suggestion for @torn orchid:
GuildMemberManager#editMe() discord.js@14.25.0
Edits the current application's guild member in a guild.
(be aware you are still responsible for whatever server owners change it to)
I know. i don't see for how to update the bot's avatar and stuff
guild.members.editMe()
alr
Will I use that for bio also?
see the documentation of the method
it takes options, there you can see what you can change
k
Hello, quick question, this message and a webhook with a componentsV2?
yes
it's a webhook message with v2 components
I tried to make a V2 components on a webhook it didn’t work
you have to add withComponents: true to the webhook.send() parameters
Aaaah ok
so if an owner changed it to NSFW image or whatever
the bot will be affected?
Potentially yes
so I may need to send profile changes to a review process before allowing it?

i made mine so admins can select from different images. Each still represent my bot in a way, that way they can’t put anything bad, and also, people will still identify it as my bot
Hi all, did the rate limits get increased? I seem to be getting more rate limits than usual before I updated my d.js version.
Uncaught exception: GatewayRateLimitError: Request with opcode 8 was rate limited. Retry after 28.645 seconds.
My bot is sending a DM to all my Admins / Users who have Admin Permissions, which is about 4 people as of right now
Discord introduced a rate limit on requesting all guild members (once per 30s per guild).
- Starting in version 14.25.0 discord.js rejects the request and exposes error details in
error.databut does not re-try automatically.

For some reason when I wrap a text using the blockCode djs formatter. All the text after gets put inside said block quote as well.
Even if I use escapeBlockQuote.
could you share a picture of that the unintended output looks like and the code that was used
container.addTextDisplayComponents(
textdisplay => textdisplay.setContent(`${[...separatedEntries].flatMap(([streamer, entry]) => {
return `${escapeBlockQuote(`### ${streamer}:`)} \n${blockQuote(`${[...entry].map(e => `${sourceEmoji(e.source)} ${channelMention(e.discordCh)} ${hasMentionRole(e) ? `Mentioning ${roleMention(e.roleToNotify!)}` : ''}`).join('\n')}`)}`
}).join(`${escapeBlockQuote('\n')}`)}`),
)
trying to save component usage mostly
What I expect to happenis only the channel mention part to get put in the block quote as seen on the top one
Channels should be in block quotes under each header
When I had the code add a textcomponent for each entry in separatedEntries using foreach it worked but that stacks up quite a bit of components
Hi my bot when i execute command /play say
❌ Failed to play music: No compatible encryption modes. Available include: aead_aes256_gcm_rtpsize, aead_xchacha20_poly1305_rtpsize
can someone tell me how support more encryption mode?
documentation suggestion for @proud shoal:
quote discord.js@14.25.0
Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
you what to be using quote not block quote. Also, you dont what to to use escapeblock quote once moved to the quote fuction
you should post in #998942774994927646 you will get better help in that channel
install libsodium-wrappers
and restart the bot it might be the issue
Thanks, that kinda works. Moved the quote function a little deeper inside the code. Into the entry#map part. which seemms to give the result I want
Also you bot violates TOS and we can't provide support for djs in this case
How can i search for an application emoji by name?
<Client>.application.emojis.cache is a Collection and has a find method you can use to search
i think you need to fetch them first for the cache to be populated, but that should just be one time
Yeah i tried that but that seems to not include any of my application emojis, only server emojis
and client.emojis.fetch isnt a function
client**.application.**.emojis.cache
ClientApplication#emojis discord.js@14.25.0
The application emoji manager for this application
Ty
I always have issues reading this site tho, its written in a way thats super confusing
from what I gather
let charemj = bot.emojis.cache.get(e => e.name.toLowerCase() == "sidrin_icon")
should work if I have an emoji with that name added to the bot's application emojis, which I do
But it just returns undefined for some reason
And if I try to use
bot.emojis.fetch()
It just tells me that thats not a function
Why is collector.resetTimer() not working properly? It doesn’t actually reset the timer any fix?
What type is bot?
nvm i figured it out, it's bot.application.emojis.fetch() ty
thats my client
Client#emojis is a manager for all GUILD emojis available to your bot. ClientApplication#emojis is a manager for the APPLICATION emojis that you have assigned to your bot
ya...the difference between a Client and a ClientApplication is subtle but important
I don’t think it actually updates collector.options. It just creates new timers
so how am I supposed to work with that? Won’t it just increase the collector timer? Because right now the collector still stops due to the old timer
No. It stops the old timer and creates a new one in its place
Node.js doesn’t let you change the time of a timer
Why are you time and idle?
No point in setting idle and time to the same value as time would always finish first
because it’s a kind of solver, and I originally set the collector timeout to 5 minutes and the idle time to 1 minute, with a button to start it. When the solver begins, I want to increase the timeout to 15 minutes for the stop button, because the solver may take a while to complete and I also need to override the old idle timer
Makes sense. Still shouldn’t be an issue tho
Can you log the reason why it stops?
The reason parameter in the end event
Idle is the end reason
I use dropdown select menu to assign a role on click. But once a selection is made, it cannot be relesected. Is there a way to prevent this or to allow re-selection?
I.e. clicking once gives the role, twice removes the role.
you can reset the selection by updating the message with the same select menu
and then handle the logic on your end
hi is there any way or event to check if new forum post in exact channel was created?
And after what time does it end with that?
documentation suggestion for @nocturne moat:
(event) Client#threadCreate discord.js@14.25.0
Emitted whenever a thread is created or when the client user is added to a thread.
thx
Replying back to this, could I degrade the version of my D.JS and will go back to normal rate limits or is it global?
the message is in a public channel, i cannot re-edit the message every time. Is there another way?
discord.js does not control or otherwise set rate limits, it just handles them appropriately when hitting them
those are determined by discord
1 min
even after setting it to 15 minutes, it still ends after 1 minute because of the old idle timer
not really, no
hm ok, i didnt have this issue before but discord being discord
I think I vaguely remember there was one, maybe adding an option on the select menu or something along those lines?
Has discord removed activies such as playing, watching etc? They don't seem to show in the user menu anymore
That should not happen. How did you determine the timer was actually set to 15m?
It actually didn’t do anything. After checking, the method didn’t affect the collector at all
HOW did you check that to be the case
here
For that you've been replied to here👆
you would still need to edit the message to add or remove options
Did you actually measure the time it takes, did you actually look at what got logged and how long it took after that log for end to emit?
yes, actually
Yea but it’s not supposed to just stop the collector after 1 min it’s supposed to remove the old 1 min timer and start a new one for 15 min right that’s how I understand it
And that's what it does
1 min after the last Interaction with end reason "Idle"
Yea but in my case the old 1 min idle timer didn’t get removed
Can you show the whole block of code where this is happening?
Alternatively make sure this is actually caused by the same collector instance you call resetTimers on
actually I think this is a bug
as kinect mentioned earlier, resetTimer doesn't update the options, but it also doesn't save this new idle option anywhere, so when it resets the timeout in Collector#handleCollect it uses the old idle value
Oh, I see. So it does reset correctly but then collects one and resets to the old value again
That makes more sense
Guess you'd need to call resetTimers in your collect event then to mitigate that. And open an issue on GitHub so it can get fixed in next version
weird that no one tried this method before
Resetting collectors is pretty rare afaik
yeah I believe a majority of people tend to just create a bunch of single-purpose collectors with separate timeout options rather than reuse one
I mean I found it easier to just use the same one with different timers so I thought this could be helpful (If it actually works)
which is fair and also why you should open an issue 🙂
Is there a reason why its not updating the guild avatar?
if (avatar?.length) {
const buffer = avatar[0].data;
await interaction.guild.members.editMe({
avatar: buffer
}).catch(e => console.log("Failed to update avatar:", e));
}
CommandInteraction#isChatInputCommand() discord.js@14.25.0
Indicates whether this interaction is a ChatInputCommandInteraction.
are you getting an error message?
nope
weird. is your buffer valid?
how can u check that?
best i can think of is testing it by sending it to a channel and see?
add some logs
k
Hey, I've just tried to set the Activity of my Bot to "Watching ..." by using: ```
client.user?.setActivity( ${guilds.size} servers!, {type: ActivityType.Watching});
Pretty sure we abandoned that style of arguments
Should just be a single object
Guess not
Also adding the name to the Activity Object doesn't fix it
The internal code looks wrong tho
So it's an issue on discordjs' side?
Prob not
So?
So instead of it saying Watching XX servers! it just says XX servers!?
Yes
That's Discord's doing, not us
Specifically the Discord client in the way it renders presence activities
But if Discord doesn't render that anymore, shouldn't that be removed from discordjs aswell?
We mimick what the API has documented
Not necessarily
Oh wait nvm
If the API documents it as X, we try to mirror that
It does show Watching when I expand the Profile
Mhm, they just changed what text is rendered in members tab
I guess I'll just have to add the "Watching" myself
Didn't know that, but thanks you two
is there an equivalent of embedbuilder.from but for containers?
You can just pass JSON to the constructor
ContainerBuilder discord.js@14.25.0
A builder that creates API-compatible JSON data for a container.
ty
this gave me the error Expected a string primitive
const container = new ContainerBuilder(interaction.message.components[0])
the ContainerComponent isn't a valid json you can pass there
you need to call toJSON on it
ContainerComponent#toJSON() discord.js@14.25.0
Returns the API-compatible JSON for this component
so [0].toJSON()
or ]?. if you want to be safer ig
oh okay
what does spoiler do in container?
same thing it does in images
Is there anyway to have a space in slash commands without it erroring? for example this below
.setName("autoresponder add")```
No
You might be looking for sub commands
Subcommands
Subcommands are available with the .addSubcommand() method. This allows you to branch a single command to require different options depending on the subcommand chosen.
Hello i was wondering is there a method djs where i can check if user in my server have the "Server tag" equiped ?
documentation suggestion for @fallen panther:
User#primaryGuild discord.js@14.25.0
The primary guild of the user
something like this
user.primaryGuild?.identityGuildId === guild.id
I have tried like this..
for (const [id, member] of members) {
const user = member.user;
const profile = await user.fetch(true);
const pg = profile.primaryGuild;
result += `**User:** ${profile.tag} (${profile.id})\n`;
if (!pg) {
result += ` primary_guild: null\n\n`;
continue;
}
result += ` primary_guild:\n`;
result += ` identity_guild_id: ${pg.identityGuildId}\n`;
result += ` identity_enabled : ${pg.identityEnabled}\n`;
result += ` tag : ${pg.tag}\n`;
result += ` badge : ${pg.badge}\n\n`;
}```
But still getting null. . .
what version of discord.js are you using?
"discord.js": "^14.14.1",
Nevermind FIXED
- Yea my dum dum head, didn't upgrade npm's ...
- And now works like a charm
You're using a quite old version of DJS...does 14.14 even support primary guild?

It does not, they were added in 14.22
A couple of days ago I asked about handling interactions both for normal users with my deployed version as well as the local testing version I am running, and the best advice I got is to either use another guild or a separate bot. I was thinking back to this and realised it's probably actually easiest to just make a small non-slash command that only works if I use it that just saves a couple of user ids in memory (both on the local and the deploye variant), and then the local starts responding to users with those ids and the deployed version ignores them. Does this sound like a good approach?
I think you can use just deploy interaction commands to one guild
I could yes, but this brings issues with that the guild I typically want to test in also has normal users using the bot
now again I could make a separate guild for it yes, but I'd rather not if the other solution I thought of is viable
You can temporarily limit use of the command by making it so it checks if its your ID
that's essentially what I suggested yeah, basically the deployed one would ignore me (and a couple of testers), and my local running version would only respond to those
Thats the best solution I could give, apart from just making another guild
Alright thanks
No problem
what is Discord.ChannelType for threads and posts?
PrivateThread or PublicThread
tnx
for checking that its a post or thread I have to check channel parent?
theres many ways of checking...you can also just use BaseChannel#isThread
ok tnx
how do I customize caching, specifically like if I want to remove cached guild members older than 1h
why it returns 0 channel?
Sweeping caches
In addition to limiting caches, you can also periodically sweep and remove old items from caches. When creating a new Client, you can customize the sweepers option. Below is the default settings, which will occasionally sweep threads. Take a look at the documentation for which types of cache you can sweep. Also consider what exactly lifetime implies for invites, messages, and threads!
However, removing guilds from the cache is not recommended and can result DJS breaking
message.guild.channels.cache.size returns 80
You put each channel type into an Array
oh
I don’t think Array.includes does type coercion
channelTypes.findIndex((t) => t == c.type) !== -1 should work if you wanted to make it work for some reason
Type coercion always comes at the cost of second guessing whether you covered all possible types
tnx also how can I get position of a channel in category?
compare its position to the category's?
BaseChannel#position should exist on all guild channels
tnx <3
and how to get category channels count?
same way...categories are channels just without messages
no I mean how many channels exists in a category?
CategoryChannel#children discord.js@14.25.1
A manager of the channels belonging to this category
it also has a cache
all of the channels are always cached? category.children.cache.size always return correct number?
yes
tnx
only thread channels aren't cached with the Guilds intent
and dms
ok tnx
if bot doesn't have UseExternalEmojis permission in interaction responsed like int.reply does it can use external emojis or not?
you wont get an error or anything, they just wont display
but I think they will display as interactions are some how a webhook not message
im not sure if i understand what youre trying to say
hi, quick one, does bot have any rights to create a super reaction within discord.js?
Rights (permissions) are granted in discord, djs itself has no say in that.
so its basically client sided but infos about superreactions are being pushed into API?
-# kinda lame tbh but aight
Huh? Yes, that's how an API works. Client send and receive stuff to/from it
i know, but if so, why there is nothing about bot client sending super reaction to a message?
just props, no method, nor extended #react() method
from what I recall a bot can't start a super reaction
but can add
correct
that I already know, thats why I've asked about starting one
yeah they can't, Qjuh just mentioned that's a discord limitation, nothing djs can change
:/
Bots can make as many super reactions as I can: none
hi am i able to use .setDefaultMemberPermission() on subcommands
no. sub commands are not separate to the api...they're all children of the main command and inherit all permissions
sub commands are just options...not unique commands
Hi, does anyone have the documentation for the new modal system with a select menu?
ModalBuilder#addLabelComponents() builders@1.13.0
Adds label components to this modal.
LabelBuilder#setStringSelectMenuComponent() discord.js@14.25.1
Sets a string select menu component to this label.
These two builders basically
Then the select menu builder too
how to set permissions for a member in a private thread?
Threads don't have permissions
Is it possible to dynamically update a select menu in a modal based on a previous field (for example, say a user had to select between a block, item, weapon and then a new select menu under it would be added or edited to display based on what the user chose for the first select menu?)
unfortunately no, it’s static
:( rip
Odd question, is there ever an instantance where GuildMember.joinedAt is null in events such as guildMemberUpdate or guildMemberRemove? I saw it has the types of Date | null but confused on when it would ever be null.
I assume GuildMember.joinedAt would be null if the member isn't cached (this is just my guess)
https://discord.com/developers/docs/resources/guild#guild-member-object it's listed as nullable on the api
specifically
Member objects retrieved from VOICE_STATE_UPDATE events will have joined_at set as null if the member was invited as a guest.
the full objects (GuildMember, Message, etc) docs are only for fully cached resources (you can see that on the partial property, their type is false)
there's PartialX for partial objects
though that's only for the docs, since the partial types are interfaces, they don't exist in runtime; in runtime they'd be the full class
ahh i see, thanks 😅
*nevermind, the issue in my code was with something else
Oh, thank you
yall my last hope does anyone know what ChannelOverwriteCreate , ChannelOverwriteDelete and ChannelOverwriteUpdate is for?
I deadass can't find it anywhere and I tried logging them but no logs
but like doesn't this trigger on normal channelupdate too or whatever like 'permission' changes
cuz im logging them all from channelupdate and its fine so im confused whats channel overwrite is for (or im just stupid)

you appear to be looking at the audit log event list
this is not the same as gateway events
those refer to what values you'd see in <GuildAuditLogsEntry>.action

thanks so ChannelOverwriteCreate isn't really used?
why not?
what are you actually looking for?
what did you log (" I tried logging them but no logs")
as I mentioned above, it's used for <GuildAuditLogsEntry>.action
it is not a gateway event, and therefore you can't do <Client>.on(AuditLogEvent.ChannelOverwriteCreate, ...) if that's what you're asking
no im trying to understand what its used for
my bad for the phrasing before
you could fetch audit logs of that type with <Guild>.fetchAuditLogs({ type: AuditLogEvent.ChannelOverwriteCreate })
when listening to messageUpdate, is it oldMessage or newMessage that can be partial? Or both?
Only oldMessage, since it depends on cache availability
That’s vague, please elaborate what you intend to do. Do you mean how you receive its interaction?
I see that you already have a post in #986520997006032896 pls do not crosspost
Okay, I'm sorry.
Can someone please tell me if node.js is using port 80? And if so, how can I change it to 81?
Node.js is just a js runtime (like Python scripts that run on computer), no reason for it to have a port
Only stuff like websocket servers and webservers like express.js would need/use a port
The thing is, I want to host Node.js on a single VPS, but here's the problem:
The site is written in .golang and uses port 80, which causes problems with the bot.
Node.js by itself doesn’t use a port
You would need a lib or startup a web server code that uses a port
okay thanks
Isn’t port 80 like https or smth?
Mb, it’s http
maybe bro
anyway i installed express
Why? I thought you were trying to not give node.js a port?
well i need to port it
Sounds like a host issue tbh
You literally set the port used by express when you start it up
When opening something in a browser you can also specify port there
Should work on its own
Might need to allow a port in the VPS firewall though first, for external connections
wait why containerbuilder aint working for me its sending ntg
Show your code
import { ChatInputCommandInteraction, ContainerBuilder, MessageFlags, SlashCommandBuilder } from "discord.js";
export default {
data: new SlashCommandBuilder()
.setName("test")
.setDescription("test cmd"),
async run(client: any, interaction: ChatInputCommandInteraction) {
await interaction.deferReply();
const container = new ContainerBuilder()
.addTextDisplayComponents((textDisplay) =>
textDisplay.setContent(`Test`)
);
await interaction.editReply({
content: " ",
components: [container.toJSON()],
flags: MessageFlags.IsComponentsV2,
});
},
};
wait it worked idk why leme see
You don't need to do .toJSON or set the content property in the reply
i want show textdisplay in modal how to?
naah .toJSON is req bro dw I got it, it was my mistake I didnt restarted the bot after adding ChatInputCommandInteraction
It's not though
you only need to do to it if youre rebuilding a container
documentation suggestion for @short granite:
ModalBuilder#addTextDisplayComponents() builders@1.13.0
Adds text display components to this modal.
Can djs v14 work in nodejs v16 ?
No, there's a minimum node version requirement that is higher
is there an equivalent of discord.py's AutoShardedBot class in discord.js?
and what does that do?
No, but you can utilize https://github.com/discordjs/discord.js/blob/db41d5cb6896c18eac7770348f22c6f513243c17/packages/ws/src/ws/WebSocketManager.ts#L309 to get the same effect
the core logic will need to be defined by you and then call the method accordingly
though without reusing sessions, this is an easy way to burn your identifies
if you are not at a scale that demands such functionality, it is better to do it manually
alright thank you
Is ShardingManager not what you want?
well i was specifically asking for an already premade class that discord.js exposes but if this helps me make it myself that works too
Okay, hold on
What do you want to do
Since this isn't d.py server, we don't know what some class there happens to do
I think that is similar to shards: "auto" in ClientOptions
How can I make sure my bot doesn't go into an idle state where it doesn't receive events
Like after being online for ages with no interactions?
There's no idle state for bots they always listen for gateway events
That shouldn't happen unless you/your host has network issues or automatically shut down after a certain idle time
How to perform horizontal separation with ContainerV2 for embeds
containers and embeds are completely different
Separator
A Separator is a layout component that adds vertical padding and optional visual division between components. You can select the amount of padding used for the Separator component (small or large) as well as whether a visual divider should be displayed (defaults to true). You can use the SeparatorBuilder class to easily create a Separator component. When a Separator component is used without any non-Separator components in the message payload, the message will not have any visible content.
is there any way to create a ticket system via thread, but without the possibility for a person to mention a role or another person and have them automatically invited to the thread? (even if it's a private thread)
I believe there's a setting for private threads to only let mods invite?
Not 100% sure though
i did this, but it still keeps adding when marked
Is it mod who's mentioning?
both moderator and member keep adding to the thread
setting block invite to false for private threads should work fine
PrivateThreadChannel#invitable discord.js@14.25.1
Whether members without the permission can invite other members to this thread. This property is always null in public threads.
Is there a part about setting a presence and activity?
Please ping me
documentation suggestion for @coral hollow:
ClientOptions#presence discord.js@14.25.1
Presence data to use upon login
Default value: {}
PresenceData discord.js@14.25.1
Data resembling a raw Discord presence.
Thanks!
can someone explain this type for the member running an interaction?
If the interaction is in cached guild, then it'll be GuildMember, otherwise it'll be APIInteractionGuildMember
thanks, how should I handle when the guild isn't cached?
Depends on what you want to do. If the interaction is in a guild that your bot is in and you have Guilds intent, it should always be cached. You can use inCachedGuild() typeguard to narrow the types
It seems like some properties aren't available for cached guilds, is this accurate?
Actually the opposite
BaseInteraction#inCachedGuild() discord.js@14.25.1
Indicates whether this interaction is received from a cached guild.
Use this typeguard ^^
yeah sorry I misspoke, uncached guilds don't have access to displayName...
Ok! If the guild isn't cached, is there a way to load it, or cache it? or do I just have to throw an error
The only way it isn’t cached is if:
- Interaction executed in DMs
- Interaction executed in guild that bot isn’t a member of
- Missing Guilds intent
- Sweepers on guilds cache/evicted guild manually from cache
3 and 4 is avoidable, 1 and 2 depends on how you want your bot to work
thanks!
displayName is a getter that gives you their nickname or (if they don't have one) their user globalName or (if they don't have that either) their username. Since for uncached stuff you get raw API data instead of a class instance it won't have any methods or getters
you can't send files while using components v2 right?
You can
does ContainerBuilder has footer or thumbnail option if it dosent is there a way to make it look like thumbnail
footer is not a thing in containers. you can get similar look using subtext -# markdown. To add a thumbnail you must use a section component with a thumbnail component as the accessory.
subtext discord.js@14.25.1
Formats the content into a subtext.
ContainerBuilder#addSectionComponents() discord.js@14.25.1
Adds section components to this container.
like in container i wanna show an image like this
but i can manage a thing like this
documentation suggestion for @wraith cedar:
SectionBuilder#setThumbnailAccessory() discord.js@14.25.1
Sets the accessory of this section to a thumbnail.
Container > Section > Thumbnail
Container themselves cant have thumbnails. Section can have thumbnails and be added inside the Container
guide suggestion for @wraith cedar:
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.
setlabel depracte in a textinginputbuilder
yes
what should i use
LabelBuilder#setLabel() discord.js@14.25.1
Sets the label for this label.
LabelBuilder
Modal > LabelBuilder > TextInput
Label builder has support for select menus and file upload in addition to text Input
Actionrow in modals is also deprecated
perfect anything for this? http://cdn.crazydev.fun/Discord_jkTqjg6tQM.png timestamp
is there any class or do we have to make it manually
time discord.js@14.25.1
Formats a date into a short date-time string.
something like this
hi whys this not working
const amountLabel = new LabelBuilder()
.setLabel('Amount')
.setDescription('How many points to bet?')
.setTextInputComponent(
new TextInputBuilder()
.setCustomId('amount')
.setStyle(TextInputStyle.Short)
.setRequired(true)
);
const choiceLabel = new LabelBuilder()
.setLabel('Choice')
.setDescription('Enter A or B')
.setTextInputComponent(
new TextInputBuilder()
.setCustomId('choice')
.setStyle(TextInputStyle.Short)
.setPlaceholder('A or B')
.setRequired(true)
.setMinLength(1)
.setMaxLength(1)
);
const modal = new ModalBuilder()
.setCustomId(`bet_modal_${interaction.message.id}`)
.setTitle('Place your prediction')
.addTextDisplayComponents([
new ActionRowBuilder().setComponents(amountLabel),
new ActionRowBuilder().setComponents(choiceLabel)
]);
return interaction.showModal(modal);
}
What do you mean not working? Do you get an error?
ValidationError: Expected a string primitive
at _StringValidator.handle (C:\Users\user\Documents\Projects\Discord\GitHub\Discord\Channel Points\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:2615:70)
at _StringValidator.parse (C:\Users\user\Documents\Projects\Discord\GitHub\Discord\Channel Points\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at TextDisplayBuilder.toJSON (C:\Users\user\Documents\Projects\Discord\GitHub\Discord\Channel Points\node_modules@discordjs\builders\dist\index.js:2064:33)
at C:\Users\user\Documents\Projects\Discord\GitHub\Discord\Channel Points\node_modules@discordjs\builders\dist\index.js:2857:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (C:\Users\user\Documents\Projects\Discord\GitHub\Discord\Channel Points\node_modules@discordjs\builders\dist\index.js:2857:35)
at ButtonInteraction.showModal (C:\Users\user\Documents\Projects\Discord\GitHub\Discord\Channel Points\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:402:46)
at module.exports (C:\Users\user\Documents\Projects\Discord\GitHub\Discord\Channel Points\events\interactionCreate.js:58:26)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:92:21) {
validator: 's.string()',
given: undefined
}
really dont understand thus new change to modals and buttons.
I believe you're missing a required field in one or more of your text input builders, but I'm not sure what it is
bruh, well i need help this isnt working at aLL I READ ALL DOCS
still doesnt work, i dont know why they made it more complicatefd
Label builders cant be added to actionrows
Oh there you go
ModalBuilder#addLabelComponents() builders@1.13.0
Adds label components to this modal.
also you are trying to add Actionrow as a text display in this code
Is there any way to get messages replied on a message?
Message#fetchReference() discord.js@14.25.1
Fetches the Message this crosspost/reply/pin-add references, if available to the client
Hello everyone! Is there a way to mention server tag? like that example.. <#& > or is not a feature yet?
pretty sure that's not a thing
Ehh, sad sad.. Would be nice to have this feature 😄 Now i need to use emoji for that eh...
Alrighty thanks anyways!
why is it that just setting an image url as embed image might not properly embed, but setting as file always embeds?
Is the URL actually an image or does it just show an image in a HTML page or redirect to one?
at Object.execute (/home/container/commands/Information/help.js:41:8)
at Object.execute (/home/container/events/client/messageCreate.js:669:21)
at processTicksAndRejections (node:internal/process/task_queues:103:5)
uh that i dont know since its from an api but the url ends with .png 
Then find out. You got the URL so you can access it
i was just wondering the logic behind that
how to fix this
Container has no thumbnail, Section does
❌ [6:10:50 PM] Unhandled Rejection: ExpectedConstraintError > s.array(T).lengthGreaterThanOrEqual()
Invalid Array length
Expected: expected.length >= 1
Received:
| []
at Object.run (/home/container/node_modules/@sapphire/shapeshift/src/constraints/ArrayConstraints.ts:35:1)
at /home/container/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:126:2
at Array.reduce (<anonymous>)
at _ArrayValidator.parse (/home/container/node_modules/@sapphire/shapeshift/src/validators/BaseValidator.ts:126:2)
at validateComponentArray (/home/container/node_modules/@discordjs/builders/src/components/v2/Assertions.ts:71:4)
at SectionBuilder.toJSON (/home/container/node_modules/@discordjs/builders/src/components/v2/Section.ts:146:3)
at /home/container/node_modules/@discordjs/builders/src/components/v2/Container.ts:236:61
at Array.map (<anonymous>)
at ContainerBuilder.toJSON (/home/container/node_modules/@discordjs/builders/src/components/v2/Container.ts:236:32)
at /home/container/node_modules/discord.js/src/structures/MessagePayload.js:151:46```
Sections ALSO needs textdisplay not JUST a thumbnail
sir any example
Do you want a thumbnail next to text or do you just want an image under the text?
guide suggestion for @hard urchin:
Section
Sections represent text (one to three Text Display components) with an accessory. The accessory can either be an image (thumbnail) or button. If you do not want to send an accessory, use a Text Display component instead. You can use the SectionBuilder class to easily create a Section component:...
thanks solved. 🫶
Hey guys, I'm having an issue, trying to import Channel for a jsdoc function description
import { Channel } from "discord.js";
but when starting the bot I get this error: SyntaxError: Named export 'Channel' not found. And I can't figure out the issue because Channel is an exported type ^^"
It's a typealias, not available at runtime. You can import directly in jsdoc like so {import("discord.js").Channel}. Also saves you from unnecessarily importing stuff if you aren't gonna use it in runtime
And how should I write it if it's for a @returns ? ^^ because rn it's looking weird
if you're using ts you should be able to do that
unless you're running instead of compiling, not sure how that works
I'm using javascript ^^
That is not JavaScript, that is typescript
My file type is .js ^^
Then where is that screenshot from? Your code or some IDE popup?
My IDE popup
Then everything is correct and how it should be
According to NyR's advice, my code looks like this
But the popup is weird ^^"
Why? The popup says exactly what you made it say
Considering it is just a type and not a runtime thing that's how it is
Why you export it as a const having an arrow function as value instead of just a function probably has some reason I guess?
But this never was djs related, so probably should move to #1081585952654360687 or #archive-offtopic
hi! how i make this message design?
guide suggestion for @violet roost:
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.
if my contexts and integrationTypes are set to Guild and GuildInstall respectively, is it safe to assume that all my interactions are cached? ie im not required to use the typeguard to check, and i can just attach the generic myself?
you could also just add the type guard in your command handler
if somehow you ever forget about it for a given command or something, then you're still safe
<ContainerBuilder>.addSectionComponents((section) => {
section.addTextDisplayComponents((textDisplay) => textDisplay.setContent(`content`));
if (url) {
section.setButtonAccessory((button) =>
button
.setLabel('View Full Response')
.setStyle(ButtonStyle.Link)
.setURL(url)
);
return section;
} else {
return section;
}
})
Why does this error, demanding either a button or a thumbnail?
Well a section needs to have an accessory, instead of conditionally returning section if url is not present, return a text display
Hey everyone, I have a question about the componentsV2
Can I update the message? If it was v2
I know the interaction.update but isn't working..
yes, could you share your code
const { MessageFlags } = require('discord.js')
module.exports = {
name: "interactionCreate",
async execute (interaction) {
if(!interaction.isButton()) return;
if(interaction.customId !== 'on') return;
})
}
}```
code block goes ```js for color
I was looking for the edit() location cv2 message can be edited
This is the full one ,
you cant edit cv2 out of a message
I didn't get it
So I can't edit a container?
you can. in your case with Interaction#update() but you cant use the content field
cv2 disables the content property
Just this right ?
interaction.update({
components:[newComponent]
})
Ok thanks mate !
Your app can still be invited without bot scope. But that would be effort on user end just to make your app fail/crash
Is there any updates on being able to get all guild members with a tag?
you can fetch and filter on your own
Is that not inefficient?
User#primaryGuild discord.js@14.25.1
The primary guild of the user
no
One single fetch, one single filter
Oh wdym filter
Collection#filter() discord.js@14.25.1
Identical to Array.filter(), but returns a Collection instead of an Array.
collection.filter(user => user.username === 'Bob');
Currently I just listen to members equipping or unequipping the tag, then if a user has it equipped already I have an interval that checks from time to time if they still have it equipped just incase
Thanks I'll be using that
Hola, quiero aprender a programar y más que nada me gusta la creación de bots, como puedo aprender?
hi there, please do your best to speak english by using a translator
Oh, okay, okay, I was saying that
I want to learn to program and I especially like creating bots, how can I learn?
Does GuildForumThreadManager#fetchActive truly return all the active threads? Even if there are 1,000?
FetchedThreadsMore#hasMore discord.js@14.25.1
Whether there are potentially additional threads that require a subsequent call
Oops wrong thing
Goal for me is to just get all active threads, albeit using an async iterator (preferred even)
It should, it’s not paginated. Only archived threads are
Kay, thanks!
i assume this works to send a message in a channel, pin it, and delete the ping message right? just seems weird cuz so many .then statements, also not sure if the .then on a pin method works like that
i would test it myself my i dont want to deploy to production and have it cause issues, so if someone whos smarter than me could just say yes or no that would be great
usually when creating a bot, you would have a dev bot to test your code before going into production
i do have one, its just so outdated and would take me so long to update it
ill probably fix it soon enough just wanna get this fix out now
I mean you don't need to .then()
you can just await
really
you should learn what promises are and how they work
djs didn't code those then methods, that's from the promise
yea i know, but this was just easier than making new variables and stuff
this returns a message, but im not sure if its the created message or the pineed message
thats essientally my question now i guess
pretty sure it's the message itself
you can double check the code
ok
looks like it
maybe i should suggest a option for pin message instead
in case you didn't know, you can click on the </> at the right side of the method
it'll jump to the code
yea i have it up now
oh well guess ill just go back to fetching
you can setup a message collector before pinning, check if it's a pin message, and delete
oo good idea
technically it can bug if someone just happens to pin a message at that moment
but that's probably very unlikely and not that big of an issue anyways
yea, this all happens right at channel creation so basically impossiable