#djs-help-v14
78874 messages · Page 33 of 79
I’m like 100% sure it’s not code
Cuz in 10 command runs it doesn’t happen then one time it happens then again
ye it happens with me too. Some times i’m .4 seconds over the 3s mark on a defer call. You can’t do much about that.
that's expected though, you can't predict precisely how long network and async calls will take
check these possibilities
So it’s okay to create error handler which will just ignore unknown interaction so it doesn’t spam console?
Bro if i know how to put image I wasn't going to ask you
no. Some times there could be an actual issue.
For example, if your application is persistently going over the 3s limit.
you can log the interaction creation date and Date.now() to see which one it is, network or code
I'm trying
I didn't say you don't know how to put an image, I said your fix suggests you don't know js
How can I do that, I mean wdym how to do it
do what part?
logging, getting the date?
In what case is it the code and when it’s network?
If you want to ignore, you should also implement some sort of counter with a threshold to notify you of it’s happening too often
if the current time and the interacion's creation difference is higher than 3s then that call will error, and you know it's your code
if it's not higher and it's within an acceptable margin then it's your network since your code is reaching the defer call in time
What is acceptable margin, 3s?
https://discord.com/channels/222078108977594368/1372407284659130378
check this forum post
3s is the limit enforced by the API. If you don’t defer, anything over will get rejected
no, it's not possible for it to be 3s since it'll always take at least some time to arrive to you
I'd say 1.5s or more is acceptable
It’s 3s from when the interaction started existing right? The snowflake?
yeah
or well when it reaches and is processed by discord technically
that’s when the snowflake is generated i assume
woah sorry im a bit tired 🤦♂️ i meant to say it does create the thread, however everyone can see it, im assuming that in this case its more of a permissions issue rather than the code itself?
if you're creating a public thread, it's because you're creating a public thread, not because you have no perms to create a private one
I missed it befor you cant use startThread to create a private thread
if you would try making private one without perms for that, you would simply get an error back
ahhh to make one i'd need channel.threads.create() right? which doesn't "link" the thread to a message
yes, It would not start with the message
hmmm alright thanks
here is the doc if it helps
GuildTextThreadManager#create() discord.js@14.21.0
Creates a new thread in the channel.
// Create a new public thread
channel.threads
.create({
name: 'food-talk',
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
reason: 'Needed a separate thread for food',
})
.then(threadChannel => console.log(threadChannel))
.catch(console.error);
hey how can I check if an embed includes a word?
embeds[0].description.includes(…)
You would need the message content intent so this won't work for a public bot really
With that out of the way, you would need to get the Message somehow, assuming you have that, just get the embed(s) from the embed property and filter through the author, description, fields and footer properties
But before you do that, what is the use case
I'm making a system that adds you to a private thread when you send a command from a different bot
Is it possible to make a decorative bot with the profile?
decorative? you cannot change other people profiles, nor do bots have access to any nitro features like customizing their own profiles
aaa okey thank you
You can add decorations to the bot's profile XD
hm?
bot cannot do quests or buy decorations
Hi! Is there a way to fetch information about the number of boosts and who has boosted on a server?
only who has boosted the server by checking who have the server booster role on that server
the amount of boosts someone has given a server is not accessible through the api
Okay I see, thanks!
GuildMember#premiumSince discord.js@14.21.0
The last time this member started boosting the guild
this also exists, no need to dig through the roles
client.once not working
but client login working ?
What’s ur d.js version? npm ls discord.js
^15.0.0-dev.1753660951-593369dbb
The event name changed to clientReady
oh okey
In the future, please keep @dev version questions in #djs-in-dev-version
thanks, its worked
Hey, I have a weird bug... I received a message from discord saying my bots token got reset because it connected to Discord over 1000 times in a short period of time. However my logs suggest it never went into the client.once('ready'... block again. So I'm reluctant to believe it's an infinite crash loop. There weren't uncaught error logs either. I'm wondering if there's anything else that could've caused client.login calls without entering any other client functions?
no part of discord.js or any submodules call <Client>.login() for you if that's what you're asking
hard to say about any other part of your bot without any info
I can link the repo, its public
That can also be caused by the bot losing internet connection for too long
Forcing the bot to make a new session rather than resuming the current one
Bot losing internet for too long.. that would have to be a VPS issue?
Yea
Maybe? It's very hard to tell, my VPS says it's been up and my instance has been up for 26 days.
The client.debug event prints out a lot of extra info, but it does let you know when this specifically happens
Ok sounds good, I'll add that in too
how can i add an emoji on custom status ?
client.user.setActivity({
type: ActivityType.Custom,
name: "custom",
state: activities[0],
});
bots can't use the actual emoji field for custom statuses
the closest you can get is using unicode characters in the state
afaik that's entirely a client side issue
not something that can be caused or fixed in your code
so can i restart client to fix or what
I did, still happening 😭
oh shi that is vencord message logger
@stable sun in my log it had this loop during the crash time that executes once an hour
Heap Used: 145 MB, RSS: 222 MB
Heap Used: 139 MB, RSS: 222 MB
Heap Used: 144 MB, RSS: 222 MB
Heap Used: 137 MB, RSS: 222 MB
Heap Used: 142 MB, RSS: 222 MB
this suggests my bot didnt crash, and the Discord.js websocket client tried to reconnect internally behind the scenes. This is just my theory, I added the logs you suggested and will see what happens for next time. But my bots been running smoothly for months so who knows. Thanks for your help.
in the section of the guide that talks about sharding, it says you only need to at a certain number of servers. i have 2 questions.
- what happens if you shard and arent at this threshold? does it just do nothing or will shards actually spawn
- can a high amount of users require you to shard? such as if your bot is only in 10 servers, but each of them have hundreds of thousands of members
- You just waste cpu to manage another shard
- No, it’s strictly based on guild count. When you shard, certain shards will exclusively receive events from their assigned guilds.
so if you arent ever close to that threshold, you wouldn't ever need to shard?
That’s correct
Does internal sharding still count as sharding in the sense that it will allow the bot to join more than 2500 servers?
yes
Internal sharding just puts the workload of multiple shards into one process
Hi, if i'm not wrong <>.deferUpdate will allow my bot to respond within the 15 next minutes, will it throw an error if I don't ? (I'm mainly talking about Components interaction)
no
good to know thanks you
So I got some code to do something when a user boosts a server, but it seems to also just happen when I change the role on someone if they have previously boosted the server?
I do not have partials enabled, but this is my code:
if (oldMember.premiumSince === null && newMember.premiumSince !== null) {
const guild = oldMember.guild;
const boosterChannel = guild.channels.cache.find(
(channel) => channel.name.toLowerCase().includes('boosters') && channel.type === ChannelType.GuildText
) as TextChannel | undefined;
if (!boosterChannel) return;
try {
const message = await sendAsServer(
{
...(await boostMessage(newMember))
},
boosterChannel
);
message?.react(BGNEmojis.GreenCheers);
} catch {}
}
This appears to trigger when I change a role on a user who has boosted, I reckon it has something to do with the user not being fully cached yet, how could I prevent that from happening?
tag suggestion for @pulsar aspen:
The Discord API does not provide a dedicated event for guild boosts, but you can check for it in the guildMemberUpdate event:
client.on("guildMemberUpdate", (oldMember, newMember) => {
// Check if the member wasn't boosting before, but is now.
if (!oldMember.premiumSince && newMember.premiumSince) {
// Member started boosting.
}
});
might be better to check for falsy value instead of null, like in this code ^^
Maybe, I will check that
I do not think sorry, that is not relevant herepremiumSince will return to null when boost stops
Maybe check the role? I don't know if there is a way to find the booster role in particular though if the guild has a different name for the booster role
you can check the role if it is the boost role role.tags.premiumSubscriberRole
https://discord.js.org/docs/packages/discord.js/14.21.0/RoleTagData:Interface#premiumSubscriberRole
Nope, same issue...
can you send your if check now?
So when checking it if (!oldMember.premiumSince && newMember.premiumSince !== null), this will trigger when the bot does not have the user cached already
Maybe
you'd have to apply the same with the second check, like newMember.premiumSince instead of newMember.premiumSince !== null
..like in this code
Yeah, I did that, exact same thing
If the user isn't cached it just immediately sees it as the user having boosted when any update happens on the member
!oldMember.premiumSince && newMember.premiumSince triggers if the member isn't cached beforehand, and I have no clue how I am going to solve it in that case.
something like this
const boostRole = newMember.roles.cache.find(role => role.tags?.premiumSubscriberRole)
if(boostRole) {
// Member is boosting
} else {
// Member is not boosting
}
Maybe, still don't know how to fix the other issue though as I cannot check a non cached oldMember's roles to see if they have the booster role beforehand to fix the other issue...
cache doesn't have much to do here, premium since is gotten straight from the event data
Then why does it trigger the first time a memberUpdate is recieved for a member who was already boosting?
what does your check look like now?
you could check the timestamp premiumSince if it is in lets say the last minute then they just boosted
All of the code:
if (!oldMember.premiumSince && newMember.premiumSince) {
client.logger.info(`Member ${newMember.user.tag} has boosted the server ${oldMember.guild.name}`);
if (oldMember.guild.id !== minecraftBgnGuild) return;
const guild = oldMember.guild;
const boosterChannel = guild.channels.cache.find(
(channel) => channel.name.toLowerCase().includes('boosters') && channel.type === ChannelType.GuildText
) as TextChannel | undefined;
if (!boosterChannel) return;
try {
const message = await sendAsServer(
{
...(await boostMessage(newMember))
},
boosterChannel
);
message?.react(BGNEmojis.GreenCheers);
} catch {}
}
where do you get oldMember and newMember from? a snippet of where it's defined
(event) Client#guildMemberUpdate discord.js@14.21.0
Emitted whenever a guild member changes - i.e. new role, removed role, nickname.
GuildMemberUpdate event, wrapped in a seperate class file:
class MemberBoosted extends GargoyleEvent {
public override event: keyof ClientEvents = Events.GuildMemberUpdate;
public override async execute(client: GargoyleClient, oldMember: GuildMember, newMember: GuildMember): Promise<void> {
if (!oldMember.premiumSince && newMember.premiumSince) {
client.logger.info(`Member ${newMember.user.tag} has boosted the server ${oldMember.guild.name}`);
if (oldMember.guild.id !== minecraftBgnGuild) return;
const guild = oldMember.guild;
const boosterChannel = guild.channels.cache.find(
(channel) => channel.name.toLowerCase().includes('boosters') && channel.type === ChannelType.GuildText
) as TextChannel | undefined;
if (!boosterChannel) return;
try {
const message = await sendAsServer(
{
...(await boostMessage(newMember))
},
boosterChannel
);
message?.react(BGNEmojis.GreenCheers);
} catch {}
}
}
}
Ignore the other namings for the client and the event, as I needed some particular attributes to make extendability easy, but that is all there is, which is why I am so confused, I can also show you where it binds the execute funciton itself and the arguments granted to it from the event
client.on(event.event, (...args) => event.execute(client, ...args)) (simplified snippet from my register events method)
Here is my current thought. What do you think?
const boostRole = newMember.roles.cache.find(role => role.tags?.premiumSubscriberRole)
const boostCheckInterval = 1500
if(boostRole && newMember.premiumSinceTimestamp && newMember.premiumSinceTimestamp >= Date.now() - boostCheckInterval) {
// Member boosted in the last 1500 milliseconds
}
That may be a workaround
I would recommend that you try to check oldMember before falling back on the timestamp
that's not needed, premiumSince is the timestamp of the first time a member boosts the guild
it's undefined if the member hasn't boosted, that's probably why it failed the null check
What about after the first time. Say they stop and start again
premiumSince stays the same
not that sure though
IDK would be nice if it was just an event
Would the boost message discord themselves send trigger a messageCreate event maybe?
Nah nvm that isn't a good idea
They do
but if you have the messages truned off it wont help
I guess this works as a work around for now;
if (!oldMember.premiumSince && newMember.premiumSince) {
if (oldMember.guild.id !== minecraftBgnGuild) return;
const boosterRole = newMember.guild.roles.cache.find((role) => role.tags?.premiumSubscriberRole);
if (!boosterRole) return;
if (!newMember.roles.cache.has(boosterRole.id)) return;
if (newMember.premiumSinceTimestamp && newMember.premiumSinceTimestamp < Date.now() - 15 * 1000) return;
why get the role then check if the member has the role? And not just check if the member has a role with the premiumSubscriberRole tag
I guess that also works, it just won't look as pretty
Nevermind I am just stupid if (!newMember.roles.cache.find((role) => role.tags?.premiumSubscriberRole)) return;
Wait you said that you dont have partials enabled right? If that is true you should get oldMember with each event. I think
Exactly, that is why I am so confused as to why premiumSince doesn't exist on a person who was already boosting
weird I cant try it right now but I will try and reproduce later
Though I did just realize something, if partials are disabled the first guildMemberUpdate event doesn't seem to get triggered?
Correct, because the member wasn’t cached at that point
Yeah fair, so then checking if someone boosted if that specific member isn't cached is impossible
So I would have to enable partials, but then no oldMember to check
The guildMemberUpdate event relies on d.js’ cache for oldMember. That’s how it’s able to serve you the data from before the event emitted - Discord only provides the data for after the update happens
Fair, explains the current issue then, no clue how I am gonna check for a boost in that case
Enabling the partial tells d.js “give me this event, even if oldMember is not a fully populated GuildMember structure”
Is this for a single-guild app? Or one that can be added to any number of servers?
Currently single guild, however if I make it work well I will see if / how I will roll it out to multiple servers
Okay, because a suggestion I give for apps in a small number of guilds is to fetch all members for the guild in your clientReady event listener. Then all members will be cached already making member-related events that rely on cache a lot more reliable
Yeah fair, that's unfortunately not an option for my use case
Not advisable for apps in hundreds or thousands of guilds though as you can imagine…
Could a webhook message be sent as a reply to another message?
nope
Yeah just saw, unfortunate.
Is there any way I could trigger a messageCreate event again for the same boost message? Or even just fake that event so I can debug it?
I cannot get more boosts for my testing purposes 😭
you could just listen to a fake event and emit that one
Unfortunately I do not have a copy of a boost message event, I will figure something out eventually hahaha
you can fetch the message and emit it
as mentioned, in a fake event, I wouldn't recommend doing it in djs' built-in ones
or well, you don't even need an event, you can call the handler function directly
I understand that a message with an embed or images when it updates the embed or image in anyway can trigger the Message Update Event.
However what I don’t understand currently is why messages from ages ago that have images or embedded links, in some cases way before the bot even joined are randomly triggering the event with no changes.
This might be more an API issue but just in case asking for help here.
How did you determine there's no change?
do i need to fetch the guild or is it loaded automaticly
<member.>guild.preferredLocale
<member> is from guildMemberAdd event
Well unless Discord is randomly updating the images posted like a refresh and then triggering the update event based on that then they’re messages from weeks if not months ago. When asking if people who it relates to edited these messages they reply that they have not.
The theme is however mostly messages with images.
No old message that has no media at all shows the same behaviour
might have something to do with link expiration for media
Could do, basically just thought I’d ask while I’m at work as I’m gonna try get to the bottom of it after
Hi guys, how do I check in the message deleted event if someone else deleted a message?
you would have to fetch the audit log
do consider there's no guarantees that first it'll emit the delete event and then create the audit log or viceversa
if ur button collector is on the interactionCreate event, is there a way to make the button only collect then send back to the command file? like this
else if (interaction.isButton()) {
// button collector logic
// after it, the other logics are continued on the command.js file
}
```?
I am not sure what you mean have you looked at the guide or docs?
BaseInteraction#isButton() discord.js@14.21.0
Indicates whether this interaction is a ButtonInteraction.
do you want to send the button interaction to the command?
i have my button collector on interactionCreate event, i want the other logic (when the buttoncollector logic is finished) to be continued on the command.js file.
so this?
just import your function and call it
that's a js question, not a djs one
how to import a function
oh my bad
it sounds like a bad approach though, personally I'd make a common function for both
specially in js that'll let you pass anything with no issues
even if that won't actually work when executed
i tried to add image but i cannot can you help me please?
Popular Topics: Display Components - Media Gallery
read more
@rose tangle i will share for you my code
the guide provides an example so if you copy that and change the values of some methods you should be good tho
if you want to add it to a container, pass it to the add method
ContainerBuilder#addMediaGalleryComponents() discord.js@14.21.0
Adds media gallery components to this container.
don't reply to my answer while ignoring it
I think your url in line 33 isnt complete, it ends with a “&” but normally there is another url query behind that too
sorry but iam trying to add image and no one help me
to which container? you have two
you already added it to one, but b3ssel mentioned a possible issue there
this
just copy what you did with the first one
but instead of passing it separately you need to add it to the container with this
bro first one not working
did you check what b3ssel said?
hi guys
if i want to send text in voice channel chat how can i do that
get the voice channel and use the .send() method just like a regular text channel
I still can't add a picture in container
I hate this
if you follow the guide and/or docs then there shouldn’t be any problem
it can be that the URL isn’t working
have you tried copying the URL you have in the code and pasting inside discord
Iam trying but there are errors and image not set in container
Can I dm you?
show the errors instead of “it doesn’t work, I hate this”
try making it work at least outside of the container first
like how you're doing it now
it should work, if it doesn't it suggests it's the link
I did it but It looks bad outside
I deleted it
then now just call the addMediaGallery component in the container and set it up there
you already figured how to do it for text displays, separators and sections
it's the exact same thing
Can you give me an example or modify my code, for example? I will be grateful for all your efforts.
and what will you learn from that? when you face another error you simply ask us again to modify code
we arent here for spoonfeeding
Bro iam trying to learning
Iam learning from another codes i watched
Popular Topics: Display Components - Media Gallery
read more
you already added a text component, a section, a thumbnail and a separator
it's the exact same procedure for a media gallery
just with a different function
ContainerBuilder#addMediaGalleryComponents() discord.js@14.21.0
Adds media gallery components to this container.
this and the guide is everything you need basically
.addMediaGalleryComponents((media) => ...)
Yeah but Media gallery is so difficult i can't add it
I will try again
So it's just assumptions. Pretty sure there actually were changes then. And if you logged what the event emits with you might find what changed
adding a section is much more difficult tbh, maybe you're just thinking too much that it's difficult and you can't do it, regardless of whether it's actually difficult
My problem is this
await channel.send({
components: [exampleGallery],
files: [file],
flags: MessageFlags.IsComponentsV2,
});
Where can I add this
you don't, you don't want to send the gallery individually
you just add it to the container and then send the container
as mentioned, it's the exact same thing as with text displays, sections and separators
I'm unsure how you managed to add all of that and can't do the media gallery
Presence discord.js@14.21.0
Represents a user's presence.
@flint pier please use #app-commands or the hide option for personal docs usage
.additem?
?
we sent you this right???
When i add image
I will write
.addItems(
yeah, in the gallery
you already did it when you sent the gallery outside
it's the exact same builder
you can quite literally copy and paste the methods you called
.AddItems is not function oh lol 🙂
Error 🙂
^^
copy your own code
new ContainerBuilder()
//…
.addMediaGalleryComponents(
mediaGallery => mediaGallery
.setItems(
mediaItem => mediaItem
.setURL(“…”)
)
)
basic reading of both the docs and the guide we provided multiple times now
if you're copying and pasting code from other sources you won't get quite far in programming, you'll have to learn how to read docs and guides
I'm certain you copied all that other code from somewhere else if you're having these issues
learn how to write your own code instead of copying
and to add you haven’t shared any error with us, just a link to your code file and the words “doesn’t work help”
function createStatusEmbed(status, checkTime) {
return new ContainerBuilder()
.setAccentColor(0x000000) // لون أسود
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent(`## 📊 | ShareBot Status`),
)
.addSeparatorComponents(
separator => separator,
)
.addSectionComponents(
section => section
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent(`
- **ShareBot Assistant**
**Online :emoji_5:**`),
textDisplay => textDisplay
.setContent(`
- **ShareBot**
**${status}**`),
)
.addMediaGalleryComponents(
mediaGallery => mediaGallery
.setItems(
mediaItem => mediaItem
.setURL(`https://cdn.discordapp.com/attachments/1362042671799074877/1400165069224022068/IMG-20250402-WA0005.jpg?ex=688c4d96&is=688afc16&hm=ad4517a4620cd0b815ab5039b4067d898aea0002b7c73c781dca262e6f207180&`)
)
)
.setButtonAccessory(
button => button
.setStyle(ButtonStyle.Link)
.setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
.setEmoji({ name: 'ShareBot', id: '1369599144221605979' }),
)
)
.addSeparatorComponents(
separator => separator,
)
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent(`-# ** *Last check: <t:${Math.floor(checkTime.getTime() / 1000)}:R>* **`),
);
}
@rose tangle check it
Iam sorry to ping
I wouldn't use a cdn.discord.com url in your code. Discord CDN links expire
Either store the image locally and share it as an attachment or post it to your own CDN
Error Media gallery is not function
I'm on mobile so it's hard to tell but it looks like your .addMediaGalleryCompoments() call is nested in your .addSectionComponente()
it is yes
if you want a thumbnail in your section you should use this:
SectionBuilder#setThumbnailAccessory() discord.js@14.21.0
Sets the accessory of this section to a thumbnail.
they already had yesterday a long issue about trying to add a thumbnail and a button accessory to the same section
they want to add a gallery now
😔 oh alr
how can i send @silent embed on discord.js v14.14.1 ! i tried content: @silent but it doesn't the bot just ended up by sending @silent with embed
@silent isn't what makes a message silent
the flag does
the @silent is just a way for humans to set the flag
after flag ?
v10: MessageFlags - SuppressNotifications
read more
thnx
pass that to flags: in the message options
and just in case, update your d.js
you pasted it on the wrong position, move it below the section
do i need to do any changes ? if i upgrade to latest sinch im on discord.js v14.14.1 rn
are you on TS or JS?
per semver, any v14 version is compatible with each other
ts
if it would be breaking, it wouldn't be v14 but v15
then yeah you might need some changes
mh
type changes aren't considered breaking, only runtimes are (since djs is a js library)
(by us)
not by semver
imma look
wait v15 released
no
it did not
where did you see that
v14.21.0 is the latest
lemme update
tipaka was making an example that if there was a (runtime) breaking change then it would be applied in a next major release, not v14, the current version
best practice is to update asap when new stuff is released and modify your code accordingly
eh
function createStatusEmbed(status, checkTime, MediaGalleryBuilder) {
return new ContainerBuilder()
.setAccentColor(0x000000) // لون أسود
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent(`## 📊 | ShareBot Status`),
)
.addSeparatorComponents(
separator => separator,
)
.addSectionComponents(
section => section
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent(`
- **ShareBot Assistant**
**Online :emoji_5:**`),
textDisplay => textDisplay
.setContent(`
- **ShareBot**
**${status}**`),
)
.setButtonAccessory(
button => button
.setStyle(ButtonStyle.Link)
.setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
.setEmoji({ name: 'ShareBot', id: '1369599144221605979' }),
)
.addMediaGalleryComponents(
mediaGallery => mediaGallery
.setItems(
mediaItem => mediaItem
.setURL(`https://cdn.discordapp.com/attachments/1362042671799074877/1400165069224022068/IMG-20250402-WA0005.jpg?ex=688c4d96&is=688afc16&hm=ad4517a4620cd0b815ab5039b4067d898aea0002b7c73c781dca262e6f207180&`)
)
)
)
.addSeparatorComponents(
separator => separator,
)
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent(`-# ** *Last check: <t:${Math.floor(checkTime.getTime() / 1000)}:R>* **`),
);
}
Now?
you're still calling it in the section
not in the container
you can't add a media gallery to the section
you add it to the container
.addSectionComponents(...)
.addMediaGalleryComponents(...)
.addSeparatorComponents(...)
you're doing this which is incorrect
.addSectionComponents((section) => section.addMediaGalleryComponents(...))
.addSeparatorComponents(...)
just updated to latest and mhmm
yeah command interaction doesn't have options, maybe you meant a chat input, which is the type for slash commands
I am confused and I can't think 😑
does that mean you understood?
No
what part specifically?
What does brackets have to do with it? I'm doing it right.
brackets mean a lot in javascript
I know but iam doing it right
if misplaced it can have a whole different meaning
you aren't, otherwise you would not receive errors
Media Gallery is a component, Section is a component -- those should not be added inside of one another
.addSectionComponents( // <<< opening bracket, start of data for section components
// everything that has relation to a section component goes here
) // <<< closing bracket, end of data for section components
.addMediaGalleryComponents( // <<< opening bracket, start of data for media gallery components
// everything that has relation to a media gallery component goes here
) // <<< closing bracket, end of data for media gallery components
Oh
I finally understood 😂😂
Sorry
brackets are also not the only thing different between the two snippets
🥳
New Error 🎉
thats common when developing, if you assume its normal to have working code instantly I have to tell you something..
but please share the error, as I have no info how to solve it now
any idea why
new ButtonBuilder()
...
.setEmoji({ name: "🔄" });
throws a
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[2].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
when sending it
why does this one emoji specifically doesn't get recognised
⏩, ⏪, ✋ and 🚮 work perfectly fine
i can't figure out how to send that damn emoji in a button
oh I thought .setItems() existed on the builder as well, my bad
only .addItems() exist, so change it to .addItems()
🙂?
could anyone tell me why my code keeps sending this error?
you are now using APIMessageComponentEmoji, but <ButtonBuilder>.setEmoji() accepts a string as well, meaning
.setEmoji("🔄")
should work for all emojis
alr i'll try that
couldn't find anywhere what the format is for the string option
What should I do 🙂?
read my message
parameter is of type ComponentEmojiResolvable, which is APIMessageComponentEmoji or string
nope still not :(
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[2].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji
for
.setEmoji("🔄️")
i think the emoji 🔄 is just bugged for some very odd reason
try .setEmoji("\u1f504") (the unicode equivalent of the emoji)
How can you detect rate limit when creating roles
did I say to remove it? try again: #djs-help-v14 message
I didn't understand what you meant
still not x)
- setItems(
+ addItems(
i guess discord just really doesn't like that one particular emoji ? really odd behaviour
okay then I have no idea sorry how some of the emojis don't work
Oh ok
Can I make a photo above button?
Sure. Reorder the components
yes! moving up the entire .addMediaGalleryComponents(...) part (including the stuff that's inside the brackets) above the .addSectionComponents(...)
the order of your code determines the order of the components displayed on discord
🙂
you did not move it up enough
Above the section, not inside it
the closing bracket of .addMediaGalleryComponents(...) must be on the line above the line where it says .addSectionComponents(
Is there another way to acknowledge button interactions without ButtonInteraction.reply()? I want to edit the original message that the button was a part of
ButtonInteraction#update() discord.js@14.21.0
Updates the original message of the component on which the interaction was received on.
// Remove the components from the message
interaction.update({
content: "A component interaction was received",
components: []
})
.then(console.log)
.catch(console.error);
it also acknowledges
thanks!
Jul 31 12:00:25 node[92261]: triggerUncaughtException(err, true /* fromPromise */);
Jul 31 12:00:25 node[92261]: ^
Jul 31 12:00:25 node[92261]: ConnectTimeoutError: Connect Timeout Error (attempted address: discord.com:443, timeout: 10000ms)
Jul 31 12:00:25 node[92261]: at onConnectTimeout (/opt//node_modules/undici/lib/core/connect.js:237:24)
Jul 31 12:00:25 node[92261]: at Immediate._onImmediate (/opt//node_modules/undici/lib/core/connect.js:206:11)
Jul 31 12:00:25 node[92261]: at process.processImmediate (node:internal/timers:476:21) {
Jul 31 12:00:25 node[92261]: code: 'UND_ERR_CONNECT_TIMEOUT'
Jul 31 12:00:25 node[92261]: }```
id assume this is part of it ?
Yes, it's a network issue
else if (interaction.isModalSubmit()) {
const customId = interaction.customId.split("_")[0];
const ticketCategory = interaction.customId.split("_").slice(1).join("_");
const ticketOption = ticketCategories.find(v => v.data.value == ticketCategory);
const activeTicketCategory = client.channels.cache.get(activeTicketCategoryId);
const closedTicketCategory = client.channels.cache.get(closedTicketCategoryId);
console.log(Object.fromEntries(interaction.fields.fields.map(v => [v.id, v.value])))
if (!ticketOption) return await interaction.reply({ content: "❌ | Böyle bir destek kategori bulunamadı!", flags: [MessageFlags.Ephemeral] });
if (!activeTicketCategory || activeTicketCategory.type !== ChannelType.GuildCategory) return await interaction.reply({ content: "❌ | Aktif destek talebi kategorisi bulunamadı, destek talebi açılamadı!" });
if (!closedTicketCategory || closedTicketCategory.type !== ChannelType.GuildCategory) return await interaction.reply({ content: "❌ | Kapalı destek talebi kategorisi bulunamadı, destek talebi açılamadı!" });
if (customId == "openTicket") {
// client.ticketManager.createTicket({
// category: ticketCategory,
// ticketCreator: interaction.user.id,
// questions:
// })
}
guys interaction.fields gives undefined. how can i solve?
How so? "gives undefined" is often confused with other errors
But if I had to guess it's because you've written interaction.fields.fields
.addSectionComponents(
section => section
.setButtonAccessory(
button => button
.setStyle(ButtonStyle.Link)
.setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
.setEmoji({ name: 'ShareBot', id: '1369599144221605979' }),
)
.setButtonAccessory(
button => button
.setStyle(ButtonStyle.Link)
.setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
.setEmoji({ name: 'loading', id: '1400602971028590713' })
.setDisabled(true),
),
);
Check this pls
@unique shoal sorry for ping
i tried both
How about not pinging instead of being sorry for it 
Both what?
Just i want it quickly 🙂
Too bad
i tried either*
Again, either of what. I don't know what you mean and you haven't explained the undefined thing.
Problem with this code
nevermind dude i solved
thanks!
your section doesn't have text displays, every section needs at least 1 and an accessory
and you can't have a section with two accessories, you were already told
so if you call setButtonAccessory twice, the last one will override the other one
if you want a line of buttons, use an action row
ContainerBuilder#addActionRowComponents() discord.js@14.21.0
Adds action row components to this container.
Interactive Components: Buttons - Building buttons
read more
I want line under last check
I don't understand
function createStatusEmbed(status, checkTime, MediaGalleryBuilder) {
return new ContainerBuilder()
.setAccentColor(0x000000) // لون أسود
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent(
`## 📊 | ShareBot Status
- **ShareBot Assistant**
**Online :emoji_5:**
- **ShareBot**
**${status}**
`),
)
.addSeparatorComponents(
separator => separator,
)
.addMediaGalleryComponents(
mediaGallery => mediaGallery
.addItems(
mediaItem => mediaItem
.setURL(`https://cdn.discordapp.com/attachments/1362042671799074877/1400165069224022068/IMG-20250402-WA0005.jpg?ex=688c4d96&is=688afc16&hm=ad4517a4620cd0b815ab5039b4067d898aea0002b7c73c781dca262e6f207180&`)
)
)
.addSectionComponents(
section => section
.addTextDisplayComponents(
textDisplay => textDisplay
.setContent(`-# ** *Last check: <t:${Math.floor(checkTime.getTime() / 1000)}:R>* **`),
)
.setButtonAccessory(
button => button
.setStyle(ButtonStyle.Link)
.setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
.setEmoji({ name: 'ShareBot', id: '1369599144221605979' }),
),
);
}
yeah that shouldn't cause issues
or well, not at first glance
I know this so iam asking you if you have solve
the code you shared here is incorrect, it's missing a text display
this code here is correct, it has both a text display and an accessory
they're different
It's working bro 🙂
Oh yes it's not working
yeah, and I explained the issue and what you need to do
Container is very complicated
😑
you just need to figure what each component needs
media galleries need at least one item, sections need one accessory and 1-5 text displays
You can add disabled button if this will solve it
no, that won't solve it
No solution 😦
@lofty topaz
it is not, starting a discord bot project requires some basic JS knowledge and is anything but recommended for absolute JS beginners
#rules rule 3
Yeah this doesnt strike me as a lack of JS knowledge honestly, there are lots of little details you need to know about how each component type works
However, Amgelo has very patiently explained those details, so now there's not much else we can do
oh imo everything seems pretty clear with just the docs and guide if you have a basic understanding of js, but that might be just me then 
const collector = selectMessage.createMessageComponentCollector({
filter: i =>
i.customId === 'selectCustomVC' && i.user.id === interaction.user.id,
time: Time.Minute,
max: 1
});
collector.on('collect', async selectInteraction => {
if (!selectInteraction.isStringSelectMenu()) {
return;
}
await selectInteraction.deferUpdate();
const selectedCustomVCId = selectInteraction.values[0];
const selectedCustomVC = sortedCustomVCDocs.find(
vc => vc.id === selectedCustomVCId
);
if (!selectedCustomVC) {
return selectInteraction.editReply({
embeds: [],
components: []
});
}
await selectInteraction.editReply({
embeds: [],
components: []
});
});
Is this correct way to do it, defer then editReply?
If you need time to perform an action that will take more than 3 seconds, yes
Otherwise you could just update directly
hello how is it called when you have commands like this
/balance add
/balance view
/balance reset
subcommands
Slash Commands: Advanced command creation - Subcommands
read more
if i do const modalInteraction = await interaction.awaitModalSubmit({})
how can i try catch it but i need to know if error in catch is like timeout (it didnt collect anything)
Thats like the only reason it can throw iirc
Assuming you pass a time
is there a way to change the ui to be more compact?
like how it would look on mobile
No
Do slash command stringOptions allow for multi select when providing choices? or is that only for selectMenus
Only select menus
aight
yes but how can I know a error reason is time
is there something like instanceof,
so I can log actual error that's not related to collector and edit message saying that select menu is expired yk IF IT's expired
No, we dont used typed errors like that
They dont really exist in JS/TS
Hi, ContainerComponent is up to 50 components but how does it work ? like they have weight like you can have a row of five buttons but a selector will take 5 places
The total limit is 40 components. A selector should just a single component but it has to be inside of an action row, so that's 2 right there...still fewer than 6 (for a full action row of buttons)
wait that means you can have 20 selectors in a container
that sounds terrible 
guys how to reset the selection on select menu?
Edit the message
message is not temporary. im making a ticket bot and message is open ticket message
That’s the only way to programmatically do it
Other way is to restart the discord app
why it says TypeError: role.setColors is not a function
role = interaction.guild.roles.cache.get(roleId);
await role.setColors({ primaryColor: rolecolor });
The error is correct
Role.setColors doesn’t exist in v14
is the documentation in the future then? https://discord.js.org/docs/packages/discord.js/main/Role:Class#setColors
That’s the main/dev version
ill have to wait for release then?
I mean, you can use the dev version. Just have to mind the breaking changes it has
Or hope that feature gets back ported
ill just wait then
hey how much customization are you able to set for your bot's rich presence?
ClientUser#setPresence() discord.js@14.21.0
Sets the full presence of the client user.
// Set the client user's presence
client.user.setPresence({ activities: [{ name: 'with discord.js' }], status: 'idle' });
You can check the properties here
This an UI issue right, no way to make it looks like its on pc?
There's basically nothing you can do about Discord rendering assuming you wrote the code properly
If each one of those is a Section with TextDisplay and ButtonAccessory, you've done all you can
I guess best i can do is complain on the dev server?
Yeah
how?
What did the Discord app show?
It says the application is not responding
Could be slow internet
You only get 3 seconds upon receiving the event to reply or defer
And what to do now, I have to give up slash commands and go to text commands?
Might be possible that ur running multiple instances of the bot, but you usually see a reply/defer alongside the error in console
No idea, there's only one running
You checked task manager?
Try killing the bot and then run the command to see if you get the same result
I killed the process and the bot shut down
you could contact your host about why your network is so slow
I am running the bot on my computer and also tried it on vm oracle. Same thing
maybe you had the two instances running back then?
I've run it more than 30 times, and carefully checked that only one copy of the bot was running :\
If I tried to run two copies of the bot, I would get an error. Because I don't use sharding
can you format your code correctly and then share it? the indentation looks wrong in that image
client.on("ready", async() => {
log("Бот запущен", "info");
if (!state_core_load) {
log("/&core&/ Ядро было отключено", "warn");
client.user.setPresence({
status: "dnd"
});
};
const commands = [
new SlashCommandBuilder()
.setName("test")
.setDescription("Проверка отклика бота")
.toJSON()
];
const rest = new REST({ version: "10" }).setToken(config.token);
try {
await rest.put(
Routes.applicationCommands(client.user.id),
{ body: commands }
);
log("Команда /ping зарегистрирована", "info");
} catch (err) {
log("Ошибка регистрации команды /ping: " + err.stack, "error");
}
client.on("interactionCreate", async interaction => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === "test") {
try {
await interaction.deferReply(); // чтобы Discord не считал интеракцию просроченной
const latency = Date.now() - interaction.createdTimestamp;
console.log(interaction);
await interaction.editReply(`Pong! Задержка: ${latency}мс`);
} catch (err) {
console.error("Ошибка при ответе на interaction:", err);
}
}
});
});
yeah that should work
kinda unusual to have the interaction listener inside the ready event but it shouldn't cause issues
yo, weird question
is there a way to get djs working on react?
why?
do you want to execute a bot in a browser?
wellll, react server
can you be more specific on how that works?
lol, you can't integrate or run discord.js directly in react you have to write an API layer between the bot and the web server
i dont really know, thats why im asking if that possible?
damn now i have to run 3 services :(
you don't know how the environment you're trying to setup works?
¯_(ツ)_/¯
well i do.. still trying to get used to react
- Djs
- React
- backend api
I'm not really sure what's supposed to be your environment where you want to setup djs though
backend is based off of py so djs wont work
react isn't a runtime, it's a library
yeah just relized that :p
is there a version of djs that has a py lib? (i bet not)
yeah, djs is only for js
if you want to use py, use dpy
dpy dosent have components v2 (or i dont think so)
no idea ¯_(ツ)_/¯
if you have a node env you can run djs there
otherwise nope, can't run it in a browser
bots shouldn't really run there either way
they're stateful, persistent applications
not something more ephemeral like a browser tab
you'd also need to share your credentials to the client
If this is critical to you, feet in hand and edit the library adding support for v2 





in general it's just not possible/worth it to run a bot in a browser
not if u try 😭
try to make it worth it?
lol
we still don't know what you actually want to build and where it'd be ran, that'd be a start
i think its possible, itll just be limited
limited to what?
what it can do
to what, not what you meant


this is how djs bots work, it's just an inherent characteristic of them
the client.. (browser)
please take general comments outside this chat
^^
but like, what would it be limited to, what would be the actual limitations you mean
if you can share what you want to build it'd be useful, maybe we can give some alternatives
Ok, This bro wants to integrate discord.js into React library but it can't be done because it's not designed for frontend, and his backend is in python, so he decided to ask for discord.js if it can be integrated because python libraries don't keep Discord API functions up to date.
not looking to build a bot in the browser, but it'll be interesting to see.
yeah, we know all that already
brower hosted bot 
the main problems are persistence and credential sharing
though with djs it's just plain impossible for now
it uses a lot of node apis
I assume that we will have to make an API for the bot to interact with the backend, otherwise it's just not realizable. Unless of course this bro has time to write his own library using discord gateway api and rest api from discord xD
but if you don't use djs but your own implementation or whatever, these would be (imo) the biggest problems
which are independent of the library you use
hmm..
at most an actual application would be one that lets you input your code and token and start a bot in the browser, no idea why you wouldn't just install node though
Write your own discord bots library for the browser, what's the problem? ))))))
true, true. Ur acctually making me think at 2 am 😭
you can come back later once you have a more solid idea about what you want to build, if it's still in a browser env you'll know it's not possible with djs but maybe we can give alternatives
yeah ill think about it, thanks for the ideas
@lusty current
Use to hata for the python
Keep this channel on topic of help for djs please
I don't think this is off-topic because the person was asking for djs and apparently didn't know it was for JavaScript and not Python
And they've been told before. So yes, it is off-topic now
How was I supposed to know he'd been told that before? 
Scroll up? You were part of this conversation for long enough to know that. And nothing you said in here today was on-topic tbh. Use #archive-offtopic for off-topic conversations
Can you give me a hint? Is there an alternative way to use slash commands somehow, because apparently I have network requests to discord send more than 3000ms.
Please don't reply to unrelated messages. Is your network connection that bad that it takes more than 3s? Can you log the interaction, interaction.createdTimestamp and Date.now() in your interactionCreate event first thing?
Please do what Qjuh suggested above. We need to see two timestamps. Interaction.createdTimestamp and the current timestamp for Date.now()
and @outer plume

Okay, so you do send the deferReply pretty fast (and judging by the screenshot in the background of your first one it even works as you want it to, no error). The complete run taking 5s indicates a very bad network connection between you and discord though. Where do you host that bot code?
I'm running a bot on my computer right now.
It is very strange that there is such a delay, because the ping to discord is 139ms.
How did you measure that?
If you mean your latency variable: for that to be accurate your local clock would have to be in perfect sync with discord's clock
Using the discord.js library code client.ws.ping, and also pinged like this (screen 1)
Well, the other option is that your PC itself is really slow or there's something else running on that node process clogging the event loop
If you know a program like btop. Here the computer is clearly not loaded to the point of being so slow
That doesn't say anything about your node process though. Since NodeJS is single-threaded if there's something else clogging the event loop then your await calls might have to wait for longer than the actual network request
Still the internet... “My internet gigachad is playing with me” xD, I have +5000ms to upload and 6ms to download.
Sounds like common asynchronous speed
searching through the discord, i am under the impression that global slash command registration is instant but i just did it (bot is in 27 servers) and i pressed ctrl + r and the commands are not here, if i set a guild ID tho, its instant
Global command registration is, indeed, instant.
You either lack perms to see them or your registration failed.
oh
im ratelimited 😭
hello where is the description used in case of subcommands?
Hey, maybe this has changed, but in StringSelectMenuBuilder I can't use .setMaxValues(4) .setMinValues(1), so I can't select more than one option.
The main command's description isn't shown in that case.
-# Discord not uploaded my image
alright thanks
why is it even required in the api then smh
because subcommands are not required?
every command needs a description, sub command or not
just like every option needs a description
mb. I had to go somewhere
anyway. Question.
What is setId for on a TextInputBuilder? It's not the customId, I know that. But then what is it for?
For you to identify specific components
was setId not there before ComponentsV2 came out?
Correct.
no wonder. alr thanku
what are the character limits for containers?
It's per message. I believe 4,000 characters
what am i doing wrong
container.addSectionComponents(new SectionBuilder().addTextDisplayComponents(new TextDisplayBuilder().setContent(text))).addActionRowComponents(row);
I cant add an action row to a section?
No you can't. You can only add a thumbnail or button
ButtonBuilder discord.js@14.21.0
Represents a button builder.
That's the wrong thing ...
So i cant do something like
text
[button1, button2]
separator
text
[button1, button2]
Well you can. But the buttons will have to be under the text, rather than on the right side
how would i do that. i did button accessory at first and it put it on the right side
ContainerBuilder#addActionRowComponents() discord.js@14.21.0
Adds action row components to this container.
found it
would i need a gateway connection for a user installable only bot?
I cant add a button accessory to component without a text display?
if you need to listen to gateway events, then yes
A section is 1-3 text displays with one accessory (button or thumbnail)
If you don't want text, use an action row instead...
If you don't want an accessory, add the text directly to the container
whats max actionrows i can do a component?
Not all members are cached
You'd have to await guild.members.fetch(); to fetch all members beforehand
can a discord bot have a server tag
No
members are not sent on ready, they're sent and cached when relevant events are received
no
k thanks
know anyone the big int of Manage Permissions i not find it in PermissionFlagsBits
manage permissions is Manage Roles
ah wow ok sorry my bad
i have a problem with calculating the total users
With Sharding
Before Shharding:
documentation suggestion for @lofty topaz:
SectionBuilder#setButtonAccessory() discord.js@14.21.0
Sets the accessory of this section to a button.
You should check the docs to make sure the function you're using actually exists
and please don't ping for support, there are more people to help than just us, and your problem doesn't require any context for you to require our specific help
the error is already self explanatory, you should learn how to read errors and find fixes, your fix would be to search the actual methods in a SectionBuilder
I'm not sure how you've come up with this problem though, you already created a section correctly before
just copy your own code from before
Copilot moment probably
Could just be some guilds having an outage
anyone know how to get a slash command in an embed like this
Can you count up unavailable guilds?
what is the solution ?
documentation suggestion for @last mountain:
API Reference - Message Formatting
read more
Thank you
You can’t do anything if there’s a guild outage upon startup. You’ll only know that bot is still in the guild
</command:COMMANDID>
Guild#available discord.js@14.21.0
Whether the guild is available to access. If it is not available, it indicates a server outage
anyone know when a bot get to show commands like this?
When it's verified and discord has enough usage statistics of public commands of it. Then it's automatically added to the profile
so all i need is to let as much as people use my bot?
hey, can I use message.content.includes in a switch statement? for example
swtich (message.content.includes()) {
case "string1":
case "string2":
}```
That is not how JavaScript switch statements work, irrespective of if it's with <Message>.content or any other string
yeah that's what I figured
probably could use an object and for (let key in object)
followed by an if statement
I'm not sure what object iteration has to do with checking whether message content includes something
Can someone help please, i tried to create a bot with basic commands(restart,stop,mute) and it's show me The application did not respond when i use slash command.
my index.js
const { Client, GatewayIntentBits } = require('discord.js'); // Updated for v14+
const fs = require('fs');
const path = require('path');
const config = require('./config.json');
const registerCommands = require('./register-commands.js');
// Initialize the bot client with necessary intents
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates
]
});
// Initialize client.commands as a Map
client.commands = new Map();
// Register commands once the bot is ready
client.once('ready', () => {
console.log('Bot is online!');
registerCommands(client); // Register the commands
});
// Command handling with timeout
const { promisify } = require('util');
const timeout = promisify(setTimeout);
client.on('messageCreate', async (message) => {
if (message.author.bot) return;
if (!message.content.startsWith(config.prefix)) return;
const args = message.content.slice(config.prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
try {
const command = client.commands.get(commandName);
if (command) {
await Promise.race([
command.execute(message, args, client),
timeout(5000).then(() => { message.reply('Команда не отвечает.'); }) // Timeout after 5 seconds
]);
} else {
message.reply('Команда не найдена.');
}
} catch (error) {
console.error(`Error executing the ${commandName} command:`, error);
message.reply('Произошла ошибка при выполнении команды.');
}
});
// Log actions to the chat and log file
function logAction(user1, action, user2, channel) {
const logMessage = `${new Date().toLocaleString()} - ${user1.tag} ${action} ${user2.tag} из канала ${channel.name}`;
try {
// Log the message in the file
fs.appendFileSync(config.voiceLogFile, logMessage + '\n');
// Log the message to the specified log channel in Discord
client.channels.cache.get(config.logChannel).send(logMessage);
// Optional: Log to console for debugging purposes
console.log(logMessage);
} catch (error) {
console.error('Error logging action:', error);
client.channels.cache.get(config.logChannel).send('Произошла ошибка при логировании действия.');
}
}
// Voice state update (logging and actions)
client.on('voiceStateUpdate', (oldState, newState) => {
try {
if (oldState.channel && !newState.channel) {
// User disconnected from a voice channel
logAction(newState.member, 'вышел из', oldState.channel);
} else if (!oldState.channel && newState.channel) {
// User joined a voice channel
logAction(newState.member, 'вошел в', newState.channel);
}
} catch (error) {
console.error('Error during voice state update:', error);
}
});
// Bot login using token
client.login(config.token);
You’re using the messageCreate event to try and respond to slash commands? You need an interactionCreate for slash commands
i see.. thanks ❤️
You also don’t seem to ever load any commands either
it's my first time and i use chatgpt for help.. so i'm pretty new.
i have js files with commands in different folder
that my structure for now
You should follow the guide imo, ai can for sure help but it’ll also get lost eventually
i see, i will try then the guide ❤️ appreciate the help
How would you go about handling HTTPError: Service Unavailable
I see no viable option to be honest so im curious if anyone does
that's one kind of error you just can't do anything about
if cf/discord are unavailable, you can't tell them to stop being such
catch it, log it, drop it
Error: Expected token to be set for this request, but none was present
"discord.js": "^14.21.0",
await channel.send({ embeds: [embed] }).catch(e => {
console.error(`err: ${e}`)
});
that's what's written in package.json
what's actually installed?
npm ls discord.js to check
is it possiable to change a response from ephemeral to not
no
ok ty
work sections without and TextDisplay?
Those are words that sort of form a question but if I think what you're trying to ask is "Can Sections work without a TextDisplay" the answer is no
could anyone tell me why this is returning undefined
const thread = message.channel.threads.cache.get(
wordle[i].threadId
);```
the variable it's reading is a valid thread id
The thread isn’t cached
I'm trying to cache it, how do I do that correctly?
using the id
Fetch it
ThreadManager#fetch() discord.js@14.21.0
Obtains a thread from Discord, or the channel cache if it's already available.
// Fetch a thread by its id
channel.threads.fetch('831955138126104859')
.then(channel => console.log(channel.name))
.catch(console.error);
all channels are always cached with the Guilds intent, except threads and dms
got it ty
😭
TypeError: Cannot read properties of undefined (reading 'add')```
```javascript
thread.members.add(message.interactionMetadata.user.id);```
that suggests thread is not actually a thread channel
if it's the result of .fetch(), did you await it?
like the example suggests, it's a Promise
that's a good idea
wait what exactly do I await
the fetch()
as a rule of thumb, every djs .fetch() returns a Promise
because it'll do an api call if it's not in cache
in contrast, cache gets are in-memory, it returns directly, no need for an await
okay that worked, but it didn't actually add me to the thread
show your code
for (let i = 0; i < wordle.length; i++) {
console.log(i);
console.log(wordle[i])
console.log(wordle[i].threadId)
if (wordle[i].number != shareContent.substring(7, 11)) continue;
const thread = await message.channel.threads.fetch(
wordle[i].threadId
);
console.log(thread);
thread.members.add(message.interactionMetadata.user.id);
console.log(
`Added ${message.interactionMetadata.user.username} to thread`
);
break outer1;
}```
the logs are for debugging
well, you aren't awaiting that .add
I'm pretty new to async sorry
no worries
in essence, all methods that do api calls return Promises, which need to be awaited or .then()'ed, otherwise it'll just proceed to the next line regardless of the actual result of the method call
await thread.members.add(message.interactionMetadata.user.id);``` still didn't add me
Resources to understand Promise:
- MDN: learn more
- Guide: learn more
- JavaScript info: learn more
did it log your "Added ... to the thread"?
yes
that suggests it did work correctly then... are you sure you're checking the correct thread?
if it didn't then it would've thrown
or maybe you have a try catch that ignores errors instead of logging?
though then it shouldn't have logged that line, nvm, it sounds you're just checking the wrong thread
okay it worked correctly, the autoarchive duration had already passed though so it didn't ping me when it added me
thanks for the help ❤️
How make so the option on the role select menus update
since i going from ping role menu to staff roles but the embed has the old selected options in it from old menu
Anyone help me please how to make like this interface message with like / messages send
Popular Topics: Display Components
Opting into using this system by passing the IsComponentsV2 comes with a set of caveats:
read more
@deft flower
idk why but messsage by my bot doesn't renderes like other bot, the embed by bot comes but the invite embed doesn't render:
https://sourceb.in/mAm6VJH47h
how can i prevent cache reset? I need to fetch all of my members but they get reset every hour. I don't wanna fetch them at every 20 min.
Cache doesn’t clear itself unless you have added sweep options or are clearing the cache yourself
i haven't added any sweep options
the fetched guild members getting reset every hour
could it be that the process running your bot is restarting frequently?
i dont think so. there are default sweepers that reset fetched cache at every specified time
i tried to change the default sweepers but it didn't work
sweepers: {
...Options.DefaultSweeperSettings,
users: {
interval: 3_600,
filter: (user) => !user.id,
},
},
does anyone know if a member flag always stays? for example for the member flag didrejoin, i tried it on a very old member that rejoined years ago but they didnt have that flag
not sure if member flag didrejoin is maybe new so thats why?
?
lol. don't do that. you are abusing the fact that the markdown parser gives up after an amount of nested quotes
that may be eventually fixed and is (as you already noticed here) often used by spammers and scammers and accordingly blocked
Okay. How did you find out that the cache is being reset every out?
I'm not exactly sure what the intended behavior is. Can you explain a bit better pls.
Maybe a before and after of what you want it to work like
Ohkay. Then why did it worked in the well known bot sapphire?
My intention is just to have a clean good looking embed. Basically I don't want to show invite link outside of embed but have the rendered invite embed by discord.
if you value "good looking" over "abusing parsers and looking like a scammer/spammer" you may want to re-evaluate your priorities
basically, i have a command that checks all the guild member for a treatment. (btw the guild has over 100k members). Bcz of the cache reset the command only sees a couple of thousand members. And when i try to stop the bot and restart again, the problem's being solved for 1 hour
In the first image, I fill in the ping roles I want, and then the message updates. However, the select menu doesn’t refresh, so I can’t choose a staff roles that i used before.
if you want the role select menu to only show some roles, not all, I'm afraid that's not possible. If you want that behaviour, rather use a string menu, and add options to it. the labels could be the role names and the values could be the role IDs. You won't get a Role object from this, but roles are cached (if you have the correct intents) so you can just get them from cache using the selected role IDs
^
i select the roles for ping but when next menu come which is staff roles i cant select the same roles
Try this. when you call interaction.update, for the select menu components, use the setDefaultRoles() method and don't pass anything in it. If this doesn't work, we'll try to figure something else out
RoleSelectMenuBuilder#setDefaultRoles() builders@1.11.2
Sets default roles for this auto populated select menu.
this what i have
yes, I read the code above
?
read this
.setDefaultRoles(true) ?
no, just .setDefaultRoles()
Nope didnt remove selected roles from old menu
can u show code pls
case "add": {
let uuid = bot.utils.MakeID(25);
con.query(`INSERT INTO tickets (guildId, channelId, uuid) VALUES (?, ?, ?)`, [interaction.guild.id, interaction.channel.id, uuid], function (e) {
interaction.update({
content: 'Select a channel:',
components: [
new bot.discord.ActionRowBuilder().addComponents(
new bot.discord.ChannelSelectMenuBuilder()
.setCustomId(`Tickets-AddChannel-${uuid}`)
.setPlaceholder('Select a channel')
.setMinValues(0)
.setMaxValues(1)
)
],
ephemeral: true
});
});
break;
}```
So after Channel is selected it goes to the staff roles menu then to ping roles menu
lemmi try too. someone else might help you out in the time I get back 
ok if want i can dm you the snipet of the code
hmmm. i dunno actually. i've seen a bot or two do it so it's definitely possible.
{
type: 6,
custom_id: 'select',
placeholder: 'Select a role...',
max_values: 3,
default_values: []
}
even though default values is empty, it's using them.
yeah thats why i am confused
And yeah, clicking that X and clearing the selection doesn't make it work either
it only works when I go to a different channel and come back
yeah i wait till djs people can see whats wrong
Yes bro
What wrong in this?
const username = interaction.options.getUser('username');
const type = interaction.options.getString('type');
const expiredDate = interaction.options.getString('expiration');
const reason = interaction.options.getString('reason')
It was causing error of undefined.
.addUserOption((option) =>
option
.setName('username')
.setDescription('Staff User')
.setRequired(true)
)
.addStringOption((option) =>
option
.setName('type')
.setDescription('Type of Infraction')
.setRequired(true)
.setChoices(
{ name: 'Warning', value: 'warning' },
{ name: 'Strike', value: 'strike' },
{ name: 'Demotion', value: 'demote' },
{ name: 'Termination', value: 'terminate' }
)
)
.addStringOption((option) =>
option
.setName('reason')
.setDescription('Reason of Infraction')
.setRequired(true)
)
.addStringOption((option) =>
option
.setName('expiration')
.setDescription('Optional - Date of Expiration. Ex: 2m, 2d, 2w, 2y.')
),
Could you paste the full error with stacktrace? Which value particularly is undefined
node:events:496
throw er; // Unhandled 'error' event
^
TypeError: Cannot read properties of undefined (reading 'getString')
at Object.run (D:\OrderNova1\src\commands\General\promotion.js:43:38)
at Client.<anonymous> (D:\OrderNova1\node_modules\commandkit\dist\index.js:643:67)
at Client.emit (node:events:518:28)
at InteractionCreateAction.handle (D:\OrderNova1\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
at module.exports [as INTERACTION_CREATE] (D:\OrderNova1\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (D:\OrderNova1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
at WebSocketManager.<anonymous> (D:\OrderNova1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:235:12)
at WebSocketManager.emit (D:\OrderNova1\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.<anonymous> (D:\OrderNova1\node_modules\@discordjs\ws\dist\index.js:1190:51)
at WebSocketShard.emit (D:\OrderNova1\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:92:21)
Node.js v22.14.0
[nodemon] app crashed - waiting for file changes before starting...
Use console log to see what the interaction object returns. As of now it looks like the option property does not exist
It returned
undefined
The order of function parameters must match between definition and function call.
function execute(client, interaction) { ... };
execute(interaction, client);
- mismatch! you pass an interaction where the client is expected
- mismatch! you pass the client where an interaction is expected
check the fuction as it sound like a parameters mismatch
tried
node:events:496
throw er; // Unhandled 'error' event
^
TypeError: Cannot read properties of undefined (reading 'options')
at Object.run (D:\OrderNova1\src\commands\General\promotion.js:42:29)
at Client.<anonymous> (D:\OrderNova1\node_modules\commandkit\dist\index.js:643:67)
at Client.emit (node:events:518:28)
at InteractionCreateAction.handle (D:\OrderNova1\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
at module.exports [as INTERACTION_CREATE] (D:\OrderNova1\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (D:\OrderNova1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
at WebSocketManager.<anonymous> (D:\OrderNova1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:235:12)
at WebSocketManager.emit (D:\OrderNova1\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.<anonymous> (D:\OrderNova1\node_modules\@discordjs\ws\dist\index.js:1190:51)
at WebSocketShard.emit (D:\OrderNova1\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:92:21)
Node.js v22.14.0
[nodemon] app crashed - waiting for file changes before starting...
probably not it cause it unable to get interaction's properties.
Your interaction is undefined meaning it is not passed at the call of the function
please share your command handler
thats problem, its a package.
If your are using a package for your command handler this is not d.js problem
MessageFlags#SuppressNotifications discord.js@14.21.0
This message will not trigger push and desktop notifications
fixed. i forgot to read guide sorry 💀
ActionRowBuilder discord.js@14.21.0
Represents an action row builder.
Message#interaction discord.js@14.21.0
[DEPRECATED] Use interactionMetadata instead.
@umbral jetty please use #app-commands for personal use
Hey
Is a bot able to read the « about me » section of a user?
nop. Discord doesn't expose that information to bots.
guys Channel#setParent is removed?
use channel#edit({parent: CategoryChannelResolvable })
Ooh, thanks!
how would i check when a member joins if they joined by an invite?
You can't reliably know that
doesn't every member join through an invite? 
discovery
oh okay yh i didnt find anything for it
ah, true
I figured they meant an invite tracker
yh that
Discord does not provide the invite that a member used to join through the bot API.
- Tracking the uses of invites through the
inviteCreateandguildMemberAddevents is unreliable and we recommend against it. - Discord has not shared any plans to make the members tab available for bots.
is there a way to get how much boosts a member spent, or should i check in guildmember update event (newMember.guild.premiumSubscriptionCount - oldMember.guild.premiumSubscriptionCount)
There's no update if they boost multiple times. Your best bet is to have the boost system message enabled and listen for that
mmh alright thanks. the guild.premiumSubscriptionCount isnt adjusted immediately on a boost?
Should be, but it doesn't tell you who boosted
Discord does not encourage (and in some cases doesn't even allow) incentive behavior like you've been asking about
because this showed 0 for me
i have it inside a guildmemberupdate event
A) there's no GMU emitted for second and more boosts
B) there's no guarantee which order you get events in
Is there any way I could ExportToJSON some data then bring it into a embed?
if I have an InteractionResponse object that I then pass to a child function via a parameter, will that child function still be able to run InteractionResponse.reply() on that parameter?
What would cause shard death?
How to handle GIFs and animated images ?? @napi-rs/canvas doest fully support managing gifs!
You mean like a code block?
Idk
Are you trying to visually show the data as raw text inside an embeds field
I want to have a command where I run /buyer-add and then it adds their data to a json/db file.
Then I can access it with /buyer-view and delete it /buyer-delete.
I believe the best route here is to learn json and object structuring, or learn how to use another storage format/external db. I think this will make life easier
both Embed and EmbedBuilder have a toJSON method
ah, I think I misunderstood, you don't want the embed as json
Isn’t Embed deprecated?
well just build the embed from the data then
no? why would it be
Embed is the class for embeds received from the api
EmbedBuilder lets you build embeds so you can send them to the api
prolly cuz components v2
can I set allowedMentions in deferReply or editReply? Or does it not matter because an edited message wouldn't ping either way?
i think you can, but the latter applies
that didn't or won't deprecate embeds though
or not in the foreseeable future
ye ik, but its an understandable connection to make
I think they specifically meant the Embed class though, given they were talking about using the builder with no issues
possible
is it possibel to defere reply and then show a modal? otherwise what could be a solution?
no
only solution is to show to modal within the 3 seconds after the interaction was created
how can i only register user-install commands? i already have global application commands but only issue is user-installed commands idk how to register those
user installed commands are global already, since its either global or guild— and guild doesn’t exist in a user installed app
i mean guild then i already have guild application commands
you set its context and integration type
but not user i have my bot authorized but i cant run the commands
btw for registering commands i use a for-loop to go by every guild ID to register since it wasnt working before
SlashCommandBuilder#setContexts() discord.js@14.21.0
Sets the contexts of this command.
SlashCommandBuilder#setIntegrationTypes() discord.js@14.21.0
Sets the integration types of this command.
i think i got it now
If you’re setting a command in every guild, why not use the global command scope?
can I use specific djs version/PR something to have access to gradient color roles
i found this in package.json of some old bot as djs version https://github.com/discordjs/discord.js/tarball/cbd7f2b9aa44a9240947ed716d0e72257ac499f7
so i was wondering if something like that is possible for gradient color roles
it wasnt working
i was doing it and it wasnt registering anything, but for a specific guild id it did so it was a lil bit of a workaround idk it still doesnt work btw :/
you may need to restart your client if it doesn't show up
but you shouldn't register a command to every guild as a workaround
Yes, you can install and use the dev version. There should be instructions available online on how to install a specific branch
i do that every time
Is there id value as number or bigint instead of string?
your discord desktop client?
..yes
either alt + f4 and restart from taskbar or ctrl + r
console.log the result of the rest call
could anyone tell me why the second if statement isn't running?
for (let i = 0; i < triggers.length; i++) {
if (triggers[i][0].test(message.content)) message.reply(triggers[i][1]);
}
if (triggers[3][0].test(message.content)) {```
```javascript
let triggers = [
[/^ping/gi, "pong"],
[/i+ *l+(o+v+e+|u+v+) *(y+o+)*u/gi, "i love you too"],
[/\bi *l *y/gi, "ily2"],
[/\bpa+ti+\b/gi, "mrow"],
],```
don't mind the regex hell
Because it doesnt match the message content?
except it does
Dunno what else to tell you, this doesnt seem djs related
wait you're right
super sorry
all good
Is there any further information?
No
any idea why this is giving me NaN? It was working previously
const totalMembers = client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0);
look into what you're adding
ah i see ok i think i was adding undefined lol
thanks
you think? or did you actually check
yeah after i added guild.memberCount || 0 it works correctly now
i'd instead actually check why is memberCount not a number
since you're just hastily patching something that shouldn't happen in the first place
Unavailable guilds?
yeah true bandaid patch i'll have to look into it further
Can I do an ephemeral deferReply, with possible errors after, and finally reply non-ephemerally?
you cannot change ephemerality state after deffering
your editReply will ignore what you pass and follow what you set for the defer
Ah, I thought followUp would allow changing it.
you can followUp freely though after you provide reply for the defer
it does
Not "changing" it
but if you followup without actually ever editing the defer, it gets treated as editing the defer
Its entirely separate, it wont change it if its responding to the defer
Hmm, I posted a followUp after no errors occurred (so no editReply), but it is ephemeral.
did you set it as such?
Is it a new followUp, or was it after the defer
did you ever editReply the defer?
No, the command is successful, so I don't do editReply, but the final followUp is still ephemeral
That does not answer the question
so your final followup has no business being a follwup
because you never told the user the interaction was successful
deferReply -> followUp will edit the deferral, and since ephemeral state cant be changed, will not be able to change it
you deferred the interacion, telling user tha tyou need more time to actually respond
and then never respond
So... my next option would be...?
editReply first
then followup
Okay, I think I was close to that, I just did deleteReply instead
Alright, that seems to work. Though, the followUp doesn't have the usual blue clicky thingy
because followup isn't a response to a command
it's a followup to the previous response
and it's indicated as such
Fair. So no way to make it a nice, clean command when I need defer?
you using a command and me replying to your command doesn't make me use the command as well
no, there isn't
this is best you get
also, note that if you dismiss the ephemeral, the followup points to nothing
and it does so always for everyone else (since they never see the ephemeral)
Yeah, I noticed. Well, that's unfortunate. But I'm sure it'll be improved in the future.
hm? there's nothing to improve here
it's been like that for years
if you don't want to use followups, just send a message to the channel
note that this means that your app will require its bot account to be in the server and have permissions to do so
Yeah, it can totally send messages (it's my bot and is only in 1 server.)
It's just unfortunate that it's not possible to deferReply and have the blue command clicky thing, that's what I meant by "it could be improved"
you cannot suddenly appear a message out of nowhere
nor can you suddenly disappear it from existence
that's what you'd want with editing ephemeral state of a message
I mean, that would be sweet, hm?
no, it would be quite bad
I mean, I know what you mean (user thinks it's private)
User thinks his input is private (ephemeral) and then the bot decides to make it public, isn't that what you mean by bad?
I guess it depends on the command/content
that too, but also a myriad of other issues in both directions
anyway, this is getting offtopic
👍 Thanks for your help, appreciate it!
Is there an integrated way of turning a djs User into an APIUser ?
Because toJSON() only returns an object without functions but still the djs named properties...
No
@discordjs/structures will allow that though
well, yes, but I need to turn the djs fields into "raw" fields.
And the djs object can't be used in the constructor...
I guess I have to do that manually.
как заставить бота подавлять уведомления для своих собственных встраиваний?
Hi, I have a text display component in a container, and I'm wondering how I can fetch the content from it, similarly to how we would use interaction.message.embeds for regular embeds
Please ignore if it sounds like a stupid question, I've only started using Components v2 in the past few weeks :)
interaction.message.components is the array of components you sent
which includes containers
though they aren't builders anymore, they're just data, so they don't have setX methods
Okay, I was just trying to pull the data from them anyways
anything for this
What's the use case here?
And it shows the new placeholder but has the old values still selected? Or what's the issue?
shows the new placeholder yeah but has the old values still selected
That sounds like a discord bug then, I'd report that on the discord-api-docs repository, see ddevs server in #useful-servers
as you can see there
should i set sharding to be auto or manually set, what's better
First, ask yourself whether you even need sharding bc an awful lot of the time people come here with sharding questions not needing it at all
How many guilds is your bot in?
i am just keeping a very simple sharding system in place, reason being is that the coming days are gonna be busy for me and won't have time to maintain the bot.
Sharding doesn't help with that
i have a bot keep saying
❌ Error registering slash commands: DiscordAPIError[50001]: Missing Access
at handleErrors (D:\Projects\last-town\node_modules@discordjs\rest\dist\index.js:748:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (D:\Projects\last-town\node_modules@discordjs\rest\dist\index.js:1149:23)
at async SequentialHandler.queueRequest (D:\Projects\last-town\node_modules@discordjs\rest\dist\index.js:980:14)
at async _REST.request (D:\Projects\last-town\node_modules@discordjs\rest\dist\index.js:1293:22)
at async Client.<anonymous> (D:\Projects\last-town\index.js:60:9) {
requestBody: { files: undefined, json: [ [Object], [Object] ] },
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1401493380156096512/guilds/1197141507409444894/commands'
}
how to solve it?
sounds like your bot is not on that server or is missing the applications.commands scope somehow
are both IDs correct and does the token match that client?
yeah everything is alright and even i have applications.commands and admin perms and correct client id and everything
then that error wouldn't appear 
its not that funny and i have 2 folders same files and i copied the file and with the same codes and everything and applications.commands the 1st folder is working in a host the other iam trying it to work in visual studio code and not working
if all the files would be the exact same, then this wouldn't happen
either the files aren't the same, or you're running something else
I'm building a user-websocket for my bot and dashboard and want to respond with APIUser[]
However, I just realized that I maybe don't even need that much info.
The primary use case of my WS is getting something called MentionUser - a stripped down version of a User, with just the username, global_name, avatar, and id.
The other WS endpoint (for getting whole users) isn't used currently, since I have a REST API Route on the dashboard where I can pass anything to either search a member, or fetch it directly with the ID (with caching).
so if you login from your host it works, but if you login from VSC it doesn't?
Good morning, I'm trying to use captcha canvas, but I get an error message that I can't install it. Anyone else having this problem?
that's not a d.js question
What would cause a shard to die for seemingly no reason? Common issues?
Lost internet connection for too long
Too many guilds on that shard
You can add debug event logs to see if it’s ended by d.js
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
client
.on("debug", console.log)
.on("warn", console.log)
- Note: if you initialize your Client as
botor other identifiers you need to use these instead ofclient - If the output is too long to post consider using a bin instead: gist | sourceb.in | hastebin
when using fetch (for channel and users) it automatically first check if it's cached before fetching for both?
Also can’t forget unhandled promise rejection
Yes
By default
hmm. It always seems to happen during the same loop
[02:55 UTC] [S4] user (server) - Attempting to create BFV Weapons canvas.
[02:58 UTC] [SHARDING] Shard 2: death
[02:58 UTC] [SHARDING] Shard 4: reconnecting
[02:58 UTC] [S4] user (server) - Successfully posted Battlefield V Weapons image for user "user".
- A function on shard 4 is being run. This should have sent "Successfully posted..." basically instantly after, but something fucks up.
- Shard 2 dies and shard 4 reconnects three minutes after
- Also three minutes after, the success message that should have happened right after the first log happens.
Looks like network issues to me, right?
I'll add the debug and warn to see if there's anything there
hi, how can I get a list of who is subscribed to an event, the condition is that there can be more than 1000 people at the event
const guildEvent = await interaction.guild.scheduledEvents.fetch('1401518571984654446').catch(() => null);
if (guildEvent) {
const subscribedUsers = await guildEvent.fetchSubscribers({ limit: 1000 }).catch(() => []);
console.log(guildEvent)
console.log(subscribedUsers);
console.log(subscribedUsers.some(u => u.id === interaction.user.id));
}```
thanks to those who will help
The limit is 100, not 1000. Read up on this https://discord.com/channels/222078108977594368/1202608431685566464 to fetch more than 100 at once
and how to get more than 100?
Read the forum post I just linked
how does rhythm put buttons in embeds?
#announcements cv2
because they aren’t embeds
^^
Popular Topics: Display Components
read more
oh thats insane cheers
im trying to usee a custom rest proxy like
import { REST } from '@discordjs/rest';
import { proxyRequests } from '@discordjs/proxy';
import express from 'express';
import { TOKEN } from 'core/config';
import { Log } from 'utils/log';
const app = express();
const port = 3000;
const rest = new REST().setToken(TOKEN);
app.use((req, res, next) => {
Log(`Received: ${req.method} ${req.url}`);
next();
});
app.use('/', proxyRequests(rest));
app.listen(port, () => {
Log(`Rest listening on port ${port}`);
});```
and inside client rest
```ts
rest: {
api: 'http://localhost:3000/api',
},```
but im getting the error
```Decompression error: ZlibError
[2025-08-03 12:00:34] Uncaught Exception: Error: ZlibError fetching "http://localhost:3000/api/v10/gateway/bot". For more information, pass `verbose: true` in the second argument to fetch()```
how should I fix/avoid it??
(sorry if its obvious, im kinda new to this api stuff)
have u tried passing verbose: true in the second argument to fetch()
how exactly?
Is there a way my bot could watch peoples display names and if they violate what word I don’t want in names can it then change that persons display name?
iirc there's an AutoMod setting for that
Where?
bump
I think you can access this through the api, but you have to find out yourself using the d.js and discord docs as I am not to sure
-# Image is from server settings > safety setup > AutoMod
Can you run .createMessageComponentCollector() on an InteractionResponse to a ButtonInteraction?
e.g.
const captchaMessage = await interaction.reply(captchaDisplayOpts);
where interaction is a ButtonInteraction
and then
const collector = captchaMessage.createMessageComponentCollector({ ... });
because every time I print captchaMessage.id it's always different from the ID i manually copy from the sent message
basically, I want to spawn an ephemeral message with action rows, when a user presses a button
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/14.17.3/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
Then create the collector on that message
It's still showing the type of the returned value to be InteractionResponse
Did you read the tag I sent?
It tells you how to extract the message
but it's returning an InteractionResponse, which doesn't have the resource attribute
should I just run interaction.fetchReply() to fetch the message?
Use
<InteractionCallbackResponse>.resource.messageto get the message
Oh, it’s a type issue
yeah, it's only returning a message if i I run interaction.fetchReply() after I send the reply
Use satisfies instead of typing it
you'd need to type it as InteractionReplyOptions & { withResponse: true }