#djs-help-v14
78874 messages · Page 38 of 79
Because users are stupid and cant work out to press the message icon - Apparently theres also a bug on ios that the message icon isnt working
and none of that is anyhow fixable by you or us
I was wondering if all the commands dont work in dms if the button still shows
Yes, the button will disappear if no commands are allowed in DMs
Appreciate it thanks so much for the help
Hey sorry I looked at the docs but I still can't seem to understand how to actually make the collector last, I understand how to make it work for a while when the bot is on but not to make it last and keep on collecting even when I turn the bot off
there is a function to check someone's server tag?
User#primaryGuild discord.js@14.22.0
The primary guild of the user
@waxen comet ^
tysm @dense jackal
you shouldn’t use any collector if you need to last it forever including restarts
it was Mark but sure np 
I see so there is an event to see when an interaction is made, do buttons count as interactions in this case? And also I'd filter with that button with it's id
yes, button presses, menu selecting and modal submitting are all interactions that will emit the interactionCreate event
along with the slash commands and context menu commands (right click on message/user > Apps)
In this case what is the exact event is it interactionCreate?
yes
client.on(“interactionCreate”, (interaction) => {
if (!interaction.isButton()) return; // Block all non-button interactions
if (interaction.customId === “myButton”) {
// Do stuff whenever the button with custom id “myButton” is pressed
}
});
Appreciate it, have a good one

