#djs-help-v14
78874 messages · Page 34 of 79
Or that
Either way, the withResponse: true pair is a crucial part of the type
now i'm getting this error
Property 'customId' does not exist on type 'APIButtonComponent | ButtonComponent'.
does captchaMessage have to be Message<true>?
if so, how can I type response.resource.message to be Message<true>
you're supossed to get the customId from the interaction, not the button component
ButtonInteraction#customId discord.js@14.21.0
The custom id of the component which was interacted with
oh... oopsies 😅
how come the output isn't formatted properly? how can i format it?
i cant get my cmd to show up in message>apps, is anything else needed?
// commands/quote.js
module.exports = {
data: new ContextMenuCommandBuilder()
.setName('quote')
.setType(ApplicationCommandType.Message)
.setContexts(InteractionContextType.Guild),
async execute(interaction) {
await interaction.deferReply();
// ...
}
}
- running the guild-specific deploy code from the guide
fwiw slash cmds register fine, just the context menu ones wont show up
Have you tried refreshing discord?
yeah
All I can say is that you would need to provide your deploy script, as context menu commands deploy together with slash.
const { REST, Routes } = require('discord.js');
const fs = require('node:fs');
const path = require('node:path');
require('dotenv').config()
const commands = [];
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
console.log(`Successfully loaded command: ${command.data.name}`);
} else {
console.log(`Cmd at ${filePath} is missing a required "data" or "execute" property.`);
}
}
const rest = new REST().setToken(process.env.DISCORD_TOKEN);
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
const data = await rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID),
{ body: commands },
);
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
console.error(error);
}
})();
ive verified GUILD_ID is correct and that slash cmds do update
are the context menus inside the commands folder?
yes, commands/quote.js is my ctx menu
i see it being parsed by the deploy script, just nothing on discord's dropdown menu
hmmm
hello, how can i add some number choices of a option of slash command in discord.js which you can pick from but also allow user to input their own number?
new SlashCommandBuilder()
.setName("command")
.setDescription("does command stuff")
.addIntegerOption((option) =>
option.setName("command-option").setDescription("number").setRequired(false)
)
that adds an integer option
thank you and can i also like add preset choices to that integer option, for example there would be choices 1,2,3,4 but you want to type 5 which is not in there which you also can do
you can do option.setChoices but i think that forces you to pick one of them, hmm
one, more convoluted method would be to use an autocomplete interaction
guide suggestion for @rigid hinge:
Slash Commands: Autocomplete
read more
is there no way to disable channel caching or sweep them?
why would you want to disable channel caching?
because my bot doesnt read any channel data
you might be surprised how often discord.js relies on a channel being in the cache to operate
Yeah, even if you dont use any channel data, you will still want to keep it around.
Which is why its not one that we support sweeping of
oh i see, thanks
thanks
Update on shard death:
Most times a shard dies, it's caused while doing:
const [backgroundImage, backgroundGrid, backgroundLogo, avatar, platformIcon, rankImage, bestClassImage] =
await Promise.all([
loadImage(...),
loadImage(...),
loadImage(...),
loadImage(...).catch(() => loadImage(...)),
loadImage(...),
loadImage(...).catch(() => loadImage(...)),
loadImage(...).catch(() => loadImage(...)),
]);
loadImage is from @napi-rs/canvas.
The shard that dies does not seem to have any connection to the shard running this code. Sometimes it's the same shard, sometimes a different one.
There doesn't seem to be any spikes in memory or network usage.
No sus logs from the client's warn or debug logs. The shard that died's client had Heartbeat acknowledged, latency of 107ms a few seconds before dying.
I am kinda lost as to what to look into.
Can anyone tell me if my codig9 is correct?
<button>"CONTINUE"</button>
identify button="CONTINUE"="automatic click"
function ="click automatic(1)"
Are you aware of what this channel caters towards?
are we sure this is discord.js? 
please elaborate
as?
Who?
that does not look like typescript or javascript
you
Okay, but how do I make it work?
why are you asking here
this channel is for discord.js and discord.js only. that is clearly not discord.js nor is it even js or ts
#1081585952654360687 if you really need standard JS help, though what youve asked gives nowhere near enough context for what "make it work" means
im confused on what this is even trying to achieve
make the program click automatically
you're in the wrong place
is client ready?
Yes
u sure?
Positive
client.on('ready'...
cuz u said shard ready
The client is receiving interactions, and said interaction runs the code that is seemingly what kills the shard
okay
at what point does it crash? like the line. and is there an error?
It's the Promise.all() that causes it. Debug logs before it run, but nothing after
hm I see
No other errors caught or logged anywhere, just shard death
weird, I would love to help u, but I gtg for now and this sounds like it needs some time to figure out
Dont bring that back in here, #archive-offtopic
i haven't seen the code, but if you're using Promise.all on a heavy operation it might be good to use .then instead of await but what do i know 🤷♂️
Doubt it, they're functionally the same really
Test
if that doesn't work try loading them all separately and log between each one to see if there is a single perpetrator (or if all of them are the problem)
i mean yes but await blocks function execution until the promise completes. Maybe there is some promise that never resolves and just hogs the call stack 🤷♂️
Was doing that before and saw some mixed results.
Sometimes a shard died during the loadImages, sometimes it died shortly after
There is this release which addresses a memory leak with drawImage, but not sure this would affect my use case: https://github.com/Brooooooklyn/canvas/releases/tag/v0.1.76
hmm so background image doesn't load?
If a different shard dies, I see no issues with the output. If the current shard dies, the process dies and stops execution
and it never dies if that code in particular isn't ran?
No, I've only seen a shard die in connection to that code
hmm
what is the code behind loadImage?
Imported directly from @napi-rs/canvas
isn't canvas rust-based?
Yes
oh noes, i have no idea how to read rust
luckily it seems like load image is mostly in js! https://github.com/Brooooooklyn/canvas/blob/v0.1.76/load-image.js
it looks like it checks to see if the file exists and then returning a promise that resolves on image load, doesn't seem like it would break a shard though
did you try this?
I'll add some more schizophrenic logging, like a .then() on every loadImage() call
alr
cough digging into canvas, be it for what it does or why it doesn't, isn't really discord.js relatead
feel free to open a thread in #1081585952654360687 and continue there
gtg, hope you the best of luck regarding this!
Since there are no errors visible, I can only assume it's something with canvas overloading something. Sigh
what im i missing in my string select menu?:
at StringSelectMenuBuilder.setPlaceholder
at Object.execute ...\find.ts:76
given: null
sounds like on find.ts line 76 you passnulltosetPlaceholder
My Ephemeral isn't working. Here is the code for the ticket system.
const { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, PermissionsBitField, ChannelType, ButtonStyle, MessageFlags } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ticket-setup')
.setDescription('The ticket setup command.')
.addChannelOption(option => option.setName('channel').setDescription('The channel to put the ticket system in.').setRequired(true).addChannelTypes(ChannelType.GuildText)),
async execute (interaction, client) {
if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
return await interaction.reply({ content: 'You do not have the permissions to do that.', Flags: MessageFlags.Ephemeral });
}
const { options, guild } = interaction;
const channel = options.getChannel('channel');
const embed = new EmbedBuilder()
.setTitle('Ticket System')
.setDescription('Click the "Create Ticket" button to open a private channel to speak with the Staff Team.')
.setColor('Aqua')
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId('button')
.setLabel('Create Ticket')
.setEmoji('🎫')
.setStyle(ButtonStyle.Secondary)
)
await channel.send({ embeds: [embed], components: [row] })
await interaction.reply({ content: 'Ticket system successfuly setup!', Flags: MessageFlags.Ephemeral })
}
}```
I believe I set it up to be Ephemeral correctly but maybe I am wrong.
Flags: MessageFlags.Ephemeral
flags, notFlags
Hello, are you there API to monitor the quests?
no
😑
is there any way to add like .setTimestamp() to components v2 like there is in embeds or nah
no
Can do whatever you like with text displays and markdown though
TypeScript solves this
Does anyone have the documentation to role gradients yet?
It's not supported by Discord JS yet
Ahh ok
Permissions - Role Object
read more
Here's the docs if you want to use a raw API request...while you wait for DJS to support it
Alright thanks
How could I DM a user with my bot? I am trying to make it so when the ticket is closed the user who opened it gets a DM with the transcript attached.
User#send() discord.js@14.21.0
Sends a message to this user.
// Send a direct message
user.send('Hello!')
.then(message => console.log(`Sent message: ${message.content} to ${user.tag}`))
.catch(console.error);
Thanks Mark!
Make sure you catch for errors as it will throw an error if their DMs are closed (and there's no way to check without attempting to send the message)
Alr
Hey, I'm having an issue where my bot can't join the voice channel using DisTube and gives me this error after 30 seconds:
(node:5864) Warning: Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.
[DisTube Debug] [QueueManager] Creating queue for guild: 677387067583627264
[DisTube Debug] [QueueManager] Joining voice channel: 804740919751999489
DisTube Play Error: DisTubeError [VOICE_CONNECT_FAILED]: Cannot connect to the voice channel after 30 seconds
at DisTubeVoice.join (C:\Users\Administrator\Documents\Bc\node_modules\distube\dist\index.js:678:13)
...
errorCode: 'VOICE_CONNECT_FAILED'
I'm using discord.js v14 and DisTube latest version. Any ideas?
We do not offer support for projects that violate the TOS
Oh yeah trying to stream music from youtube violates that right? I remember there being a huge thing a few years ago where all the popular bots got taken down
Yes, it's always been a violation
Even if not from YouTube, 99% of the time, music streaming is against the ToS as most people don't have a license to distribute the music they are playing
Oh yeah this too
does anyone know why this would sometimes error out with this error
code:https://sourceb.in/Nzw7rDWf4d
error:https://srcb.in/1giWhpz2G4
are you sure that's the erroring code?
Line 83 index.js
the error says you're calling setName somewhere
but it's not in that snippet
oh shoot sorry had to bathe the kiddo
line 83 is guildCountId.setName(`Total guilds : ${guildCount}`);
it's just weird because it is only sometimes
guildCountId is sometimes undefined
but it shouldn't be...it's the same channel id everytime. Could this be happening since I have it inside a scheduled cron job?
do you have sweepers?
is the cronjob started after the bot has logged in?
do you have the Guilds intent?
also, this won't solve your issue but:
Don't use the find method to query a Collection by key (mostly the associated id)
- someCollection.find(structure => structure.id === "348607796335607817")
+ someCollection.get("348607796335607817")
I just noticed it didn't paste everything in the sourcebin. Let me update it. It worked in the ready event. The cron job is in the index.js file. https://sourceb.in/btdL5uWL2A
I'm doing that method...just the long way for some reason. I will 100% most likely condense it though
you're not doing that method, find and get are different
get is an O(1) map get, find is a O(n) map search
oh I read it backwards 🤦♂️ I'm tired so that isn't helping lmao
You should be instantiating your cron job inside of your ready event
but anyway
1.) what are sweepers?
2.) it's in the index.js
3.) yes
Otherwise there's the possibility it triggers before the client is ready
I tried that with another cron job and it wasn't working...can't remember why though. Let me see if this one triggers it
now it's doing the setName error on another line in the same code 😑 let me see what's going on and I'll update this message
EDIT: I forgot to put the channel ID in the array for channels 🤦♂️
I want to ask whether gradient role can be done in DJS?
not yet, it'll be on next release
okay, thanks for the information
how can i get all historical messages in a channel?
hi guys, is there a way to use socks5 proxy in discord.js?
@discordjs/proxy exists
Ive been reading the message history and see i shouldnt register on every startup, but how should i then? Also i came here because i probably restarted too many times and now the commands are not registering anymore even after a night
But how should i fix the not registering now
but how should i then
Manually, once you actually change something
But how should i fix the not registering now
You don't, you keep waiting until the ratelimit is lifted.
So just like make a console command and like make it register thecommand.js
Yes
Creating Your Bot: Registering slash commands
read more
After updating and testing in a dev bot
If i try restarting now and then does it extend the ratelimit because i feel like its been 24 hours
No, it will just keep limiting you.
If you catch the rejection you should be able to see how much time is left.
Kk thanks
I couldn't seem to find the max amount of characters anywhere in both the official discord documentation nor the discord js documentation.
What is the limit on Text Display Components, and is that a per text display component limit or is it a limit based on the total text?
I think its 4000 characters combined in the message
i cant find any docs about this
Update on shard death:
Each of these CPU usage spikes is correlated to a shard dying. I don't know if it spikes and causes the shard to die or if it spikes because the shard is being respawned
I just added catch and it just does nothing
Nothing pops up
Its like theres no error message
I feel as though I'm going crazy at the fact this was working in an earlier version of DJS, and porting over to the newer version, permission checks for the client are basically being ignored whilst my userPermission side of operations works 100%. May I have some form of assistance to just at least steer in the direction of what may be causing the issue? I feel it is literally right in front of my face, and I'm not seeing it after looking at this for ages. 
The bits boxed in are what I am primarily focusing on in the code that I believe are the sources of the issue- but it is drivin' me crazy. 
just to make sure I understand, in that if body you add permissions to that clientPermissions array that the bot doesn't have?
Yeah! The bot is primarily creating the array for storing permissions it doesn't have* for a later message that gets pushed through a translation tool I'm using for the project. 
ah okay, then yeah, looks good to me?
also you can make that if statement way shorter by just using interaction.guild.members.me.permissions.has()
That's what I was thinking too yeah; For some reason when it happens to jus' not have the permissions; it just outright skips the whole section of code- and jus' ignores the client side is what is confusin' for me. 
does it have admin though?
.has() skips the perm check by default if it has admin
In the testing environment I got it in atm, it doesn't I beliiiieve- but I'll triple check rq. 
Yeah, it doesn't have administrator and still jus' skips. 
Otherwise just add some good ol debug logs and log some relevant values like guild.members.me.permissions.toArray()
I'll give that a shot again, somethin' is being real weird about it all. I've tried doin' that earlier and once it hits the forEach() method, it just basically just goes completely silent. 😭 
Even with a good 'ol log of just that line in general, to even just throwing a good 'ol Hello World into it. 
@snow onyx (pinging you cus u know what i was saying earlier) i added a single registration console commands and i did one command and it worked, then i did another and it didnt work anymore
how do you know "it didn't work anymore"
Yeah no checking again like you'd mentioned with .toArray(), it does still show the client still has the permission I'm deriving it of, but yet again- it doesn't have it on it's role, nor in the channel it's being used in either. I swear this bot is breaking my logic with permissions again. 
did you make sure it even arrives here and slashCommand.clientPermissions contains something?
Because it says preparing and then finished processing but now it only sats preparing and stops again
Yeah, if I happen to log for the slashCommand.clientPermissions, it'll pull it directly, but I believe the second it hits either the forEach(), or .has(); it begins to slip somewhere that I don't begin to primarily understand any longer. 
I guess try a for..of loop instead?
for (let permission of slashCommand.clientPermissions) {
...
}
Got'cha yeah; I give that a shot! For some reason with the slashCommand.userPermission side of things, this exact bit of code works exactly the same. 
I'll give this an approach and see if I might've just literally foobarred this somehow and I might not just not see it personally since I been looking at this for hours. 
If im not wrong, a section needs both text and image.
. addMediaGalleryComponents()
Yeah no for whatever reason, the clientPerm... side of things is like foobarred like insane. Even with switching out the the forEach() to the for (let...); It just doesn't read the GuildMember permissions for the Client; Yet for some reason despite the code quite literally being identical to the userPermissions side of operations, the userP works just fine. 
I just genuinely am beginning to have zero clue on what is possibly causing this just from glancing into this section, or if really it may be outside if everything seems fine even then. But I still appreciate it. 
Is there a way to do fields in new components? Basically a table?
Components V2 doesn’t have fields. Those are only in embeds.
You can get creative with ascii tables if you’d like
How can I get option values from the initial command? I need to get them during the point where I'm responding to an action row interaction and I can't see anything to get the initial command...
Depends how you're collecting the interaction
via interactionCreate
If it's a slash command and its response contains components, you're better off handling the component interactions within the command logic
I'm assuming that's what you're doing here, not a permanent message with components, because you mentioned an 'initial command'
Using either awaitMessageComponent or an InteractionCollector
alright, ill just use the awaitMessageComponent thing then, thanks
also what's the type for collectionFilter again? (typescript)
It's a callback
i know, but it wants a type
Show your code, you shouldn't need a type if I understood you correctly
Oh wait hold up I get what you mean now
In theory you shouldn't need one if you're returning a valid type it can infer
yeah just last time i copied the code exactly typescript went flare up
but this time ive just written inline and it seems to work?
If you do that it will be fine, because the type is already specified in the parameter
The type is CollectionFilter btw, didn't know it had an actual typealias
documentation suggestion for @fluid plinth:
CollectorFilter discord.js@14.21.0
Filter to be applied to the collector.
thanks
@zinc quartz hey, let's talk here
This fix is pretty okay now i just register them 1 by 1 and then from now on only reg a new one / edited one
i’ll share you my deployment file (which only deploys to a testing guild) but you should be able to use as a guideline if that helps
why does it remove all commands first 
i found it tedious to have to do this one-by-one when changing things in-dev
you dont need to, put already takes care of all lthat
and for just a testing guild i found it’s generally fine to do, not globally of course
put takes a list of commands and replaces existing commands with the new ones
This is about the exact same thing i useD and it just went to refreshing and just didnt do anything further, no errors and no successfully reloaded
ah yeah but if i created a command like /test and now don’t need it anymore
then it will be gone with put
Doing a single put with all of your commands does the same as your two requests now do
hm that’s interesting, i’ll have to give that a go since i’ve never had it work that way for me in the past
as in, ‘/test’ would remain after deploying my new commands with the file containing ‘/test’ logic deleted
bulk overwrite will overwrite all commands with the payload you send so that shouldn't happen if test isn't in that payload
how do I get the value of a sectioncomponent textdisplay? such as when I'm using a button and want to read information from the container
Thats why they allow you to set an id on components, so you can find them again
guys, where can I find a list of all the api endpoints for discord bots? for example v9
I've been reading the api docs but couldn't find a comprehensive list
Not sure what to tell you
The docs are pretty much it unless someone decided to put them all on one page
Besides, raw API is not discord.js related
(and can be found here https://discord.com/developers/docs/intro)
couldn't find any other channels for it beside #1081585952654360687
So you did find the channel is what youre saying 
Or even other servers like Discord API / Discord Developers
thanks 🙏🙏
exactly what I was looking for (to some extent, I'm sure I'll figure it out from there)
The best option really is to do a deep compare between existing commands and what you're trying to deploy
Wait what? I thoiught you were already reading the api docs
Store the IDs somehow, and just compare the data
idk what to tell you 🇦🇲
wish you the best 🙏
how can I fetch all the channels and threads in a server including the archived ones?
also forum post threads
Channels are fetched by default, threadss from the forum thread manager
ThreadManager#fetch() discord.js@14.21.0
Obtains a thread from Discord, or the channel cache if it's already available.
// Fetch a thread by its id
channel.threads.fetch('831955138126104859')
.then(channel => console.log(channel.name))
.catch(console.error);
ThreadManager#fetchArchived() discord.js@14.21.0
Obtains a set of archived threads from Discord. This method requires the permission in the parent channel.
Update on shard death:
I realized that Railway (my host) had a 1GB memory limit on this service, and now I assume that's what caused the shard deaths
Is it possible to get information about what tag the user has set?
Not yet with DJS but you can find it under primary_guild under the raw user object
👍
Users Resource - User Object
read more
To add, will likely be included in the next release
for UserSelectMenuBuilder() is it possible to exclude the current user who trigger the interaction to be in the select menu
no, you cannot modify user selects/channel selects/role selects to decide what can be selected and what not
=\ wish there was a way
check if the user id is inside the array of <UserSelectMenuInteraction>.values
was hoping to filter it without the workaround of checking values after user selects
Are there any breaking changes from 14.14 to 14.21?
minor versions will never introduce breaking changes
Cool thanks
consider only runtime breaking changes are considered for that
breaking changes on typings don't bump major, they're still on minor or patch bumps
oh
is that because it only affects a small number of people using the library?
iirc because djs is technically a js library, not a ts one
hm. makes sense
as in, it mostly targets js
and also because most typings changes are inherently major (in the context of this library)
they'd need to bump it quite frequently lol

does components v2 can work with flags: mf.ephemeral?
Sure
if (!interaction.guild?.members.me?.permissions.has(PermissionFlagsBits.ManageEvents)) {
await interaction.reply({
components: [
new TextDisplayBuilder().setContent(
[
`# ${getEmoji("danger")}`,
`It seems like I don't have permission to manage events to create giveaways...`,
].join("\n"),
),
],
flags: MessageFlags.Ephemeral,
});
}
I am trying something like this but
Yes, just include both flags
flags: [ ephemeral, cv2 ]
wait, it accepts array? yeah it is "flag(s)"
Yeah it can
typealias BitFieldResolvable
Data that can be resolved to give a bitfield. This can be:
- A bit number (this can be a number literal or a value taken from Flags)
- A string bit number
- An instance of BitField
- An Array of BitFieldResolvable
Can you also do like | or >> or something?
ephemeral | cv2 would also work. "Bitwise OR"
thanks
Can we make a footer like this on a container with components v2?
if you use a custom emoji for the avatar then yes
avatar is the user's avatar
that makes it still possible
Yes. They're saying you could make a temporary emoji for the avatar. Components V2 don't have icons like that. Closest is thumbnails in sections but they're much larger
You can’t no, best thing you can do is to use -#
-# footer
I feel like making an emoji on demand is a bit much
Yeah I won't be able to make a custom emoji per user who uses the command
not that hard to code tbh, its just a wacky workaround
Yeah I wouldn't recommend it, but it's an option, technically
It will get me ratelimited probably
Put that rust tag to use an make some canvas addon in rust
the guy working on discord for cv2 said once they will look into so called “user icons” to be used just like custom emojis work: emojis used in text that display the users avatar (or a server icon)
Yeah, but there's no way to make a small thumbnail like that right?
Nope
but as of now thats non existent so you cannot replicate the embed footer 1 to 1
Too bad
I would assume also no way to add a timestamp to the footer?
You can put a formatted date in small text and it looks similar
-# <t:1754332920:f>
Right, thanks
This is probably as close as I can get
How to use the componentsv2 string select menu?
It's for my RPG bot
it's the exact same component as the v1 version, it behaves the same
Interactive Components: Select menus
read more
2025-08-04T17:31:45.547553354Z This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
2025-08-04T17:31:45.547611492Z DiscordAPIError[10062]: Unknown interaction
2025-08-04T17:31:45.547615881Z at handleErrors (/build/node_modules/@discordjs/rest/dist/index.js:748:13)
2025-08-04T17:31:45.547619437Z at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2025-08-04T17:31:45.547623264Z at async BurstHandler.runRequest (/build/node_modules/@discordjs/rest/dist/index.js:852:23)
2025-08-04T17:31:45.547626731Z at async _REST.request (/build/node_modules/@discordjs/rest/dist/index.js:1293:22)
2025-08-04T17:31:45.547650955Z at async ButtonInteraction.reply (/build/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:200:22)
Anyone seen this error before and have ideas how to fix it? I have no idea where its happening and cannot reproduce it - just see it sent in my logs randomly
Common causes of DiscordAPIError[10062]: Unknown interaction:
- Initial response took more than 3 seconds ➞ defer the response *.
- Wrong interaction object inside a collector.
- Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance)
* Note: you cannot defer modal or autocomplete value responses
how to do this in v14
restRequestTimeout: 30_000
for client Object
rest: { timeout: 30_000 },
thx
it's fine to put large numbers like 1 or 2 min?
no rest request should take that long
that'd indicate a network issue
the default is already a more than reasonable value
I have DirectMessages and MessageContent intent selected for my bot, and approved for it on the dashboard, but the event MessageCreate is not returning any data as if it isnt firing when I message my bot directly. Is this something intended? Like I can get it to reply to commands and slash commands in DM Groups and direct dm with it. but not reply to chats sent to it?
If this is for a user-installable app, the way you reply is through the interaction, not standard messages
Oh...
your app has a bot account that you can add to servers
It is for that yes. I am trying to let people talk to the AI running on the bot in direct message. So is both user installable and guild installable.
it's not possible for that bot account to be added everywhere where you can add the app itself - like user installs
So it cannot fire an event for MessageCreate in the dm? What is fired when I message the bot directly?
me user-installing your app does not allow you to listen to every message i receive, that's a huge privacy issue
DMs are still just regular messages
they simply come from a channel with different type
(and require you to have the separate intent, as well as a partial enabled)
If you message the bot directly, yes, you'll get a MessageCreate event, but that requires your app to be installed to mutual guilds with the bot scope
I think I have all the intents I need?
If it's missing the bot scope, you're restricted to just interactions
I have it installed in mutual servers and as a user installed app... I am not sure why it is not firing the MessageCreate event for a dm to it, but works for servers.

