d.js docs
d.js docs
DIAdiscord.js - Imagine an app
Created by Skullfromroblox on 4/29/2025 in #djs-questions
How to add "ephemeral message" code to my code
We are not Discord, just some nerds who develop Discord bots! - /report appeals and age updates - /howtoreport reports (harassment/hacking/spam/abuse) - /support anything Discord related - /billing payment/nitro - /feedback feedback/feature requests
85 replies
DIAdiscord.js - Imagine an app
Created by Skullfromroblox on 4/29/2025 in #djs-questions
How to add "ephemeral message" code to my code
Codeblocks: ```js const Discord = require("discord.js"); // further code ``` becomes
const Discord = require("discord.js");
// further code
const Discord = require("discord.js");
// further code
Inline Code: `console.log('inline!');` becomes console.log('inline!');
85 replies
DIAdiscord.js - Imagine an app
Created by Skullfromroblox on 4/29/2025 in #djs-questions
How to add "ephemeral message" code to my code
Codeblocks: ```js const Discord = require("discord.js"); // further code ``` becomes
const Discord = require("discord.js");
// further code
const Discord = require("discord.js");
// further code
Inline Code: `console.log('inline!');` becomes console.log('inline!');
85 replies
DIAdiscord.js - Imagine an app
Created by Skullfromroblox on 4/29/2025 in #djs-questions
How to add "ephemeral message" code to my code
The ephemeral option when replying to an interaction will be removed in v15
- {..., ephemeral: true}
+ {..., flags: MessageFlags.Ephemeral}
- {..., ephemeral: true}
+ {..., flags: MessageFlags.Ephemeral}
Read here on how to specify multiple flags
85 replies
DIAdiscord.js - Imagine an app
Created by Skullfromroblox on 4/29/2025 in #djs-questions
How to add "ephemeral message" code to my code
:propertysignature: InteractionReplyOptions#flags [email protected] Which flags to set for the message. Only MessageFlags.Ephemeral, MessageFlags.SuppressEmbeds, and MessageFlags.SuppressNotifications can be set.
85 replies
DIAdiscord.js - Imagine an app
Created by xTwisteDx on 4/28/2025 in #djs-questions
How do I properly manage a modal?
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. - Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance) * Note: you cannot defer modal or autocomplete value responses
21 replies
DIAdiscord.js - Imagine an app
Created by Panda on 4/28/2025 in #djs-questions
Interactions Confusing themselves w/ modals
:guide: Popular Topics: Collectors - Await modal submit read more
18 replies
DIAdiscord.js - Imagine an app
Created by Panda on 4/28/2025 in #djs-questions
Interactions Confusing themselves w/ modals
:method: ChatInputCommandInteraction#awaitModalSubmit() [email protected] Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
// Collect a modal submit interaction
const filter = (interaction) => interaction.customId === 'modal';
interaction.awaitModalSubmit({ filter, time: 15_000 })
.then(interaction => console.log(`${interaction.customId} was submitted!`))
.catch(console.error);
// Collect a modal submit interaction
const filter = (interaction) => interaction.customId === 'modal';
interaction.awaitModalSubmit({ filter, time: 15_000 })
.then(interaction => console.log(`${interaction.customId} was submitted!`))
.catch(console.error);
18 replies
DIAdiscord.js - Imagine an app
Created by Panda on 4/28/2025 in #djs-questions
Interactions Confusing themselves w/ modals
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.
18 replies
DIAdiscord.js - Imagine an app
Created by bringupyourpost on 4/27/2025 in #djs-questions
how do i check if a user is an admin
documentation suggestion for @bringupyourpost: :property: BaseInteraction#memberPermissions [email protected] The permissions of the member, if one exists, in the channel this interaction was executed in
9 replies
DIAdiscord.js - Imagine an app
Created by nobody on 4/27/2025 in #djs-questions
Type error when sending a container and a action row (CV2)
In TypeScript the ActionRowBuilder class has a generic type parameter that specifies the type of component the action row holds:
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button)
const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu)
const row = new ActionRowBuilder<TextInputBuilder>().addComponents(textInput)
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button)
const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu)
const row = new ActionRowBuilder<TextInputBuilder>().addComponents(textInput)
6 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 4/27/2025 in #djs-questions
Edit components within a container (CV2)
:method: ContainerComponent#toJSON() [email protected] Returns the API-compatible JSON for this component
15 replies
DIAdiscord.js - Imagine an app
Created by Baldy on 4/27/2025 in #djs-questions
Components V2 Select menu
:method: SectionBuilder#setThumbnailAccessory() [email protected] Sets the accessory of this section to a thumbnail.
16 replies
DIAdiscord.js - Imagine an app
Created by Luftjunkie_19 on 4/27/2025 in #djs-questions
The up-to-date guide
:guide: Creating Your Bot: Command handling - Loading command files read more
6 replies
DIAdiscord.js - Imagine an app
Created by Luftjunkie_19 on 4/27/2025 in #djs-questions
The up-to-date guide
We highly recommend you extend the Client structure properly instead of just attaching custom properties like .commands to the regular discord.js Client instance. - Using typescript, you might want to consider casting or augmenting the module type
6 replies
DIAdiscord.js - Imagine an app
Created by DanielBA on 4/27/2025 in #djs-questions
Components v2 error
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
22 replies
DIAdiscord.js - Imagine an app
Created by DanielBA on 4/27/2025 in #djs-questions
Components v2 error
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.
22 replies
DIAdiscord.js - Imagine an app
Created by Nikode on 4/25/2025 in #djs-questions
what do i do yall???
Resources to understand Promise: - MDN: learn more - Guide: learn more - JavaScript info: learn more
14 replies
DIAdiscord.js - Imagine an app
Created by #ToiYeuSweetLiquor <3 on 4/23/2025 in #djs-questions
Problem with Action Row
Structures from the API cannot be edited directly. To do so, you can create a new structure (a builder) using the .from() method
const newEmbed = EmbedBuilder.from(embed).setTitle("title")
const newRow = ActionRowBuilder.from(row).addComponents(component)
const newEmbed = EmbedBuilder.from(embed).setTitle("title")
const newRow = ActionRowBuilder.from(row).addComponents(component)
5 replies
DIAdiscord.js - Imagine an app
Created by #ToiYeuSweetLiquor <3 on 4/23/2025 in #djs-questions
Problem with Action Row
:method: (static) ActionRowBuilder#from() [email protected] Creates a new action row builder from JSON data
5 replies