Just another question is there a way to see if a button already exists through it'd ID?
exists where
just like if that button already exists
ok, but exists where
within a server
no
there's no button search
Alright thank you for your help
when i try to run ping command, it shows "The Application Did not respond" here is my index.js
const path = require('node:path');
const { Client, Collection, GatewayIntentBits, MessageFlags } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.commands = new Collection();
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
client.login(token);```
can you help me pls?
do you have an interactionCreate listener
i have it
can you show it?
i have a index.js already
we know that since you've shown it
Is it possible to add an empty embed field?
one way or another, yeah
here in the interactionCreate file:
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
}
}
},
};```
and what happens in your console when you run the command
i restarted the bot, and i try to run the command, the error pops out for no reason
"There was an error while executing this command!" error
and what about the question?
hey is it possible to use the discord api to update user's profile avatar / banner?
ClientUser#setAvatar() discord.js@14.22.0
Sets the avatar of the logged in client.
// Set avatar
client.user.setAvatar('./avatar.png')
.then(user => console.log(`New avatar set!`))
.catch(console.error);
ClientUser#setBanner() discord.js@14.22.0
Sets the banner of the logged in client.
// Set banner
client.user.setBanner('./banner.png')
.then(user => console.log(`New banner set!`))
.catch(console.error);
the 14.22.0 release i can for example see how mush users uses my server tag?
assuming the user has to be on the guild to use the tag, you could filter the guild.members.cache by the tag data and check the size (if they don't have to remain on the guild to continue using the tag, then there's no way to check, but tbh that makes no sense. i have no further knowledge of tags though)
thats for the bot itself right i'm talking abt actual user's
no, you can't edit another user. that would be atrocious
what makes you say that? why would it be atrocious? the user clearly has to authorize first
because it has far-reaching implications and would be ripe for abuse. user data is global data, why not change the username to a slur or something else malicious, put them at risk for being actioned? same for the avatar. you might not do this, but another app may, or your app could even be compromised and do that to users who authorized your app to be able to change that data
i mean discord already has a endpoint for it
"current user"
if you want to edit another user maybe you can do so through oauth with that endpoint, just guessing though
that'd be a question for ddevs
yeah, that's the endpoint the client.user.setAvatar() uses
Is there any way to make a Discord button always reply ephemeral at creation time (like .setEphemeral(true)), instead of deciding inside the interaction handler?
-# Ping me when you reply!
it isn't
Ohh. you mean, there is no way?
yeah sorry, meant it isn't possible
Then, any ideas to override on button set time even?
you could add something in your customId that marks your button as ephemeral and then make your replies ephemeral if they have it
but imo it's much more convoluted than just replying ephemerally normally
ah okay i see thank you
Because, we need the same message shoudl be displayed dynamically in different situation.
-# Anyway, Thanks for helping me out!
Any way for a webhook to like publish announcements automatically in an announcements channel?
webhook is not a member in a server to be able to have permissions to do so
Hello, does anyone know why everything works on the local server, but on the VDS the application does not respond? It worked before..
make sure there's no error while starting the bot, and also that you have the correct token
Anyone know what the DiscordjsErrorCodes or similar is for the cannot dm this user
Found it i think, RESTJSONErrorCodes.CannotSendMessagesToThisUser
Say I make a container with a text display with id 1, and retrieve access to the container's message somewhere else, how could I get get the content of the text display with id 1? (At least I assume that's what that ID is for?)
you'd iterate through the components array of the container
and yes, that's the purpose of the id
Oh actually that leads me to a different question, is it possible to do it somehow if it's ephemeral? cause last time I did something along those lines I encountered not being able to access the "message" class of the ephemeral response
you can access it normally, you just can't use it as a regular message (eg fetch, delete, etc)
i want a filed image to media builder for V2but it wont be a valid URL so if i do
await interaction.reply({ files: [attachment] });``` will it attach like a Embed setImage? from attachment if i use "://attachment" thingie
I see I see, thanks
I have another question actually 😓, say I have a container with a button that summons a modal, from the modal submit interaction, would it be possible to retrieve the message that the button was attached to?
Or would I have to just save a reference in memory
interaction.message will work
on the modal interaction?
Yes
does it just propagate somehow from wherever the modal response got sent?
S
Discord provides the message
alright
thanks
What things can I add in SectionBuilder? Can I add a menu or something similar?
no, sections can only have text displays and buttons/thumbnails as accessories
what function so that only administrators can see these buttons? approve suggestions and reject suggestion
ContextMenuCommandBuilder#setDefaultMemberPermissions() discord.js@14.22.1
Sets the default permissions a member should have in order to run this command.
What is the max length of a Text Display ?
The limit is 4000 characters total across all text display components in a message
how do you "embed" commands in a message (generally).
I apologise if that's difficult to understand but i'm referring to when I see a command within a bot reponse like
/help
that i can click on and have it run that command, clickable commands in bot messages
🙌
can you parse command options to almost "template" the command
so if i were to embed that slash command in the message, could i embed it with options already filled out
You can't per-fill options
Edit: I guess other than subcommands
how do i host a bot 24/7 for free, not just like expensive ones like Google Cloud
hello i wanna ask if there any idea about sync the data 1 by 1 ?
like after changing roles of someone by any member
then refresh cache of the bot automatic
optimized plan
i want plan guild roles, members roles, members nickname
caching
If you have the GuildMembers intent, you will already receive an updated guild member when you update their roles, and it would be automatically cached
Better in what way?
by using await but on deferReply makes sense, thanks tho
How long do I have to wait for global commands to be deployed?
It should only be minutes at most. You may need to restart your client Ctrl+R
would it be possible to get the bot owner directly from discord.js?
not as in hardcoding it
ah ty
why is this showing N/A members on roles where there are
how to make slash commands show only in specified channel and not in all channels? what function
The members who have that role aren’t cached
You can fetch all members from the guild beforehand
ah ok
A bot editing slash command permissions in a guild requires OAuth2
this is already done, most players see commands in channel #chat, but we need to make sure that these commands are seen in channel #bot commands.
That would be a server setting, then - servers can set their own command permission overrides.
how can i showoff my bot commands like that
it's only for verified bots and you don't get to choose them, it's automatic
my bot is verifiedd
ok ty i was looking everywhere to set them
and you don't get to choose them, it's automatic
i have a command that takes two inputs - two players, for comparison, and since it can be search by last name, there can be multiple results for each of the inputs. what i have right now is, if theres multiple options for either player 1 (p1) or player 2 (p2), the user gets a button menu to select their desired option from, but i cant figure out what to do if theres multiple options for both p1 and p2. any guidence on where to go with this?
players from an outside game or discord users?
if the latter you can simply use two user options
how to map over a member's roles in order? when I do just member.roles.cache.map it's not ordered by priority
you’re in the wrong server, sorry
If by "priority" you mean hierarchy, sort it by their position
Collection#sort() discord.js@14.22.1
The sort method sorts the items of a collection in place and returns it. The sort is not necessarily stable in Node 10 or older. The default sort order is according to string Unicode code points.
collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
Role#position discord.js@14.22.1
The position of the role in the role manager
player ie. hockey players
tryna make a util bot for sports
ah, well you could make it an autocomplete string option
maybe force the user to select one choice by replying with an error if they don't
mmmm wouldnt that be problematic bc im tryna handle a database of around 6000 hockey players
How can I know the current server tag using discord.js? I just found how to know an user primary guild tag.
Cant see why it would be, thats exactly what autocompletes are for
Im not sure thats exposed, I dont see any changes to the Guild class in the PR for user tags

how to find /test if this command is not in my scripts?
What do you mean?
/test
Yes
this cmd is not in my scripts
You can fetch either guild or global commands to find it
Or just use our deployment script which overwrites commands
everytime i run the /ping command in my bot, it shows this:
interactionCreate code:
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
}
}
},
};```
have you checked the console for the error you're logging?
Well thats your own error message, which it will send no matter why it throws
i checked it's not defined
?
i just fixed it by adding
const { MessageFlags } = require('discord.js');
nvm it fixed
That... uhh okay well as long as its fixed
also, how do i host a discord bot 24/7 for free, because the others are expensive
leave your pc running
There are no good free hosts
ok
You can find good ones for under $5/month
k
is it my scripts? what if this /test slash-command is not in my scripts?
Then it isnt in your scripts
But it once was, and has been deployed
So you need to delete it, or overwrite it
Slash Commands: Deleting commands - Deleting specific commands
read more
can they be in the node_modules folder?
no lol
unless you really fucked up hard
commands stay deployed regardless of what your files are
discord has no way to know what's on your pc
like monbrey said, you deployed it once and it's still there, you're either not deleting commands that aren't in your files anymore (you're not using rest.put()) or you're deploying globally and it's deployed on the guild (or viceversa)
everytime i run /gif command it shows: "The application did not respond" error
code:
module.exports = {
data: new SlashCommandBuilder()
.setName('gif')
.setDescription('Sends a random gif!')
.addStringOption(option =>
option.setName('category')
.setDescription('The gif category')
.setRequired(true)
.addChoices(
{ name: 'Funny', value: 'gif_funny' },
{ name: 'Meme', value: 'gif_meme' },
{ name: 'Movie', value: 'gif_movie' },
)),
async execute(interaction) {
const category = interaction.options.getString('category');
// category must be one of 'gif_funny', 'gif_meme', or 'gif_movie'
},
};```
that seems expected?
you aren't replying
yes
then what's the issue?
this was a rhetorical question just in case it wasn't understood
i try to run the /gif command and it shows "The application did not respond" error
and what did I say?
yes, I understand that, and I've answered to you
you aren't replying
because i was out
I'm not sure what you're expecting it to show
I meant that you aren't replying to the interaction
if you don't reply, it will say you didn't reply (respond)
simple as that
yeah
if you know that then what's the issue
reply to your interaction so it won't say you didn't reply
do i need to put "await interaction.reply"?
yeah but not just that
you need an actual reply
your entire execute code only gets an option, nothing else
it doesn't reply with anything
Ok
Hey so I am trying to use the message collector (promise based one) but I keep on getting the issue ```bash
response.resource.message.channel.awaitMessages({ max: 1, time: 30_000, errors: ["time"] }).then((collected) => {
^
TypeError: Cannot read properties of undefined (reading 'message')
This is my code ```js
await interaction.reply({ content: "Hello", withReply: true }).then((response) => {
response.resource.message.channel.awaitMessages({ max: 1, time: 30_000, errors: ["time"] }).then((collected) => {
console.log(interaction);
}).catch((collected) => {
interaction.followUp("No one replied");
});
});
``` I can't seem to find out what could be causing it as I'm just trialing code from the guide
The option is withResponse
Not withReply
Alright could I use an await message collector within the dms of a user as well?
Sure
You can use a message collector in the DMs between the bot and the user, but not in other people's DMs, I don't believe
Yeah thats what I mean between a bot and the user
Okay i've used almost the exact same code in the dms (it sends a dm to a user then tries to collect message from it)
await interaction.user.send({ content: "What is the reason for this message?" }).then((response) => {
response.resource.message.channel.awaitMessages({ max: 1, time: 30_000, errors: ["time"] }).then((collected) => {
console.log(collected);
}).catch((collected) => {
console.log("Looks like no one replied this time.");
});
});
But now I seem to the get the issue ```bash
node:events:496
throw er; // Unhandled 'error' event
^
TypeError: Cannot read properties of undefined (reading 'message')```
You're forgetting that the whole response pattern is for using the withResponse option in an interaction
Sending a DM to a user is not an interaction
I see, how would I go about achieving this in DMs then?
send() resolves with the message itself, not a response
So remove all of that response.resource stuff
DMChannel#send() discord.js@14.22.1
Sends a message to this channel.
// Send a basic message
channel.send('hello!')
.then(message => console.log(`Sent message: ${message.content}`))
.catch(console.error);
Okay thank you very much
DMChannel#awaitMessages() discord.js@14.22.1
Similar to createMessageCollector but in promise form. Resolves with a collection of messages that pass the specified filter.
// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
channel.awaitMessages({ filter, max: 4, time: 60_000, errors: ['time'] })
.then(collected => console.log(collected.size))
.catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
Wait sorry I forgot this but to read DM messages do I need a specfic intent?
To receive direct message events on "messageCreate" with your bot, you will need:
- The
DirectMessagesgateway intent - The
Channelpartial setting
Alright got it thank you very much appreciate it
Hey sorry to bother you again, but with the awaitMessages how do I exactly read the message response from the user in dms?
awaitMessages returns a collection of the collected messages
What would be the property to find these collections of messages?
property?
Its just the return value
oh wait nvm I didn't see taht in the log my mistake thank you very much
is there a way to make the thread message like ephemeral? So that the only included users will se it
Slash Commands: Command response methods - Ephemeral responses
read more
(node:36460) Warning: Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.
why does it keep saying that
because it's true!
The ephemeral option when replying to an interaction will be removed in v15
- {..., ephemeral: true}
+ {..., flags: MessageFlags.Ephemeral}
``` Read [here](<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR>) on how to specify multiple flags
instead of
flags: MessageFlags.Ephemeral
can i do flags: 64?
I mean it's just an enum for better readability
and less typos
~~Finally new components for modals! https://github.com/discord/discord-api-docs/pull/7773~~
#archive-offtopic for off topic
oops
you would need to return a boolean and use the function as an if condition for the last line
so something like this:
export async function <functionName>(args) {
...first line
if (!guildSearch.logging) return false
...rest of the code
.catch(){
...
await interaction.channel.send({embeds:[embed]})
return false
}
return true
}
...
const result = await <functionName>
if(result) {
await <channel>.send()
}
yeah I did that. forgot to delete the OM 😅
Can you have permissions for buttons?
you'd have to do the check from the button submission event and send a custom (maybe ephemeral) message as response
there is no permission native to who can use a button, if you can see it you can click it
-# unless it's disabled / you are timed out / the thread is archived
Alright thank you, just curious how would I go about seeing who in the server has admin privillages
ButtonInteraction#memberPermissions discord.js@14.22.1
The permissions of the member, if one exists, in the channel this interaction was executed in
Popular Topics: Permissions
read more
Alright thank you, is there anyway I can loop over all members in the guild
why is that needed? what is your usecase?
Does discord js has a builder for PrimaryEntryPoint commands?
Can component texts present in inline?
but if it is true, i guess we cant keep the button on align?
They don't have an inline option
👍
Error starting application process: CombinedError (2)
Received one or more errors
1 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ButtonBuilder]
|
| Received:
| | undefined
2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ThumbnailBuilder]
|
| Received:
| | undefined
at _UnionValidator.handle (/Users/devyxi/Desktop/Coding/Adminium/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1965:23)
at _UnionValidator.parse (/Users/devyxi/Desktop/Coding/Adminium/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at SectionBuilder.toJSON (/Users/devyxi/Desktop/Coding/Adminium/node_modules/@discordjs/builders/dist/index.js:2169:37)
at /Users/devyxi/Desktop/Coding/Adminium/node_modules/@discordjs/builders/dist/index.js:1870:64
at Array.map (<anonymous>)
at ContainerBuilder.toJSON (/Users/devyxi/Desktop/Coding/Adminium/node_modules/@discordjs/builders/dist/index.js:1870:35)
at /Users/devyxi/Desktop/Coding/Adminium/node_modules/discord.js/src/structures/MessagePayload.js:151:46
at Array.map (<anonymous>)
at MessagePayload.resolveBody (/Users/devyxi/Desktop/Coding/Adminium/node_modules/discord.js/src/structures/MessagePayload.js:150:49)
at DMChannel.send (/Users/devyxi/Desktop/Coding/Adminium/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:191:61)```
what's the problem cause Im currently using components v2
You have a section without an accessory
ahhh ok. mb lol
When will the API be updated for #discord-dev-news message?
The API is already updated for those changes... If you mean when will DJS have those changes? When it's ready, there's still months before it's mandatory anyways, so they're likely waiting
where's the docs for components v2, i can't for the life of me figure out how to use separators
I meant discord.js indeed :)
MessageManager#fetchPins() discord.js@14.22.1
Fetches the pinned messages of this channel and returns a collection of them. The returned Collection does not contain any reaction data of the messages. Those need to be fetched separately.
// Get pinned messages
channel.messages.fetchPins()
.then(messages => console.log(`Received ${messages.items.length} messages`))
.catch(console.error);
Already there and released
How can i achieve this for subcommands?
</command subcommand:id>
my confusion is the name lookup part
Subcommands are options of the base command
hm oki
.
Popular Topics: Display Components
read more
If you want a guide, not just docs
finally, gives me code
thank yiou
in v15 the code style and formats will be changed like from v13 to v14?
there are breaking changes, yeah, that's the point of major releases
mostly builders v2 and removal of deprecated elements
(for now, there could be more in the future)
But there is no v15 yet, so the question is hard to answer apart from a vague "yes"
ok
js discordbot2 % node delete-commands.js DiscordAPIError[50035]: Invalid Form Body application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake. command_id[NUMBER_TYPE_COERCE]: Value "commandId" is not snowflake. at handleErrors (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:762:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async SequentialHandler.runRequest (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:1163:23) at async SequentialHandler.queueRequest (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:994:14) at async _REST.request (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:1307:22) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Invalid Form Body', code: 50035, errors: { application_id: [Object], command_id: [Object] } }, code: 50035, status: 400, method: 'DELETE', url: 'https://discord.com/api/v10/applications/undefined/commands/commandId' } DiscordAPIError[50035]: Invalid Form Body application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake. command_id[NUMBER_TYPE_COERCE]: Value "commandId" is not snowflake. at handleErrors (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:762:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async SequentialHandler.runRequest (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:1163:23) at async SequentialHandler.queueRequest (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:994:14) at async _REST.request (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:1307:22) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Invalid Form Body', code: 50035, errors: { application_id: [Object], command_id: [Object] } }, code: 50035, status: 400, method: 'DELETE', url: 'https://discord.com/api/v10/applications/undefined/guilds/1375115092773044224/commands/commandId'
Hi,
I keep running into this problem when i try to delete commands, tried researching and looked and used the code from discord.js
Whatever you're passing for the application ID in your request is not valid. Likewise with your command ID
I dont have a application id listen in my config.json file though
That'd be your problem then
Put one into your config.json
💀 im dumb af
my application id is the same as my client and guild id
Your application/client ID should not be the same as your guild ID
They should most definitely be different, because they are different things
thats what it says on discord developr page
The developer page does not have guild IDs listed anywhere in it as far as I know
question, im looking to privatise a couple commands to a private server but keep the rest global, i looked up and it says "you have to delete form global then register to guild" but i only know how to removall all commands by a empty array, how do i tell it what to keep as global and what to delte then turn to guild?
ApplicationCommandManager#delete() discord.js@14.22.1
Deletes an application command.
// Delete a command
guild.commands.delete('123456789012345678')
.then(console.log)
.catch(console.error);
Delete the specific commands by their ID instead of doing a bulk-delete
ok, then how do i target it to be guild only?
Deploy them again to that specific guild
Creating Your Bot: Registering slash commands - Guild commands
read more
do i add a in the command data if its guild
No, this is all you are required to do in order to deploy and use commands in a specific guild rather than globally
got a reference error for some reason
ok, but, would it deploy all at guild this is where im ripping hair out, i want to have "application panel" for example as a guild one whiles having all the existing non senstive to the development still global,, but then again, would i beable to direct a "/guild-commands" folder in the guild deploy ig? as it will still be commands
its just i have a command disabler which does check user ID to my ID but at the same time it just would look out of place for a maint command on global
would it deploy all at guild
If you're asking if it deploys to all guilds your app is in, no, it deploys to the guild whose ID you provide when deploying. If that's not what you're asking, I'm afraid I'm not quite understanding your concern
would i beable to direct a "/guild-commands" folder in the guild deploy ig? as it will still be commands
That is entirely up to you regarding how you handle deployment and storage of your command data & logic. d.js does not try to shoehorn you into any specific way of deploying commands and how you organize them
container.addSectionComponents(
new SectionBuilder().addTextDisplayComponents(
new TextDisplayBuilder().setContent(
`# ${nickname ?? user.displayName}\n${user.username}`,
),
new TextDisplayBuilder().setContent(`ID: ${user.id}`),
),
);
Are you unable to put two textDisplay's beside each other, mimicing inline fields, I guess
no
so you are able to?
any reason why reaction.message.author.id would be null/undefined at the author part?
you can’t, no
ah thank you
TypeError: Cannot read properties of null (reading 'id')
Found it matched this part
I also add this at the top of my event
async execute(client, reaction, user) {
if(user.partial) return;
if (!reaction.message.inGuild()) return;
The message is a partial
Oh i forgot to mention i have these as well
if (reaction.partial) {
try {
await reaction.fetch();
} catch {
return;
}
}
if (reaction.message.partial) {
try {
await reaction.message.fetch();
} catch {
return;
}
}
That's not gonna actually patch the properties inside reaction.message as far as I know. Would need to actually take the return value of fetch() and use that
so like let message = reaction.message
if(partial) message = await reaction.message.fetch()
type thing
cool thanks
why do we have multiple methods to add components to a container, and not a generic .addComponents() method? just curious
how do i access userPremiumType or premiumType, I see it's relating to APIUser so I wonder if i'll have to do some direct API fetching here?
it's only accessible over oauth2 with the identify scope afaik
Can’t have the builder pattern with a generic function
wasn’t that the case with the ActionRowBuilder then 🤔
yes, which is why ActionRowBuilder is being changed in builders v2
or at the very least, it's getting addXComponents methods
I do notice addComponents still seems to exist
cool, good to know
The class/constructor had the generic. Which always was a pain
so when builders v2 comes out, the generic will no longer be necessary because of the addXComponents methods?
ActionRowBuilder has no generic in v2, correct
It was a wrong assumption in the first place based on that there was only one component type that doesn't take the whole row
whats a user friendly way to let a user friendly compare a number?
for example, what i've done is taking a string like "<5" and parsing it and then checking if the stat value is lower than 5
now i need a user friendly way to do this with dates
i came up with "<[25y 7mon 6d]" but its gotta be a little hard to implement
is there a better way to ask the user for a date? and then potentially an operation?
if its inside a slash command option you could make use of 3 integer options “day” “month” and “year”
sadly discord hasnt got any sort of calendar component yet
its inside of an options array inside an option already, i cant make more slash command options because that would make too much clutter
we should go back to prefix commands ffs
you can’t have options in options?
or are you talking about subcommands and subcommand groups
its like i made them like that, like you split parens and i parse them kind of things
oh but you can change your current string option to be replaced with 3 integer options right?
not really, that wouldnt work and i want all the parts to be available, even hours and minutes if possible
slash command can have up to 25 options so you should have plenty of space left
slash commands are so damn limiting man
not at all
its so slow and theres so much clutter
there is absolute zero difference in this and a prefix command regarding speed and clutter
bro i have tried everything i possibly could.... but i cant add a file display component to my message. Im using a discord cdn url to upload the file with the message and i have a name set for the attatchment. wtf is the url i need to use for the file component so it uses the file i uploaded???????
i tried things like: attachment://[original-dicsord-cdn-uel], attachment://[last-path-argument-of-cdn-url], and attachment://[attachment-custom-name]
i assume web urls differ from relative path urls as shown fromhttps://discordjs.guide/popular-topics/display-components.html#file
im genuinly confused please help....
attachment:// is only if you are uploading something via the files property. If you're just using a CDN link, then you don't need to prefix it with attachment
im using that cdn url to reupload it and set a new name for the file as it seems the file component cant set the file name. The reason why im doing this btw is because the cdn url comes from a command attatchment argument and i need to have the file in a certain name format.
is it because the file name has spaces? i would rather to keep the spaces
CombinedPropertyError (1)
Received one or more errors
input.url
| ExpectedConstraintError > s.string().url()
| Invalid protocol for file URL. Must be attachment:
|
| Expected: expected to match a URL
|
| Received:
| | 'attachment://Y3@T [144 BPM - C# Minor] - Vaisonic.mp3'
at _ObjectValidator.handleIgnoreStrategy (file:///app/node_modules/.deno/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2119:72)
at _ObjectValidator.handleStrategy (file:///app/node_modules/.deno/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1983:47)
at _ObjectValidator.handle (file:///app/node_modules/.deno/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2089:17)
at _ObjectValidator.parse (file:///app/node_modules/.deno/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at FileBuilder.setURL (file:///app/node_modules/.deno/@discordjs+builders@1.11.3/node_modules/@discordjs/builders/dist/index.js:1585:36)
at file:///app/src/lib/utility/createPostMessageContainer.ts:68:39
at resolveBuilder (file:///app/node_modules/.deno/@discordjs+builders@1.11.3/node_modules/@discordjs/builders/dist/index.js:2224:12)
at file:///app/node_modules/.deno/@discordjs+builders@1.11.3/node_modules/@discordjs/builders/dist/index.js:1795:75
at Array.map (<anonymous>)
at ContainerBuilder.addFileComponents (file:///app/node_modules/.deno/@discordjs+builders@1.11.3/node_modules/@discordjs/builders/dist/index.js:1795:56)
With Containers, is it possible to send an (image) attachment in the same reply as the Container? I am hitting a bit of a wall trying to, but perhaps I am misunderstanding the implementation of Containers.
if you're using components v2, you can only use display components
that being said, you can just have a media gallery after the container
btw i tried uploading the file with the name having _ instead of spaces, and it still cant find the attatchment. bro wtf
I imagine the issue is the @
you'll want to url encode the filename first
From the discord API docs
Images can also be referenced in embeds using the attachment://filename URL. The filename for these URLs must be ASCII alphanumeric with underscores, dashes, or dots. An example payload is provided below.
https://discord.com/developers/docs/reference#uploading-files
then nevermind on the encoding, doesn't sound like they'd accept % either
so i need to url incode it like the person said above?
no, you'll need to rethink the filename format
i mean the field is litrally a url so why wouldnt it aloow url encoded text
I am unsure, I can't test it right now
ill try url encode it
so i got it to work with no - and stuff, url encoding seems to not work. Also: Not only do i have to potentially rethink how my bot names files, but after ALL this time, i find out apparently audio files dont have previews in display components!!!! Which is A REQUIRMENT for my bot btw... what do i do? do i just revert back to normal messages without components v2 (which i only find out about today and i really like them)?
yes, there's no current solution
a file component doesn't support previews, it's just for arbitrary files
and url encoding doesn't work since, as mentioned, % isn't an alphanumeric character or an underscore/dash/dot
does media gallery work with audio files?
nope
bruhhhhhhhhhhhhh
at most you could send the audio file in another non cv2 message
in message.mentions.members, if you mention yourself it wont be in there right?
why wouldn't it be there
tbh i could do that but i was using v2 components for main reason to have the file inside a container component with other information in one spot
if the message actually mentions <whoever>, that <whoever> is in that Collection
cuz you mention yourself. i think its like that in parsedusers im not sure
well, mention yourself
the message will have yellow highlight
fair
Can I ask question?
Can I add thumbnail? In this ?
containers don't have thumbnails
this is nothing that required pinging me specifically for help
Thanks
Not sure why this doesn't work help please. uses Components v2
please be specific as to what isn't working.
It wont send the message at all
does the event fire at all?
Yes I have this line of code in index.js
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}```
that's just your event handling. this doesn't exactly mean that the event is being executed
is this line of code logging in your console when a new user joins the server?
No.
right below async execute(...) put console.log('test')
you can simiulate an event by emitting it like so
client.emit('guildMemberAdd', member)
name: Events.GuildMemberAdd,
async execute(member) {
console.log('test')
try {
// Check if we've already processed this member
if (processedMembers.has(member.id)) {
console.log(`Member ${member.id} already processed, skipping`);
return;``` Like this right?
yes
Yeah no it didnt work
if the "test" doesn't log, then the event isn't running
do you have the GuildMembers intent?
No, thank you I just added it. Testing now
please do not use language like that
Okay, but still didn't work
did you enable the GuildMembers intent in the dev portal?
Wait I forgot to save it works!!!
oh great
is there a utility function that takes in a hex code and can return a number that we can provide to accent color for container?
No but Javascript does have parseInt
so just parseInt the hex?
With a base of 16, yes
parseInt("FFCCAA", 16)
I think that should work
thanks
You can also use hex number notation without conversion, 0xFFCCAA
ah ok
resolveColor discord.js@14.22.1
Resolves a ColorResolvable into a color number.
pretty sure you meant that?
oh there you go
this only takes in one of the ColorResolvables though, not any hex code
also why am i getting this error?
data.components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
"HexColorString" is a ColorResolvable though
Youre not setting the IsComponentsV2 flag
if you mean just the hex code without the #, looks like it also accepts that
it's not reflected in typings
so how would i pass in a string then? like a clean hex
just pass it
unless you use ts then you'll need to type assert
Hi,
How to edit a followUp ?
Thanks
editReply
.editReply({ message: followUpMessage, … })
If editReply edits the followUp, does that mean if there was a reply before the followUp then the reply can no longer be edited ?
No. None of that is related to each other
You can still use editReply normally to edit the original reply
How do I choose which I'm editing, given than editReply isn't a method of Message but Interaction ?
followUp returns a Message
Yes
You use that in editReply to edit the follow up
If you want to edit the original message, you don’t specify the message in editReply
editReply doesn't take a Message parameter, only string | MessagePayload | InteractionEditReplyOptions
Yes it does
InteractionEditReplyOptions.message
Ohh
Nice, thanks
I wonder why not just mapping Message.edit(content) to Interaction.editReply({ message, ...content }) though
because then you wouldn't be able to edit them after 15m
Would anyone know as to why this is only being limited to 1k? ```js
const guild = await client.guilds.fetch(interaction.guild.id);
const bans = await guild.bans.fetch();
that is discord’s limit
Oh
Is there any way to make it show over 1k though?
it’s per call afaik, but i’m not 100% sure on that
Alr
How the hell do you handle interactions after 15m without putting your entire codebase in client.on wraps?
What's the issue you're having?
you can't handle an interaction after 15m 
quick question... is there a way to change server traits and banner via the discord api?? and if so is it in djs yet?
nvm ill just check myself
server traits are undocumented
Guild#setBanner() discord.js@14.22.1
Sets a new guild banner.
guild.setBanner('./banner.png')
.then(updated => console.log('Updated the guild banner'))
.catch(console.error);
for the latter
last time I checked discord was deciding whether to keep traits in the first place
yeah, i doubt bots will ever be able to change traits
but how about banner colors, like you canc haneg the banner color and use banner images if ur lvl 2
theyve been out for long enough, i hope they added a way for bots to select the color.. but its one of thoose features where they may take awhile to add it or never add it
is there a way to change if the server is private or not via bot
how about guild tags..
😭
image format????? gif??????
wait no im dumb
bots cant change guild tags ether... what a prison.... i still wanna read user pronouns, badges, and discriptions via normal bots
why?
banner color?
Hey how would I get the role provided from this I know it's interaction.options? But what comes after options?
getRole
Slash Commands: Parsing options
read more
Alright, I've tried get role but for some reason it still tends to return null, when I try to log it
you misspelled administrator in your option name (addRoleOption)
change it and deploy your commands
Oh sorry I didn't clock that my bad
no worries
Sorry to bother you again, but for threads is their anyway to add roles instead of members within threads?
Ping the role in the thread
CombinedError (2)
Received one or more errors
1 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ButtonBuilder]
|
| Received:
| | undefined
2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ThumbnailBuilder]
|
| Received:
| | undefined
But, you know, even in the discord js template, they given as ButtonBuilder.
and you didn't give it anything
What's the way you ping roles again?
<@&role_id>
Or just role.toString() if you happen to have it
Thank you
if a message component collector ends due cause it's time has expired then what would be the value for endReason
time
oik
Why am I getting a type error here?
Is this the correct type for the interaction object, when receiving the interaction over http?
import type { APIInteraction } from "discord-api-types/v10";
if you write interaction inside the case 5: block and hover over that word, you’ll see that interaction is still from type APIInteraction
are you using d.js library?
only "discord-api-types" which is also from djs
can you check if a simple if (interaction.type !== 5) break; will fix it
switch statements and typeguards are sometimes not working properly idk
Oh yes I just noticed the previous cases don't have a break
thank you!
ahh that might be the issue
overlooked that too actually lol
I’m already using it
could be you have client.on(“ready”, () => {}); somewhere else in ur project
shouldn’t pop up if the old event name isn’t anywhere in your project
No, just once
Can you show your code for the ready event? Also your event handler
I use commandkit
Doesn't mean you can share your code, and if your events are handled by commandkit, check with them how they are doing it and if they have update their code to remove deprecated events
Oh ok
Does anyone know what's wrong about this embed?
Specifically the author.
As soon as I add that, I get a "encountered one or more errors" error when the bot tries to send the embed, without any clear info on what's wrong...
//send a warning message both to all channels the filter deleted messages in and the log (if it exists)
let warnemb = new Discord.EmbedBuilder()
.setAuthor({name: `⚠️ A user triggered the scam prevention filter`, url: `msg.url`})
.setTitle(`⚠️ Do NOT click any links from recent messages!`)
.setDescription(`A user has triggered the scam prevention filter. Recently posted links may be dangerous.`)
.setColor(`#f55742`)
.setFooter({text: 'A.C.I. Security can make mistakes. Moderators have been informed.'})
The error should tell you what's wrong, it's not so clear though, can you share the full error here?
Sure, one second!
oh god i think i just saw it
yeah i used 'msg.url' instead of msg.url
Seems like you wanted to do ${msg.url} and just forgot to hahah
yeah haha
can custom emojis show in modal question titles? like "Who is this?
"
I don't think so, no.
My bot isn't responding to DM.
I have
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
Am I missing something else?
Can u share more code, where it should respond to DMs
Isn't responding how? The 1st intent is unrealted to events, 2nd is for dm. Show your full code
To receive direct message events on "messageCreate" with your bot, you will need:
- The
DirectMessagesgateway intent - The
Channelpartial setting
@grave willow ^^
this may sound insanely stupid, but i've seen specifically a discord bot named Dyno that has basically the same "message commands" as the slash commands (for example, you can use the ban slash command or the message ?ban)
is there some way i can kinda replicate the system on my own bot? i'm just trying to experiment with it and to see what i can do with it
Team, whats the "Set a channel status", can someone give me a quick help ❤️
https://discord.js.org/docs/packages/discord.js/main/VoiceChannel:Class Cant for the life of me find it here
listen to both “messageCreate” and “interactionCreate” events, parse the options/arguments from message commands (slash commands don’t need this as its already done by discord), make your execution method accept both structures of data
thats about it actually
hm, i'll try to figure out a simple system for this
tag suggestion for @lusty bramble:
discord.js does not support features until they are officially documented.
While there might be a way for these features to work, it can change at any time without any notice
sorry trying to figuer out this issue
https://voidbin.com/paste/3fe7cfbf-b6d8-4637-a479-51dd65258d29
[ERROR] August 24th 2025, 9:36:42 am [FrostSentinel.GuildCreate] ❌ Failed to create FrostSentinel setup in guild: undefined - TypeError: guild.channels.create is not a function
could you provide the full stack trace of the error
yay let me remove logger and i will send
TypeError: guild.channels.create is not a function
at Object.guildCreate (/home/shawnhamby/Documents/Projects/FrostSentinel/src/bot/events/guildCreate.ts:34:43)
at FrostSentinelClient.<anonymous> (/home/shawnhamby/Documents/Projects/FrostSentinel/src/bot/handlers/eventHandler.ts:39:54)
at FrostSentinelClient.emit (node:events:518:28)
at module.exports [as GUILD_CREATE] (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/discord.js/src/client/websocket/handlers/GUILD_CREATE.js:30:14)
at WebSocketManager.handlePacket (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/discord.js/src/client/websocket/WebSocketManager.js:351:31)
at WebSocketManager.<anonymous> (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/discord.js/src/client/websocket/WebSocketManager.js:235:12)
at WebSocketManager.emit (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/@vladfrangu/async_event_emitter/src/index.ts:513:28)
at WebSocketShard.<anonymous> (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/@discordjs/ws/src/strategies/sharding/SimpleShardingStrategy.ts:32:47)
at WebSocketShard.emit (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/@vladfrangu/async_event_emitter/src/index.ts:513:28)
at WebSocketShard.onMessage (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/@discordjs/ws/src/ws/WebSocketShard.ts:640:10)
The file you linked is guildCreate.ts?
yup
if you log guild on line 32 what does that print
its a blank line no code
I mean using console.log(guild) what is printed out to console. as I believe guild is being passed undefined
could you also provide the code where guildCreate is used
u think i see my issue it calling client in guild
let me try one thing
it’s cache.create
cache.create is not a function on Collection.
guild.channels.create is the correct function to create a channel
Hey everyone! My current discord.js version is ^14.14.1, and I’m considering updating to the latest one. Could anyone help me out by pointing out any major changes or breaking updates I should be aware of?? There have been quite a few releases..
no it’s not
yup that was issue
Create is not on collection
https://discord.js.org/docs/packages/discord.js/14.22.1/Collection:Class
it’s on the GuildChannelManager class
which cache returns
cache is a collection on the channel manager?
look at the docs
🥴
i can also agree with mafia i read the docs i was doing it right that is why i needed help
Anyone?? 
The only changes I can think of that are breaking are to typing around components v2 affecting messages
Currently I don't have any plan to use them
im very sorry, i confused myself
no, but if you are getting components from the message like button or select menu and updating them it may affect your code
Oh! Means I have to go through the releases 
Thanks Mafia! I really appreciate 👍
You can update right to the latest. you may just need to add some typegaurd stuff
when mentioning an amount of users in a server and that mention appears as "unknown-user", is there a definitive fix for that, or is it soely dependant on which users are cached for the person viewing the message?
I don't have many things in the code, just replies, messages sending and few components..
I think the update will not break the code
If the user mention is parsed that I believe the viewing client will cache the user but other wise yes
so - there is no way in my code to "force" the mentions to appear for all users
sound like, To reword what I was saying the "change are only breaking if you are parsing a message"
by default all mentions should be parsed
let's say it was a leaderboard command that mentions the top 100 message users in a larger server, can I force resolve those mentions for those that view my bots message
it's appearing as "unknown-user" for some people and I imagine it's a cacheing issue
also if it an embed. the mentions are not parsed in the embed
it's cv2
than it should, could you share the send/reply function where the message is sent
I meant in the code
(for me)
await interaction.guild.members.fetch();
const memberNames =
role.members.size === 0
? "N/A"
: role.members.size > 10
? `${role.members
.map((member) => `<@!${member.user.id}>`)
.slice(0, 10)
.join(", ")} ...`
: role.members.map((member) => `<@!${member.user.id}>`).join(", ");
(previous to this we were just using member.user)
I am looking for ineration.reply. as a side note <@!USER_ID> format is deprecated I would recommend using member.toString()
hello, is there any way for me to "acknowledge" an interaction, without replying to it? basically i want nothing to show up after executing the command, not even a confirmation message or anything
without showing The application did not respond
only way i thought of doing this is to send a dummy reply and then delete it
Hello! I want to ask if it is possible to add a select menu to the modal window.
It's best practice to give some type of feedback that the interaction was executed successfully. If you don't want that message to contain relevant information then it's best to just be like action completed successfully in a ephemeral message
yes, the feedback is there, just not in the reply
Not currently
Could you elaborate a little further? Is this for a Slash command, context command or a component interaction?
It's a shame, but thank you for your reply! 💙💛
im unsure of what the end goal is here? you could reply ephemerally and there would not be a visible message to other users but outside of that i dont think there is any way to achieve this
basically im doing a github issues style task management bot that is super specific for my use case. when you add a new issue, a new thread for that issue is generated and a big message containing a list of all issues
so pretty much the feedback is the thread being created and the list updating, sending a message just to say "created successfully" would be distracting
Yeah but that would be the correct response. Create an ephemeral message that says that the issue was created and potentially a button linking to the message where it's tracked or thread
that would also be a good idea
button and select menu interactions (but I think select menus are less relevant in this case) have a way to not reply anything at all
ButtonInteraction#deferReply() discord.js@14.22.1
Defers the reply to this interaction.
// Defer the reply to this interaction
interaction.deferReply()
.then(console.log)
.catch(console.error)
sent the wrong one hold on
ButtonInteraction#deferUpdate() discord.js@14.22.1
Defers an update to the message to which the component was attached.
// Defer updating and reset the component's loading state
interaction.deferUpdate()
.then(console.log)
.catch(console.error);
that still shows an error but after a while, wouldn't recommend using it for that since it's not what discord intended and they were already answered with a better idea
How do I do this for command groups?
const parts: string[] = command.split(" ");
const topCommand: ApplicationCommand | undefined = commands.find(
(c) => c.name === parts[0],
);
if (!topCommand) return `No command found with name "${command}"`;
const { command: deepCommand, id } = getDeepCommand(topCommand, parts);
const description: string =
"description" in deepCommand && deepCommand.description
? deepCommand.description
: (topCommand.description ?? "No description");
return {
components: [
new ContainerBuilder()
.setAccentColor(0x0494e4)
.addTextDisplayComponents(
new TextDisplayBuilder().setContent(
`</${parts.join(" ")}:${id}> — ${description}`,
),
),
],
flags: MessageFlags.IsComponentsV2,
};
};
I'm having no luck with this
use that function from discordjs to format it
I foudt it
documentation suggestion for @unique mountain:
chatInputApplicationCommandMention discord.js@14.22.1
Formats an application command name and id into an application command mention.
in raw text it looks like this </name subcommand_group subcommand:COMMAND_ID> The Id is the same for all subcommands and subcommand groups
this isn't true
I'm sure it references the parent ID, so for commands, it's own id, for subcommands, the command ID (same twice) for grouped commands, the subcommand group id
API Reference - Message Formatting
read more
it is true
Subcommands and subcommand groups can also be mentioned by using respectively
</NAME SUBCOMMAND:ID>and</NAME SUBCOMMAND_GROUP SUBCOMMAND:ID>.
yeah
afaik subcommands and subcommand groups do not have a separate id
correct
then why saying Mafia said something that isn’t true?
</name subcommandgroup subcommand:0> this is a valid format
can you use emojis in autocomplete similar to select menu emotes?
nvm u can't
can you not have a button + thumbnail in a section? its only displaying the thumbnail
you cannot, you can only have 1 accessory
whats this then
2 sections
ohhh
in message.cleanContent sometimes threads dont get formatted to their thread name. am i doing something wrong or is it a bug?
I mean... if you have read the text inside the screenshot you sent... you could've gotten your answer lol
no its not a bug
then what im doing wrong
Is it possible to get all servers where the bot is in a voice channel? I don't want to go through every guild to do this.
mind if i ask for what purpose?
Sometimes some shards have a higher ping, and I'm trying to figure out why. To do that, I want to look at a few things, including this.
client.voice.adapters I believe
afaik there isn't a way to get all servers where the bot is in a voice channel across all shards in one go
that collection of adapters is going to be specific to the current shard
furthermore if you're looking to get guilds where the bot's voice state shows them connected despite having destroyed the connection from your end, there wouldn't be an adapter
does discord.js support reading server tags yet
oh yay
ApplicationCommandPermissionsManager discord.js@14.22.1
Manages API methods for permissions of Application Commands.
This used for to update a command’s permission to override in a channel, right?
Yes, if you have the oauth scope to be able to do so
and token
Can you elaborate on what you mean by "do" in regards to attachments?
how do i make the embed field look like this? like the bracket a and bracket b, because when i try it out, it become bracket a, bracket b, and then bracket c
I try this but the Field 4 just don't want to get up```js
interaction.reply({
embeds: [
new EmbedBuilder()
.setTitle('Fields')
.setColor('Random')
.addFields(
{ name: 'Field 1', value: 'Value 1', inline: true },
{ name: 'Field 2', value: 'Value 2', inline: true },
{ name: 'Field 3', value: 'Value 3', inline: false },
{ name: 'Field 4', value: 'Value 4' }
)
]
})
no matter i set inline true or false on field 4, its just still there
these are two fields
and then the \n character for a new line is used
so its
{ name: “Bracket A”, value: “NikooLoy vs TBA\nBelum dimulai\n\nAjax kenzz va Babyshark\nBelum dimulai\n\n…” }
Yea, the way you want to do it is simply not possible with embeds
how do i pass in files/images when sending msgs to a webhook?
documentation suggestion for @toxic moat:
Webhook#send() discord.js@14.22.1
Sends a message with this webhook.
// Send a basic message
webhook.send('hello!')
.then(message => console.log(`Sent message: ${message.content}`))
.catch(console.error);
accepts MessagePayload
can i just pass anything in files?
no, files only accepts RawFile[] or null
read the docs, its all explained there
It should be BufferResolvable, not RawFile, no?
files? : readonly ( | BufferResolvable | Stream | JSONEncodable<APIAttachment> | Attachment | AttachmentBuilder | AttachmentPayload )[]
Supposed to be inherited from MessageCreateOptions
I’ve never seen anyone use MessagePayload directly tbh. It’s usually used internally
Yea, no one uses MessagePayload
Always MessageCreateOptions
yeah but they asked for a webhook, so I looked up Webhook#send()
and this is what is present on the docs
WebhookMessageCreateOptions mostly extends MessageCreateOptions
It does omit some options, but files is not omitted
files do not exist on WebhookMessageCreateOptions
WebhookMessageCreateOptions discord.js@14.22.1
Options that can be passed into send.
that one extends MessageCreateOptions
which does have files
oh wait I see now
but why isn't it listed on that page then?
on what page
WebhookMessageCreateOptions|
if it extends it should be listed on there too right?
yes but it doesn't appear on the properties list
It’s inherited
yes because its not typed that way
I thought that would automatically add it to the properties list
send takes string | MessagePayload | WebhookMessageCreateOptions
What each type extends is listed on their own interface docs
yeah and I thought the docs would taking everything it extends to be present on the list of properties
so the user itself doesn't need to click on different pages if stuff is extended from something else
Pretty easy to assume that extended props show when in reality it’s just overridden methods
TextChannel.send isn’t real. A separate class adds on the send method
yes, TextChannel extends BaseGuildTextChannel
and .send() comes from class BaseGuildTextChannel, but it also appears on the list of methods on the TextChannel page
Have you checked the implementation?
this page gives me the assumption that this is everything I can work with
why would it be needed to click on MessageCreateOptions to see if it is present there, maybe that is extended from some other class, which might be extended from another class
do I then really have to click that extends X class page three times just to see what I actually have for properties?
BaseGuildTextChannel.send is not real
just saying that the d.js docs maintainers might need to think about showing every possible property or method on each interface or class -- omitted stuff gets removed from the properties list, so why not extended stuff being added to the list?
yes I can check it on my TS intellisense too, but that shouldn't be needed
Hello, i tried to run the command /create-flight it says "The application did not respond", i have await Interaction.reply already.
create-flight.js code:
module.exports = {
data: new SlashCommandBuilder()
.setName('create-flight')
.setDescription('Creates a flight!')
.addStringOption(option =>
option
.setName('flight_number')
.setDescription('Flight Number example: NE-XXXX')
.setRequired(true))
.addStringOption(option =>
option
.setName('departure')
.setDescription('Departure Airport example: JFK or KJFK')
.setRequired(true))
.addStringOption(option =>
option
.setName('arrival')
.setDescription('Arrival Aiport example: LAX or KLAX')
.setRequired(true))
.addStringOption(option =>
option
.setName('aircraft')
.setDescription('Any Aircraft example: Airbus A320')
.setRequired(true))
,async execute(interaction) {
const flightnumber = interaction.options.getString('flight_number')
const Departure = interaction.options.getString('departure')
const Arrival = interaction.options.getString('arrival')
const Aircraft = interaction.options.getString('aircraft')
const exampleEmbed = new EmbedBuilder()
.setColor('8x808080')
.settitle('fuck flight ever')
.setDescription('yeah')
.setTimestamp()
await interaction.editReply({ embeds: [exampleEmbed] });
}
}
Where do you have .reply()? Not in that codeblock
And unless you get an error in your console that code isn't even executed
Do you have an interactionCreate event handler?
yes
code:
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
}
}
},
};```
And is that event handler getting called at all?
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn more
yeah, ngl
Either its not executed or you are getting an error.
You are not replying properly to that command, since you are directly trying to use editReply() without having deferred or replied before
do i need to reply the command by fixing it?
Responding to interactions:
#replyimmediately respond with a message#updateimmediately update the original message (buttons, select menus)#showModalimmediately show a modal (cannot be deferred)#deferReply/Updaterespond later (up to 15 minutes)#followUppost an additional message
The initial response has to happen within 3s of receiving the interaction!
You need to do either of 1, 3 or 4
In your case probably 1 or 4
alr
hey uhhh got a problem and I come here just to know if it is a problem with discordjs rest or with api or something else. sry I'm a little lost since it is a problem about a request on a bot I try to host online and I only get this when he is hosted online not and not when he's hosted on my computer.
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/workspace/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:762:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async BurstHandler.runRequest (/workspace/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:866:23)
at async _REST.request (/workspace/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:1307:22)
at async ChatInputCommandInteraction.reply (/workspace/node_modules/.pnpm/discord.js@14.22.1/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:200:22) {```
and it was working fine not long ago and I didn't touch anything since but now I get this for every interaction I do
I get a 404 on the post
and rawError: { message: 'Unknown interaction', code: 10062 },
Are you running multiple of the same bot at once
hmmmm
feeling dumb rn because I think that's it I didn't configure the hosting to avoid it
I didn't think of this problem since last time I tried running another instance I had a different error : 'Interaction has already been acknowledged.'
But yeah I think that's it thank you a lot I'd be stuck much longer without asking
i tried to replied it, i did not work, it repeats
all the commands are working except, /create-flight.js
i do have
await interaction.editReply({ embeds: [exampleEmbed] });
yeah
.size also returns 0 for me when the bot is in voice mode.
are you running it through broadcastEval?
I ran it on every cluster, isn't that enough?
we don't have clusters
I have clusters, and each cluster has two shards.
and that doesn't really answer the question
If you want further help you should show how you checked that. The relevant djs code that is, not whatever "cluster" you use
module.exports = {
data: new SlashCommandBuilder()
.setName('create-flight')
.setDescription('Creates a flight!')
.addStringOption(option =>
option
.setName('flight_number')
.setDescription('Flight Number example: NE-XXXX')
.setRequired(true))
.addStringOption(option =>
option
.setName('departure')
.setDescription('Departure Airport example: JFK or KJFK')
.setRequired(true))
.addStringOption(option =>
option
.setName('arrival')
.setDescription('Arrival Aiport example: LAX or KLAX')
.setRequired(true))
.addStringOption(option =>
option
.setName('aircraft')
.setDescription('Any Aircraft example: Airbus A320')
.setRequired(true))
,async execute(interaction) {
const flightnumber = interaction.options.getString('flight_number')
const Departure = interaction.options.getString('departure')
const Arrival = interaction.options.getString('arrival')
const Aircraft = interaction.options.getString('aircraft')
const exampleEmbed = new EmbedBuilder()
.setColor('8x808080')
.settitle('fuck flight ever')
.setDescription('yeah')
.setTimestamp()
await interaction.reply({ embeds: [exampleEmbed] });
}
}```
i have added await interaction.reply({ embeds: [exampleEmbed] })
I know, just trying something different
@cosmic burrow still 👆
yeah
What "yeah"? Did you do that? Do you know where execution stops?
i know
But you'd rather keep it for yourself instead of telling those trying to help you?
yes, because i have a console.log
Good luck fixing it yourself then
yeah, i have await interaction.repy
run the command and it didn't work
Show your console output.
PS C:\Users\timpu\OneDrive\Desktop\NovaEagle Discord Bot> node deploy-commands.js
Started refreshing 4 application (/) commands.
Successfully reloaded 4 application (/) commands.
PS C:\Users\timpu\OneDrive\Desktop\NovaEagle Discord Bot>
i reloaded the commands, tried to run the command, it did not worked because of this stupid error "the application did not respond"
Just so we are on the same page... you are actually starting the bot, are you?
What you have shown is just registering the command(s), but that ain't running the bot
yes
Show the output of running the bot & using the command then
Ready! Logged in as NovaEagle Air Bot#7331
you said you placed logs
(and didn't show where which would be useful as well)
after i run the bot, and i run the command it says "There was an error while executing this command!"
are you a native english speaker?
nah
what's your native language?
English
If that is all that was logged, add more debug logs to figure out where it stops.
My guess is that your command handler or event handler is broken.

k
how can i use interaction.options.getUser() if the interaction is autocomplete? my command is structured like this:
/name <user> <string>
and when autocompleting the string i want to get the id of the user. is this possible?
guide suggestion for @tranquil pivot:
Slash Commands: Autocomplete - Accessing other values
However, the .getUser(), .getMember(), .getRole(), .getChannel(), .getMentionable() and .getAttachment() methods are not available to autocomplete interactions. Discord does not send the respective full objects for these methods until the slash command is completed. For these, you can get the...
read more
so #get().value will return the id entered in the command right
the id of the selected user, yes
HI, I have a question, what is the limit for placing TextDisplay in ContainerBuilder? How many can I place at most?
iirc you can have up to 40 components in a container, the api docs should list the limits
oh okay, thanks
40 components in total. Since a container is also a component the max is 39 textdisplays in it. But if all you have in it are textdisplays then one textdisplay does the same job
my code used to work fine until it started running into this error Error processing file: image1.jpeg Error: Expected token to be set for this request, but none was present am i being rate limited?
What version of DJS are you using?
Sounds like a bug that was fixed in 14.21.0
nope it still breaks (it also sends this at the end Uncaught RangeError RangeError: Shard 0 not found
at the end of what
That sounds like you destroyed your client somewhere
oh found the issue if (){ client.destroy(); }
any examples of what is a invite with a type of friend/2?
a what?
do i need to do anything about any of this? was getting errors earlier for missing libraries (and have since installed @snazzah/davey)
Invite#type discord.js@14.22.1
The type of this invite
that question is better suited for ddevs #useful-servers
ive seen group dms invites but never friend invites
I'm literally so confused right now. I'm following the discord.js guide setting up the ping, server, and user slash commands but I'm repeatedly getting an error from the bot saying that the bot didn't respond in time. I searched in this chat for the same problem but it didn't help at all. I made sure the bot was running with node . and I tried putting console.logs all over index.js but it's not showing up at all when I try the commands
i put global commands and my commands are duplicated 2 commands:
/ping
/ping
tag suggestion for @cosmic burrow:
If you have duplicate commands on your server, you registered both global and guild commands.
You can remove the duplicates by resetting either the global or guild commands
- Resetting global commands:
rest.put(Routes.applicationCommands(clientId), { body: [] }) - Resetting guild commands:
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
what does execute?
do you have logs in your interactionCreate event?
if you do, do any of them log?
i put several console.logs and nothing showed up inside the interactionCreate event
if you go to the dev portal, did you set an interactions endpoint url?
oh my god. I had it set to the endpoint that the discord api recommended I use. what would I change it to now?
if you want to receive interactions through the gateway, you shouldn't have one at all
ahhh ok i gotchu thank you. I removed it but I'm getting another error when I try to do /ping but imma see if I can try to fix it on my own
Hey everyone, what's the recommended way to serve HTTPS certificates when setting up an activity?
Doesn't sound very djs related
Looking now and it seems I've been mislead. I was running into a SSL Handshake Failed while trying to load my activity but I think the error is somewhere else.
If it's not related to DJS, you can ask in #1081585952654360687
was MessageFlags.IsComponentsV2 removed? if yes, whats the replacement
not at all
why would it be removed?
idk, but im getting this error Property 'IsComponentsV2' does not exist on type 'typeof MessageFlags'. when i try to use MessageFlags.IsComponentsV2
oh boy, let me refer this to the devs
what version of d.js are you on?
discord.js@14.22.1
export declare enum MessageFlags {
/**
* This message has been published to subscribed channels (via Channel Following)
*/
Crossposted = 1,
/**
* This message originated from a message in another channel (via Channel Following)
*/
IsCrosspost = 2,
/**
* Do not include any embeds when serializing this message
*/
SuppressEmbeds = 4,
/**
* The source message for this crosspost has been deleted (via Channel Following)
*/
SourceMessageDeleted = 8,
/**
* This message came from the urgent message system
*/
Urgent = 16,
/**
* This message has an associated thread, which shares its id
*/
HasThread = 32,
/**
* This message is only visible to the user who invoked the Interaction
*/
Ephemeral = 64,
/**
* This message is an Interaction Response and the bot is "thinking"
*/
Loading = 128,
/**
* This message failed to mention some roles and add their members to the thread
*/
FailedToMentionSomeRolesInThread = 256,
/**
* @unstable This message flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
ShouldShowLinkNotDiscordWarning = 1024,
/**
* This message will not trigger push and desktop notifications
*/
SuppressNotifications = 4096,
/**
* This message is a voice message
*/
IsVoiceMessage = 8192,
/**
* This message has a snapshot (via Message Forwarding)
*/
HasSnapshot = 16384
}``` looks like its rreally gone lmao
it's there for me. try reinstalling d.js
will do
its fixed now, thank you!
oh okay great
I'm having problems with my bot's cache, it's not getting the right users, or it didn't go to the cache, what can I do? I used client.users.cache.size and it only returns 2, even though there are 38 users using it.
can someone help me?]
you can fetch the member/user
but I am not sure what you issue is. In regards to the "not getting the right users"
If you could share the affected code and what your trying to acomplish
await client.users.fetch()
but if you don’t fetch them on startup only users who interacted with your bot will be stored in the cache
You cant bulk fetch users
oh
What would the scope even be
I thought you could under 100
no
the first one I'm using:
client.guilds.cache.reduce((a, b) => a + b.memberCount, 0)
other:
client.users.cache.size
Getting your bot's member count
client.users.cache.sizeis unreliable because it will only return cached users- The preferred method is using
collection.reduce()onclient.guilds.cache
client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)
This doesn't explain why you're concerned about the users not being in cache
And I mean, technically those numbers could be correct if its just you and your bot in 19 guilds 
I have a server with 19 members and another with 6 and it is in others... but even so it only pulls 2 users
And why is that a problem?
Do you do any cache overrides in your constructor?
should pull all users, right? Like all the users it finds on the servers...
no it shouldnt "pull" anything
The user cache is populated over time when people interact with your bot
This shows everything except the options you passed
oh, I think that's the problem then, I didn't know it was like that lol sorry
yeah okay, that looks fine
It must be that problem you told me about, about how as users use the bot, it collects
but sorry, and thanks for the help
no worries
Why am I getting this error?
Error executing command "leaderboard": TypeError: leaderboardStore.init is not a function
at Object.execute (C:\Users\hollowed\OneDrive\Desktop\the-organization\src\commands\Community\leaderboard.js:87:22)
at Object.execute (C:\Users\hollowed\OneDrive\Desktop\the-organization\src\events\handlers\interactionCreate.js:168:31)
at Client.<anonymous> (C:\Users\hollowed\OneDrive\Desktop\the-organization\src\functions\handlers\handelEvents.js:83:62)
at Client.emit (node:events:520:35)
at InteractionCreateAction.handle (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
at WebSocketManager.<anonymous> (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\discord.js\src\client\websocket\WebSocketManager.js:235:12)
at WebSocketManager.emit (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.<anonymous> (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\@discordjs\ws\dist\index.js:1190:51)
[01:14:29] ✚ ADD │ errors\2025-08-25T23-14-29.190Z.txt File created
The issue is with your leaderboardStore object. likely being undefined unless that is a djs object it is not a djs issue
Alright, thank you.
what progress djs v15 now?
there is no v15 yet
discord.js v14 covers 99% of the discord api at this time
v15 will come when there’s a need for it
TypeError: Cannot read properties of undefined (reading 'highest')
const bot = interaction.guild?.members.fetch(`${this.client.user?.id}`) as unknown as GuildMember;
..........................
if (member.roles.highest.position >= bot.roles.highest.position) {
??
fetch returns a Promise, you're not awaiting it, you really don't need to use as unknown as ... or even as
ok i did this
const bot = await interaction.guild?.members.fetch(`${this.client.user?.id}`)
``` but getting 'bot' is possibly 'undefined'
And that's correct because you're using optional chaining
'bot' is possibly 'undefined' is was typescript compile error xd
tysm for help
const container = new ContainerBuilder()
.setAccentColor(0x0080FF)
.addTextDisplayComponents(
new TextDisplayBuilder()
.setContent("abcd")
)
return interaction.update({ components: [container], ephemeral: true });
Using this to update an existing container, but recieving the following error:
DiscordAPIError[50035]: Invalid Form Body
data.components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:748:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async BurstHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:852:23)
at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1293:22)
at async ButtonInteraction.update (/home/container/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:361:22)
You need to add the MessageFlags.IsComponentsV2 flag
when updating as well?
I believe so, yes
I don't add that flag when editing/updating and it still works
I mean, you are getting the error about it, so probably :P
Is there some convenient way of re-sending components (e.g. a container) with just one thing modified? Something like destructuring the interaction.message.components into discordjs classes and then change one text display or so?
If you notice that the role selection menu or channel selection menu is not updating or is showing old selections when moving between steps (like from "Give Roles" to "Take Roles" or when selecting channels),
how do i make an embed like this
use containers
guide suggestion for @sharp basin:
Popular Topics: Display Components - Container
read more
is there any way to put some text below the image besides the footer? im learning the hierarchy for the embed but i cant seem to get some text below the image
i dont think that the order in the code matters
No, there is not
It should be possible with Components V2, but then you don't have specific fields/footers
so the only way is using the footer
In Embeds, yes
componentsv2 is the new message style thing right? i remember looking at it but i think you cant send embeds through it
You are not supposed to, it replaces them
Popular Topics: Display Components
read more
but the guide covers only a little bit no? or is that the whole thing
take a look and you’ll see what it covers
Read the guide and ask questions here if you have follow up questions
the only question that i have is that if i can have multiple accessories in a section
one accessory per section
how yall handle buttons?
something i do is similar to handling slash commands like shown in the d.js guide, but instead of setting slash command data, i set the custom id and run the file that way
buttons in container?
i mean just buttons,i also used smt like sladh command and found that messy creating new folder / file for each folder so i added an button function in the same as command file is and i use swich case to handle each button but it seems to be buggy talking about replying and some command gets cross executed
makes no difference to the button
i don't understand why it's giving me this error:
RangeError: Non-premium buttons must have a label and/or an emoji.
Because you have two buttons with empty strings as labels and customId
they're special characters
yeah, don't do that
which are probably getting stripped
hangul filler (U+3164)
i tested it by replacing them with numbers and it gave the same error
yeah my bad
same error again
changed code?
yes
Show full error with stacktrace
well, i'd hope you changed it, but i can't see that
yes I changed both using hangul filler and with normal letters
Increase stacktrace Limit, as that doesn't even include your code
That doesn't point to the code you showed but a different place in your code
ok one sec
this is the execute method where i update the container
https://hastebin.com/share/owexelijoc.javascript
use emoji instead?
hey, i dont think this has anything to do with discord.js but im still gonna ask cause i dont know where to ask, if i want to reuse a button isnt it best practice to make the button into a function in a separate file and call that function in the command files that use the same button?
fun fact. “isNan()” tries to parse values. So you don’t need to parseInt inside it 
yea. Reusable components. How you do it doesn’t matter. But yes, that’s one way to do it. You’re creating a button factory
whats the other way?
i feel like creating the same button over and over in different files is wasting time thats why im asking
There are many other ways. It’s up to you how you want to do it
i dont know if this is the most efficient way but its something so i dont make the same button over and over
yes I got that the first time you said it…
and it’s efficient. If you’re using the button more than once, that is
doesn't change
thanks for the suggest xd
What is createComponentBuilder() method here? Because your cast there seems wrong and causes your issue
ContainerComponent discord.js@14.22.1
Represents a container component
Your message.components[0] is an instance of 👆 , not raw API data. Call toJSON() on it to get the API data
https://discord.js.org/docs/packages/discord.js/14.22.1/APIInteractionGuildMember:Interface#roles
well, how can i access APIInteractionGuildMember from <ChatInputCommandInteraction>
member : CacheTypeReducer<Cached, GuildMember, APIInteractionGuildMember>
I would like to access APIInteractionGuildMember's roles structure
How do i narrow member down to APIInteractionGuildMember
roles is a GuildMemberRolesManager when it come from a cached guild. So inCachedGuild is what you want. If you want the raw roles array of strings then it’s when it’s not from a cached guild
alright
https://discord.js.org/docs/packages/discord.js/14.22.1/GuildMemberRoleManager:Class#holds
can i pass raw snowflakes
nvm i can't
i checked and isNaN accepts only numbers
that's what typescript tells you
but the literally first thing in the javascript specification is to try and convert the given parameter to string
-# TypeScript hates implicit coersion because Weird and Unfortunate Things™ can happen.
GuildSoundboardSoundManager#create() discord.js@14.22.1
Creates a new guild soundboard sound.
// Create a new soundboard sound from a file on your computer
guild.soundboardSounds.create({ file: './sound.mp3', name: 'sound' })
.then(sound => console.log(`Created new soundboard sound with name ${sound.name}!`))
.catch(console.error);
does the file here support base64?
make it a buffer and pass that
how can I convert base64 to buffer?
Buffer.from(string[, encoding])
Creates a new Buffer containing string.
I was able to pass base64 until now, but today I saw an error and realized it's interpreting the base64 I'm sending as a file location, trying to find the file in the working directory, and giving an error because the base64 is too long
if i put the base64 string in this will it work?
djs always resolved strings as file paths
it will but you have to pass the encoding
oh im dumb I was already taking it as a buffer before converting to base64
thanks
how to make a normal space?
and why aren't the stickers showing?
you have to set them in the emoji field
ButtonBuilder#setEmoji() discord.js@14.22.1
Sets the emoji to display on this button
and what do you mean with “normal space” here??
ty
is this the same message? or is this just viewed from another client (mobile and pc)?
How do I get the hash of a guild tag badge via djs?
UserPrimaryGuild
documentation suggestion for @cinder shale:
UserPrimaryGuild#badge discord.js@14.22.1
The guild tag badge hash
thank you!
Is it possible to make a button without any content, as in this image? (These currently use a "blank" emoji, but I'd rather not use this method.)
Could try a non-breaking space
Good idea, thank you!
Don't think that's possible.. Non-premium buttons must have a label and/or an emoji.
yeah idk then sorry
seems like the blank emoji is the way to go then
Yup but that's fine. Is it possible to use application emojis in buttons? By just pasting the ID?
what about using a blank unicode character in the button’s label (e.g., \u200B)?
@spark ledge
The error message I got before appearantly was from something else.
But using non-breaking space or this character you gave gives this error:
components[0].components[0].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji```
Oh wait, my bad, I used setEmoji instead of label. \u200B does in fact work
i just tried the blank unicode character and it worked fine for me.
I don't know about those non-breaking spaces, but I'll do it with this character. Thank you very much!
Yeah I know, I was doing it wrong. Thanks!
Oh thats the one I meant, zero-width space
My bad
WelcomeChannel discord.js@14.22.1
Represents a channel link in a guild's welcome screen.
hm
(event) Client#guildMemberAdd discord.js@14.22.1
Emitted whenever a user joins a guild.
#app-commands for personal usage please
how would i set allowedmentions off in my message reply but only set reply to user mention on
set it to don't parse anything, and set replied user to true
thanks
any idea why my channel name is returning undefined? I made sure that I had the correct channel ID. I think it might have something to do with the cache but I'm not sure how to check that.
it is not in cache or the id is wrong. you could try to fetch the channel
also it looks like your tring to get the channel befor the bot is logged in
i have it after my client.login, it just for some reason shows that first idk why. How would I fetch the channel?
ChannelManager#fetch() discord.js@14.22.1
Obtains a channel from Discord, or the channel cache if it's already available.
// Fetch a channel by its id
client.channels.fetch('222109930545610754')
.then(channel => console.log(channel.name))
.catch(console.error);
ahhh i gotchu thank you
There is a difference between your client being logged in and your client being ready.
im not 100% sure what you mean by that, sorry
The <Client>.login method resolves when the websocket connection is established. This does NOT mean that your client is ready to begin receiving gateway events or make API calls.
client.once(Events.Ready, () => {
console.log("connected to discord"); // Will run after the bot is ready to do stuff
});
await client.login(token);
console.log("I run after login"); // Will run after the bot has connected to the websocket - but NOT necessarily after the bot is *ready*.
ahhh ok i gotchu thank you. I think this might be the problem then because fetching returns null
fetching shouldnt be able to return null
:0 ok so maybe this is something else then idk what but imma try to figure it out
could you share you code and goal
But you were not fetching before? You were accessing the cache, which is different. <Client>.channels.cache.get() can return null.
I want the bot to send a message when someone joins the server in the general chat
you need use GuildMemberAdd event
I didn't know fetching was a thing. I used the example that was on the discord.js site
client.on("GuildMemberAdd", member => {})
I have a file using the guildMemberAdd but it didn't work I forgot what the error was
you using interaction
clientchannels isnt a thing
replace interaction to member
And you probably do not want once:true.
why timeout is 10 seconds((
oh my god I forgot the period
I mean... I also dont know where client is defined here so