To receive direct message events on "messageCreate" with your bot, you will need:
- The
DirectMessagesgateway intent - The
Channelpartial setting
Ah I was missing the partials. Did not know that was needed now. have not worked on this bot in a long time.
Hello! Does anyone know why is the message not ephemeral? The message is deferred and I get the log.
This code is in my SlashCommand event:
const { Ephemeral } = Discord.MessageFlags;
if (interaction.isCommand()) {
if (command.onlyEph === true) {
console.log("Interaction is only ephemeral");
await interaction.deferReply({ flags: Ephemeral });
} else if (command.onlyEph === false) {
await interaction.deferReply({ flags: undefined });
};
};
why is there no EmbedBuilder.from in djs v15 (dev)
Because you don't need it
lol i literally need to update embed..
It uses builders v2 which supports passing to constructors
new EmbedBuilder(interaction.message.embeds[0])
Argument of type 'Embed' is not assignable to parameter of type 'Partial<APIEmbed>'.
Types of property 'title' are incompatible.
Type 'string | null' is not assignable to type 'string | undefined'.
Type 'null' is not assignable to type 'string | undefined'
Pass embed.data
there is no ColorResolvable anymore? I need to use parseColor if i want to use hex or what
That should still exist but you can just write hex literals
0xAABBCC
it wants only number, color: number
idk then, if you're using dev you should be in #djs-in-dev-version
can I install discordjs/rest dev version to have access to gradient color roles then? 😭 without modifying discord.js
to clarify, when you say "and I get the log", do you mean that it logs Interaction is only ephemeral?
if so, what version of djs are you using?
could you show the output of npm ls discord.js?
You don't need the dev version of rest though, any version can make the API call
wdym
I don't know what else that could mean
i need to create a role but with new gradient color roles, that isnt available on latest stable djs version
I don't think you need the dev version of rest to make a call to that endpoint
Yeah but you asked about /rest
yes, which version do i need for that
Any
It makes API calls
Just pass the right params
if i pass withResponse: true when interaction.replying to a slash comamnd, would response.resource or response.resource.message ever be null, or can i safely expect them both to exist in this context?
.resource.message is only null if the channel isn’t cached (not in guild, or sweepers discards channel or guild)
Yes, I get "Interaction is only ephemeral", and I'm using version 14.15.3
you'll want to update, likely to the latest version 14.21.0
the flags option was only implemented in 14.17.0 as prior to that, the only flag available was Ephemeral, so it was implemented explicitly as ephemeral: boolean rather than a flags bitfield
how can i get my bot that uses discord.js to send a message (as if its in a DM/GC) but not reply to the interaction
- interactions need responses, so if you don't respond to the interaction, you'll get a "Application did not respond" error in the client
- as if it's in a DM/GC?
as in it's not actually in that DM/GC due to it being a user app?
if that's the case, it can't since it's not actually in the DM/GC
if this is a DM with the bot or a guild channel, you can just use<Channel>.send(), but you would still need to respond to the interaction aside from that
no, i have something already responding to the interaction as a secret message. im just having trouble sending the next message without replying.
ok then that aside, is this a user app?
you can followUp which creates a separate message
and you can make it ephemeral if you want
it'd work regardless of whether the bot is actually in the guild or not, but if it isn't you can only followUp 5 times (for that interaction)
yes
still "replies to the interaction" tho im trying to make it not reply to the interaction for the second message in a DM/GC
if that's the case, it can't since it's not actually in the DM/GC
but i used the command in a DM/GC
The response.resource is null if not a reply nor update (e.g. deferReply, showModal) iirc
yes, but the bot is not a part of that DM/GC, therefore it cannot send a message to it normally aside from the interaction
user apps are limited to only what you can do with the interaction
otherwise that'd be a security nightmare
oh! hm
hey guys so my bot pings roles in a bunch of servers and i'm getting complaints from some server owners that users with the roles don't actually recieve the discord push notification for the message anyone have any ideas?
they have the role for the ping but they just don't recieve the notification. The message is still highlighted yellow and stuff
My bot sends messages with multiple role mentions in each, and I saw some user mentioning how they don't recieve notifications for the first role mentioned. Has anyone heard of similar issues?
Not specifically no, if you've set it to parse mentions correctly, and its not in an embed or something, its just push notification behaviour
there's also an embed but the actual notifications are in the content of the message
i store roles in a database and then send them using <@&[roleid]> and im just super confused why some ppl aren't getting notifications
seems like a discord thing then which is annoying. I notice in larger servers role pings aren't super reliable so I don't rlly know what to do abt this
If it works in some servers but not in others, and you're not messing with allowedMentions, then I'd assume it's just some server owners not setting up roles/permissions correctly
Just architectural scale
yeah alright i understand
push notifications aren't a super reliable mechanism, can even be impacted by app settings or battery saving settings on personal devices
i see alright well thank you for your help
let i = 0;
setInterval(() => {
client.user.setPresence({
activities: [activities[i]],
status: 'online'
});
i = (i + 1) % activities.length;
}, 5000);
this wont work..
my activities table is this
const activities = [
{ type: 'LISTENING', name: 'to Jibriel.' },
{ type: 'LISTENING', name: 'to Faisal.' },
{ type: 'WATCHING', name: 'for chammaks.' },
{ type: 'WATCHING', name: 'the falcons fly.' },
{ type: 'LISTENING', name: 'to Hussain Al Jassmi.' },
];
- I wouldn't recommend changing presence every 5s
- activity types are numbers, not strings
Not only wouldnt I recommend it, you cant ever 5s
okay thank you, where can i find the activity types? documentation?
v10: ActivityType
read more
So i literally just change it to a number, or is it an enum?
imo even 30s would be a much more reasonable approach, not that anyone will be taking a look every 5s either way
I shared the doc to the enum, which is ActivityType
It was just for testing to ensure it was looping correctly, then I was going to change to a minute, thx for ur help
Bro, Im so confused on how to get buttons on a seperate row with no text with comp v2
you just add an action row with a button to the container I believe?
I tried doing that but got "ExpectedConstraintError: Invalid Array length"
code?
and used:
const sectionButton = new SectionBuilder()
.setButtonAccessory(nowPlayingButtonRow)
.setButtonAccessory(optionsRow);
container.addSectionComponents(sectionButton);```
you cannot add two buttons to a section
so you did not try to use an action row
But how do I use action row in the section builder???
Popular Topics: Display Components
read more
you don’t
Sections are not the only component available
but those 2 rows are using action rows
ContainerBuilder#addActionRowComponents() discord.js@14.21.0
Adds action row components to this container.
thanks! it's finally working lol :)
Not sure if this is related to the library or not, but probably the best place to ask I know of...
I've updated a command to be used in DM's, allowed DM's to the bot, and updated the commands list, but I still can't see the command in DM's
are we talking about actual slash commands or prefix commands, cuz your screenshot is not an slash command
they probably have set that reply to any regular message being sent in DM to make the user aware to only use actual slash commands
documentation suggestion for @hallow horizon:
SlashCommandBuilder#setContexts() discord.js@14.21.0
Sets the contexts of this command.
SlashCommandBuilder#setIntegrationTypes() discord.js@14.21.0
Sets the integration types of this command.
afaik you need both of these in your command builder and set them to DM as well
or maybe you just need to reload your discord client using CTRL + R
I'll take a look over this, thanks
The issue I am having is the command isn't even showing in DM's
It shows in my server, Just not in DM's
I have message Intents, I've set the messageCreate event to listen for specific commands in dms, I've updated the reg-commands file for global applications...
show how you are building the command that you then register
message Intents, I've set the messageCreate event to listen for specific commands in dms
these aren't relevant for slash commands
This, actually was the issue...
I just seen it, and refreshed the discord
Thanks
dotenv@17.2.1] injecting env (0) from .env -- tip: 📡 observe env with Radar:
C:\Users\dmitr\Desktop\Новая папка\testdcjs\node_modules\discord.js\src\client\Client.js:542
throw new DiscordjsTypeError(ErrorCodes.ClientMissingIntents);
^
TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\dmitr\Desktop\Новая папка\testdcjs\node_modules\discord.js\src\client\Client.js:542:13)
at new Client (C:\Users\dmitr\Desktop\Новая папка\testdcjs\node_modules\discord.js\src\client\Client.js:81:10)
at Object.<anonymous> (C:\Users\dmitr\Desktop\Новая папка\testdcjs\index.js:6:16)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function._load (node:internal/modules/cjs/loader:1282:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5) {
code: 'ClientMissingIntents'
}
Node.js v22.17.0
You also need to set intents in the client constructor.
Popular Topics: Gateway Intents
read more
I have a problem. I want to send a message to a user on the server, but after a while, the bot says "Bot Quarantined."
Your bot has been flagged by our anti-spam system for abusive behavior. While your bot is quarantined, it is unable to join any more guilds or send any direct messages to users it has not previously messaged. If you believe this to be an error, click here and select "Appeal an action taken on an app/bot" as the Report Type to submit an appeal.
How can I fix this?
For example,
I sent a message with 30 * 1000 timestamps per timeout.
do what it says?
Bot Quarantined
Your bot has been flagged by our anti-spam system for abusive behavior. While your bot is quarantined, it is unable to join any more guilds, or send any direct messages to users it has not messaged before. If you believe this to be in error, click here and select "Appeal an action taken on an app/bot" as the Report Type to submit an appeal.
okay?
What kind of answer do you expect now
i need wait send in the user for cooldown in message
setTimeout()
hello, everytime i use my bot it tells me i exceeded my current quota (i use openai api key). are there free credits when you make a new account?
this is not support for openai
ok thanks
Hi ! how long do I have to wait before being able to use a custom emoji of my application
it's instantaneous
😕
is that a problem?
Yep, when i put :
.setDescription(<:dot: 1402278991393718273>
I have this issue (without space)
is the space in your code?
ah, nvm just saw your edit
sounds like the id or name is wrong then, the panel has a copy button you can use
Yup sorry i cant white :dot:withID
Yep i copied but idk :/
Make sure application is same where the emoji is uploaded
thanks, that was the case!
when is Presence.user null?
didn't see this anywhere on the docs so i'm not sure. and if there's some way i can easily figure out when other fields can be null, i'd love to know, because so far i've been either guessing or searching this server.
When the user isn’t cached. Usually caused by sweepers or manually uncaching users
It does say User | null in the docs and typings
Presence#user discord.js@14.21.0
The user of this presence
to be clear, i understood that it could return null.
i didn't see any information about when that would happen, so i asked here
but that's basically what i figured, just wanted a definitive answer, thanks
Prob just check the source code tbh
i was about to say that, i guess i could just read the source code, but was hoping to avoid haha
If that doesn’t answer your question, then dive into ddocs
well, thanks again for the quick response
How to add two graphics where the selection in red
SectionBuilder#setThumbnailAccessory() discord.js@14.21.0
Sets the accessory of this section to a thumbnail.
Its a thumbnail accessory from section
thank you
hello how to disable all components on components v2, I do this but it's didn't work
msg.components.forEach((row) => {
row.components.forEach((component) => {
component.data.disabled = true;
})
})
await msg.edit({ components: msg.components }).catch(() => {});
Disable like remover just add an empty array
componats: []
disabling is not the same as removing
Structures from the API cannot be edited directly. To do so, you can create a new structure (a builder) using the .from() method
const newEmbed = EmbedBuilder.from(embed).setTitle("title")
const newRow = ActionRowBuilder.from(row).addComponents(component)
that said, the above applies. you need to use the existing data, pass it to the correct builder, and then disable it. then you pass the updated data to edit()
also not every component is a row, which you should know already given you mention you're using components v2
I know I'm trying to clarify the request. Upon rereading the request, it's clear. I've misunderstood
Can you not remove buttons from a container by editing it with a new container without the button components?
Buttons can't be added to containers. They can only be added to sections as an accessory or action rows. Could you show your code in how you're replacing the container?
Just editing the reply with a new array of components which is essentially the same container just without the buttons in the sections
Is this in response to a button interaction?
No, when the collector times out
You want to use editreply. But also just know that it's only good for 15 minutes from the initial interaction
Yes, I am using editReply and the collector times out after 30 seconds
And edit reply is not removing the container as you expect? Could you share your code?
Editing the reply by passing in a new set of components should replace the previous ones. Does that not work for you?
It shouldn't remove the container, I'm editing it with exactly the same container just without any buttons in the sections
No. I think it expects a similar container? As I get this error
topaz-dev | Unhandled Rejection: CombinedError (2)
topaz-dev | Received one or more errors
topaz-dev |
topaz-dev | 1 ExpectedValidationError > s.instance(V)
topaz-dev | | Expected
topaz-dev | |
topaz-dev | | Expected:
topaz-dev | | | [Function: ButtonBuilder]
topaz-dev | |
topaz-dev | | Received:
topaz-dev | | | undefined
topaz-dev |
topaz-dev | 2 ExpectedValidationError > s.instance(V)
topaz-dev | | Expected
topaz-dev | |
topaz-dev | | Expected:
topaz-dev | | | [Function: ThumbnailBuilder]
topaz-dev | |
topaz-dev | | Received:
topaz-dev | | | undefined
That’s a validator error
We can't help you further if you don't share your code
Are you passing in an accessory component without a thumbnail or button?
This is all I'm doing:
cmd.interaction.editReply({
components: [this.getContainer(cmd, profile, false)],
});
private createQuestSection(quest: AnyQuest, withButtons: boolean = true): SectionBuilder {
const section = new SectionBuilder()
.addTextDisplayComponents(new TextDisplayBuilder().setContent(`**${quest.title}**`))
.addTextDisplayComponents(new TextDisplayBuilder().setContent(quest.description))
.addTextDisplayComponents(new TextDisplayBuilder().setContent(`-# Rewards: ${this.formatRewards(quest)}`))
if (withButtons) section.setButtonAccessory(
new ButtonBuilder()
.setCustomId(`claim-${quest.id}`)
.setLabel("Claim")
.setStyle(ButtonStyle.Success)
.setDisabled(!quest.completed)
);
return section;
}
private createEmptySection(i: number, withButton: boolean = true): SectionBuilder {
const section = new SectionBuilder().addTextDisplayComponents(new TextDisplayBuilder().setContent("**No active quest**"));
if (withButton) section.setButtonAccessory(
new ButtonBuilder()
.setCustomId(`find-${i}`)
.setLabel("Find a Quest")
.setStyle(ButtonStyle.Primary)
);
return section
}
If I’m right, sections need an accessory.
lemmi check past messages in this chat tho
So they would need a button or thumbnail? That was basically my initial question, if it was possible to remove a button from a section
.
You’re not exactly “removing” it. You’re just replacing the current components with new ones.
If you’re using a section, you can’t get rid of the button because a section needs either that or a thumbnail.
Maybe disable the button instead?
I already have disabled buttons for a different "meaning". So I guess a thumbnail of an empty png?
that could work, ye
guys how can i make my bot fetch logs correctly
Guild#fetchAuditLogs() discord.js@14.21.0
Fetches audit logs for this guild.
// Output audit log entries
guild.fetchAuditLogs()
.then(audit => console.log(audit.entries.first()))
.catch(console.error);
replace the section with just the text display
const blacklist = async (interaction: ChatInputCommandInteraction) => {
const subcommandName = interaction.options.getSubcommand();
switch (subcommandName) {
case "view":
await viewBlacklist(interaction);
break;
default:
break;
}
};
Whats the correct type for a command group interaction?
CommandInteractionOptionResolver#getSubcommandGroup() discord.js@14.21.0
Gets the selected subcommand group.
Property 'getSubcommand' does not exist on type 'CommandInteraction<CacheType>'.
That error says CommandInteraction, but your code says ChatInputCommandInteraction
and the method is in the options, not in the interaction
apologies - the command seems to fall under isCommand so using CommandInteraction which then errors, rather not typecast if I don't need to
The command is blacklist view - There are no other params or inputs
Use isChatInputCommand() instead
its not isChatInputCommand - it doesnt trigger it
it doesn't trigger the error?
it doesnt trigger any code checking under the if for isChatInputCommand
then it's not a chat input command interaction
if (interaction.isCommand()) return handleCommandInteraction(interaction);
if (interaction.isButton()) return handleButtonInteraction(interaction);
if (interaction.isChatInputCommand()) return handleChatInputCommand(interaction);
if (interaction.isModalSubmit()) return handleModalSubmit(interaction);
Unless all commands are isCommand too?
yes
that would be the issue then 😉
XCommandInteractions are also CommandInteractions
CommandInteraction is the base class
there shouldn't be any situation where you need to work with that, you should only work with its "implementations"
chat input, context menus, entry point
so if its a slash command but not a ChatInputCommand - what is it?
A slash command is a chat input command
isCommand() covers message and user context menu commands as well as chat input/slash commands and entry point commands. isChatInputCommand() is for chat input/slash commands specifically, which is what have subcommands and all that other jazz
got it
Remind me - is there an easy way to display all text channels in a StringSelectMenuBuilder in ComponentsV2
you can just use a ChannelSelectMenuBuilder, and filtering GuildText channels with .addChannelTypes(ChannelType.GuildText)
Perfect thanks!
Is there a way to not submit the input until a button is pressed? (So making a modal but with componentsv2)
input?
like a text input in a modal?
or a select menu?
select menu in a container
Would anyone be able to point me in the right direction to start with ComponentsV2?
guide suggestion for @solemn arch:
Popular Topics: Display Components
read more
you could update() make it disabled or something and then only actually do the logic you want after the user presses a button
Why would I need to make it disabled?
you don't need to, it was an idea
"disable or something", something being whatever fits your needs
got it thanks
how big of a file can a bot upload?
Same as regular user or server member
Hi peeps, My bot is setup as Public, and I have a command for users to use in DM's, For me it works flawlessly, but everyone else who has tried, it gets either "Your message could not be delivered as you dont share a server", or "Failed to respond in time" or "Unknown application" error...
Everyone whose tried it 100% shares a server, and I am unsure why they get the other errors, although it works flawlessly for me?
I also don't have it limited anywhere to just respond to me either
The first one is not the same kind of error as the other 2
I know - But I also don't get any logs output - When I add logs to try and troubleshoot
So I resolved the "You don't share a server" issue... The server they were trying to DM from, had Direct messages turned off, they joined my server, and was able to interact throguh DM's - However when they try to do the command, they got "This interaction failed"
But if I do the command, It works.
Could this be something to do with it being an "app"?
Do you happen to have the bot installed as a User Installed Application?
No - Guild installed
Strange thing, the second time they tried it, I added this logging:
console.error('[trade.js] Caught error in main try/catch:', {
error: mainError,
stack: mainError?.stack,
user: interaction.user?.tag,
userId: interaction.user?.id,
guildId: interaction.guildId,
channelId: interaction.channelId,
isDM,
commandName: interaction.commandName,
options: interaction.options?.data
});
And now they can use the command with no errors or output?
I'm so confused...
First time from joining - Interaction failed
Second time from joining (Adding above code) - Works, no errors...
is interaction withresponse same usage as fetchreply?
No. They have different return types and fetchReply makes an additional API call
whats the best i should use to react with emoji?
You should use withResponse since the other is deprecated
alright thanks
How do I clear a select dropdown if validation fails?
Is it just me or is the "Manage Members" permission just gone? I don't see any permission in the role settings to allow changing roles for users, my bot randomly started crashing because it now lacks that permission
The role to change member roles is ManageRoles
So it changed then? Because my bot did have the role and since a week it has been crashing now
No it's always been that. Have there been any changes to role hierarchy?
Edit the components in place and it will refresh selections. Can be done in an update call or through the channel/message
Nope, literally nothing changed my audit logs would know and I don't think it's manage roles because that allows you to change the roles themselves but not the roels of the users themselves
It's definitely that permission. The fact that it's combined is actually a pain point imo
Discord must have done something then because there's literally nothing in my audit log and it just randomly lost the permission (that one entry is me trying to fix it)
🤷
How do I edit the message with the componentsV2 items in - I select something in the select menu and want to edit the message
await interaction.message.edit({ components: [container] }); does not seem to work
You should be using update on the select menu interaction
thanks
Hello, please help me remove the 'started a thread' notification when the bot creates a thread, so the layout looks cleaner
// Find the original message from the interaction
const originalMessage = interaction.message;
let targetThread = null;
// Check if there is already a thread for this message
if (originalMessage && originalMessage.hasThread) {
targetThread = originalMessage.thread;
} else if (originalMessage) {
// Create a new thread if it doesn't exist yet
try {
targetThread = await originalMessage.channel.threads.create({
name: `💬 Confession Reply`,
autoArchiveDuration: 1440, // 24 jam
reason: 'Thread untuk discussion confession',
startMessage: originalMessage
});```
can i add role without fetching a member
Hrmm doesnt seem to be working - says its updated by the fields arent resetting
maybe delete that message as after creating thread
Does it matter its ephermeal?
Anyone have a clue why this isn't actually editing the message or progressing past it? No errors are being thrown at all. Basically nothing happens after the third log.
console.log("Updating ID:", discussMsg.id);
console.log(embed.toJSON());
console.log(discussMsg)
await discussMsg.edit({ embeds: [embed] });
console.log(`✅ Updated discuss embed in <#${announcementsChannelId}>`);
return true;
So the third log does happen?
Could be a rate limit
Yup. But nothing happens after that. I have tried a try/catch and other things, and nothing has worked... the code just magically stops.
I don't know if it's a rate limit either, considering this is only happening on command once in a while, and not frequently enough to trigger any ratelimits I am personally aware of. And, again, no errors are being thrown, such as the ratelimit error which I have a handler for that pings me.
Can you show code?
Someone said they used components to make this, does anyone know what type of components that this uses?? I had no idea you could do this 😭
Popular Topics: Display Components
read more
holy what this is amazing tysm
is there any way for this?
I've figured this has to do with something on Discord's end. It seems my edit requests get hung up in the ether for ages before Discord actually responds to them. I logged rest stuff for rateLimited, request, and response and the requests were properly sending, but Discord was never sending back a response.
I'm going to assume this is a Discord-side issue for now and revisit tomorrow to see if it's still having problems.
If you're talking about the thread bubble underneath the starting message in the main channel, I don't think you can delete that. But you can delete the thread created (type 18) message
okay, it worked, thanks
Ok quick question, is there a way to make it so when I make a new Button or component that can run a callback (i.e. Buttons, SelectMenus, etc), they are stored in a collection and the time the message / interaction was sent so then I can check if that specific button from that message / interaction has overlapped an allotted time, we no longer allow the function to run?
This idea just came to me because I was thinking of a way to solve the solution when clicking on a button after restarting the bot can cause the bot to either be out of sync or the function can't get internal saved information since it restarted
well it's not something related to the discord api but more of a programming question, so the answer is usually yeah, you can do most stuff you can dream of with programming
you're not constrained to what the discord api offers, that's entirely backend logic
that's some form of persistence though, so you'll need to store that data in a db or something
if you want more details you can ask in #1081585952654360687
Does the messageUpdate event also trigger when like an reaction is added?
No. That’s a separate event
(event) Client#messageReactionAdd discord.js@14.21.0
Emitted whenever a reaction is added to a cached message.
Is client.guilds.fetch gonna fetch latest guild members too? Or how does that work
you need to explicitly fetch members for that
uh im having an issue with ContainerBuilder with sections, it just physically won't allow me to send a interaction reply with this setup
const container = new ContainerBuilder()
.addTextDisplayComponents(
textDisplay => textDisplay.setContent('# An Error Occured!'),
)
.addSeparatorComponents( separator => separator.setSpacing(SeparatorSpacingSize.Large), )
.addSectionComponents(
section => section
.addTextDisplayComponents(
textDisplay => textDisplay.setContent('Dude please work'),
)
);
await interaction.reply({
components: [container],
flags: MessageFlags.IsComponentsV2,
});
It's giving me these errors:
sections are required to have an accessory
if you just want a text display, just add it directly to the container
documentation suggestion for @sweet flax:
ContainerBuilder#addTextDisplayComponents() discord.js@14.21.0
Adds text display components to this container.
Ah i wasn't thinking about TextDisplayContainers as being multiple even though it had add infront of the function 😭
Ok is it possible to disable the formatting in the textDisplayComponents?
Unless you are stuck with formatting no matter what
What formatting? It's text
Format it however you like, what am I missing lol
You can escape formatting characters with backslashes if that's what you're looking for
oh thats cool to know
am i able to make multiple events, commands and handlers in single file? just like cogs
the User class doesn't have the primary guild upon fetching the user?
that is correct?
If you are talking about all this tag stuff, that will be in the next release.
isn't there any dev builds that i could use?
You can install discord.js@dev, yes
ty
i installed it but the bot doesn't start for some reasons
once reply is deferred, you can actually editreply more than once?
thought u had to use followup
editReply edits the reply, so sure? xD
followUp is just for sending a new reply
see pins in #djs-in-dev-version
Sorry for the delay
import { AnySelectMenuInteraction, ChannelType, MessageFlags, PermissionsBitField, User } from "discord.js";
import { getConfig, updateConfig } from "../utils";
import { fetchChannel } from "../../utils/fetchChannel";
import { client } from "../../index";
import { getConfigMessage } from "./getConfigMessage";
export const updateConfigHandler = async (interaction: AnySelectMenuInteraction) => {
if (!interaction.guild || !interaction.inCachedGuild()) return;
const { customId } = interaction;
const currentConfig = await getConfig(interaction.guildId);
const value = interaction.values[0];
if (interaction.isChannelSelectMenu()) {
const channel = await fetchChannel(interaction.guild, value);
const container = await getConfigMessage(interaction.guild);
const hasPerms = channel
?.permissionsFor(client.user as User)
?.has([PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel]);
if (!hasPerms || !channel || channel.type !== ChannelType.GuildText) {
await interaction.update({ components: [container] });
await interaction.followUp({
content: "I do not have permission to send messages in this channel.",
flags: [MessageFlags.Ephemeral],
});
return;
}
}
const camelCaseName = customId.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
// @ts-expect-error Type mismatch, but we know it's correct
currentConfig[camelCaseName] = interaction.values[0];
await updateConfig(interaction.guild.id, JSON.stringify(currentConfig));
const container = await getConfigMessage(interaction.guild);
await interaction.update({ components: [container] });
};
any way to get these 2 flags? (quest and orb)
no
You can write your whole bot in a single file (altho that goes against SOLID). Djs is a library, not an opinionated framework.
(altho that goes against SOLID)
Good thing you don't need to follow SOLID
Well, yes. But u should 
meh
I want to ask whether gradient role can be done in DJS?
not yet. May be added in the next version
Not "may", it will be added in the next version
Ah ok
Is there an event for when a poll vote is received
documentation suggestion for @dense kiln:
(event) Client#messagePollVoteAdd discord.js@14.21.0
Emitted whenever a user votes in a poll.
Thanks
what discord Discord API or Discord Developers
Developers
If I edit a message to @mention a user (edit due to deferReply)
Will the ping be silenced
As editing a ping into a message obviously does not ping
Some users reported the bot doesn't mention them and I have an assumption its that
it is yeah
That's a huge design flaw and incredibly stupid omg
Considering Discord practically forces you to deferReply if you're doing any validation via a db, I can't initially ping a user before running my checks
Use a followup message
you could use a regular .reply(“${mention}”); as well
as long as its within the 3 seconds
Yeah but we don't know the user until after running a database query
In addition to edited messages not pinging, the deferred message is probably already marked as read so it wouldn't show up as an unread ping either
That might work
ah yeah then the follow up edocsil mentioned should fit better, but do know that a .followUp() after a .deferReply() will work as a .editReply()
any additional .followUp() create a new message, just not the first one after defer
Huh
So the first followUp is practically the same as a normal edit
if you deferReply yes
Oh mah gawd
you could just editReply and then followUp if thats the thing you want out of it
And if I editReply() first?
Or do I really have to do a random followUp edit to send my actual followUp
no you can editReply first
Ok good
Or just don't defer and reply -> followUp. First one can be ephemeral if you want to reduce clutter
"Searching..."
"Found @ user"
Or whatever you're trying to do
Yeah discord also silently added the ability to delete empheral messages shortly after releasing them so I could just delete it
Gotta love those useless 3 API calls
I thought that always was possible, deleting ephemeral replies
Nah i tried it shortly after slash commands released and it wasn't possible, and since then I lived with that belief, till recently 😭
I think it just returned a message not found
Makes sense, as the message doesn't really exist on discords end
what channel should i put it at
implementation detail kept for backwards compatibility with other systems
i recommend not relying on it, not because it's going away - it is not, but because it makes no sense semantically
a followUp is supposed to be an additional source message
anyone have a like website to design these like message component embed things bc they look pretty cool
how can i change the permssion for an channel Thread so that only specific users/roles can see and write something in their?
Not really a thing on a thread-by-thread basis, other than changing send permissions for the parent channel or adding/removing members from private threads. Or locking it I suppose
oh okay thanks
awesome ty
I’ve been trying to create a ticket and ad mod bot w cgpt
I also tried to use components v2 to no success (cgpt doesn’t know about those I believe)
Does anyone think they could help me convert it into components (and other bug fixes)?
im sorry, no
we help with discord.js issues and questions, not really do it for you
especially if you didn't even make the code yourself
Hello, I'm running into a little wave here when trying to implement ComponentsV2 utilizing djs.
For context, I do have my own ContainerBuilder class, however, that is not the issue as all it does is unify the way components are added. In addition, I did in fact try the native ContainerBuilder with the same result.
I receive the following error:
Error: Expected a string primitive
at _StringValidator.handle (file:///C:/Users/User/Documents/GitHub/SU/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:2607:70)
at _StringValidator.parse (file:///C:/Users/User/Documents/GitHub/SU/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:964:90)
at TextDisplayBuilder.toJSON (file:///C:/Users/User/Documents/GitHub/SU/node_modules/@discordjs/builders/dist/index.mjs:1635:33)
at file:///C:/Users/User/Documents/GitHub/SU/node_modules/@discordjs/builders/dist/index.mjs:1797:64
at Array.map (<anonymous>)
at ContainerBuilder.toJSON (file:///C:/Users/User/Documents/GitHub/SU/node_modules/@discordjs/builders/dist/index.mjs:1797:35)
at C:\Users\User\Documents\GitHub\SU\node_modules\discord.js\src\structures\MessagePayload.js:151:46
at Array.map (<anonymous>)
at MessagePayload.resolveBody (C:\Users\User\Documents\GitHub\SU\node_modules\discord.js\src\structures\MessagePayload.js:150:49)
at MessageContextMenuCommandInteraction.reply (C:\Users\User\Documents\GitHub\SU\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:198:56)
heres the code line in reference:
const container = new ContainerBuilder().addTextDisplayComponents(
new TextDisplayBuilder().setContent(
["**Message Report**", "-# Does this message violate the server rules? Tell us how!"].join("\n"),
),
);
this is crafted right before its sent off to Interaction#reply with no alteration, heres that line:
interaction.reply({
components: [container],
flags: MessageFlags.IsComponentsV2,
});
Edit: It's worth noting, at error start I was running v14.14 and as part of debugging, I did cleanly install latest; same problem.
Edit 2: I'd like to mention, without using the Container component, the message will post just fine; it's only when utilizing the container that the issue occurs.
any help is appreciated, thanks y'all :)
TextDisplayBuilder.setContent takes a String, not Array
It is intaking a string as seen with Array#join
but thank you for taking the time to reply anyway, much appreciated
for allowedMentions, what is the difference between parse and users
It's worth noting, at error start I was running v14.14
given components v2 wasn't yet supported in that version, I'm curious, did you have@discordjs/buildersinstalled separately?
how are are you importing the builders?
Correct me if I'm wrong but /builders should be refreshed with the clean install I did of djs entirely, no?
users lets you specify specific ids of users you want to be able to mention. parse lets you enable all users, all roles and/or everyone mentions
And how to use parse to disable mentions? parse: ["roles", "everyone"]
Like this?
and heres that import for you
That would allow all roles and everyone, but no user mentions
thats from my altered ContainerBuilder class but the context is the same
that's not what I'm asking about
if you were using v14.14 but were already writing code with components v2, I'd guess you had @discordjs/builders installed separately and were importing the builders directly from there rather than from discord.js
- we recommend not installing /builders separately
- importing directly from /builders rather than djs also happens to result in djs not recognizing the class as the same builder, so it uses the wrong object as the builder data resulting in your error
Great, and here is with everyone?
Yes
Ok thx
unless I'm wrong, v14.14 did have components v2 support because the builders existed when it was updated whenever that was
You're wrong
i see
then I must be getting the version wrong, it was prob 14.15
14.19.0
^-^
well either way its latest now
either way, your issue is caused by importing the builders from @discordjs/builders rather than discord.js
alright, I appreciate that brother thanks for your help
What does bulkDelete(number, filterOld) the filterOld do? Does it filter out messages that are over 14 days and only delete the ones UNDER 14 days?
yes that's correct
Ok thank you
The docs dont tell you that 😂
Duck, I do not mean to insult your intelligence in any way however, I'm baffled that was the issue. Again, I'd like to apologize and say thank you for taking the time to reach out. I don't entirely understand why /builders is installed alongside djs when it has this type of behavior but either way, thanks for the help.
D.js adds helpers to certain methods
This’ll prob change in the future tho
Yeah, I've gathered they aren't too concerned about it anymore if it has buggy behavior like that. Certainty a head scratcher...
is the char limit of a container also 6k?
Quick question but does message.interactionMetadata exist on every interaction even if its like way back and already answered or just on pending interactions that are currently being processed?
exists on old messages as well, I just fetched it from a 2 months old message
Ok then my question is: Can I somehow check if a message is a currently active interaction?!
iirc the limit is 4k across all text inputs
ty, my worst enemy
define "active"
like one that was defered and is currently "thinking" and does not have sent a response
there is <ChatInputCommandInteraction>.replied
but idk if that boolean will be true when deferred
as you also have <ChatInputCommandInteraction>.deferred
thats why #deferred is also a thing 
Yeah but deferred isnt avalible on message.interactionMetadata
yeah so that means you could do
if (interaction.deferred && !interaction.replied)
{
// whenever its in “bot is thinking” state
}
no need to look in the interaction metadata, use this snippet instead
...I think you dont unterstand...or you are using a deprecated version. Like message.interaction is deprecated. and message.interactionMetadata should be used
check if message flags has MessageFlags.Loading
Well this should work I guess haha 😂 thank you
you just need to set a different accent color
ContainerBuilder#setAccentColor() discord.js@14.21.0
Sets the accent color of this container.
or, if you want to remove it, use #clearAccentColor()
thx lemme give a try
what is there
Im really not sure what you are referencing in this screenshot
like the bg that orange thing
where is that orange 😭
on the right 
check this
The ping markdown
LOL THE PING?! 
^ You can be pinged within containers

tag suggestion for @tropic yoke:
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"] } }


I thought we were talking about the container accent color since that was yellow too ._.
i was stupid sry
lool
i already disabled this thing from client lol
seems like thats not helping
the thing is it's not a message.reply im sending that msg with channenl id
that doesnt matter, the message posted above is not just about reply
show what you have configured
working fine now just used this
await channel.send({
components: [container],
flags: MessageFlags.IsComponentsV2 | MessageFlags.SuppressNotifications,
allowedMentions: { parse: [] },
});```
Why is this happening?
you haven't deferred/replied before using editReply
you can't edit a reply once there wasn't an initial reply first
I have replied though
then show us? the images you provided only shows an .editReply()
how can i solve this warning
tag suggestion for @mighty wyvern:
The fetchReply option when replying to an interaction will be removed in v15.
- {..., fetchReply: true}
+ {..., withResponse: true}
```This returns an [InteractionCallbackResponse](https://discord.js.org/docs/packages/discord.js/14.17.3/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
thanks
I dont see you replying
line 11
not what the error is about
the error complains about 106 which is a different handler
oh yh
@soft lance whats on uddelleenliity.ts line 106
this is uudelleenliity.ts
line 106 has break; so no
all I can think of is that buttonpart has interaction as param, and you only use interaction.editReply() in that section
and no interaction.reply() or interaction.deferReply()
but I can't do that because i'm editing the same message as earlier?
then use interaction.update() instead
Okay
Is it possible to open a menu from a componentsv2 button?
what menu?
and buttons behave exactly the same
modal i mean
the only thing cv2 did was add display components and ids
no behavior changes
you can still do what you were able to do before and can't do what you weren't able to
const dmChannel = await <member>.user.createDM()
const sentMessage = await dmChannel.send({ components: [container], flags: [MessageFlags.IsComponentsV2] })
const collector = sentMessage.createMessageComponentCollector({
componentType: ComponentType.Button,
time: 60_000 * 5, // 5 minutes
max: 1,
})```
this collector would **end ** after either 5min or one interaction correct ? or does it always end after 5min and i need to use the <collector>.on("collect", <function>) for a direct use of the interaction ?
The former
But you do need to use the collect event. You might want to use awaitMessageComponent(...) instead
ok ty
||guys I was programming a bot for discord in discord js that sends the notification on a discord channel every time someone in a streamer list goes live like notifyMe does. As a bee I used tiktok-live-conncector but it doesn’t go.
we don't offer support for other packages. if it's an issue with their package, i suggest you contact them via their npm page/repo, or you could show code and issue in #1081585952654360687 . if it's an error coming from d.js, then post your code and error here
Hi,
I just saw a bot pass a clickable element in an embed that fills the user's message input with a slash command on click.
How to do that, and does it support prefililng parameters as well ?
Thanks
looks like an embed, is a container display component
Popular Topics: Display Components
read more
I think they are talking about </command_name:command_id>
you meant something like this?
if so: can be done using the syntax I said above -- and it does not allow you to put in prefilled options (at least I couldn't make it work for me lol)
That's it, thanks
Is there a nice way to update an existing client object (that's initially not "ready") with the <true> generic to mark the nullable fields as nonnullable?
as in new Client<true>()
What are you trying to do
Or where
Just wanting to be able to access values like Client.user without it possibly being null, and afaik, creating a new client with <true> does that
No, creating a new client does not take a generic, and neither does it ever log in, so you have a different Client instance that has no data
Are you trying to access that in some code/function of yours, or just in an event listener
The source has this
class Client<Ready extends boolean = boolean> extends BaseClient
Okay, but that's not how that works
You setting true there will not log the client in
I know that. I'm wondering how to update that value after it logs in
In events it should already be marked as ready
If you're taking Client somewhere in your function parameters instead of Client<true>, you can either change that, or use the typeguard
Client#isReady() discord.js@14.21.0
Returns whether the client has logged in, indicative of being able to access properties such as user and application.
I've seen that. Just don't want to have to check that value before every single time I access a nullable value
It's a typeguard
Are you using typescript?
I'll see if I can rework my code for this though
If you return / throw / whatever if it's not ready, the type will be narrowed already afterwards
That's how typeguards work
does deleting a sticker or emoji also delete their image urls, or are they kept in cache for some time?
const name1 = member1.nickname ?? member1.user.username;
const name2 = member2.nickname ?? member2.user.username;
what would be command for my actual name? so not destiezk.dev which is my username, but destiezk
user.globalName
Or use displayName which uses globalName if available but falls back to username if it isn't for whatever reason
globalName can be null so I suggest that
The delete event removes from cache
Unless you're asking about discord itself
In which case - they are impossible to delete and stay up permanently
You can't send new ones with that id, but the emote will continue existing in existing messages
my bot just died for no reason, it doesnt respond to any command, and theres no error on the terminal
Does it just not respond or has the process actually died?
does not respond
Network issues most likely
what do you mean?
after trying to switch fetchReply with withResponse I get this error Cannot read properties of undefined (reading 'first')
because the promise resolves into a different object, it's not a message
The fetchReply option when replying to an interaction will be removed in v15.
- {..., fetchReply: true}
+ {..., withResponse: true}
```This returns an [InteractionCallbackResponse](https://discord.js.org/docs/packages/discord.js/14.17.3/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
Can you listen to client.on('error') and client.on('warn')
why does that link take me here?
memes, apparently 
InteractionCallbackResponse discord.js@14.21.0
Represents an interaction's response
okay so how do I use this to get the image link now?
the tag explains how to get the message, then use it like you were using it before
what is .resource
the callback resource, the docs explain what each property is
if thats the callbackresource why is there also InteractionCallbackResource do I need to use that instead?
resource: InteractionCallbackResource | null means there's a property called resource, which is of type InteractionCallbackResource or null
nothing
won't be null for this case though
so you restarted and it still isn't answering? doesn't sound like a network issue but a code issue
i did, multiple times
Show your code
Preferably your command/interaction handler and an exemplar command
theres no errors, that what is throwing me off. i have no idea what's wrong. not even /ping works
this just tells me message is unreadable
the property is in the response
it's not a static property on InteractionCallbackResponse
the tag has an example
this is why you use TS
to be precise, <InteractionCallbackResponse> means "an instance of InteractionCallbackResponse", which would be your replyMessage (which is a missname since it's not a message, it's a response)
copied directly from the docs. the ping command example doesnt work, which is weird since it was working before
Can you show it anyway
after a user adds my bot to a guild, is there any way to get information about the guild my bot was just added to? i feel like discord used to expose a guild_id in the callback url params, but can't seem to find any info on this now
i need to keep track of what guild a user added the bot to in a database so that I can authorize any commands received from guild id xyz
the guildCreate event emits the Guild object
but what do you mean by "so that I can authorize any commands received from guild id"
Yeah that last part doesn't really make sense
I'm assuming you're talking about adding guilds to guild scoped commands but idrk why you would want that
https://pastebin.com/Ntj4QtN4 this is index.js
and your interactionCreate listener?
so I need to make reply message an instance of InteractionCallbackResponse?
No
it's an instance of that already
type casting doesn't exist in javascript anyways, so you can't make something an instance of another thing
my fault! i have an external userbase and am building a discord bot that my users can add to their own servers. in my database, i need a way to connect each user to whatever guild they add the bot to so that when the bot receives a command from some guild:
- I'll be able to authorize that guild by checking if it exists with some user in my db
- i'll be able to use the guild id to fetch external data about the user associated with that guild id (the functionality of the bot depends on which user it was added to)
in other words, if the invite link gets exposed, anyone can just add that bot to their server - I want to prevent the bot from being functional in any server that wasn't added my one of my users
I figured it out
you could just fetch the guild on guildCreate, if it doesn't exist in your db, leave it
so my plan here was to expose the invite link in my product's dashboard with a callback url. then after a user adds the bot to a guild, they're redirected to my product with a guild_id that I can verify and save
i'm struggling with understanding where/when to even store the guild in my db
I'll be able to authorize that guild by checking if it exists with some user in my db
I meant, don't do this check when you receive a command, just do it when you join the guild
since the bot isn't going to be functional anyways you can leave directly
hmm, I maybe I worded that confusingly. my issue is with actually linking my external user with the guild id (see red text in image).
i assume that, typically, authorization would be done with some kinda /authorize command where the user would input an API key or secret (where the bot would then fetch the user from the api key and link the guild with this user).
but i'm trying to avoid this by just linking the guild with a user right after a user adds a bot to a guild (since the user is already signed in on my product dashboard, I know I can trust them)
the guildCreate event wouldn't have any information on my user, so I wouldn't be able to link the guild with the user
if the user is the guild owner, you get that info as well in the Guild, if not then maybe you could wait a bit (since event order isn't guaranteed) and then check audit logs (but your bot would need permission to read them), and those would show who invited the bot
in both approaches you'd get both the guild and user id, then you should be able to associate both with an account you stored
if you go for the second approach you can specify the default permissions in the invite, if it somehow doesn't have them you could leave and maybe send an info message to a channel where you have permission to send messages
How likely is it that a channel ID can match a user ID?
0%
Snowflakes are unique
*unique within their scope
there are no 2 users with same ID
but there are servers and channels with the same ID
deploy-commands.js stuck on 'Refreshing 48 application commands', client id, guild id, token are all set properly, same deploy-commands.js in guide
been like this for 10 mins, it used to work
maybe you're ratelimited? do you run it on start or very frequently?
module.exports = async (interaction) => {
const topUsers = await getTopCatCoinUsers(leaderboardLimit);
const leaderboardContainer = new ContainerBuilder();
for (let i = 0; i < topUsers.length; i++) {
const user = topUsers[i];
const member = interaction.guild.members.cache.get(user.userId);
const memberIconUrl = member?.displayAvatarURL() ?? defaultAvatarUrl;
leaderboardContainer
.addSectionComponents(
section => section
.addTextDisplayComponents(
textDisplay => textDisplay.setContent(`${i + 1}. <@${user.userId}> (${user.userId})\n - **Cat Coins: ** ${user.coins} ${catCoinEmoji}`)
)
.setThumbnailAccessory(
thumbnail => thumbnail.setURL(memberIconUrl)
)
)
.addSeparatorComponents(smallSeparator);
}
};
Quick question, since there is a 40 component limit, wouldn't this be valid if I am trying to display the top 10 users? I'm trying this with a 10 person leaderboard but it's saying my components can't exceed 40, as far as I can tell each iteration should add 4 components, so in total it'd be 40?
the container also counts
ah makes sense, thank you 
could be... how long do rate limits last?
you can see it by logging on rateLimited
rest.on('rateLimited', console.log)
by default the manager will wait until the ratelimit expires then re-send the request, and only then the promise will resolve
you can use the rejectOnRatelimit option to make it reject instead, you can also log it if you want since it accepts a callback
RESTOptions#rejectOnRateLimit discord.js@14.21.0
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
passed to the REST constructor
DB file exists: false
📦 Loaded 48 commands.
🔄 Refreshing application (/) commands...
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1369038912684691456/guilds/1356734866628153495/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: '3e32a240d3716487d7d8f6dae6c54f6b',
limit: 2,
timeToReset: 59808,
retryAfter: 59808,
sublimitTimeout: 0,
scope: 'user'
}
yeah you're ratelimited
from that log it sounds like you're doing it on every start, don't
i'm not, i just had to update my bot a lot in the past hour
just wait then
59808 is millisecond?
meaning like a aminute-ish
yeah, about 1m
it's been a minute, and it went up to 59824 ;-;
actually 3 minutes it's been
What on earth are you doing to hit this limit that badly
maybe it goes up if you still make requests
so how long do you recommend i wait? 10 min?
all i know is that i'm running deploy-commands a lot in the past hour
I mean 1m should be enough, but you shouldn't time it precisely, just wait for a bit, a minute goes by without noticing
but why
updated a lot of commands names and descriptions, made like around 10-20 ish commands
Discord says the retry-after is in seconds, so thats at least 10 minutes
59000 seconds?
16 goddamn hours?!
nah it shud be on MS not seconds
Its a weird rate limit response
i retried after 3 mins
It says your limit is 2, which cant be right for a whole day
the thing is why r u running that many deploys to trigger a rate limit
^^
iirc there's a daily limit but that's for amount of commands, not for amount of requests
just work on some other stuff, you can try again tomorrow
if you're not deploying on start that shouldn't be an issue
it's not on start
then work on something else for now
there's really not much you can do when hitting a ratelimit except wait
thing is i've finished all of my stuff and it's 2.30 am
i'm just gonna wait 20ish minutes cause i need the bot started now
Okay yeah confirmed we emit in ms
Youre not individually deploying them to multiple guilds or something are you?
no just one guild
Okay fuck is discord doing
It's been 5 minutes and it's just gone down to 59811
Limit's still at 2
The limit wont change
Why though?
We dont know we arent Discord
Kinda seems like something is spamming way more requests than you think
{"message": "401: Unauthorized", "code": 0}
So whatever was going on was bad enough to get the token revoked
So I have to make a new token?
yes
The thing that was going on was I was running it like 10 times in 5 minutes
Bot's still up though? I use Railway
@unique shoal Went down to 45164.
📦 Loaded 48 commands.
🔄 Refreshing application (/) commands...
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1369038912684691456/guilds/1356734866628153495/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: '3e32a240d3716487d7d8f6dae6c54f6b',
limit: 2,
timeToReset: 45614,
retryAfter: 45614,
sublimitTimeout: 0,
scope: 'user'
}
okay, theres still nothing we can do
Hey guys, I'm getting a 37-1 hour rate limit from defer reply commands. The commands that don't use a reply or use a PATCH request will go through, while messages that needs to be edited via interaction is completely rate limited, basically locking out most of the commands that the bot has.
[SHARD 2] REST Debug: [REST 3d2712a9e4fe17cc9d3fed4a8e672e5f:1376145557487226912/aW50ZXJhY3Rpb246MTQwMzE3ODc5MzE4Njc1NDY5MTpaQXlnY21lWEgwSUJMdWU5S3dzcDBqdDRnQVRpdWFNeElUN0dDZFVtSHBRTExTYlYzSWZhejh6Ukxwd0JOd0xvQ3hrVURLN0FlZk5saVZoOHRyS0VEaFNiZEsyRE1sSGNkOXhBM1hmbzJDVFRaZEtsaXpnSnhLa0tzRmNyd1k2cg] Encountered unexpected 429 rate limit
Global : false
Method : PATCH
URL : https://discord.com/api/v10/webhooks/1376145557487226912/aW50ZXJhY3Rpb246MTQwMzE3ODc5MzE4Njc1NDY5MTpaQXlnY21lWEgwSUJMdWU5S3dzcDBqdDRnQVRpdWFNeElUN0dDZFVtSHBRTExTYlYzSWZhejh6Ukxwd0JOd0xvQ3hrVURLN0FlZk5saVZoOHRyS0VEaFNiZEsyRE1sSGNkOXhBM1hmbzJDVFRaZEtsaXpnSnhLa0tzRmNyd1k2cg/messages/%40original
Bucket : /webhooks/:id/:token/messages/%40original
Major parameter: 1376145557487226912/aW50ZXJhY3Rpb246MTQwMzE3ODc5MzE4Njc1NDY5MTpaQXlnY21lWEgwSUJMdWU5S3dzcDBqdDRnQVRpdWFNeElUN0dDZFVtSHBRTExTYlYzSWZhejh6Ukxwd0JOd0xvQ3hrVURLN0FlZk5saVZoOHRyS0VEaFNiZEsyRE1sSGNkOXhBM1hmbzJDVFRaZEtsaXpnSnhLa0tzRmNyd1k2cg
Hash : 3d2712a9e4fe17cc9d3fed4a8e672e5f
Limit : Infinity
Retry After : 1111050ms
Sublimit : 1111050ms
Scope : user
(This is not an actual discord webhook rather a webhook from interaction route i assume )
Is there a way to resolve this other than to remove DeferReply () as we think thats causing the issue as u would also need to edit the reply... the bot is also in over 43k servers that might be one of the reason for the heavy traffic.
This doesnt quite look like discord.js rate limit output, you might be better off asking Discord Developers. Seems unusual
its from using REST debug or listening to rate limit events
There's not much we can do either way, discord.js just responds to what Discord provides
Right, so in order for these rate limits not to trigger we just gotta remove the editReply() part right
I can't really answer that, but no, I wouldnt think a single edit on a single defer per interaction should ever be causing this
We are using a single defer per command
This is really outside what we can support with, I suggest you try Discord Developers server
the commands that don't use a deferreply, or a patch request goes through instantly
ddevs would be a better place to ask, but afaik each interaction has its own ratelimits, it'd sound like you're using editReply too much for a given interaction
or its not a command and its an actual webhook
in which case it'd sound more likely to get a ratelimit
can i not defer then show a model
a bit confused because i havent made any changes to my bot recently but it suddenly stopped working, were there breaking changes to the api?
answered my own question Showing a modal must be the first response to an interaction. You cannot defer() or deferUpdate() then show a modal later.
weird how i didn't have this issue before
Nope, that's always been the case
for database is sqlite3 decent enough?
before i made python bots, but since a week or so im using discord.js V14 with the componentsV2 stuff
but before i used aiosqlite
dont know if that matters that much
Its fine
As in, they both good enough or does it like not really matter
It's the same thing really
A wrapper for sqlite, which is the actual database
It's absolutely fine, if you want to continue using SQL
I find MongoDB works very well with js, might want to give it a try
I have been using MongoDB for about 18 months on our bot, and its absolutely perfect, I think we got 3k members bots in 4 guilds atm and working solid!
meaning mongo has bigger database?
im bad with using correct terms lol
mhm i can have a look at it, but not for now i guess
I just use the free tier stuff currently and nothing has failed/and we store a lot of details/images/transcripts etc
how can i use applications? like these
Other Interactions: Context Menus - Registering context menu commands
read more
whats difference channel.position and channel.rawPosition ?
former: calculated, tries to emulate the order of channels you see in the left pane
latter: a mess (as returned from the api)
certain channel types are forced to be ordered after others if in categories, multiple channels can have the same position, even if in the same category
categories have their own order and their children start from 0 again, etc. etc.
trying to filter though all text channels and sort by their position but even fetching each channel there are duplicate position numbers. how to fix this?
tried normal position and the rawPosition but both have same issue
I keep getting this error
(process:14784): Pango-WARNING **: 14:09:33.428: couldn't load font "Headliner No. 45 Not-Rotated 50px", falling back to "Sans Not-Rotated 50px", expect ugly output.```
#1081585952654360687 as that looks like canvas and definitely not djs related
flags: MessageFlags.IsComponentsV2
this no longer works?
It does