#djs-help-v14
78874 messages · Page 50 of 79
iirc sharding is only really needed around 2k, so start thinking about it around 1k
you can't
You definitely can. Add default values
how would i go about implementing reaction roles?
Personally, I'd recommend you use onboarding instead of reaction roles. But do you have a specific part of your reaction roles that you are looking to have help with
hmmmmm
yes onboarding is the best option
so basically i want a command to send an embed with the reactions of the roles, then to use partials (for bot restart coverage) to check the emoji that was reacted with and assign the role that it has linked to it, but i dont know where to start
you've described what you need though? I'm not sure where you're confused
i dont know how to actually do it
you already know the steps so you know where to start
do you know how to make commands?
how to create and start a client?
yeah
on a string select menu? i can only just set one value to true but not multiple
then describe exactly where you're confused
because it sounds like you know already what to do
at the very least you know how to make the command
send snippets
you can, just make sure to allow multiple selected values
StringSelectMenuBuilder#setMaxValues() builders@1.12.1
Sets the maximum values that must be selected in the select menu.
how to assign the roles, idk what listener to use, like interactioncreate etc, and also dont know how to use partials
i mean the auto populating like in user and roles selects etc
that isnt possible for string select menu?
documentation suggestion for @pine laurel:
GuildMemberRoleManager#add() discord.js@14.23.2
Adds a role (or multiple roles) to the member.Uses the idempotent PUT route for singular roles, otherwise PATCHes the underlying guild member
you get that manager via GuildMember#roles
(event) Client#messageReactionAdd discord.js@14.23.2
Emitted whenever a reaction is added to a cached message.
use that to listen to reactions
Partials
Partial Structures were introduced to the library in version 12 and are optionally received whenever there is insufficient data to emit the client event with a fully intact discord.js structure. They are (as the name suggests) incomplete, and you cannot expect them to have any information besides...
read more
and there's the guide for partials
thank you
string select menus aren't auto populated, no
I'm not sure with what they'd be auto populated in the first place though
@tardy sable do you mean like this?
MessageSelectMenu
MessageSelectMenuhas been renamed toStringSelectMenuBuilder-StringSelectMenuBuilder#addOption()has been removed. UseStringSelectMenuBuilder#addOptions()instead.
read more
i may have misunderstood your question but im not sure @tardy sable
addOptions would do
Yo guyz what's going on?
just like you would populate channels etc
now im just limited to one with setDefault(true) on string selects
you don't populate them though, that's why they're auto populated
that's marking an option as default, not populating
its not possible with string select menu
.setMin(value)
.setMax(value)
with populating i mean what pops up in the selection field not the addoption. sorry for misunderstanding
it's possible to marking many options as selected by default, like I said just make sure your select menu allows multiple selected values in the first place
specifically i mean an .setDefaultUsers([""]) (example) equivalent for string selects
StringSelectMenuOptionBuilder#setDefault() builders@1.12.1
Sets whether this option is selected by default.
yh only limited to mark one. hope they add multiple like for channels and roles etc
Then you set the option is true for multiple
I'm not sure why you're not reading what I'm saying though
you can
In simple you want to show multiple roles in menu field as a default value?
the default selected options are stored at the option itself, not on the select menu
wont that throw error?
only in auto populated menus they're stored in the select menu, because you don't specify any option
why would it, and why would we suggest something that we know it would
That gave me an idea.
because its called "default", but ill try that out then
I'm not sure what that has to do with the issue
in case you haven't noticed, it's a method on the option
not on the select menu
You define that a value is a default
it wouldn't make sense for it to say setDefaults, because you're in a single option
let me just show example thats easier to explain
yeah please
im allowed to set multiples values as default?
modal.addLabelComponents(
new LabelBuilder()
.setLabel("Select an option")
.setStringSelectMenuComponent(
new StringSelectMenuBuilder()
.setCustomId("options")
.setMaxValues(3)
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel("Text").setValue("text").setDefault(true),
new StringSelectMenuOptionBuilder()
.setLabel("Attachments").setValue("attachments").setDefault(true),
new StringSelectMenuOptionBuilder()
.setLabel("Stickers").setValue("stickers").setDefault(true)
)
)
)
correct
yes
ok thanks for clearing my confusion
what does djs export that is the same as MappedEvents from the core package?
you mean ClientEvents?
yes this, thanks
ah, I missunderstood the question, thought you meant the way around (what's the core equivalent of ClientEvents) lol
well that answered it anyways 
best way to check if can start a thread on a message is by checking channel perms, or is there a message.threadable ?
or can i just use deletable for that?
Can i use deffer with componentV2?
yes
Thx
why targetId is null when I fetch audit logs
AuditLog.MemberMove event
how do i add a string select to a modal?
this is a preview to the updated guide with select menus, i'd suggest using that for now, until that gets merged on to the actual guide.
thank you- but the actual functionality is live?
yes
yes
whats the max options in a string select menu?
25
ty
would be nice having autocomplete interactions on string select menus, then you could effectively have infinite options
It would, but that is not a Discord feature
indeed
It would likely be far more complicated as messages dont have a "live update" framework built in the way slash command choices do
Components are inherently very static
Did the client.once("ready, () => {}) event get deprecated? What should I be using instead?
Events.ClientReady
use clientReady
Ah the docs just say use ClientEvents instead, but that is the type of every event.
When is v15 coming? 
there is no v15 yet
Why do you think v15 would be coming
what would v15 even ensue
Well its an enum. It includes references to every event, yes
Only reason a v15 would be needed would be if there was a complete redo of the discord api like a discord api v11...
Because of this
Thats not the only reason, but a good example of one
Those milestones dont really mean anything tbh
😭👍🏻.
It also answers your question: No due date
Ah yes a milestone of v15... that could be like... 4 years off.
💀
The % annoys me because if you have 100 tasks, you can compelte 99 small ones and it say you have 1% to go but the last task be the longest most challenging one... At least from my experience with how work uses them...
Kinda off topic but feel to discuss in #archive-offtopic
i just created my slash command and my slash command called: annoucement didn't showed up
does it show when you type / ?
yeah
then there's no issue. don't rely on that page. it doesn't update properly
module.exports = {
data: new SlashCommandBuilder()
.setName('annoucement')
.setDescription('Create an annoucement embed')
.addStringOption(option =>
option
.setName('title')
.setDescription('Adds a title for your annoucement embed')
.setRequired(true))
.addStringOption(option =>
option
.setName('description')
.setDescription('Adds a description for your annoucement embed')
.setRequired(true))
.addStringOption(option =>
option
.setName('color')
.setDescription('Adds a hex color for your annoucement embed')
.setRequired(true))
.addStringOption(option =>
option
.setName('footer')
.setDescription('Adds a footer for your annoucement embed')
.setRequired(true))
.addChannelOption(option =>
option
.setName('channel')
.setDescription('The channel where the annoucement embed would send in')
.setRequired(true)),
async execute(interaction) {
const title = interaction.option.getString('title');
const description = interaction.option.getString('description');
const color = interaction.option.getString('color');
const footer = interaction.option.getString('footer');
const channel = interaction.option.getChannel('channel');
const annoucementEmbed = new EmbedBuilder()
.setColor(color)
.setTitle(title)
.setDescription(description)
.setColor(color)
.setFooter(footer);
await interaction.reply({ embeds: [annoucementEmbed] });
},
};```
i type /annoucement nothing shows the command
what do you mean "nothing"
idk?
i suggest looking at #how-to-get-help to improve your question
it's hard to help without knowing what "nothing" means in this context
You have to spell announcement correctly in the command name
Or don’t. Just be consistent however you decide to spell it
Nvm, you edited message
does clicking a button inside an archived thread makes the thread automatically unarchived?
Should ask in ddevs #useful-servers
Afaik, editing a message isn’t allowed in archived threads, but sending a message is and will unarchive it
If you use the editMe too often, you get
DiscordAPIError[50035]: Invalid Form Body
banner[BANNER_RATE_LIMIT]: You are changing your profile banner too fast. Try again later.
Is this intended to error, not just like a normal rate limit? Is this the same if you use like client.user.edit or whatever it is
Blame Discord for sending the rate limit as an Invalid Form Body error
Yh that doesn’t feel right
Hey guys, how can I avoid that? I tried using escapeMarkdown() but it makes the text be ghost\_jonas\_ instead of just ghost_jonas_
For now I'm doing it like that:
return `${formatEmoji({ id: "1411365868964806758", name: "accounts" })} ${bold("Contas:")}\n` + data.accounts.map(account => `${formatEmoji({ id: "1411360326707839016", name: "steam" })} ${hyperlink(inlineCode(account.username), `https://steamcommunity.com/profiles/${account.id}`, `Acesse a página de perfil de ${account.username} na Steam`)}`).join("\n");
If you guys know a better way instead of using inlineCode() please ping me here
How do I receive the choosen Channel from ModalBuilder?
Wdym?
documentation suggestion for @hasty fern:
escapeMarkdown discord.js@14.23.2
Escapes any Discord-flavored markdown in a string.
Nevermind, I found it getSelectedChannels
@wary coral Read my message
Sorry I don't have any other answers. Right now
Ok, I'll keep it with inlineCode() for now then
just tested it and it worked on plain text will test with URL shortly
await interaction.reply({
content: `${escapeMarkdown("ghost_jonas_")} instead of just ghost_jonas_\n${codeBlock(`${escapeMarkdown("ghost_jonas_")} instead of just ghost_jonas_`)}`,
});
can i use the same custom id for multiple buttons on the same message? i am facing a situation where i am going to have a list of minecraft names as buttons and i am unsure what the best way to approach it is.
i was thinking of temporarily storing the names and appending them to the data for one button file but im not sure yet
something like this?
update it looks like the issue is how Discord renders hyper links. there is nothing you can do to stop this. Issue is not Discords side sorry
sure you can but typicly the custom id is telling your bot what to do with the button. if they all have the same custom id your bot will treat them the same
alright this works for my needs. i believe ill be able to use the text stored in the button for what i need to use. im just running commands w buttons on my server
Fair enough, but it is not best practice to use the buttons label as stored information.
what would be the best option for something like this?
Include the information in the custom ID and use a character such as - or _ to separate the data from your action for example
buttonid-buttondata
You can then use the string function split to separate the two strings
appreciate it :)
Oh ok ty, I'll prob just use inlineCode then
The custom id has to be unique in a message
cc @wary coral
Are embeds smaller than component v2 containers by default? I have the same text, image, etc., but the container is noticeably larger.
Might have bit more padding here and there
Hi,
can .addFields be uset inside containers to have multiple texts inline?
No. Containers aren't embeds and don't have a notion of fields
is there any other way to do this inside container?
if you want fields, use an embed
container doesn't have an equivalent of inline fields
ok thanks
hello
where can i find the source from github i can't find it ?
for discord.js? https://github.com/discordjs
nah you don't understand me i mean you know bot tutorial from discord.js Guide ?
i want the final project source
the guide aims to explain concepts to you that you can freely apply to whatever code base you are working with
so if you read and understand it, it should be easy to apply
if you are struggling with something specific, you can always ask here
ohhhhh ok thx
does djs support text display for modals?
no
What? #announcements message
oh 
ig im outdated
in the new modal component, how could i get the value of channel select menu?
like somewhat similar to interaction.fields.getStringSelectValues()
ModalSubmitFields#getSelectedChannels() discord.js@14.23.2
Gets channels component
The docs have all your answers
if im adding/removing a role from a member, will it check to see if the person already has/doesn't have the role before sending the request?
is there a way to get ActionRow from interaction.message.component or can I just get this with the index
[
ContainerComponent {
data: { type: 17, spoiler: false, id: 1, accent_color: 54008 },
components: [
[TextDisplayComponent],
[SeparatorComponent],
[TextDisplayComponent]
]
},
ActionRow {
data: { type: 1, id: 5 },
components: [ [ButtonComponent], [ButtonComponent], [ButtonComponent] ]
}
]
No, you'd need to check
No, but the request won't change anything in that case
I don't quite understand the question. You can get it from the components array, yes. By index or by .find or whatever you like
yes .. found a way - thx for your response
Hi everyone!
I’m a software developer with 8+ years in Next.js, Vue, Rust, Django, and AWS. I enjoy building scalable systems and collaborating with technical teams.
Looking forward to contributing here!
Is there server only avatar for discord bots?
Sounds like a scam to me,
Why would a guy with 8+ years of experience have an anime profile and, especially, go into random dev servers begging for collaboration?
The profile is trivial, but why look for collaboration in a random Discord server with a stranger?
And, if you were genuinely asking, head to linkedn, not in random discord server.
to be honest if you are that skilled you should already have enough projects / work to do that you can not have time to chat in random servers
I am freelancer
then, i believe that 8 year exp thing is a lie.
no way, a 8 exp guy go and beg for free lance, you sound like really immature.
If you want to do free lancing, this isn't a place, You should move to fiverr.com or freelancer.com
Is there server only avatar for discord bots?
Again, this is not a place, and you sound like chatgpt
and, don't expand this conversation anymore.
^^
documentation suggestion for @wooden carbon:
GuildMemberManager#editMe() discord.js@14.23.2
Edits the current application's guild member in a guild.
why does RPC disappear after 24 hours?
how can i have more than one og the same options
.addUserOption((option) =>
option.setName('fighter1').setDescription('Fighter Number 1').setRequired(true),
),
.addUserOption((option) =>
option.setName('fighter2').setDescription('Fighter Number 2').setRequired(true),
),
RPC? bots cannot have rich presence
if you mean presence status, then that's just due to how discord handles long running connections on their end
you can avoid that by setting the presence in the Client options
oh yeah
why does my bot just randomly turn off?
it doesnt print any errors or anything. I am very confused.
turn off how?
it just shuts off after a hour or so.
but, its still running in the console, no errors, anything.
by "shuts off" you mean it goes from
to
?
yes
and commands dont work, but, console still running
out of curiosity, is that cmd or powershell?
git bash
looks good imo lol.
okay but, by default cmd/powershell pause execution when you start selecting text
ye, this dont do that.
i registered 2 commands then why /announcement command didn't showed up?
then you gonna have to get some debug logs
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
client
.on("debug", console.log)
.on("warn", console.log)
- Note: if you initialize your Client as
botor other identifiers you need to use these instead ofclient - If the output is too long to post consider using a bin instead: gist | sourceb.in | hastebin
how did you register them
using node deploy-commands.js
and what does that do
it registers commands
i thought it cooks food
how does it registers them
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');
const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter((file) => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
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());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);
// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(Routes.applicationCommands(clientId, guildId), { body: commands });
rest.put(Routes.applicationCommands(clientId, guildId), { body: [] })
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();```
using node deploy-commands.js
You're deploying the commands to a guild, right?
Is it this guild?
yes
Could you log the commands in that script right before the rest.put() call to see what is actually being sent to discord?
ok
debug event? is that what you mean?
.
ah
didnt see that LMAO.
my bad lmao.
Hello, I have a quick question to ask you when I choose option 1 on the select menu, I have to choose option 2 to click on option 1 again. Is there a way to be able to click on the option without having to choose another one each time to select it?
Did you set your select to require at least one option?
no why would that be the solution ?
ping me
if i do allowedMentions: { replied_user: true } it will only mention the replied user and nothing else right?
Hi,
What's the event for when a user is being timed out (isCommunicationsDisabled toggles from false to true) ?
Thanks
that would be the guildMemberUpdate event iirc
or do i also have to add parse: []?
yes guildMemberUpdate
So, I've been trying, but it seems I can't find out how to trigger this event, I even tried changing nicknames too, without success... 🤔
you need the GuildMembers intent
Ah, intents.
I'm just gonna enable them all cause I always forget about them and I don't see the point of loosing time on a toggle 😂
It works, thanks !
There's no event when the time out ends though ?
correct
Well, I need to log messages when someone gets timed out and when the time out ends, how can I do the second one ?
I did notice there's an event when the time out is manually stopped before the scheduled end though, but that's not the majority situation
set a cron job on the duration and then log it, thats your only way
I may have overseen something, but how do I create input fields for modals now?
The guide is not finished yet. A preview is available
https://discord-js-guide-git-fork-bowenjw-main-discordjs.vercel.app/legacy/interactions/modals
thank you .. I've asked the wrong question but found what I was searching for .. I can't use .setLabel() anymore in TextInputBuilder
Set label has moved to the label builder. It still exists on text input but is deprecated
thank you .. I will no change that
This is actually complexified for no reason : the cron job has to be cancellable in case the time out is lifted manually, which means it has to be mapped, but mapping by user ID wouldn't be enough in case the user is timed out in different guilds, so it has to be mapped by guild as well...
Is it possible after initializing a WebhookClient to somehow check if this webhook URL is still valid?
const webhookClient = new WebhookClient({ url: 'https://discord.com/api/webhooks/id/token' });
trying to make sure it wasn't manually deleted by a user etc
you could use a regex, but i’m pretty sure an error will throw if the webhook is invalid
Fairly sure they mean the webhook exists. https://discord.com/developers/docs/resources/webhook#get-webhook this exists, but other then that ig you’ll have to fetch the webhooks from that channel and see if that url exists
Is there now an option to get the user who has created a channel
through the audit log
for threads channels use ownerId
thx
does getTextInputValue auto trim()?
The function internal to discord.js does not - Discord might in what it sends you though.
Is there a better way for a bot to hyperlink a message than using https://discord.com/channels/${guildId}/${channelId}/${id} ?
Especially since this template string, for example, doesn't support threads, forums, and who-knows-what-else-they'll-create-next ?
Thanks
Message#url discord.js@14.23.2
The URL to jump to this message
or
messageLink discord.js@14.23.2
Formats a message link for a channel.
Oh, I searched link but not url 😅
Thanks !
Yeah that's what I meant, unfortunately if I initialize it with a deleted webhook's URL it does not throw an error until I try to send something etc
Is there a method for that get-webhook on the WebhookClient or should I just make that GET call separately?
EDIT: I found client.fetchWebhook I suppose that works 
You can get the hyperlink off the message object. Sorry I guess I'm a little late on this
And it supports threads and forums just fine, because that's the only format for a message link that exists. It even works in DMs where the guild id is just @me.
hey question is it possible to see who invited the bot to server
You might be able to check the audit log for who added an integration
Yeah, there is a BOT_ADD audit log type
// Apps added in the last 45 days
const integrationCreateLogs = await guild?.fetchAuditLogs({type:AuditLogEvent.IntegrationCreate})
Promise<...>
ahh thank you so much i will try it
Requires the read audit logs permission, of course
add you will need to pares the logs for the bot your looking for.
note if your are looking for bots add by a particular user you can add the option user to the fetch options
How long does Discord store audit logs? bc I think the events "fall off"
I think BOT_ADD has been super seeded by INTEGRATION_CREATE
added a bot to a server add got this log
It’s either 60 or 90 days. Can’t remember for too long
Oh, it’s now 45 days now apparently
good to know thanks
how are the components inside the embed
because that's not an embed, it's a container
oh nice thanks
dafuq
okay the link is correct, it just doesn't display any preview like before
it was probably this.
i dont know.
i only got 1 shard lmao, so, ye.
might just remove this. no point in it rn.
Hi guys, i want to implement a feature in my bot that gives users a role when they use my guild tag, the bot should auto update the role (add/remove) depending if they use it or not. Is that possible yet?
User#primaryGuild discord.js@14.23.2
The primary guild of the user
Yes
Ty!!
you can only set one child component per label right?
Correct
oh no
Are you able to make it so only select roles show up in role select menus?
No
hey guys, is discord.js websocket only? is there a way to set up http interaction endpoints?
the docs are 404ing right now. only the /legacy links work in the guide. thanks!
https://www.discordjs.guide/creating-your-bot/command-handling
You can use @discordjs/core (with @discordjs/rest). Btw, where did you get that link from?
I just googled "discord js commands" lol it's the first result
also is there any documentation for those two packages you mentioned other than the auto generated API reference? not quite sure how to get started with those currently
I'm wondering if this would be enough to get slash command interactions working via webhook https://github.com/discord/discord-interactions-js
There's no guide on how to use them, @discordjs/core is pretty easy (see the README.md). That's all you need to know.
For HTTP interactions, you'd need a way to respond to ping interactions validate security headers, which discord.js doesn't provide though. There's example code on Discord's documentation or discord-interactions (if you're not comfortable setting things up yourself, might recommend that)
to be clear is the ping interaction a deal breaker for a discord.js core/rest setup? or do I just have to set up the interaction to make it work with those?
thanks for the help btw @golden laurel
Any of you writing tests for your bot ? If so, how do you do that ?
I mean discord.js doesn't have a native way to do this (I said ping interactions, meant validate security headers)
https://discord.com/developers/docs/interactions/overview#setting-up-an-endpoint-validating-security-request-headers
But that library does. You could also just do it yourself without one
I see, probably going with the discord interactions library then, thanks!!
claude just told me I should stick with websockets cause the webhooks are too limited 😂
whelp, guess you cannot use webhooks then
Depends what you need, ofc you can’t get any events using the webhooks. If you only care about interactions then sure
A few of my util bots can be interaction only so I just stick them on a cf worker
if the member wasn't cached, and GuildMemberUpdate has been fired
is it possible that the OldMember will not be accurate? answer is yes
how do I get a user's bio? (or does discord api not read it?)
bios aren't exposed to bots
Did StringSelectMenu is supporter in Modal ?
Yes
Thanks
ApplicationCommandOptionWithChoicesMixin discord.js@14.23.2
This mixin holds choices and autocomplete symbols used for options.
No embed preview? 😔
how to disable context menu after inactivity?
what do you mean by "disable context menu"?
if you mean a modal, you can’t
I was wrong, not context, select menu
Edit the message to not contain the menu anymore
or disable it
StringSelectMenuBuilder#setDisabled() builders@1.12.1
Sets whether this select menu is disabled.
How to add status text on my bot’s profile (not presence)?
I saw some bots like Appy have a small text under their name on their profile (status like how discord accounts can set status that “+ Add Status” thingy).
I’m using Discord.js v14 and I know how to set presence/activity (Playing, Listening, etc.), but that’s not it, that im looking for.
How can I set that profile status text for my bot?
I checked docs and StackOverflow but couldn’t find anything, i asked chatgpt but it said bots cannot set custom status only activities, custom status only for user account not discord bot
tysm
Hi,
Regarding the guildUpdate event :
Emitted whenever a guild is updated - e.g. name change.
Is there an exhaustive list of situations ?
Thanks
No
Is it correct that you can add Select Menus to modals now?
Can someone point me towards the updated documentation for it? I haven't found anything . Thanks
LabelBuilder#setStringSelectMenuComponent() discord.js@14.23.2
Sets a string select menu component to this label.
And so on...
slash commands support attachments right?
Yes
If you mean attachment option that is
yes
not available in modals yet afaik
SlashCommandBuilder#addAttachmentOption() discord.js@14.23.2
Adds an attachment option.
correct
ty
In the emojiUpdate event, how to know whether the emoji image was updated ?
Thanks
compare the old and new emoji objects for the imageURL()
emoji.imageURL() changes systematically ?
you can't change emote image
Oh, okay, what can be changed then ?
name
and roles that can use it
client.on(
'channelUpdate',
async (oldChannel, newChannel) => {
if(!newChannel.inGuild()) return;
```Shouldn't `inGuild` be a thing here ?
There's the inverse in isDMBased() or you can check whether it has a guildId
better question is if DM channels can even be updated
gDM channel with a new user added or user removed
While true, those can't have bots, right?
that can never have a bot in it
i thought bots could make gDM’s my bad
they might (which itself is also very annoying to do)
but still won't really be a part of it
it's wonky af
Thanks ! Why though 🤦
why what?
why do we have one property and not the other?
Yes
Because it would be redundant
because the coin flip made us use this one and not the other
you can perfectly fine achieve the same thing with it
Well, the question is also : why create an opposite property altogether
It should be either isDMBased() everywhere or inGuild() everywhere
🤷 doesn't seem like it really matters
Also funny how one is prefixed is and the other one isn't
the second one isn't on a channel, is it
interaction would never be a guild
It does for DX : if there's only one, you'll always remember to use it, but if not, then you'll always have to check
so wouldn't make sense to be interaction.isGuild()
and a direct DM check on a channel makes more sense because it's DMs that have less stuff in it
also
I didn't mean is vs in, but rather is vs no is, as in it should be either isDMBased and isInGuild or DMBased and inGuild, not a mix (also, I prefer the former)
i believe there's a reason to this
if you look at this:
the ises are checking what it actually is
while the inses check where it is
ises should remain unchanged and ins should be renamed isIn.
channel has only the thing checks
Clean code.
that has like, nothing to do with it whatsoever
i explained why
your reasoning is not really relevant
Yes, this is totally valid :
the
ises are checking what it actually is
while theinses check where it is
But the latter should still beisInrather thanis.
is= what it is,isIn= where it is.
In all cases,isbecause it's a boolean.
we're not going to break this for the sake of semantics
Is there a limit for .addStringOption inside the SlashCommandBuilder?
what type of limit are you referring to?
Of options to add to an CommandBuilder like string, user, bool etc. but it seems to be 25
that is correct
options? * array of command options Parameters for the command, max of 25 CHAT_INPUT
https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
what are the d.js methods for new modify current member endpoint
GuildMemberManager#editMe() discord.js@14.23.2
Edits the current application's guild member in a guild.
does changing nickname via editme still require changenickname permission
Guild Resource - Modify Current Member
read more
you will need CHANGE_NICKNAME Permission
what is the best way to send messages on a channel if i only have the id, possibly not in the cache, and without having to make a request just to paste an instance of BaseChannel?
If you have the id of the channel?
yes, i'm using this right now: ```js
return clients.discord.rest.post(
/channels/${channel_id}/messages,
{ body: payload /* RESTPostAPIChannelMessageJSONBody */ }
);
but i don't know how to parse `files` from `MessageCreateOptions`
The .post has a files option
yes, but the MessageCreateOptions.files can be ```js
readonly (
| BufferResolvable
| Stream
| JSONEncodable<APIAttachment>
| Attachment
| AttachmentBuilder
| AttachmentPayload
)[]
Is there any tool within discord.js that makes all of this automatic parse for RawFile?
djs doesn’t seem to have a like client.channels.send
yes, i miss this 😦
What kind of channel is it?
why not fetch the channel?
a lot, most commonly text channels, threads and dms
fewer requests, it doesn't suit me to make a request that I won't need
Yea, I think what you have now is the best method if you aren't fond of making a fetch request prior to sending it
Out of curiosity are you validating that the channel is text when you get the id?
yes, that's what i use, the problem is that this version llimit me from sending files, i don't know how to parse so many options that MessageCreateOptions.files can have to become RawFile
these are channels that the bot has worked on before and the ids were saved in the database, i validate before insert. I have a few hundred bots running with this function and I've never had any problems with it
You can try and use the MessagePayload class that d.js has to construct the options & resolve any files you want to send https://github.com/discordjs/discord.js/blob/14.23.2/packages/discord.js/src/structures/interfaces/TextBasedChannel.js#L194
Scratch that, the target needs to be some d.js class, so I don't think that'd work for your use case after some quick thinking
yes, i tried this before sending message here
happily i ever use AttachmentBuilder for files, i'm trying to parse AttachmentBuilder => RawFile
You might still be able to use the static resolveFile() method on it though
i tried this, this is basically what <MessagePayload>.resolveFiles() do, but it seems that AttachmentBuilder is not compatible with fileLike, my typescript complained
Could .toJSON the builder
toJSON returns unknown 🥶
I'd just cast it. Based on how d.js uses it, passing an AttachmentBuilder instance should still work just fine
i put @ts-ignore to test and it works anyway, problably it's only a typing error
i believe that resolveFile really should receive an instance of AttachmentBuilder 
Yea, seems to just be missing in the typings is all
What does it mean for a select menu to be required? Oh nvm only for modals
is the modal user selectir thingy still not a thing in djs (#discord-dev-news message)
It is a thing, yes, #announcements message
any chance you can tag it in djs’ docs
i cant find it 😭
UserSelectMenuBuilder discord.js@14.23.2
Class used to build select menu components to be sent through the API
perfect, ty!
is it possible to have select menus be able to let the user select multiple options instead of just one
yes, just set the min/max values
oh ty
why doesn't this work?
also emojicreate and delete doesn't work
define "doesn't work"
does it error? does the event not emit?
are components in modals now supported?
Yes
are there some examples available?
Apart from this work in progress guide, you also have the docs
LabelBuilder discord.js@14.23.2
A builder that creates API-compatible JSON data for labels.
thank you
guys
😂
Can you teach me?
You can’t
You can put it in a Container tho
Can you teach me ? And I will give you money
That’s not an embed
Speak Arabic ?
اي
if ?
لقيت واحد يفهم علي
That link’s for you @rare verge
ممكن تعلمني كيف أعمل بوت عشان أصير برمج محترف 🙂🥲 @rare verge
Can you teach me how to make bot ??
thank you very much
Nice
Container Builder
It's new right?
@stable sun
Am I transparent and not see? @rare verge @stable sun
Yea
والله انا اعلم نفسي قبل
🙂🙂🙂🙂
Display components are the new stuff Discord made
Well, before they released new modal components
Can you teach me yes or no ???
I will learn it
That response wasn’t for you. Unlucky timing
I can, but not right now. My mind’s mush. Need some rest
Can you show me a vedio how to make it ?
Prob not
vedios*
Every d.js video made becomes outdated by a year
with s
+5
yes
I hope a new video is released
Maybe your friend that read the guide earlier can teach you
can you pause dms through the api?
I am not sure that bots have this option
trying to add this feature to our own server bot
https://hashbot.com/docs/dm-disabler
Oh you want to edit the guild not the user settings. One sec I will see if I can find it
yes correct sorry if my wording was confusing
I didn't see it in the guild feature, figured it'd be there if it was documented because that's where the pause invites is
wonder how that bot managed to do it
undocumented does not mean inaccessible. But it does mean that DJs will not support it. You would need to do the work to find it and edit it with raw rest requests
hmm i guess i’ll just add that bot then thank you for the help
edit dms_disabled_until on the guild actions object to a timestamp, iirc it’s up to 24h only, but this is a documented endpoint so djs probably supports it
Guild#setIncidentActions() discord.js@14.23.2
Sets the incident actions for a guild.
It does yeah
can i use cache for getting all active threads instead of using fetchActiveThreads()?
Hi,
Does (CommandInteraction | MessageComponentInteraction).deleteReply() throw Unknown message when an ephemeral message is deleted by the user before the bot deletes it ?
Thanks
Yes
Is there a way to check whether the message is deleted before trying to delete it ?
No, you'll have to catch the rejection
does current djs fully support components v2?
Yes. #announcements message, and modal components were added last week.
Since when did discord come up with this
back in 2023 i think?
please keep off topic content to #archive-offtopic
you can now upload files in modals??
SoonTM
the endpoints are still locked down to staff/testers
ContainerBuilder discord.js@14.23.2
A builder that creates API-compatible JSON data for a container.
@rare verge can you please use hide:true or #app-commands for personal usage of the bot?
Oh of course I'm sorry
np just heads up
ok ❤️
I just added it to discord.js 
there's already a PR

time to check if what he did is the same as me
prob not
almost the same
hi, how can i add this to my bot's description?
It’s done automatically, bot has to be verified and then when Discord has enough data it displays the most used commands
Modals can only be sent to a user from a click of a button right? not via any link or so
Or slash command, but yes
Interaction responses only
Gotcha
Bots cannot read messages in a Group DM can they? Would be useful for Guild Application Interview Archiving
correct (aside from the target of a message context menu command, but that doesn't sound like what you're looking for)
even when a bot has been added to a GDM?
I was under the impression they couldn't be added to a gdm
Is there an ETA on how long Discord takes with Documenting these things? Maybe just adding a "Archive" User account to the GDM is the only way then, because i dont want to stay in all those group dms. Even if its just the last 100 groups...
Yeah I'm not aware of any situation where the bot user can be added to a group DM
what exactly are you expecting them to document?
the lack of feature?
or were you asking how long it'll take for them to add?
never mind then. I must be mis rembering the command context as adding the bot to the gdm
I am under the impression that this whole Apply to Join system is not yet documented in the Discord API Documentation. Even just for reading the application form.
That doesnt mean theyre going to document it, if its not a feature they intend to make available to applications
Also unsure how Apply to Join related to group DMs?
and beyond that I also believe they don't do ETAs anyways
ETA as in, from your experience
it varies
some things take years
some things take weeks
Yeah its essentially impossible to tell.
the apply process has a button to create a GDM with applicant
(which is wonky af, but that's besides)
Interviews in Apply to Join open group dms, I'd be happy if I can just archive the application form answers
Some stuff is just surprise documentation we didnt know about. Some stuff is documented after the fact within weeks to months. Some stuff is never documented
We havent heard that Discord have any intention to give applications access to this feature, so it might be a "never"
Ohh alright, thanks!
I wasnt too sure, only just recently got back to discord applications
Yeah fair enough
We're very much at the whims of what Discord decides to do on any given day lol
Maybe going back to letting everyone in and handling applications in the server is the most safe approach
Given the recent enhancements to Modals you could probably build a pretty mature workflow on your own now
Yes I saw, especially the Text Display and Containers are very interesting
Last time i really put in work into discord apps was well before interactions and similar things were a thing
Thanks for the info everyone
I'm having an odd issue deploying commands...for some reason, deploying guild commands simply hangs:
await rest
.put(Routes.applicationGuildCommands(clientId, guild), {
body: pcommands,
})
.then(() => {
console.info(`Synced commands to ${guild} successfully.`);
})
.catch((err) => console.error(err));
I tried setting the timeout on the rest client lower, but it never completes or catches. Never had trouble before...
if it's a bad command definition I usually get an error back lol
if you're doing it too often, you're rate limited
Ah...I see it now. I broke on debugging and it's indeed in discordjs's sleep(), with the stacktrace pointing twoards the ratelimit handler.
I doubt its a djs thing specifically but i wanna make sure, is ther eanything that happens almost EXACTLY after a bot has been up for 8 hours that DJS does? Asking since after i updated my DJS to newest version, its been crashing every 8 hours from startup, consistantly
no, nothing specific
Damn, okay thanks
Does Label builder support attachments too?
the modal attachments have not been added to d.js yet at this time
Alright, thanks Jö.
We cannot select forum channel from ChannelSelectMenuBuilder?
You mean a thread channel?
Oh I think it's called post
Discord api calls it a thread
You will not find PostChannel in Discord api docs (and thus neither d.js docs)
Never tried it tbh
Well somehow... The channel appear if I test it on my test server
Idk whats wrong
Is it because my main server had too many channel?
Try copy pasting the thread channel id
Nope, it's not working
Better off asking in ddevs tbh
Can’t be helped on d.js end
When using a role-select menu, am I able to only display specific roles, instead of all of them?
no
Shame. ty
can i have emojis in components selector dropdown menus?
StringSelectMenuOptionBuilder#setEmoji() discord.js@14.23.2
Sets the emoji to display on this option
how exactly do i use it?
<:emoji_name:emoji_id:> stringg format?
yeah that should work
any guide to use the new modal?
documentation suggestion for @visual copper:
ModalBuilder#addLabelComponents() builders@1.12.1
Adds label components to this modal.
LabelBuilder discord.js@14.23.2
A builder that creates API-compatible JSON data for labels.
basically you can now add a label component, which can wrap a select menu with a label text and a description
see the LabelBuilder for all the label component methods
and you can also add a text display
ModalBuilder#addTextDisplayComponents() builders@1.12.1
Adds text display components to this modal.
can i collect buttons and selection menus with one collector or must i make multiple?
You can, assuming they are on the same message or at least in the same channel
How can I do this? I don't see anywhere on guide where I can use attachments and options in a modal?
attachments were just released in the api roughly 12h ago
modal select menus were added in djs a while ago, but the guide doesn't have it yet
just see a few messages above for a quick answer
Ah thank you
const interaction_collector = response.resource.message.createMessageComponentCollector({
componentType: [ComponentType.Button, ComponentType.StringSelect],
time: 35000,```
so this should be fine?
No. Don't pass componentType if you don't want just one type
in the TextInputBuilder, why can't we set the value to an empty string?
it's throwing this error:
✖ Too small: expected string to have >=1 characters → at component.value
but using an empty space seems to work fine if you do something like this: .setValue(someValueThatCanBeUndefined || ' ')
Maybe just don't set the value at all? :o
I mean that’s not empty that’s a space
that's what i meant
If you use setValue, you have to set a value. If you don't want to set a value, don't use setValue.
but I want to set a value... it's just not always present
A space is a character, so I can’t see why it wouldn’t work
Then check if it's present before setting it.
that would mean i need to split my code and use variables rather than just retuning a new modalbuilder 
Ternary operators also exist, however a space is a character
Something like this worked perfectly fine before
return new ModalBuilder()
.setCustomId('')
.setTitle('')
.addLabelComponents(
new LabelBuilder().setLabel('').setTextInputComponent(
new TextInputBuilder()
.setCustomId('')
.setPlaceholder('')
.setValue(code || '')
.setStyle(TextInputStyle.Paragraph)
.setRequired(true)
.setMaxLength(1900),
),
)
now you need to add an extra space in there or split the code up
Using an empty string for customId works on the builders or for discord? For discord it’s within the api that you need to have a custom id above string length of 0. Which is intuitive. Djs just follows the spec
this is how builders are by design
it was just an example, i do have my custom ids and titles set properly
The only time you can’t have a customid is when you have a url button
Then it’s not really an example, since that won’t work regardless
like, if you don't want to do that, I'd actually recommend you just use json objects instead
You can’t have empty strings in places that require you to have a non-empty string however
Just adding the empty space works for me, i just don't get why there needs to be a check if the length of the value is greather than one
because the API doesn't allow an empty string, or at least we think it doesn't
It worked fine before the update
¯_(ツ)_/¯
djs builders are for building and validating, which makes sense. You don’t wanna build something for it to not work
open an issue on github if you think the behavior is inconsistent with the API
but, as I said just earlier
just because this "works for you" doesn't mean we recommend it, I think you're going totally wrong if you're setting values to empty strings
builders, are, by design, to create concise and readable complex conditional code. if your task is as trivial as setting a single property conditionally and you don't want to use the builder pattern, you should just use plain objects
I build the modal based on previous interactions and the value may be present or may not be
Cool but they need to be there in the api, hence djs checks it
yes, I understand that. this is what builders are for, but if you insist on a single return with the whole thing, then you're throwing all of that away
what we want you to do is
const builder = new WhateverBuilder();
if (conditional) {
builder.setSomething(someValue);
}
return builder;
Am I saying something wrong?
but again, if you don't like that and if your logic is simple, you're better off just writing
return {
field: conditonal ? 'value' : undefined
};```
yes, you're repeating what I'm saying just more passive aggressive
I never used discord.js before, how long will it uusually take until the File Upload modal component that released yesterday is supported?
should be pretty soon, but we don't give ETAs
So I’m not wrong then, sorry I’m coming across like that it’s not my intention
the relevant pull request is here https://github.com/discordjs/discord.js/pull/11179
When do you think it will be merged?
Djs doesn’t provide etas. It was also released yesterday
I'll just solve my issue by doing this and it works just fine 
return new ModalBuilder()
.setCustomId('customid')
.setTitle('title')
.addLabelComponents(
new LabelBuilder().setLabel('label').setTextInputComponent(
new TextInputBuilder({
custom_id: 'customid',
placeholder: 'placeholder',
style: TextInputStyle.Paragraph,
required: true,
max_length: 1900,
value: someValueThatCanBeUndefined,
}),
)
);
you do you, I gave you my stance as someone that's actively working on builders
Just approximately, compared to how fast the other modal components were supported.
yeah, it just seems silly to me that there's a check if it's not a requirement
like a value does not need to be provided here at all
It’s just not something djs provides
Okay, how long did the Label modal component take?
about one month, i believe
plus minus a few days
Alright, thank you!
again, if you're sure the API supports it but we don't, then that's technically a bug
I can't be bothered
though the API does also say that it is not a required field
value? string Pre-filled value for this component; max 4000 characters
Of course the value is not required, but if you use setValue in your code, that can't be empty.
yeah but you used to be able to just give it an empty string, now discordjs expects the string to be at least one character long
then this
does the api allow an empty string in the first place?
I don't think it'd make sense for that context
it can either be something (non empty string) or nothing (not set)
I don't know, it might have just been handled by discordjs before and they didnt send off the value at all if it was an empty string
Wouldn't it be cool if discord.js would not set it if it's empty?
Like it did before...
I'd say it should validate it's something
apart from builders I don’t believe djs validates much else, since everything required by the api is checked in a builder
just tested, the api does accept an empty string
please just make an issue
because you'd be inputting something and it'd actually set a different thing
Oh cool
Okay, thank you duck, i will make an issue
Guys I might've found a bug but I'm not sure.
On the new modal components, the ModalSubmitFields property is an array, that is OK. (1st pic)
However the LabelModalData has a property of component which suggests that there is only one component - but the type says it's an array (2nd pic). When I log out ctx.fields.components out though, I get this:
[{
type: 18,
id: 2,
component: {
type: 4,
id: 3,
customId: "text-display-1",
value: "asd",
},
}]
This suggests that LabelModalData is supposed to be singular instead of an array.
Is this intended or what am I doing wrong? I want to iterate over all label components because I need to collect all data with custom ids (I can't predict which custom ids to expect)
A Label can only have one component inside of it.
yeah but the type suggests an array
I'm drafting an issue for the repo right now. Update: Done.
-# Hi btw
Yeah that's probably a good idea
-# Hi lol
Is it possible to use container layout in modals?
no, containers can only be used in a message
Alright, ty
The discord-rpc package is deprecated or merged into the main repo?
deprecated
Ah, does it still work or do i have to use the d.js package for rpcs?
Should still work
What djs package for RPC?
the main one (what i meant is discord.js v14)
That has nothing to do with RPC
Isn't there supposed to be an attachment component?
Not in DJS yet
sigh
It was just officially announced yesterday...it takes some time for libraries to update to the new features
Yeah I think someone said that but I thought they meant updated to djs yesterday
I can wait :p
anybody having oauth url problems recently?
We wouldn't know, we don't handle that
TypeError: channel.isTextBased is not a function
const channel = await guild.channels.fetch(channelId);
if(!channel) return;
if (!channel.isTextBased()) {
return;
}
but why?
npm ls discord.js and what is the output of channelId and channel
Is the channelId undefined? That'd make it return a Collection which does not have a isTextBased typeguard
I did log that by .then and I also got a collection of channels
I only can't get the value of the channel's isTextBased() function
Yes, so find out why channelId is undefined and handle that case
would using client.channels.fetch() make any difference?
Finding out why your variables are wrong is a better fix than using different functions
const audit = (await guild.fetchAuditLogs()).entries.first();
^
TypeError: guild.fetchAuditLogs is not a function```
```ts
const audit = (await guild.fetchAuditLogs()).entries.first();
??
What is guild defined as?
I get this error:
[17:02:41] [Command ] [Slash] Command "help" executed by mihivx (1427480488511279124) in Mein Test Bot server (1428234467272687641)
[17:02:43] [Error ] Command Error qmxqgj3t4a:
[17:02:43] [Error ] Error Details:
[17:02:53] [Database] Backup settings changed: Interval=24h, Retention=7d
And this is my code: https://srcb.in/yeyJUD4uh2
async exec(guild: Guild, user: User) {```
where can i share my code when its to long for discord?
I did debug it, it had to be a typo in the config file...
if the channel is not in the guild
^^
is that your full error log?
yes
the error log doesnt say anything useful
try to console log the full error
I will just use try so i can print it out
[17:11:35] [Command ] [Slash] Command "help" executed by mihivx (1427480488511279124) in Mein Test Bot server (1428234467272687641)
Error sending help message: 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 (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:1965:23)
at _UnionValidator.parse (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at SectionBuilder.toJSON (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2404:37)
at C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2105:64
at Array.map (<anonymous>)
at ContainerBuilder.toJSON (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2105:35)
at C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\discord.js\src\structures\MessagePayload.js:151:46
at Array.map (<anonymous>)
at MessagePayload.resolveBody (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\discord.js\src\structures\MessagePayload.js:150:49)
at ChatInputCommandInteraction.reply (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:191:56)```
!!!!!
your guild is undefined
This is not where the guild is defined
wait what
Wherever your main event handler is it doesn't look like you're defining your event name parameter properly.
no, I define it correctly, it's like that everywhere for me.
Did you sow the error?
I personally think you should console log your guild object and check what it actually is
const files = (await glob(`src/events/**/*.ts`)).map(filePath => path.resolve(filePath));
files.map(async (file: string) => {
const event: Event = new (await import(file)).default(this.bot);
if (!event.name)
return delete require.cache[require.resolve(file)] && console.log(`${file.split("/").pop()} does not have name.`);
const execute = context.provider((...args) => {event.exec(...args)}, lang);
if (event.once) this.bot.once(event.name as keyof ClientEvents, execute);
else this.bot.on(event.name as keyof ClientEvents, execute);
return delete require.cache[require.resolve(file)];```
my event handler
k
GuildBan is indeed not a Guild
(event) Client#guildBanAdd discord.js@14.23.2
Emitted whenever a member is banned from a guild.
Check what it actually gets emitted with
tysm
i removed user: User, and changed guild: Guild to guildban: GuildBan, and it works
how can i fetch removed ban in guildBanRemove event?
Fetch?
What do you need that for
i wanna get removed ban, in guildbanremove event
You can fetch from audit logs like you did with your guildBanAdd event
Well, the ban no longer exists so there's nothing to fetch
Well if you're fetching from bans yes, but it still appears in audit logs
You're sent the GuildBan in the event
Yes so if you grab the guild the ban was from and then fetchAuditLogs you can get no?
Get what
Get the entry
I didn't say Guild, i said GuildBan
GuildBan discord.js@14.23.2
Represents a ban in a guild on Discord.
Yes I know 😭
What are you trying to get from audit log
And are you sure you don't just receive it in the event already
I'm not the one recieving help I'm just saying that's what they wanted isi it not? I'm confused because otherwise it makes no sense to me
They asked about fetching it after it's gone
Don't blindly fix the "can't fetch", ask what data they are trying to fetch instead
Ah okay I thought they might have wanted the ban log or something that was an oversight on my behalf I apologise for making it a big thing
Hie guys i got this error:
Error sending help message: 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 (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:1965:23)
at _UnionValidator.parse (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:972:90)
at SectionBuilder.toJSON (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2404:37)
at C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2105:64
at Array.map (<anonymous>)
at ContainerBuilder.toJSON (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2105:35)
at C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\discord.js\src\structures\MessagePayload.js:151:46
at Array.map (<anonymous>)
at MessagePayload.resolveBody (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\discord.js\src\structures\MessagePayload.js:150:49)
at ChatInputCommandInteraction.reply (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:191:56)
(node:2228) Warning: Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.
WARNING: Warning : Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.
code:
And this is my code: https://srcb.in/yeyJUD4uh2
any doc for new modal components?
what is the replacement for guildKickAdd?
i want for modal one...
I am getting Error: Expected a string primitive so wanna know what's wrong with my code
!!!
If you mean in the event where a user is kicked it will fire the guildMemberRemove event
Can somone help??
Im asking for help 3 times now
Please be patient and someone will help you I'm sure
How annoying, I don't know how to use the new selection menu in modals! Can anyone help?
section takes an accessory, either a button or a thumbnail
if you don't need that, dont' use a section
use the text display directly
Ohh
You need to use a label component otherwise it is the same as an action row
Alright thx
Do you have sample code? It's all depraved.
There's no guide yet. Here's the preview
https://discord-js-guide-3gofz1r1u-discordjs.vercel.app/legacy/interactive-components/select-menus#using-select-menus-in-modals
Thanks, it worked!!
why messageDelete not receiving content
if you have partials enabled and the message wasn't cached, or you lack the message content intent
ok ill try it
I have a file that is a bit long but I still can't understand the problem. Can anyone help me?
yee it works, tysm
guys
where can i find codes to copy paste for discord js in python it was pretty easy
what do you mean
example codes are on our guide and on github
in python i could usually google something like meme command discord.py
but it seems like discord.js has lots of changes??
changes like what?
syntax in general?
i dont really understand what you mean by that. can you be more specific?
i tried to use chatgpt but it works with older versions of discord.js only
https://www.discordjs.guide/legacy
You mean like the guide?
thats because you asked ai to give you code that doesn't work
oh ok
is it possible to get someones bio/description with discord.js?
nope
the api doesn't allow it
weird, ive seen bots that show the bio
then they do that by breaking ToS
no bot-accessible endpoint exposes that information
ohhh i see, thank you!
thats probably why the command of that bot is so much slower than others 😭
would make sense. i'd report that for breaking ToS
anyway, nothing you can obtain via discord.js
just over the Report App button?
makes sense, thanks again
can someone do filter and collector for 2 buttons "show" and "go back"? i dont understand and gpt doing errors
well, don't use chatgpt for discord.js
Component collectors
For situations where you want to collect multiple interactions, the Collector approach is better suited than awaiting singular interactions. Following on from the select menus guide, you're going to extend that example to use an InteractionCollector to listen for multiple Begin by adding to the...
read more
Can I read other bot's responses on interactions? so if a user uses a foreign interaction, i should be able to read the response message right?
ohh
Yes
i wanna sleep
Unless it was ephemeral
Using Sapphire:
I set a breakpoint on the first if statement and it wont trigger when using the interaction
interactions are webhooks
ohhhh
Thanks!
Code:
const container = new ContainerBuilder()
.addSectionComponents((section) =>
section
.addTextDisplayComponents((textDisplay) =>
textDisplay.setContent(
`Welcome to the server, ${member.user.username}!`
),
)
.addTextDisplayComponents((textDisplay) =>
textDisplay.setContent(
'We are thrilled to have you here. Please take a moment to read through our server rules and guidelines to ensure a positive experience for everyone.'
),
)
.addTextDisplayComponents((textDisplay) =>
textDisplay.setContent(
'-# Make sure to check out the various channels and introduce yourself to the community!'
),
)
.setThumbnailAccessory(
(thumbnail) => thumbnail.setDescription('Welcome').setUrl(member.user.displayAvatarURL({ size: 1024, extension: 'png', dynamic: true })),
),
);
Error:
CLIENT ERROR: TypeError: thumbnail.setDescription(...).setUrl is not a function
at C:\Users\user\Documents\VSCode\random bot\Synapse-Base\events\AUTO\welcome.js:37:76
at resolveBuilder (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2461:12)
at SectionBuilder.setThumbnailAccessory (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2359:61)
at C:\Users\user\Documents\VSCode\random bot\Synapse-Base\events\AUTO\welcome.js:36:22
at resolveBuilder (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2461:12)
at C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2050:75
at Array.map (<anonymous>)
at ContainerBuilder.addSectionComponents (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\builders\dist\index.js:2050:56)
at Object.execute (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\events\AUTO\welcome.js:19:14)
at Client.<anonymous> (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\utils\Loaders\EventLoader.js:41:76)
Attempting to reconnect... (Attempt 1/5)
Client error: thumbnail.setDescription(...).setUrl is not a function
[22:58:53] [Warning ] Shutting down dashboard server due to error...
setURL()
also, the dynamic option has been removed
forceStatic is the opposite. dynamic is enabled by default
Ohh okay
When using the following reply, I get the warning, that ephemeral is deprecated.
interaction.reply({
content: `You don't have permission to use this command${
interaction.options.getSubcommand().toUpperCase() === "ENABLE" ? "" : " in DMs"
}.`,
ephemeral: interaction.inGuild(),
});
Does anyone have a solution using flags that doesn't look too bad? Best I could think of was this:
interaction.reply({
content: `You don't have permission to use this command${
interaction.options.getSubcommand().toUpperCase() === "ENABLE" ? "" : " in DMs"
}.`,
flags: interaction.inGuild() ? MessageFlags.Ephemeral : undefined,
});
I guess it works fine as long as MessageFlags.Ephemeral is the only flag...
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
I don't see how using bitwise operators could make the code look better. I'd still have to check, if the message was sent on a server. Or do you want me to shift the boolean value? Could you please give me an example of what you think works best?
that is what works best
Shifting the boolean?
no? i think what you have is fine
"looks bad" is subjective, while using enums is objectively better than magic numbers or other such things
Okay, thx then. I really liked the ephemeral option, but i guess I'll have to live with flags now...
Webhook discord.js@14.23.2
Represents a webhook.
hey @grizzled bison, please use #app-commands or set the command option hide: true
owh ok sorry I am having problems with webhooks previously i used the same code and it worked but when i started voting the webhook was not sent and i tried to add logs to check the error and that's what happened
Show the rest of the error message and code
ahh i found it it was a problem withComponents previously i was using MessageFlags , thanks you
how does wordle send these when i havent run the command
it says you did though
might be the cool case of it just following up in next 24 hours
The 15 minute expiry doesn't apply?
thats what i was thinking
it says it was sent yesterday though?
it was
then?
it was way after i did /wordle
weird it says there you ran it and then it replied immediately
also follow ups reply to the original interaction rpely
it does it every day
I remember it simply sends a reminder like any message
though wordle is a special bot anyways
it's in every server without being invited
true
so it might be another special thing if it's like you said
yeah your probably right🥀
yeah, that thing that was pushed to everyone is special and has 24 hours for it
im surely doing everything right simply asserting interaction.guild everywhere
outside of global commands
If your bot is private, and cant be used in DMs, sure
there is no like, "global interaction" and "guild interaction", they all trigger the same event
unless you mean in the command code itself
then if you know that it would never happen in a DM, sure
but you could also just typeguard your interaction and not have to assert it everywhere
Yeah my handler seperates them, that command practically (hopefully) cant run outside of a guild
o
BaseInteraction#inGuild() discord.js@14.23.2
Indicates whether this interaction is received from a guild.
or
BaseInteraction#inCachedGuild() discord.js@14.23.2
Indicates whether this interaction is received from a cached guild.
Perfect, thank you!
is there also one for the channel menu?
Yes, all select menus are supported
I followed documentation of creating handlers and such. It has started to create tech debt as my project has grown, with my "interactionCreate.js" and being touched by 10 other files or "guildMemberAdd.js". For example...
- GuildMemberAdd.js handles checking for muting, onboarding,
- Interactions Create, handles welcoming, onboarding, role menus.
- All these files have their own OTHER files as command.js files as shown in image figure.
Pretty much my code is bouncing all around the place. If "guildMemberAdd.js" has issue it takes out several functions at once and has grown to like 1000 lines of code.
TLDR: Is it advised/possible to just put all function feature's in separate/single files so each thing is its own comparntalized bit so I don't have these monolithic "interactionCreate.js" files for a "command handler" structure?
Im curious just how "monolithic" they are, but yes, you can absolutely modularise further
You can also just separate things out into separate functions within the one file
Would it become a API problem if I rewrite and declare below several times across my code? Currently everything that requires "InteractionCreate" ends up in this single file module export which is my main concern and what I want to escape from
name: Events.InteractionCreate,
async execute(interaction) {```
The downside of having multiple event listeners is that it will fire ALL of them at once, and you then need to ensure you kill off the functions that shouldnt be handling a particular aspect of the event ASAP
There's a balance between multi-handling and single-triage
What exactly is failing that "takes out several functions" that you cant architect around without multiple event handlers?
Nothing is failing, but I just don't want one file with 10 totally different and unrelated functions. I am use to everything to do with "something" should just be in "something.js". Now I have to check if interaction is fine, then check command file itself, then check guildMemberAdd.js event and so fourth etc...
How are you handling it now, if/else or switch cases or something based on details of the event?
pretty much, why its such a PIA.
Yeah fair enough, you could modularise a bit via something like
switch(interaction.type) {
case InteractionType.ApplicationCommand:
switch(interaction.commandType) {
case ApplicationCommandType.ChatInput:
return handleChatInputCommand(interaction)
default:
console.log("Unhandled");
}
}
}```
And that way each interaction type is split out
And then those component functions like handleChatInputCommand can be separate functions, in other files if you want
There isnt a significant benefit to having multiple event listeners over this triage
Is there any good open source projects that are "beautifully designed" that could be helpful for me to reference?
I only ever seem to find half baked iffy bot templates on github 
No idea sorry haha
Good design changes depending on scale
Modularising to the degree you're looking to do would be terrible for a smaller bot
These are the two options basically, I'm inclined to prefer the first one
I would like to keep idea open of scaling the bot up and sharding it etc... I rather invest now in making it strong than fix up holes later with 10x the codebase. I am only at 331,800 characters total code base but I am only like 30% done.
But feel free to experiment with what suits you better
For this design #djs-help-v14 message would it scale well or become a giant problem later?
Really depends on how you write it, like using maps or switch cases, things with efficient lookups
How can i use dropdown menus in models?
You just put them in a LabelBuilder and inside of ModalBuilder
documentation suggestion for @toxic moat:
LabelBuilder#setChannelSelectMenuComponent() discord.js@14.23.2
Sets a channel select menu component to this label.
I will try it
Ohh in need use LabelBuilder so i can delte Module Builder
No
You add the Label to the Modal
This is my code now:
const { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, } = require('discord.js');
module.exports = {
customId: 'open-case',
async execute(interaction, args, client) {
const modal = new ModalBuilder().setCustomId('open-case-modal').setTitle('Open Moderation Case');
const caseReasonInput = new TextInputBuilder()
.setCustomId('case-reason')
.setLabel("Reason for the case")
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder("Describe the reason for opening this case...")
.setRequired(true)
.setMaxLength(400);
const caseReasonRow = new ActionRowBuilder().addComponents(caseReasonInput);
const categoryInput = new
}
};
ModalBuilder#addLabelComponents() builders@1.12.1
Adds label components to this modal.
I dont check the document sorry im new.
can you give me a example please
No needent
Youve been given the documentation now though
.addLabelComponent((labelBuilder) => {
return label
.setCustomId(…)
.addStringSelectMenuComponent((menuBuilder) => {
return menuBuilder
.setCustomId(…)
// … select menu stuff
})
// … label stuff
});
})
// … modal stuff
why does the ActionRowBuilder take a generic for the components it contains while almost every other one has specific methods for adding specific components?
Prob bc it was legacy behavior
I guess technically not all components are allowed in every context
Can’t use buttons in modals
Like this?
modal.addLabelComponent((labelBuilder) => {
return labelBuilder
.setCustomId('case-category')
.addStringSelectMenuComponent((menuBuilder) => {
return menuBuilder
.setCustomId('case-category')
.setPlaceholder('Select a category')
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel('Warning')
.setValue('warning')
.setDescription('Issue a warning to a user')
.setEmoji('⚠️'),
new StringSelectMenuOptionBuilder()
.setLabel('Mute')
.setValue('mute')
.setDescription('Mute a user')
.setEmoji('🔇'),
);
})```
That looks fine
Alright i will try it
You could use callbacks in addOptions instead of making the classes
.addOptions((optionBuilder) => …, (optionBuilder) => …, …)
just out of curiosity...there's no functional difference between using a callback and instantiating a new class correct?
That’s correct
Alright
Callbacks just reduces the imports you need to do
I will try first if it works
Without error we cant learn
Indeed
This is my cmd code:
const { SlashCommandBuilder, } = require('discord.js');
const { modal } = require('../../components/modals/open-case.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('open-case')
.setDescription('Opens a moderation case'),
async execute(interaction, client) {
// Show the modal to the user
await interaction.showModal(modal);
}
};
Can you log modal in the command before you show it?
And this the modal:
const { ModalBuilder, LabelBuilder, ContainerBuilder, ButtonStyle, ButtonBuilder, TextDisplayBuilder, MessageFlags, StringSelectMenuBuilder, StringSelectMenuOptionBuilder } = require('discord.js');
const { model } = require('mongoose');
module.exports = {
customId: 'open-case',
async execute(interaction, args, client) {
const modal = new ModalBuilder().setCustomId('open-case').setTitle('Open a Moderation Case');
modal.addLabelComponent((labelBuilder) => {
return labelBuilder
.setCustomId('case-category')
.addStringSelectMenuComponent((menuBuilder) => {
return menuBuilder
.setCustomId('case-category')
.setPlaceholder('Select a category')
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel('Warning')
.setValue('warning')
.setDescription('Issue a warning to a user')
.setEmoji('⚠️'),
new StringSelectMenuOptionBuilder()
.setLabel('Mute')
.setValue('mute')
.setDescription('Mute a user')
.setEmoji('🔇'),
);
})
});```
Oh, it’s clearly not exported then
Log what do you mean sorry if the question are dumb.
There is no modal exported here
module.exports = { modal }; right?
You only export a customId and execute function
Well, need to be careful on the specifics of implementing that
Callbacks also allow you to keep it as a single expression
Alright i make it now in callback.
I was talking about a different thing
.addX(X()) vs .addX(() => x.…)
I guess technically that’s an expression too
Can you help me because idk what i should do now.
Just export the modal at the top-level
just how youre exporting the custom-id
Like module.exports = { modal }; our?
Same way you did with customId
Add a key: value pair
ahh
Like this?
If you capitalize the key, you have to change it in the other file too
Alright+
Also no, you can’t access modal variable from here
You have to make the model before you do exports
I got this error:
[04:09:03] [Command ] [Slash] Command "open-case" executed by mihivx (1427480488511279124) in Mein Test Bot server (1428234467272687641)
Error showing modal: DiscordAPIError[50035]: Invalid Form Body
data[BASE_TYPE_REQUIRED]: This field is required
at handleErrors (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\rest\dist\index.js:762:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async BurstHandler.runRequest (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\rest\dist\index.js:866:23)
at async _REST.request (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\@discordjs\rest\dist\index.js:1307:22)
at async ChatInputCommandInteraction.showModal (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:399:22)
at async Object.execute (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\commands\Moderation\open-case.js:12:13)
at async validateAndExecute (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\utils\Handlers\InteractionHandler.js:377:17)
at async Client.handleInteraction (C:\Users\user\Documents\VSCode\random bot\Synapse-Base\utils\Handlers\InteractionHandler.js:428:21) {
requestBody: { files: undefined, json: { type: 9, data: undefined } },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { data: [Object] }
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1428565452833161226/aW50ZXJhY3Rpb246MTQyODU2NTQ1MjgzMzE2MTIyNjpWTFlNVllwV1VaeHU0REFLaWthQmVWenZacXBHWUtueGVROElYMjExejFtQUVLSmY2V2E0b3AzM1pjeGJYQklHN05BaDlidHZXTEs1SlZ4R3ZBVGxUbDV2ck8xSDFFSDhLWWFqaWJlUWExTVRmTWt2bWN3czlzZ0o5b1h4aTVoZA/callback?with_response=false'
}
Ahh and probably is good to know im using this base here: https://github.com/gonepecan/Synapse-Base/tree/main?tab=readme-ov-file#creating-events
console.log modal in the command
Prob still an import/export issue
The base has this temp:
const { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder } = require('discord.js');
module.exports = {
customId: 'test',
async execute(interaction, args, client) {
const modal = new ModalBuilder()
.setCustomId('test_modal')
.setTitle('test Modal');
const input = new TextInputBuilder()
.setCustomId('test_input')
.setLabel('Enter some text')
.setStyle(TextInputStyle.Short)
.setRequired(true);
modal.addComponents(new ActionRowBuilder().addComponents(input));
await interaction.showModal(modal);
}
};```
Idk started scripting ago 3 days.
You never learned to print variables?
Oh, you replied to the other message
I know how to print errors our variables.
its undefined
Show that other file that’s making the modal
const { ModalBuilder, LabelBuilder, ContainerBuilder, ButtonStyle, ButtonBuilder, TextDisplayBuilder, MessageFlags, StringSelectMenuBuilder, StringSelectMenuOptionBuilder } = require('discord.js');
const { model } = require('mongoose');
module.exports = {
customId: 'open-case',
async execute(interaction, args, client) {
const modal = new ModalBuilder().setCustomId('open-case').setTitle('Open a Moderation Case');
const category = modal.addLabelComponent((labelBuilder) => {
return labelBuilder
.setCustomId('case-category')
.addStringSelectMenuComponent((menuBuilder) => {
return menuBuilder
.setCustomId('case-category')
.setPlaceholder('Select a category')
.addOptions((optionBuilder) =>
optionBuilder.setLabel('Warning').setValue('warning').setDescription('Issue a warning to a user').setEmoji('⚠️'),
);
})
});
}
};
You're not exporting a modal there
When i try save it i get this [04:26:06] [Error ] Failed to load command open-case: modal is not defined [04:26:07] [Command ] Commands: 0 updated, 3 unchanged
@stable sun should i talk with the owner of the base?
Okay
That’s why you must define the modal before you export
You can’t have it inside of execute
