#djs-help-v14
78874 messages · Page 64 of 79
this isn't a job board
Can a separator be used inside the section?
No
A section is just for displaying up to 3 text displays next to an accessory
ok thanks
what’s the default spacing size used in a separator 3?
at handleErrors (D:\Data\Coding\Repositories\airmalpi-occ\node_modules\@discordjs\rest\dist\index.js:762:13)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
at async SequentialHandler.runRequest (D:\Data\Coding\Repositories\airmalpi-occ\node_modules\@discordjs\rest\dist\index.js:1163:23)
at async SequentialHandler.queueRequest (D:\Data\Coding\Repositories\airmalpi-occ\node_modules\@discordjs\rest\dist\index.js:994:14)
at async _REST.request (D:\Data\Coding\Repositories\airmalpi-occ\node_modules\@discordjs\rest\dist\index.js:1307:22)
at async GuildMemberManager.edit (D:\Data\Coding\Repositories\airmalpi-occ\node_modules\discord.js\src\managers\GuildMemberManager.js:428:15)
at async Object.execute (file:///D:/Data/Coding/Repositories/airmalpi-occ/commands/admin/gp.js:111:17)
at async Module.execute (file:///D:/Data/Coding/Repositories/airmalpi-occ/events/interactionCreate.js:12:13) {
requestBody: { files: undefined, json: { nick: '| FlySnivy' } },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PATCH',
url: 'https://discord.com/api/v10/guilds/1157019563066671154/members/468117897697427466'
}```
Missing permissions? The bot is administrator and the role is above all roles. Can somebody give me an hint on how to solve this?
- Bots cannot moderate (kick/ban/nickname/...) a target with a higher or equally high highest role or the guild owner.
- Bots cannot modify (edit/add/remove) roles that are higher or equally high compared to the bot's highest role.
- The
Administratorpermission does not skip these checks.
i needddd helpppp
I assume you're the owner of that guild
my api latency is 100ms but db is literally 5000+, what can be wrong? its supabase backend
That doesn't sound djs related. #1081585952654360687 for db issues
Can someone help me with a site where i can learn js fast and free?
More likely bots js
not djs related #1081585952654360687
Can someone recommend me a site where i can make my own website and run it for free?
No we can't
🗿
how to check if interaction.member is a GuildMember?
i tried this
interaction.member instanceof GuildMember```
but my IDE is complaining
It's a GuildMember if the interaction is received from a cached guild, so you'd want <Interaction>.inCachedGuild()
when would that be false?
If you don't have the Guilds intent, in guilds where the app was installed without the bot scope, and dms
ok, thx
heya i have a question that might seem stupid:
``await interaction.followUp({ content: '<@&1271383474326212699>', embeds: [embed], components: [component] });`
but this does not notify people with said role,
even though i see the role getting mentioned,
is there a logical reason for?
or is it a bug?
tag suggestion for @stark adder:
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"] } }
by default, interactions only include "users"
ah okay,
seems like something that wasn't needed in the past (12 and/or 13),
TY will look into it
in giveaway systems, do we need a realtime listener to db?
what would be the right way to define a type for slash command builder return type?
Right now i have
export interface SlashCommand {
command: SlashCommandBuilder;
run(interaction: ChatInputCommandInteraction): Promise<void>;
}
but it doesn't serve me well
Learn more about select menu limits at the Discord Developer Documentation
What are you looking for. The code you have would be right for a slash command
i have a questionnnnn, how do big bots handle giveaways? like they pool after every 10s to check for active gwys and draws the winner? isnt it is very heavy load?
How many select menus can my message have? I currently have one for selecting a staff role which works but the second one for a specific channels just failed silently: "The Application did not respond". I use multiple action rows
Please use #app-commands or the hide option for personal use of commands
sorry
in a case when i have a slash command with subcommands, it doesn't match
someone gonna reply me
Would be nice to get an answer :)
I don't think it's too heavy, also this isn't a djs question
sorry, but can you just confirm that if its the way others do it or most common or possible way?
I don't quite understand, are both menus in the same or different messages?
Same message
like we have to check after every x seconds or have a realtime listener?
then what's erroring? if they're both in the same message it's not possible for one to show up and the second to error due to too many action rows
if that happened then none would show at all
It shows up, but when i select something it failes silently
you can have a union of SubcommandsOnly and OptionsOnly or make it be the return type of #build() and just call build on all your commands
"have to" no, there's a lot of approaches you can do
you don't have to adhere to a specific one
well here's how i typed it:
export type botCommand<T extends SlashCommandBuilder | SlashCommandSubcommandBuilder> = {
data: T;
dev?: boolean;
highRank?: boolean;
execute(interaction: ChatInputCommandInteraction, ...args: any[]): Promise<void>;
autocomplete?(interaction: AutocompleteInteraction): Promise<void>;
};
i mean the best and common one. is it?
then it sounds like it's something on your collector or listener for that select menu, also djs doesn't fail silently, if you're ignoring errors somewhere, you should log them at least, that way you'll know what's wrong
damn, so there gotta be or (|)
export const chatInput: ChatInputCommand = async (ctx) => {
await ctx.interaction.deferReply({ flags: MessageFlags.Ephemeral });
const setupEmbed = new EmbedBuilder()
.setColor(Colors.Green)
.setTitle('Ticket Setup')
.setDescription(
'Hier richtest du das Ticket-System ein.\n*Nur 15 Minuten gültig.*'
);
await ctx.interaction.editReply({
embeds: [setupEmbed],
components: [(
<ActionRow>
<RoleSelectMenu
placeholder="Support-Rolle auswählen"
onSelect={onRoleSelect}
/>
</ActionRow>
),
(<ActionRow>
<ChannelSelectMenu
placeholder="Choose a channel"
onSelect={onChannelSelect}
/>
</ActionRow>),
(<ActionRow>
<Button onClick={onFinish}>
Setup abschließen
</Button>
</ActionRow>)
]
});
};
It doesnt even call the function
most common one probably, "best" isn't objective, there's advantages and tradeoffs with every implementation
ok thanks
that kind of components aren't from djs at all
they aren´t?
I used commandkit.js i thought the components were from djs
check your imports and you'll see they're not coming from djs
well it's from command kit then
djs doesn't have that react-like syntax for components
How would i do it in djs? Could you be able to provide me please?
only builders for sending, like the EmbedBuilder you did there
could you?
guide suggestion for @limpid matrix:
Sending select menus
To send your select menu, create an action row and add the buttons as components. Then, send the row in the components property of InteractionReplyOptions (extends BaseMessageOptions). You can also send action rows inside containers or between other components, when using the display components system.
djs has building and replying in separate parts
gpt will do the job ig
that's why you don't do new SlashCommandBuilder().setExecute() or something like that
I sent you the guide though?
yeah too lazy to read that
right, try not to ask for help if you don't want it anyways
How do you expect us to help you if you're "too lazy" to read the resources?
I thought it was from djs chill out
Thought what was from djs?
You didnt read the whole chat did you?
Since .setLabel is deprecated, what's the new way of doing labels for text input builders? I can see there's a LabelBuilder class but I'm not sure how to use it
Maybe I'll have ChatGPT read it for me
chill out
setLabel is not deprecated. see labelbuilder
Nevermind, the guide has a section covering it
you have to use inside a label
Technically it's not deprecated but will be, so might as well make the move
but i see you already have the guide so i guess you good to go?
Yeah. The changes seem fairly simple so I should be good
im converting my bot from eris.js to discord.js
in eris i had to .acknowlege() an interaction if it takes some time to respond, do I have to do the same in discord.js?
yes, that's a dapi thing, not dependent on the library
in djs you'd defer
Deferred responses
As previously mentioned, Discord requires an acknowledgement from your bot within three seconds that the interaction was received. Otherwise, Discord considers the interaction to have failed and the token becomes invalid. But what if you have a command that performs a task which takes longer than three seconds before being able to reply? If you have a command that performs longer tasks, be sure to call deferReply() as early as possible. FAQ.
Hi, I'm currently working on a ticket system for my private Discord bot, and I was wondering if it's possible to prevent the ticket creator from mentioning roles in the ticket channel.
I've already tried disabling the MentionEveryone permission, but that doesn't seem to work. Even with it disabled in the channel permissions, the ticket creator can still ping roles and users. Any idea what's going on?
GuildTextThreadCreateOptions#invitable discord.js@14.25.1
Whether non-moderators can add other non-moderators to the thread Can only be set when type will be ChannelType.PrivateThread
Do you mean this? That they can't add users by mentioning the role? Because there's a difference between being able to ping them or add them to a thread
Oh no I'm not working with threads. I'm using regular text channels for the tickets. We've had issues in the past where users would just spam @ mentions after creating a ticket, which is pretty annoying. I was wondering if there's a way to prevent that?
Sure, that would be the permission you mentioned already. Are you sure you denied it and there's no other overwrite that allows it again?
Yes
Permission gets disabled just fine
Yet I can still mention roles and users (this is from the ticket creator's POV)
You can't really deny them being able to mention users. You can moderate them when they do that though
Oh
Are the roles set to be able to be mentioned by everyone maybe?
Yeah everyone can mention those roles, and that's fine in other channels. I just don't want them to be able to mention roles specifically in the ticket channels. I'm guessing that's not possible?
Nope. But you can make your bot timeout anyone that does so they can't spam it
And ofc also setup automod mention-spam
Ah that sucks. Oh well, I'll find a different way I guess
Appreciate the help!
Maybe I'm missing something but won't the ticket channels only include the creator and the relevant staff members, so it doesn't matter if they can ping other people. Or do you also want to prevent them from pinging the staff?
I want to prevent them from pinging anyone, but role mentions are the bigger concern. We have a "role timeout" system where a role becomes unmentionable for a certain duration after it's mentioned, to prevent spam. If users start pinging those roles in ticket channels, the role would become unmentionable, which could stop others from mentioning it when it’s actually needed. It’s a moderator role meant for emergencies, so that could be a problem.
I was hoping to solve that problem by disabling the ability to ping the moderator role in ticket channels, but I guess I’ll just make it so the role doesn’t become unmentionable if it’s mentioned in a ticket channel haha
You shouldn't change the role based on something a user does. Change that user instead
Yeah I know, but the system has worked fine for a long time now. The timeout isn’t even that long, it’s only 10 minutes
But it sounds easily abusable. If I can prevent other users from reporting me by doing more stuff that's spammy
It's a bit hard to explain if you're not actually part of the community. We have our own way of reporting people. The mod role usually only gets pinged if there's a hacker or someone breaking the rules excessively in-game. It's a Discord for a FiveM server
Is there a way to track who moved channels or roles?
Hi, how do I fetch messages in a channel before a specific timestamp? I found the MessageManager Class but the FetchMessagesOptions interface expects a message ID for the before attribute.
youd just filter after fetching
no they dont produce audit logs
documentation suggestion for @celest coral:
API Reference - Snowflakes
Discord utilizes Twitter's snowflake format for uniquely identifiable descriptors (IDs). These IDs are guaranteed to be unique across all of Discord, except in some unique scenarios in which child objects share their parent's ID. Because Snowflake IDs are up to 64 bits in size (e.g. a uint64), they are always returned as strings in the HTTP API to prevent integer overflows in some languages. See Gateway ETF/JSON for more information regarding Gateway encoding.
snowflakes(message Ids) have a timestamp built in their structure
So if there is a troll that is moving channels, there is no way to track down? bots and normal?
Yep, but I surely cannot put a generated snowflake in the after field right? I guess you're suggesting the same as BakeWithMe. In that case i can just use createdTimestamp on the already fetched messages
If there is a troll you probably shouldn't give them permission to move channels, would be my take
nope no way to know who did it
if your trying to fetch messages before or after a time I dont see why generating a fake snowflake would not work. ultimately it is just a string
Ill try it then. I was guessing it would just produce an error because the reference message does not exist.
how would you extract the timestamp from the snowflake?
thanks
Can cv2 support multiple images in one media thingy? If so has anyone got an example of how it looks?
Media Gallery can have 1 to 10 media gallery items
Cheers
the first line works for getting a fields "lable" or question right
and the second one gets the user answer
or wait both of those are the same arnt they
anyone know how to get the lable of a field then?
they would both return the same value. What do you want the label component values?
you would have that info via knowing the modal the interaction came form
my code sets a random question for each modal, so i want to know which question was so i can evalualte the answer properly. i could just pass it through client and stuff if theres no way but i just wanted to know if there was a eaiser way\
best way to deal with that is to encode it into the custom id
ok thanks
or you can find in the interaction.fields.fields
no? That does not contain information form the label component
Uh yh my bad last time i did this i thought i saw it in there. setting it inside customid is the way to go then
is there an update with guildmemberadd event ?
about what?
are you having a specific issue?
ig it's not trigger for all members that join the guild
is there any update for this event last month or nothing change
there's no breaking changes by djs without a major bump
at most maybe you could expect a few breaking changes from the api every once on a while but there hasn't been one for that event in particular
you should either always receive it or not at all if you don't have the intent
maybe it could break if you mess with the guilds cache
idk i will check more
oh i find it
guild.fetchVanityData() take too much time to respone it may take 30m
why is that ?
You probably hit a rate limit
did the rate limit change ? cause i'm use it when ever someone join to check if he join from the vanity url or normal url
Not sure. Discord can change rate limits at any time
You can make use of ClientOptions.rest.rejectOnRatelimit and make it error if the wait time is too long
link to dec ?
RESTOptions#rejectOnRateLimit discord.js@14.25.1
Determines how rate limiting and pre-emptive throttling should be handled. When an array of strings, each element is treated as a prefix for the request route (e.g. /channels to match any route starting with /channels such as /channels/:id/messages) for which to throw RateLimitErrors. All other request routes will be queued normally
Default value: null
new Client({ rest: { rejectOnRateLimit: … }, … });
thank u
Why would you fetch on every join instead of checking the cached data? It's updated as long as you have the guilds intent, which you should since you're listening for members joining
I keep on getting rate limits for my bot, i think it is based on channel permissions... but i don't have any clue how to fix it..
url: 'https://discord.com/api/v10/channels/--------------/permissions/--------------',
route: '/channels/:id/permissions/:id',```
My bot is growing faster than my knowledge 🤣
No body got any clue :(
Well it's really hard to help with just that information. You'll need to show the code that's causing the rate limit or give some more details.
pretty much the only advise for ratelimits are to do less requests either way
is it possible to make text input components with autocomplete?
you could share what feature you're building though, maybe there's a way that does less requests
it isn't
oh ok 🙁
does component v2 work in dm?
yes, why wouldnt it
if (!interaction.guild) {
if (interaction.isRepliable()) {
return interaction.reply({
flags: MessageFlags.Ephemeral,
components: [
new ContainerBuilder().addTextDisplayComponents(
new TextDisplayBuilder().setContent("> I can’t run this command outside a server")
),
],
});
}
}
Flags should be an array and include the IsComponentsV2 flag
oh lol my bad i forgot about it
you can also use SlashCommandBuilder#setContexts to control where a command can be used
I don’t want to allow anyone to use any commands in dm
then you want to set the contexts of the command to
SlashCommandBuilder.setContexts(InteractionContextType.Guild)
this will prevent the command from being used in BotDMs
What are ratelimits for /applications/{application.id}/guilds/{guild.id}/commands?
tag suggestion for @vagrant rampart:
Ratelimits are dynamically assigned by the API based on current load and may change at any point.
- The scale from okay to API-spam is sliding and depends heavily on the action you are taking
- Rainbow roles, clock and counter channels, and DM'ing advertisements to all members are all examples of things that are not okay
thanks
Should I check bot permissions per channel or at the guild level? I’m constantly hitting missing permission errors
depends on what you are trying to do?
When I only check guild permissions, private channels still cause missing permission errors and checking both guild and channel permissions has ruined my mind
generally speaking, you should check the channel if you are sending a message
ok
does anyone know why I have /test in place even though it's not in the source code? only /link, /stats
you probably register it as a guild command and didnt refresh on startup or vice versa
flags doesn't need to be an array
const username = i.fields.getTextInputValue('username');
const files = i.fields.getUploadedFiles('files', true).toJSON();
const response = new ContainerBuilder()
.setAccentColor(0x0099ff)
.addTextDisplayComponents(textDisplay => textDisplay.setContent(`Username: ${username}`))
.addSeparatorComponents(separator => separator)
.addFileComponents(files.map(f => new FileBuilder().setURL(f.url)));
await i.reply({
components: [response],
files,
flags: MessageFlags.IsComponentsV2
});
Whats wrong with this?
files builder is for local files. you have to add attachement://
Files in embeds should be attached via the message option object and referenced in the embed:
const attachment = new AttachmentBuilder('./image.png', { name: 'image1.png' });
const embed = new EmbedBuilder()
.setTitle('Attachments')
.setImage(`attachment://${attachment.name}`);
channel.send({
embeds: [embed],
files: [attachment]
});
Also attachment is for attachments to your message which you need to re-upload. You can't just attach the ephemeral attachment from the modal
Q1: To implement DAVE (e2ee) on discord.js/voice, do I only have to install @snazzah/davey: ^0.1.6 ?
Q2: where can I see if there are any breaking changes from v0.16.0 to v0.19.0 of DJs/voice ? I know that with djs there are usually migration steps on the wiki/documentation page
there are generally no breaking changes on a minor version
I'd just check the release notes of each release since it's not that many
I think in semver you can do breaking changes in v0 without bumping major
not sure if djs completely adheres with that though
More specifically, when the major is 0, any changes in the "minor" place is considered a breaking change
all of the above, but just to confirm, there weren't any breaking changes to any interfaces between those versions
it's mainly just been bug fixes, DAVE, and further encryption lib support
Perfect, thanks!
can subcommandgroups not have options?
that is correct, they can only have subcommands
they're not meant to have options, that is what subcommands are for
I mean for the sub commands under subcommandgroups
im not sure i understand what you're asking
Subcommands in subcommand groups can have options
😬 time for debugging
whats the difference between setValue() and setPlaceholder() for TextInputBuilder?
use setValue() to provide an existing or default value you want the user to see and potentially edit (e.g., a user's current name on a profile update form), and use setPlaceholder() for user guidance in an otherwise blank field (e.g., "Enter your email address").
If I only have a setPlaceholder, would the value of that field be blank if the user didn't edit it?
Yes.
thank you
Mhm
hey one question, I've been trying to register my slash commands on my bot
🔄 Deploying commands...
URL: https://discord.com/api/v10/applications/1418440834931490888/commands
Commands: 28
Payload size: 12261 bytes
Sending request (60s timeout)...
(node:22440) Warning: Accessing non-existent property 'getBuildingLevel' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:22440) Warning: Accessing non-existent property 'getConstructionSpeedBonus' of module exports inside circular dependency
Response received!
Status: 429 Too Many Requests
Rate Limit Scope: shared
Rate Limit Remaining: 0
Rate Limit Reset After: 34.082s
Rate limited! Waiting 36s before retry...```
but I just keep getting 429 status, whenever I try to do it on another bot it actually works fine
The error says what it is. 429 too many requests. You've been rate limited
yeah, Ik its just I want to know like an eta
it's been like this for hours, like 5 hours I suppose
Ratelimits are dynamically assigned by the API based on current load and may change at any point.
- The scale from okay to API-spam is sliding and depends heavily on the action you are taking
- Rainbow roles, clock and counter channels, and DM'ing advertisements to all members are all examples of things that are not okay
I believe the command registration end point and once you've been rate limited it is for 24 hours. However, Discord does not publicly disclose rate limits
oh, tysm for that info
Best way todo this?
best way to do what exactly?
to update the orginal message
"Best" is subjective. does your code work?
atm yes but looking to compact more of the code
that looks pretty compact to me
did the issue of the menu not resetting get fixed
what issue?
like the data when moving from one role menu to next one use to keep the data
Does anyone know how to disable the default kick and ban command from the server?
If i implement my own commands into my discord bot and submit the command, discord uses the default kick or ban command from Clyde
not possible
also not really a d.js question
im not sure im following.
How to move member between voice channels
Okay thanks for the fast answer 🙏
documentation suggestion for @undone glade:
VoiceState#setChannel() discord.js@14.25.1
Moves the member to a different channel, or disconnects them from the one they're in.
ty
Hi,
I'm trying to remove role "A" and add role "B" but instead bot removes role "A" and then add roles "B" and "A"
console.log("To remove:", toRemove); //["A's id"]
console.log("To add", toAdd); //["B's id"]
if (toRemove.length > 0) {
await targetMember.roles.remove(toRemove, reason);
}
if (toAdd.length > 0) {
await targetMember.roles.add(toAdd, reason);
}
are you sure your roles are correctly assigned in toRemove and toAdd?
should I fetch targetMember's roles before adding or smth?
I'm sure
no you would get an error if something was wrong
To remove: [ '966135859583795230' ]
To add [ '995881716923240449' ]
there is only 1 role in To add list but my bot adds 2 roles
then it must be something outside that code snipping affecting it
maybe youre reassigning that variable somewhere?
this is the only place where roles are added
here's full logic
const desired = i.values.filter((id) => adminRoles.includes(id));
const currentAdminRoles = adminRoles.filter((id) =>
targetMember.roles.cache.has(id)
);
const toRemove = currentAdminRoles.filter(
(id) => !desired.includes(id)
);
const toAdd = desired.filter((id) => !currentAdminRoles.includes(id));
const reason = `Zmiana ról przez ${ctx.user.username}`;
console.log("To remove:", toRemove);
console.log("To add", toAdd);
if (toRemove.length > 0) {
await targetMember.roles.remove(toRemove, reason);
}
if (toAdd.length > 0) {
await targetMember.roles.add(toAdd, reason);
}
it's too simple to be broken :/
set the array instead of the variable in the function. do you see the same outcome?
toRemove and toAdd are arrays, I'll change them to variables one sec
I am saying to put the value hard coded into the functions for testing
yeah i got it.
if (toRemove.length > 0) {
await targetMember.roles.remove("995881716923240449", reason);
}
if (toAdd.length > 0) {
await targetMember.roles.add("966135859583795230", reason);
}
^works fine but
if (toRemove.length > 0) {
await targetMember.roles.remove(["995881716923240449"], reason);
}
if (toAdd.length > 0) {
await targetMember.roles.add(["966135859583795230"], reason);
}
^produces same result
that just wouldnt make any sense, what djs version are you on?
ikr xd
14.25.1
how do you know bot added 2 roles? in audit log?
try this on a new member, audit logs can stack
i just removed and added random role to other member to prevent aduit logs from stacking. That's not the case here
same thing with different member
thats also a screenshot from a discord client it looks like? view it on native desktop app
and the member roles also show they got added 2 roles?
yup
that second added role is from toRemove array?
each array has only 1 role
one is "Moderator" and one is "Support" (or "admin org2")
only explanation is that you're modifying the roles again on somewhere else in your bot
it could be true if that produced same result in those 2 cases
but they didn't
so the hard coded example does not add 2 roles?
yup, but only when i use strings instead of arrays
It is possible a bug I am going to try and reproduce
I'm using outdated command handler called gcommands but I don't believe it's the culprit
I should have mentioned this at the beginning, but as I said, I don't think it matters.
I tried to downgrade d.js to 14.25.0 and 14.15.1 but the problem still occurs 
very weird, so the bug only occurs when youre adding a role by string and not in an array?
bug occurs when I'm adding and removing a role by ARRAY only
Ik it's very weird. I never had such issue (and I'm making bots since 2021). I may be just cursed or smth
Id recommend then to add and remove role through the discord api to see if its a bug with djs
You could also try with using a single set
I believe this might be a cache-related issue and the fact that there's separation here between the rest api and gateway, and awaiting only awaits the rest call
That said, unsure if it's actually the case, and if it's even applicable in this case
I also thought that it might be related to the cache, which is why I asked at the very beginning.
Users can have a lot of roles and i only want to edit a small part of it. I don't think using .set will be the best option here
for example
A
B
C
D
E
[...]
adminRoleA
adminRoleB
adminRoleC
I'm only interested in editing adminRoles
You can absolutely do it with set
Grab roles they have, filter out roles they need to lose, add roles they need to get, call set with that
One api call for both adding and removing
hmm I thought it would be really api intensive call for some reason
I guess I'll try that, thanks!
Discord just does like a member roles = what you passed in set
Which does mean that you have to keep any managed roles in the list, since you cannot remove them
oh I see, smarter every day
please can a good discord.js person dm me, I need help and it will take like 10 min so is too long for here please
@loud quartz can you?
do not ask around for dms, just ask your question
There's 50000 people here, not just me.
ok i will try
you seem better though
is this a problem with node
Doesn't mean others are incapable of helping
What even is that
wispbyte
Doesn't sound like it's d.js
proficient role is for djs devs?
No
is node part of d.js
oh... do you know what this is a problem from
No idea, and as this is not discord.js, this is not a channel for guessing what this is and what's the issue
ok i need help with another isuse
does this make any sense
I specified a customURL when creating the client for rest. But is it possible to use a different one for Channel Create, for example, i.e., only for a specific endpoint?
Looks like network issue on your host
Not really in the client itself
But you're free to point it to a proxy of your own where you can send anything anywhere
mhm okay
is this a djs issue
dude, d.js is just a library you use in your code
bro i got reccomended this server for this stuff i dont know im sorry
Did you write this code?
half, and other half from chatgp
but it worked before
Which part
all of it
The network part that has no relation to your code whatsoever, or the code that uses an undefined variable
it worked for 1 month then yesterday it break
what am I missing for this to detect all non user messages?
it works on most bot messages
just not ones from the same bot?
trying to prevent users from using bot commends in certain channels
message.system, but thats just system messages
also i think you dont have to add webhookid and applicationid i think they count as bots too
you probably ignore somewhere if user is client user
yeah nvm I am just dumb 😭 something elsewhere was causing the bot to ignore itself lmao
this is what happens when you work on someone else's bot </3
im not at home right now, anyone know if the file upload field in a modal follows the server's upload size limits?
it does
ty!
I feel like I'm missing something for creating message ContextMenus (relevant part of the guide attached). currently, I handle commands in a /commands directory, which contains folders (for organisation) which contain all of the command files. my command handling code is attached. all commands that I have created use a generic base type called Command, which all have the properties data, execute, aliases. I'm not sure how I'm supposed to push a context menu command to this setup
I need to create a context menu for reporting messages. I'd also like it to trigger a modal where the person reporting the message can provide a reason, which will then be sent to the mod channel in the server (so if there's anybody with thoughts on how to do that, I'd appreciate them)
alright I figured out creating the commands -- basically just had to do the same thing and deploy them in their own way
im backkk
im thinking of making a discord bot game where bot will ask random words including specific letters, answer under 10s
user reply with any english word valid word with that letters, how bot will know that is valid word?
using api will be slow? and no way people store whole english directory in bot code
I’m sure someone has done that
You can prob find some api online too
it will be slow, to send request and blah blah ( i hate this cd )
Maybe
Depends on how fast you need it
And reliably
well, its a game, no one gonna wait for bot to check it
Who said searching a text file would be faster tho?
I guess you could index it beforehand and make a special search algorithm to make it faster
huh? it will? becasue its in out bot directory
bruh my hosting platform bugging hard while saying 460k words
You would still have to read the entire file
i just created and tested, it was hella instant.
Ok
Are you just loading the entire file into memory?
my ai knows better
Ah, you just made a CGPT prompt
yes
` Is "${word}" a valid English word? Only respond with simple "yes" or "no". Do not add any additional explanation, reasoning, or gratuity to your response. `
no, chatgpt sucks, i use better ai
Ah, you use Gemini. Clever guy
nuh uh
Then you are lying
lol no
the one i use is kinda underrated, rarely people use it for bot dev
i have made literally a whole website + dashboard for my bot and discord bot with it
with ticket system / staff applications / staff stats/ suggestions / appeal system / games / custom commands / auto moderation / leveling / and other small feaues, like it have everything you ever saw in a discord bot
I wonder if you can code an entire Discord bot by delegating majority of logic to ai prompts and the code only checks the result of those prompts
he remembers my whole code
if hit limits, thats pain, i will have to start new chat and explain every shit of my code
stop guessing 😭
hi, i need a small help,
my bot have 5k servers and 1m users
but i only used 1 cluster and the shards are auto but it used 5 shards so some one can tell me which number i can use instead auto ? I'm not well knowledged about clusters stuff 
do role mentions work in ephemeral interactions?
initial testing seems to say that they do not
but I'm just checking
Yes
You likely have smth else going on if markdown isn’t being displayed normally
interesting
oh wait
just realized none of the markdown is working 😳
Maybe you have some escape markdown function?
It's possible I suppose. I am just getting back into this codebase, which is a bit old
but I don't really remember writing anything like that
Show code
export async function handlePrintLevelsInteraction(interaction: Command.ChatInputCommandInteraction, level: number) {
try {
const totalXp = totalXpFormula(level);
getLevelFromXp(totalXp);
const levelMappings = xpCache;
const levelsStringArr: string[] = [];
const promises: Promise<void>[] = [];
levelMappings.forEach((xp, level_) => {
promises.push(
new Promise<void>(async res => {
let levelRoles = await getLevelRolesByLevel(level_);
let gainedRoles = levelRoles.filter(role => role.gained).map(role => `<&@${role.roleId}>`).map(str => '+' + str);
let lostRoles = levelRoles.filter(role => !role.gained).map(role => `<&@${role.roleId}>`).map(str => '-' + str);
let allRoles = gainedRoles.concat(lostRoles);
let rolesString = allRoles.join(", ");
if (level_ <= level) levelsStringArr[level_] = (`**Lvl ${level_} - ${xp}**${rolesString.length > 0 ? '\n' : ''}${rolesString}\n`);
res();
})
)
});
await Promise.all(promises);
const levelsString = levelsStringArr.join('');
await interaction.editReply({content: levelsString });
} catch (error) {
throw error;
}
}
What’s wrong w/ 5 shards?
oh wait, I forgot to mention I'm using a framework. I'm using Sapphire, which is where the Command class comes from
The role mention is backwards in the code
Doesn’t match what you showed
oh don't mind that, that was just me gaslighting myself
as a possible fix being I had it backwards
can someone send docs link of guild tags
Also the exclamation marks was from the lostRoles line, but I changed it before copying that snippet
like how to fetch a server guild tag
anyway honestly this is probably actually maybe a Sapphire.Js question, so I'll ask there instead. Thanks for the time and attention to this matter o7
guild.vanityURLUses ?
it's return null
It's not documented by discord
then how do i do
i want to give users role if they have equiped guild tag of current server
then you will need to loop over the users and check User#primaryGuild#identityGuildId
User#primaryGuild discord.js@14.25.1
The primary guild of the user
Prob easier to make them run a cmd to receive it
pain for 'em
Does adding guild tag trigger user update event?
Yes*
*but sometimes no
our user update is extracted from discord's guild member update
Yea
So for uncached members we have no way to know it was user that was updated and not member
Just requires the user to be cached
It should be controlled by partials tbh
Although yes, that reasoning makes sense
Partials would be the exact same, but more often
False positive vs false negative
Yeah, it's our own doing for end user convenience
Can still have both the event and command as fallback for his case
like my bot is frequently getting rate limited
Ratelimited while doing what
Shards doesn’t help w/ rate limit issues
We can try to help you optimize your code to not hit rate limits
but we tried to fix our code like yeah somuch problems have to been fixed
a guy told me that
like add multiple clusters
Rate limits are based on your bot's token/account, so having more clients/clusters doesn't help at all with that
The only way to "fix" being rate limited is to fix your code so that it doesn't spam the API
or add cd handler cuz interactions might trigger ratelimits when invoked too frequently as well
it doesnt help at all, in fact more clusters = more shards that can spawn = more potential bot clients = ratelimiting almost instantly when something happens
so the only thing you can do is to slow down user from interacting to prevent request overflow
Each interaction is its own webhook having separate rate limits from each other and other API Endpoints
so there is no use with that? it can optimize right?
Is it possible to send a webhook in a thread?
Yes, with the threadId parameter
it only optimise performance of your app, nothing else
Webhook#send() discord.js@14.25.1
Sends a message with this webhook.
// Send a basic message
webhook.send('hello!')
.then(message => console.log(`Sent message: ${message.content}`))
.catch(console.error);
yeah which could be a good numbers?
how much cluster and shard
djs doesn't have clusters
if you're using an external package you should ask them
how do i make commands work in dms (sorry im new to djs and js)
slash or legacy
documentation suggestion for @thorn sphinx:
SlashCommandBuilder#setContexts() discord.js@14.25.1
Sets the contexts of this command.
slash
oh ty
is there a way to use a api's .mp3 extention as a audio inside a container?
like for example, im trying to create a word definition finder, i want this: https://api.dictionaryapi.dev/media/pronunciations/en/catholic-us.mp3 to be inside the container as an audio
you can use the File component to display it, but it won't have a player
how do i set an image inside a container builder?
documentation suggestion for @turbid flame:
ContainerBuilder#addMediaGalleryComponents() discord.js@14.25.1
Adds media gallery components to this container.
or do you want a thumbnail?
thumbnail
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.
ContainerBuilder#addSectionComponents() discord.js@14.25.1
Adds section components to this container.
so add a section compontent to the container builder to use the thumbnail?
Yes, Note: sections need at least 1 text display
can the text display be empty?
prob gonna do a tias moment lol
I have this flow currently:
Context Interaction -> Send ephemeral defer -> editReply with action row -> button triggers modal
the part I am stuck on is when I receive the ModalSubmitInteraction. I need to update the ephemeral reply that was attached to the button, and I know you need to call .update on the button, but I don't seem to see a way to do that using ModalSubmitInteraction. Suggestions?
sure but IDK why you would want that the formatting would look strange
documentation suggestion for @uncut lark:
ModalSubmitInteraction#update() discord.js@14.25.1
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);
modal submit has update and defer update
weird... https://img.sticks.ovh/KtqGzRlLc
check you djs version
I am on latest
Believe it also has editReply, which also works.
editReply threw an error for me: "Unknown Message"
Update only exists if it's a component interaction that triggered the modal
edit reply is not a response to the interaction
it does in this case, it's button. Is there a type guard I'm missing?
ModalSubmitInteraction#isMessageComponent() discord.js@14.25.1
Indicates whether this interaction is a MessageComponentInteraction
wait that might be wrong, ya that is wrong
ModalSubmitInteraction#isFromMessage() discord.js@14.25.1
Whether this is from a MessageComponentInteraction.
that should be the right check
Hello, I'm wondering how to tell if a user has a Guild Tag or not, and especially how to find out a precise one.
documentation suggestion for @brave iris:
User#primaryGuild discord.js@14.25.1
The primary guild of the user
Thank you, I had taken a completely different approach.😂
adding status roles in a all in one bot is a bad choice?
how you design your bot in not up to us
wdym with status roles? if you mean adding/removing roles quickly that gonna cause for ratelimits yes
giving/removing status roles means when a user changes its status
Discord already shows user status
No need to also do that with roles
...
people do this to give a "supporter role" which is then used for extra perks
alr im gonna remove that shi, also the guild tag one
yh thats not how discord wants you to use their api. its a bad design choice since discord already shows status
So that's not really "status"
is this not the right way to get a message that comes from button/modal trigger? This seems to return empty for me.. interaction.message?.fetchReference(); with a typeguard if (!interaction.isFromMessage()) return;
But just arbitrary requirement for arbitrary role for arbitrary reason
supporter role for something like going online? that doesnt make sense to me
for having a specific text in their status
Message from button is just interaction.message.
oh yh nvm confused for online presence
like discord.gg/their-server-link so more peopel see that server or maybe join
a lot of bots do that already, i dont see a big problem in that
its heavy
youre just gonna add a role if they have something in their status. thats nothing heavy
a lot of bots that does it arent all in one bots and the all in one bots just dont do it
bot will have to check thousand of srvers and million of users status continously, realtime
This is a context command, .message returns the orgianl message content from the bot. I'm looking to get the user's message
you will receive the events through the presenceupdate i assume. your bot isnt fetching all these statuses
so, context -> hidden reply -> button -> modal
^
we want the message from this step
i dont think so
About what part
events one, like isnt it like we fetch it?
No, it's not
documentation suggestion for @tiny blade:
(event) Client#presenceUpdate discord.js@14.25.1
Emitted whenever a guild member's presence (e.g. status, activity) is changed.
You don't fetch every single message one by one every time either
wait waht, gimme a sec
Discord sends events
do you mean you have a context command thats done on a message? that would be interaction.targetMessage then
try Message.interactionMetadata that may have what you are looking for. otherwise you may need to encode the message id in the custom id of the button
I had to do this: ts const messageRef = interaction.message.reference; const referencedMessage = messageRef ? await interaction.channel?.messages.fetch( messageRef.messageId!, ): null;
.message.reference exists on modal submits created from a button context. We assume it's always going to be in the same channel and fetch it that way
(maybe this might be worth adding to ModalSubmitInteraction when type is from a message (using isFromMessage) maybe something like:
interaction.message.getTargetedMessage() as .targetMessage doesn't exist in the ModalSubmitInteraction type
still, reciving million of events continuosly isnt laggy?
receiving is not
i just realised im also reciving events, not fetching.
Beyond the fact that you have to shard beyond 2500 servers
then why do people seprate it? like bleed made seprate bot for only that purpose
Separate what
seprate bot, they made two bots, bleed ( main ), bleed vanity for giving roles to user for having a status
you should ask them. theres nothing heavy about receiving events
ok thanks,i was just going to remove it
Because they wanted to, because it's optional functionality, for branding reasons.. we have no idea and no reason to know
one more question, is having a realtime listener to db is heavy ?
listens to every update in db table, im doing this in a way like, bot starts, load all configs of guilds realted to bot in ram cache, uses it, if a column value changes, realtime will know and update the cahce
code optimization is all up to you
Instead of worrying about something that might be heavy, implement your feature then see if it actually is heavy. Premature optimization is a progress killer for so many beginners and intermmediates.
bleed had a seperate bot because their main bot didn't have the presence intent enabled, but they eventually got their 2nd bot verified with the presence intent so it could be in more than 100 servers
why didnt had presence intent enabled? and then how 2nd bot did got?
they just never got approved of the presence intent on the main bot and they got tired of having 2-3 "bleed vanity" instances because they kept getting capped at 100 servers, so they tried getting their bleed vanity bot verified with the intent and it worked
ok, i was just wondering if im just wasting my time making new stuff in bot and then later i get to know a bot cant even handle it
but it took them a few tries i believe
hmmm
Well, worrying about performance issues before they happen is a waste of time in itself
hm
This doesn't seem very relevant to DiscordJS... Let's move this conversation to #archive-offtopic or #1081585952654360687
but i suggest you use a separate vanity bot
ended.
using containerBuilder... is it possible to have text side by side? like how in embeds you can set inLine=true?
Inline is not possible with Components V2
one shard can only handle 2.5k guilds, in order to receive "million of users status" each server would need at least 400 members (most don't), and every single one of those members would need to change their status at the same time (won't happen), so even that scenario is very unlikely to happen
oops didn't check the whole convo, just noticed it ended, mb
Which event should be used to ensure that the person who removed or added the Guild Tags is correct?
"event to ensure"? there's only one event, when it changes
which PermissionFlagsBits we need to use to toggle them?
(Use `node --trace-warnings ...` to show where the warning was created) (node:98794) TimeoutOverflowWarning: 2866389078 does not fit into a 32-bit signed integer. Timeout duration was set to 1.
what is error?
you exceeded max timeout value
it needs to be lower than 2_147_483_647 ms
Toggle what?
these permissions in like this
On a channel or role?
in a channel
set voice channel status has yet to be documented, so dapi-types has yet to support it
use activities is PermissionFlagsBits.UseEmbeddedActivities
and what about Manage Permissions?
ManageRoles
But I didn't overdo the timeout.
your warning suggests otherwise
either way, this is related to setTimeout, not a discord timeout, so this is unrelated to discord.js
How can I silently reply to a modal?
Basically, I have a button that shows a modal, after its filled out it sends a message to a pre-defined channel, but the modal window errors out
you cannot silently reply to any interaction
the closest is for components (and modals originating from components) you can do an empty edit (or deferUpdate and never actually update)
otherwise you'd need to reply and delete the reply, but imho it's better UX to at least reply ephemerally with a success message
not in this case, since my goal is to avoid the "user used /somecommand" thingy, and the command only works in the same channel the message is sent
ReferenceError: "x" is not defined: learn moreTypeError: Cannot read properties of undefined/null (reading "x"): learn more
this thing
I'm not sure to what part of that you were saying "not in this case", but either way my answer is the same
those are your options
but imho it's better UX to at least reply ephemerally with a success message
what's the common way of building a music system??
that's an incredibly vague question with many different answers, and at first glance, I'd say none of them are djs related
if you have a question about something more specific, feel free to ask
but forewarning, your first step should be to find a tos-compliant source of audio since most of the ones people ask about (youtube and spotify) don't have a tos-compliant means of streaming
so with youtube/spoitfy is against yt?
yes, both YouTube and Spotify do not allow the restreaming of their content via their API. And they have and could take leagl action against people for doing it
if we don't care about it, discord won't as well?
and then what should be the source? any idea?
We will not help you create an app that Violates any services terms of service
That is outside the scope of djs
soundcloud is an alternative. but this isnt djs related
weird
wdym
nothing, i just though yt/spotify is good to go with
im confused what to do now, soundcloud doesnt feels good ( i just have a internal feeling )
also worth saying to not overwhelm yourself with an all in one bot when you arent that familiar with djs. start with perfecting one system, otherwise you just gonna end up recoding everything anyways
🤷♂️
How to get bio of guild member?
you cant. api doesnt send that info
what a shame, anyways - thx
Keep this channel on-topic, troll elsewhere
i just.... gave the only possible solution
Is there a way to get the amount of bots in a server? Without fetching all members and filtering out humans
not without doing that, no
There are ways to estimate it, but none that are 100% accurate. What's the use case?
A server info command to just dispaly some general info about the server. (members, humans, bots) and more
So you just want to have the number because you want to? Or do you have actual users wanting such information in there
do you have more source options?
I want just the number of how many bots and humans.
you run the server info command, and the bot shows some general public information such as role count, created date, icon and member info, I just want it to show how many not the actual names and stuff
i searched up and there are alot of flaws in soundcloud
then just fetch and filter
Wouldnt that be bad for larger servers
you can get cache members and filter for bots
this is your reminder that this is unrelated to djs
it's entirely up to you to find a source you're satisfied with
ok
Will the cache number be up to date and correct?
if you got the right intents djs will keep the cache in place
*after fetching once
wanted to add up on that* recommended to fetch all members at startup then
Ia it a good idea to fetch eveerything on startup once?
It's not really worth to apply for guild members intent if that's the only thing you need it for
Especially since it won't get approved for more than 100 servers
My bot has banner set in specific guild, but when i fetch my own API:
const guild = await client.guilds.fetch(guildId);
const member = await guild.members.fetch(client.user!.id);
const hasCustomProfile = member.nickname !== null || member.avatar !== null;
return {
nick: member.nickname || client.user!.username,
avatar: member.avatarURL() || client.user!.displayAvatarURL(),
banner: member.user.bannerURL() || client.user!.bannerURL() || null,
bio: null,
isCustom: hasCustomProfile,
isPremium,
};
I receive
{
"nick": "Siema xd",
"avatar": "https://cdn.discordapp.com/guilds/1032657339649622036/users/905135889305440297/avatars/bfef9fa4909748a860737f7167629c9b.webp",
"banner": null,
"bio": null,
"isCustom": true,
"isPremium": true
}
Avatar is okay - its per server avatar as it is, but banner is always null. Why is that?
I imagine you'd need to force fetch your client member much like how you'd need to force fetch users to get global banners
wdym by force fetch?
see below. it skips the cachefetch("id", true)
not sure if any of the fetch methods take multiple parameters anymore
but there's also <Guild>.members.fetchMe({force: true})
const guild = await client.guilds.fetch(guildId);
const member = await guild.members.fetch({
user: client.user!.id,
force: true,
cache: false
});
const hasCustomProfile = member.nickname !== null || member.avatar !== null;
return {
nick: member.nickname || client.user!.username,
avatar: member.avatarURL() || client.user!.displayAvatarURL(),
banner: member.user.bannerURL() || client.user!.bannerURL() || null,
bio: null,
isCustom: hasCustomProfile,
isPremium,
};
still the same
but ill try what duck sent
still same result with
const member = await guild.members.fetchMe({ force: true })
GuildMemberManager#fetch() discord.js@14.25.1
Fetches member(s) from a guild.
// Fetch all members from a guild
guild.members.fetch()
.then(console.log)
.catch(console.error);
it looks like some kind of bug with bannerURL() (?) when i wrapped it with then and console.logged i have banner hash
you are right. I am behind
well I'm curious about why you're using member.user.bannerURL() when you're trying to access the guild-specific banner

stupid mistake, thx lmaoo
just got back to checking
does not look like you even need to force fetch, it was just the .user lol
yeah
message.attachments.each(a => {
a.url
});
everytime I run this code, it gives a url that says "This content is no longer available." even when I go to it right away
am I missing something? I thought the url should be visitable later and render the image
are you doing this on a deleted message event?
because you cant guarantee the attachment will still exist if its deleted
discord cdn links dont last forever, usually a short period before you gotta fetch the attachment again
no. messages are still up, and even when I visit the url as soon as it logs in console, it does it
so even after getting an attachment url from an existing message it says this content no longer available?
@tardy sable really weird. it seems to be working now. I deleted the file and reprogrammed it.. to my knowledge exactly the same. thanks anyhow
I'm running some tests with my code, and it seems that about once every 10 times I initiate the project, I get this:
node:events:496
throw er; // Unhandled 'error' event
^
Error: socket hang up
at connResetException (node:internal/errors:787:14)
at TLSSocket.socketOnEnd (node:_http_client:519:23)
at TLSSocket.emit (node:events:530:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ClientRequest instance at:
at TLSSocket.socketOnEnd (node:_http_client:519:9)
at TLSSocket.emit (node:events:530:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'ECONNRESET'
}
Node.js v20.11.1
any idea what this is about?
tag suggestion for @hazy delta:
Errors such as ECONNRESET, ConnectTimeoutError, SocketError: other side closed indicate a network issue
- Free or shared hosting providers often come with significant limitations
- Another indication of these issues are 'Unknown Interaction' errors.
There's no limit. Just keep in mind that you can only have 40 components max
What's the difference between displayName and globalName
In context of a User, displayName will try to return globalName first, however will fall back to username if globalName is null
In context of a GuildMember, it has similar behavior but with nickname - which can be null - also being taken into consideration before the other two
alright thanks I was a bit confused since both seemed to return the same value but now it makes sense
Quick question, does the latest version of v14 support setting a bot's avatar per server?
yes
GuildMemberManager#editMe() discord.js@14.25.1
Edits the current application's guild member in a guild.
yeah just searched and found it, ty
When I click on my button I get this error.
node:events:497
throw er; // Unhandled 'error' event
^
ValidationError: Expected a string primitive
at _StringValidator.handle (C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2615:70)
at _StringValidator.parse (C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at TextDisplayBuilder.toJSON (C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\node_modules\@discordjs\builders\dist\index.js:2074:33)
at C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\node_modules\@discordjs\builders\dist\index.js:2868:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\node_modules\@discordjs\builders\dist\index.js:2868:35)
at ButtonInteraction.showModal (C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:402:46)
at Object.execute (C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\handlers\buttons\client-add-button.js:40:27)
at Object.execute (C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\events\interactionCreate.js:14:28)
at Client.<anonymous> (C:\Programming + Coding\DiscordBots\Frost_Manager\frost-manager\index.js:37:46)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
validator: 's.string()',
given: undefined
}
Node.js v20.17.0```
I will provide my code if needed.
ur not putting a valid string as a TextDisplayComponent, your likely passing a empty string ('') or just nothing at all.
I am passing it like this:
.setTextInputComponent(proofs)```
(just took this little snippet as an example btw)
if proofs is empty, then youll get that error.
It isn't.
try debugging, log ur proofs and see if its empty
It isn't empty.
could i see the logged proofs
data: { type: 4, custom_id: 'client-proof-input', style: 2 }
}```
like the logged proofs, console.log(proofs).
wdym?
not the whole text input builder.
try
.setTextInputComponent(t => t.setContent(proofs))```
should work now.
I figured it out thank you for the help though.
can u tell me what the problem was
I had modal.addTextDisplayComponents instead of modal.addLabelComponents.
btw in the future you should post both the code and the error, not just the error
helps to do less assumptions and mistakes about what your code actually looks like
oh yeah, it had ButtonInteraction.showModal on the error.

is there a way to use a api's .mp3 extention as a audio inside a container?
like for example, im trying to create a word definition finder, i want this: https://api.dictionaryapi.dev/media/pronunciations/en/hello-au.mp3 to be inside the container as an audio and also make it playable?
it isn't
the file component simply displays it as a file, no kind of preview
oh dang
escapeMarkdown(message, {
codeBlockContent: false,
codeBlock: true,
});
does this escape ``` but
at _StringValidator.handle
won't changed to
at \_StringValidator.handle
That sounds reasonable
but it seems still escape the code block conetnt
Log the input and output string of escapeMarkdown and put it into a code bin like pastebin or github gist
rate this pls
give it some color lol
what color? Its a definition finder
https://discord.js.org/docs/packages/discord.js/14.25.1/RESTOptions:Interface#rejectOnRateLimit
rest: {
invalidRequestWarningInterval: 500,
api: config.bot.restAPI,
rejectOnRateLimit: (data) => {
return data.route === '/guilds/:id/channels' &&
data.method === 'POST';
}
},
just want to incorporate this for channel create. Now I'm just wondering how the guildId is replaced, whether simply with :id or with :guildId, so that the route fits.
white, maybe
thanks
whats a cheap vps?
There's a message sent by bot,
the message has the content and a component (StringSelectMenu)
but why interaction.update({content: "", embeds: [embed], components: []})
won't delete the StringSelectMenu component?
Where's the interaction coming from
<@&839912195994812420> scammer
any1 can send the thing of container - the link pls
ContainerBuilder discord.js@14.25.1
A builder that creates API-compatible JSON data for a container.
ContainerBuilder#addSectionComponents() discord.js@14.25.1
Adds section components to this container.
please use #app-commands or the hide option for personal use of commands
lavalink is against tos also?
Again not djs related. Just read the tos
sorry
Hi, does anyone know how to mention someone in a container without pinging them? Like embeds do.
can anyone send a simple container code .js?
same as you would with message content, the allowedMentions option
guide suggestion for @tiny blade:
Container
A Container is a layout component which groups its child components inside a visually distinct rounded box with an optional accent color on the left, similar to the message embed look. Unlike embeds, not specifying a color will make the left side of the Container component match the background color. You can mark Container components as spoiler, which blurs all content inside the container. You can use the ContainerBuilder class to easily create a Container component. - a Separator component;...
I know embeds can render
<@user>/@everyonewithout triggering notifications.
My question is: is there any non-embed message container (e.g. rich container, component tree, system-like payload) that can render a
<@user>mention without notifying the user, similar to embeds?
I’m aware pings are only processed in
content, but I’m wondering if there’s any internal flag, suppressed-mention container, or non-public field used by Discord that isn’t exposed in the public API.
what
Is there any way to show <@user> as a real mention (blue + clickable) without sending a notification, outside of embeds?

notifications are controlled via allowed_mentions on the API level, allowedMentions on the wrapper level
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"] } }
if the mention syntax is rendered clickable or not depends on if that entity is cached on the viewing client
it always resolves if you choose to notify, because the message itself will include the required data if notification is enabled
there have been effort on discord's end to always render these regardless, but it keeps being turned on and off
I can't figure out why this error appears only when I submit a number outside the range of pages (like 8 when I have only 5 pages)
I'm not even sure what this error means :/
embeds: [pages[page - 1]]
if that's outside the range then you'd send embeds: [undefined] which isn't a valid embed object
L113
it's clamped
I'll log embeds ig, but I doubt this is it
pages.length isn't the last index, it's the length of the array
the last index is length - 1
hence pages[page - 1]
ah, right, do some logging then
I did, the embed is there
I believe that error is caused by not passing an object
log right before the editReply what you're about to send
huh
if it's NaN then you shouldn't use it directly, btw
Somehow, between the assignment and sending it becomes undefined
let num = isNaN(selectedPage) ? page : Math.floor(selectedPage);
Yes, that's the line i read
And i misread
:)
So sending it again doesn't change anything in any case
Regardless if i did or not
Anyway
it can be better, i agree
but for now how the heck did this happen cuz idk
Uh
If i glance at the code right, on collect you only set the page number
And I didn't see you ending the collector
And code using the page number is outside of that
on collect i set the page var, and after that update the embed with the correct one
This thing is what's updating the embed
the page is just set above and used here, all in the collect event
istg djs should have a built in way to paginate embeds
how a bot can set status of a voice channel
not supported yet in djs
@loud quartz @rose tangle Fixed it, turns out I made a logic error on line 115, I was setting page instead of num like intended 
it's always the little things
so in py?
It's not documented by Discord so pretty much no library will support it
idk which library supports it but djs not yet and i think its undocumented by discord too
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
i doubt, not documented but rythm bot does it.
and maybe that bot is discord.js
I doubt it
lets try asking 'em, gimme a sec
doesnt mean its not documented that it is inaccessible. they probably found out how
Not documented does not have to mean it doesn't exist
There's a lot of stuff discord client does that's not available to bots and therefore undocumented
But undocumented stuff can change or go away at any point, and d.js simply avoids dealing with that
ye ik
bruh im so dumb, just get to know that we can use lang other than js or py to make bots also
rythm uses kotlin
A bot can be made in any language that can perform HTTP requests and form/read JSON.... So pretty much all of them
That PR is not meagered also it is a draft and therefore not documented.
djs does not support voice channels status currently
hehe
Slight difference between not possible and undocumented 
As i already said
And so did they
ikik
is it possible to make last seen command?
without storing users status
No
can I set url for non link styled buttons?
not really, no
alright, thanks
Hello discord.js support,
how can I interaction dynamic custom IDs?
For example:
staff_apply_reject_1
staff_apply_reject_2
staff_apply_reject_3
What do you mean by "handle"?
interaction or reply
Use the interactionCreate event, check if the interaction is a button, then check the custom id and reply accordingly
like this:
if (interaction.isButton()) {
let button = interaction.client.buttons.get(interaction.customId);
if (!button) {
const buttonKey = Array.from(interaction.client.buttons.keys()).find(key => interaction.customId.startsWith(key + '_'));
if (buttonKey) {
button = interaction.client.buttons.get(buttonKey);
}
}
if (!button) {
console.error(`No button matching ${interaction.customId} was found.`);
return;
}
try {
await button.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
content: "There was an error while executing this button!",
flags: MessageFlags.Ephemeral,
});
} else {
await interaction.reply({
content: "There was an error while executing this button!",
flags: MessageFlags.Ephemeral,
});
}
}
return;
}
Or is there a better way?
Better is subjective at this point
You could make 1 file per button
Yh how you make your navigation is up to you
I prefer to include the command name in the custom id and have them in the same file as the command
same, most organized 
Because I tested it and it works, but something happened or interfered with the interaction of another button
Something like ban:confirm:123456
Your custom_id is storing the state of the interaction... I don't see you separating the id from the state in that snippet
i use underscores, those dots reminds me of internet addresses 
I guess if you don’t use underscores in command names
_ are also used to combine words... : are not... so you could do some_thing:id_here
Yea, that would explain why it looks weird to me too
yh i don't i usualy always do something like this
if (interaction.customId?.startsWith('mod_')) {
const action = interaction.customId.split('_')[1];
const userId = interaction.customId.split('_')[2];
}
But something strange happened, or I don't know how to explain it.
Let's say there's a reaction staff_apply_reject_1, and it doesn't have a corresponding file or response. So it responded with another button.
Why?
Log your raw CustomID and ensure that it's not being generated incorrectly
He responded with staff_apply
It's possible you're putting the wrong ID into the button's CustomID, not that your button hander is interacting with the wrong ID
The array find look suspicious
But why did he do that?
Because I misspelled the custom ID?
Should start by logging the custom id and the button key right before the button.execute
Do you mean I should reverse it?
Huh?
I asking you to console.log stuff
you should just place a console log
ok
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'messageDelete',
async execute(message) {}
Event is not executed.
Partials are on. Intents are on.
const { Client, GatewayIntentBits, Collection, Partials } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessageReactions],
partials: [Partials.Message, Partials.Channel, Partials.Reaction]
});
Another event is executed (MessageReactionsAdd)
I have no clue what im messing up
Have you tried adding a log message outside of the module.exports as well as another one at the beginning of the execute()?
const { EmbedBuilder } = require('discord.js');
console.log('test out');
module.exports = {
name: 'messageDelete',
async execute(message) {
console.log('test');
},
};
console.log('test out bottom');
```tryied this but that also seems not to do anything
module.exports = (client) => {
client.eventHandler = async (eventFiles, path) => {
for (const file of eventFiles) {
const event = require(`../events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client));
} else {
client.on(event.name, (...args) => event.execute(...args, client));
}
}
};
}
```event handler
its strange because I pulled both out of a project that is still suppposed to work
Well first thing, looks like your args are mismatched between your event file and your event handler. Your execute should always end with client as you're passing it as well as the events args... So async execute(message, client) .... Technically you don't need to pass the client at all to events as the client is included in most events anyways
Second, you should add another log right after your const event for something like console.log("Loaded event file: ", event.name) to make sure it's getting loaded at all
thats weird.. its not loggin anything...., like nothing at alll
passing more arguments to a function than the function defines results in absolutely no difference at all. you just can't access those extraneous args since you never allocated a variable for them.
also "is included in events" is a bit misleading - it's not included in events. it's accessible from almost all d.js structures, and almost all events happen to emit with such
const functions = fs.readdirSync(`./systemfunctions`).filter(file => file.endsWith('.js'));
const eventFiles = fs.readdirSync(`./events`).filter(file => file.endsWith('.js'));
(async () => {
for(const file of functions) {
require(`./systemfunctions/${file}`)(client);
}
client.eventHandler(eventFiles, "/events");
client.login(process.env.BOTTOKEN);
})();
So than id assume its in here? but this always has run fine ?
well, something is wrong, so check where does it stop
check what the variables contain
I am now even more confused I am uploading files to a vps and testing from there. But for some reason. It does not seem to pick them up as it runs fine locally
this honestly might be something totally different than. Forget Ive said anything -> I am working in the wrong directory

thanks to both of you for your help anyway. Happy Holidays.
I believe in that link they are trying to send you here:
https://discordjs.guide/legacy/sharding/additional-information
oh thx
Can I change the resource volume without enabling inlineVolume?
is it possible to send a message with @ everyone but make it so a few specific users dont get the notification? like the owner or admins of the server
No
It's kinda in the name. Everyone
tell 'em to disabled the notification
( not related to djs btw )
can a bot send voice message?
Why am I getting this error again and again?
Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
at target.send (node:internal/child_process:753:16)
at Gotty.<anonymous> (/Users/Void/workspaces/GoTTY/node_modules/.pnpm/discord.js@14.25.1/node_modules/discord.js/src/sharding/ShardClientUtil.js:37:19)
at Gotty.emit (node:events:519:28)
at WebSocketShard.<anonymous> (/Users/Void/workspaces/GoTTY/node_modules/.pnpm/discord.js@14.25.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:196:23)
at WebSocketShard.emit (node:events:519:28)
at WebSocketShard.checkReady (/Users/Void/workspaces/GoTTY/node_modules/.pnpm/discord.js@14.25.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:184:12)
at WebSocketShard.gotGuild (/Users/Void/workspaces/GoTTY/node_modules/.pnpm/discord.js@14.25.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:158:10)
at WebSocketManager.<anonymous> (/Users/Void/workspaces/GoTTY/node_modules/.pnpm/discord.js@14.25.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:238:15)
at WebSocketManager.emit (/Users/Void/workspaces/GoTTY/node_modules/.pnpm/@vladfrangu+async_event_emitter@2.4.7/node_modules/@vladfrangu/async_event_emitter/dist/index.cjs:2504:31)
at WebSocketShard.<anonymous> (/Users/Void/workspaces/GoTTY/node_modules/.pnpm/@discordjs+ws@1.2.3/node_modules/@discordjs/ws/dist/index.js:1190:51)
I get a RateLimitError when using message.edit(). It says retryAfter: 1.05s (I divide retryAfter / 1000). I am currently testing it so that I always try again after 6 minutes. But after 6 minutes, I get exactly the same error and retryAfter is exactly 1.05s again. How can it be that retryAfter is 1.05s and after 6 minutes it is still 1.05s?
That error means your ShardingManager process died or at least lost contact to your shard child processes while the child processes somehow still are running
ahh, why is this happening and how do I fix it?
Sounds to me like you have two "things" (process, thread, event handlers, ...) trying to edit shortly after each other. If both retry after the same time then the second one will fail with the same retryAfter again. Did you check the editedTimestamp of the message in question to narrow the issue?
Without knowing anything about your code that's all I can tell you. You'd need to debug yourself what's happening
ok, errors somehow stopped for now after I restarted everything
edited_timestamp is set to “2025-12-25T11:55:06.417000+00:00.” This indicates that it has been edited. However, I am uncertain where it should run twice in my code.
I'll check that out, thank you.
Is it possible that discord.js will try a second time?
I checked, and I only use message.edit() in one place in the code, and it is only called once every 6 minutes with this message.
hi, how do i edit app avatar per guild?
Yes, if you don't rejectOnRatelimit it will. How do you determine that you need to retry in the first place?
documentation suggestion for @last mango:
GuildMemberManager#editMe() discord.js@14.25.1
Edits the current application's guild member in a guild.
thanks u
can i set custom status per guild?
Hopefully someone can help me...
I get this in my logs:
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'undici@6.21.3',
npm WARN EBADENGINE required: { node: '>=18.17' },
npm WARN EBADENGINE current: { node: 'v18.9.0', npm: '9.2.0' }
npm WARN EBADENGINE }
I think I have to update my node, but how?
I check whether the error is a RateLimitError.
What's also unusual is that it's always the same message, but over 5,000 servers use this feature. Only this one message throws the error.
go to the node page and download latest lts version but thst not directly djs related so if you still struggle afterwards maybe a thread in #1081585952654360687 would be appropriate
Alright
Where is it hosted?
is it possible to enforce number input in any modal field?
Nope
someone tell discord api devs to put that on their to-do list
well that's neat
it's already discussed but it looks stale D:
they wont work on modals again for any time soon. best for now to just convert to integer after text input submit
speaking of modals, I cant figure out how exactly does deferring work, say I get a button interaction, i show a modal, then how do I reply? using the ModalSubmitInteraction or the button one
cuz i want the button to just show the modal and stop, then the modal should send a message in a specific channel on submit, but that leaves the modal errored unless i do .deferUpdate() (and then i dont actually update anything)
did discord change this/ I cant see anymore who got moved/kicked
reply with the modal submit
look at the audit log data, pretty sure it doesn't have the users that were moved
Yep it doesn't, Id reckon its than either more work todo or
Is there some of information about the possible options for components v2?
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.
Most if not all options are listed here. What specific things are you looking for?
Is there a rest event that allows me to log all requests that go outwards?
What it wrong with this code:
const aboutContainer = new ContainerBuilder()
.setAccentColor(config.general.MessageEmbedItems.color)
.addSectionComponents((section: SectionBuilder) =>
section
.addTextDisplayComponents(
(textDisplay) => textDisplay.setContent(`# About ${config.app.info.name}`),
(textDisplay) => textDisplay.setContent(`${config.app.info.description}`)
)
)
.addSeparatorComponents((separator: SeparatorBuilder) => separator)
.addSectionComponents((section: SectionBuilder) =>
section
.addTextDisplayComponents(
(textDisplay) => textDisplay.setContent(`# Developers 💻`),
(textDisplay) => textDisplay.setContent(`
ItzExotical (itzexotical)
Jarvo (jarvo01)
`),
)
)
.addSeparatorComponents((separator: SeparatorBuilder) => separator)
.addSectionComponents((section: SectionBuilder) =>
section
.addTextDisplayComponents(
(textDisplay) => textDisplay.setContent(`# Status 🛠️`),
(textDisplay) => textDisplay.setContent(`**📦 Version:** v${config.app.version.string}`),
(textDisplay) => textDisplay.setContent(`**📡 WebSocket:** ${i.client.ws.ping == -1 ? 'Ping not measured yet, please try again later.' : i.client.ws.ping + ' ms'}`),
(textDisplay) => textDisplay.setContent(`**🟢 Status:** All systems operational\n**Uptime:** ${process.uptime().toFixed(0)} seconds`),
)
)
.addSeparatorComponents((separator: SeparatorBuilder) => separator)
.addSectionComponents((section: SectionBuilder) =>
section
.addTextDisplayComponents(
(textDisplay) => textDisplay.setContent(`# Need Help? 🆘`),
(textDisplay) => textDisplay.setContent(`Chat with us, and get direct support`),
)
.setButtonAccessory((button) =>
button.setCustomId('supportButton').setLabel('Support Server').setStyle(ButtonStyle.Primary).setStyle(ButtonStyle.Link).setURL(config.general.support.discord.invite.link!),
),
);
await i.reply({
components: [aboutContainer],
flags: MessageFlags.IsComponentsV2,
});
Because it gives me that the application did not respond.
put it inside a try catch block to catch any errors and then see
that go to the discord api?
yeah
1 [ValidationError: s.nullish()]
2 [ValidationError: s.number()]
3 [ValidationError: s.tuple(T)]
That is what it gets me
don think an event exists for that
A section component is required to have an accessory component (button or thumbnail)
Aaahhh
Okay, I fixed that, but now it still doesn't work...
const aboutContainer = new ContainerBuilder()
.setAccentColor(config.general.MessageEmbedItems.color)
.addTextDisplayComponents((textDisplay: TextDisplayBuilder) => textDisplay.setContent(`# About ${config.app.info.name}`))
.addTextDisplayComponents((textDisplay: TextDisplayBuilder) => textDisplay.setContent(`${config.app.info.description}`))
.addSeparatorComponents((separator: SeparatorBuilder) => separator)
.addTextDisplayComponents((textDisplay: TextDisplayBuilder) => textDisplay.setContent(`# Developers 💻`))
.addTextDisplayComponents((textDisplay: TextDisplayBuilder) => textDisplay.setContent(`
ItzExotical (itzexotical)
Jarvo (jarvo01)
`),
)
.addSeparatorComponents((separator: SeparatorBuilder) => separator)
.addTextDisplayComponents((textDisplay: TextDisplayBuilder) => textDisplay.setContent(`# Status 🛠️`))
.addTextDisplayComponents((textDisplay: TextDisplayBuilder) => textDisplay.setContent(`**📦 Version:** v${config.app.version.string}`))
.addTextDisplayComponents((textDisplay: TextDisplayBuilder) => textDisplay.setContent(`**📡 WebSocket:** ${i.client.ws.ping == -1 ? 'Ping not measured yet, please try again later.' : i.client.ws.ping + ' ms'}`))
.addTextDisplayComponents((textDisplay: TextDisplayBuilder) => textDisplay.setContent(`**🟢 Status:** All systems operational\n**Uptime:** ${uptimeFormatted}`))
.addSeparatorComponents((separator: SeparatorBuilder) => separator)
.addSectionComponents((section: SectionBuilder) =>
section
.addTextDisplayComponents(
(textDisplay) => textDisplay.setContent(`# Need Help? 🆘`),
(textDisplay) => textDisplay.setContent(`Chat with us, and get direct support`),
)
.setButtonAccessory((button) =>
button.setLabel('Support Server').setStyle(ButtonStyle.Link).setURL(config.general.support.discord.invite.link!),
),
);
await i.reply({
components: [aboutContainer],
flags: MessageFlags.IsComponentsV2,
});
Doesn't work in what way? What's the error?
There is no error...
I'll ask my friend who I am coding with... Maybe he can figure out.
If I use a package for cross-hosting so that the bot can run on two servers simultaneously, will all guilds still be in the discord.js cache on both servers? Or will half of the guilds be in the cache on one server and the other half on the other?
Are you sharding?
yeah
Then you will only get the guilds that belongs to that shard
And shard 0 gets all DMs
Ah, I thought that might be where my high memory consumption was coming from, but that's not it either.
Are all users stored in the cache by default?
Only ones that d.js receives
You can fetch all members on startup and then the gateway events will keep the cache updated
Usually become cached from certain events
That’s the opposite of what they want tho
Yup....I realized after I said it... 
But does that mean guild.members.cache is empty in startup?
Not necessarily
Certain intents may cause certain members to be cached upon ready
Guild presences intent would cause non-offline members to be cached
Guild voice states would cause members in vc to be cached
But with a 30k member Discord, would all members ever be in the cache at startup?
It’s unlikely
What intents do you use?
Maybe if the bot runs long enough to where every member eventually becomes cached by some event
You can also set a limit on the size of your GuildMemberManager cache to x members or set a cache sweeper to clear it every y amount of time
Cache Customization
Sometimes, you would like to be able to customize discord.js's caching behavior in order to reduce memory usage. To this end, discord.js provides you with two ways to do so: 1. Limiting the size of caches. 2. Periodically removing old items from caches. Customization of caching behavior is an advanced topic. It is very easy to introduce errors if your custom cache is not working as expected.
is GuildMemberManager per guild or global?
Per guild
[
"Guilds",
"GuildVoiceStates",
"GuildMessages",
"GuildMembers",
"GuildPresences",
"GuildModeration",
"GuildExpressions"
],
Is there a way to show me what is currently in the cache?
Several ways. You can use Collection#map for example to only show the userIDs of members in the cache, or just Collection#toJSON and just print the whole collection itself
But you can look through the Collection class to see all available methods
So it is advisable to limit the GuildMemberManager to 500. When a voiceStateUpdate comes in, for example, the member is added to the cache so that it can be used, and if 500 more events come, the first one is simply removed again.
Now the question is, if you want to use other members and fetch them, what about the rate limit? Is there a list where you can read everything in detail about the rate limit, which route can be requested how often per time, and so on?
Rate limits are dynamic and unpredictable. They can change based on many factors such as current API load
You can get a rough estimate by sending a request to an endpoint to see what the limit currently is. But Discord does not document the rate limit
I'm just afraid of changing something in makeCache or sweeper, because I'm afraid that I'll hit a rate limit or do something careless in the live bot. Of course, I can't test all the changes on the dev bot, because there isn't much going on in the cache there.
can i set custom status and activity per guild?
No, it’s by shard, not by guild
I would like to ask how i can do a selectmenu in modalbuilder
ModalBuilder -> LabelBuilder -> StringSelectMenuBuilder
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.
Thanks Brother
o7
What abt this
ModalBuilder#addTextDisplayComponents() builders@1.13.0
Adds text display components to this modal.
is there a way to update a specific bot message without showing below it the edited text?
not really, no
wikes. I needed to put 7 rows of buttons inside a container builder so I had to send 2 to fit them and when the first one is edited it leaves a space between them ruining the design
do you not want to have the buttons and container together in one message?
35 buttons won't fit
that would be ideal
whoops i didn't see rows lol
32 is max
I need a way to somehow get rid of the first edited. I dont mind the second one
not really possible, sorry
can I send both container builders on the same message?
you should be
also dont want to be rude but doing a calculator command in discord isnt really useful
I know, its for an npm package because its a remake of a deprecated one so I added it as well while it existed.
And also I tried to put both containers on same message and its not possible.
components[COMPONENT_MAX_TOTAL_COMPONENTS_EXCEEDED]: Total number of components cannot exceed 40
yh you will probably reach the max amount of components in one message
id say add a page button
Ya. There's more components there just for the buttons than are allowed in a message. You can't exceed 40 total components, that counts containers and action rows
so it counts 35 buttons + 7 action row + 2 containers?
.
hi, what's the easiest way to kill the bot with a command
"killing" the bot is not something you want to do
Client#destroy() discord.js@14.25.1
Logs out, terminates the connection to Discord, and destroys the client.
what does it mean with logging out?
It's just the opposite of client.login()
Instead of waiting for a missed heartbeat
oh okay
how make dis bottun in embed ?
it is not an embed but a container
Container
A Container is a layout component which groups its child components inside a visually distinct rounded box with an optional accent color on the left, similar to the message embed look. Unlike embeds, not specifying a color will make the left side of the Container component match the background color. You can mark Container components as spoiler, which blurs all content inside the container. You can use the ContainerBuilder class to easily create a Container component. - a Separator component;...
How do you do this in code though?
follow the guide above
dis my embed and button wat need for it
please follow the guide sent above on creating containers and adding buttons inside them
tnk
Trying to track down a bug (I think) with components V2. I have small thumbnail images that are fetched from a cdn with url version control https:[//]somecdn.com/media/1asafefgg.jpg?v=1234
It seems to be a hit and miss with fetching the image via the url. Old embeds will display the image, componentsV2 thumbnail will not fetch the image, but it will succeed if the image has already been cached by Discord either by an Embed or by it been uploaded in a normal message.
You might have better luck in ddevs, as this seems to be an issue with discord getting it, nothing on the library's side
What if you first build an attachment?
Example ```js
const url = https:[//]somecdn.com/media/1asafefgg.jpg?v=1234;
const attachment = new AttachmentBuilder(url, { name: some_name.jpg });
const media = new MediaGalleryBuilder()
.addItems([
new MediaGalleryItemBuilder()
.setURL(attachment://some_name.jpg)
]);
container.addMediaGalleryComponents(media);
reply({ components: [container], files: [attachment], flags: MessageFlags.IsComponentsV2 });
When I've had issues with images not loading, even in normal embeds, first turning it into an attachment has fixed it for me. Worth a try :))
can you use custom emojis in components v2 markdown text?
update: yes i can
I followed the guide to this point: https://discordjs.guide/legacy/additional-features/cooldowns
But this one gives the error: ReferenceError: client is not defined
It's not very clear where to put everything, I tried playing around with the placement and references, but can't figure it out
It's not very clear to me how client.cooldowns = new Collection(); in index.js gets passed to the interactionCreate.js file - I think that's where it goes wrong, but not sure at all
client refers to an instance of the Client class, an object with methods (functions) and attributes, if you will
the library uses that client to instantiate all other classes, like Message, ...Interaction etc. and passes a reference to itself to those objects
most classes that discord.js gives you to work with have a .client field that exposes said Client instance so you can easily access it
client.cooldowns = new Collection();
as mentioned in that page, in the command files itself, you can access it via interaction.client
and since that is the same instance, it will also have the cooldowns field you attach to it
const { cooldowns } = interaction.client;
so why am I getting a: ReferenceError: client is not defined
I tripple checked everything in the guide, but might have missed something
because you are trying to reference client in a scope you don't have it defined in
hard to say without seeing what you are working with
exactly what is on the page I linked - I followed all the tutorials step by step, everything worked, up until that point
well, apparently not
