discord.js - Imagine an app

DIA

discord.js - Imagine an app

Support server for discord.js, a Node.js module to interact with the Discord bot API.

Join

djs-questions

djs-voice

Forum tags - Create a new tag if not exists

I try to create a new tags in a forum if the tag exists: ```ts const availableTags: GuildForumTagData[] = allTags.map((tag) => { return { id: tag.id,...

The reply to this interaction has already been sent or deferred.

Hi I have a problem. When I run the command "/partnership" "owner..." it gives me the error "Unhandled promise rejection: Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred." on the string: await interaction.showModal(modal); here is the complete code https://sourceb.in/4sNvPn1yWI...

How to resolve this error, it happens when I try to send an image(only sometimes)

Unhandled Rejection: SocketError: other side closed at TLSSocket.<anonymous> (/home/container/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher/client-h1.js:681:24) at TLSSocket.emit (node:events:531:35) at endReadableNT (node:internal/streams/readable:1696:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {...

How to send custom emoji in embed description

const eventtic = new EmbedBuilder()
.setColor('#AC00FF')
.setTitle('Booking us')
.setDescription('If you are interested in booking our supervisory team, By clicking the button, a ticket will be opened for you with the Event Management.\n\n :Warning: Note: When you open this ticket, it means that you have confirmed our rules. If you violate the above rules, you will be punished by our event management team, but the final decision lies with them!');
const eventtic = new EmbedBuilder()
.setColor('#AC00FF')
.setTitle('Booking us')
.setDescription('If you are interested in booking our supervisory team, By clicking the button, a ticket will be opened for you with the Event Management.\n\n :Warning: Note: When you open this ticket, it means that you have confirmed our rules. If you violate the above rules, you will be punished by our event management team, but the final decision lies with them!');
as title says i doing several times but it all shows ⚠️ or only words :Warning:....
No description

guild.members.fetch will still fetch those who have left the server

Hey everyone, I am trying to make a simple function that checks if a user is in a server. ``` export async function userIsInGuild(userId: string, guildId: string) { try { const guild = await client.guilds.fetch(guildId)...

Sending attachment with message edit

Hi guys, I need a hand i'm struggling af. I took a 2-4 month old code, added webpack and update libs, what worked before is now crashing....

I need help with my code

it send ```C:\Program Files\nodejs\node.exe .\my-discord-bot\index.js Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'FLAGS') at <anonymous> (c:\Users\user\Desktop\dis\2\my-discord-bot\index.js:6:17) at Module._compile (internal/modules/cjs/loader:1358:14) at Module._extensions..js (internal/modules/cjs/loader:1416:10)...

What are `idHints`?

Question is clear when registering slash cmds or making them

Unknown Interaction

for some reason I keep getting this error when trying to run a command, this only happens sometimes. ```DiscordAPIError: Unknown interaction at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5)...

Sychro problem

I'd like to know a little more about automatic rate limit management with Discord.js For example, if I make a function call to attempt to kick a guild member, and it throws due to a rate limit, I'd like this kick attempt NOT to be automatically re-executed after the retry after specified by Discord. I need to know when the kick has failed or not, so that I know whether to record it in a DB history or not....

messageCreate event

Does messageCreate event affect the bot stability because it get called every time a message got sent ? And is interactionCreate better in stability ?

Message interaction is null

is there still a way to get the interaction associated with the message? Because i have a bot where if you use a slash command it responds with a message with buttons. I want to limit those buttons to only the person why send the intiial interaction, but for some reason when i fetch the msg or get it from the button interaction the interaction associated with the message is null (unless its the first time you click the button for whatever reason) ...

I am confused with interactions

How I can create a script that switch the message with interaction.update there is a "edit" message I don't like to show it get another way?

Guild member caching

What is the default behavior for guild member caching? Are guild members swept at all by default? Basically, if a bot had the presences intent and received all guild members that way, or didn't have the intent/the guild exceeded large_threshold members and guild.members.fetch() is called, is it guaranteed that all members in that guild are in the cache and will stay in the cache?...

Everything executes fine, but then it crashes

I was having an issue ages ago where the code after the interaction.reply was being run twice, then it just randomly went away. Now, I have everything being executed as intended, but I am guessing the double handling is happening again but its now missing context or something and crashing. Its just a guess I am not sure, but I also dont know what to do from here https://sourceb.in/zXvnRVnR5Q this is the error response: (I removed the try/catch to get more details on the errors and let it crash) https://sourceb.in/IynnHw5tom...

"The application did not respond"

I don't understand what is wrong. I have followed what https://discordjs.guide/ says, and it doesn't work. I have searched for help but nothing relevant.
No description

Code organisation

Does discord.js have a feature like Composer in Telegraf (the library to make Telegram bots)? I don't think so (or at least I don't know). It would be cool to have such a feature that helps organising code into files without implementing command and/or event handlers. Please let me know if there is something like that by tagging me, thanks!...

Chanel Creation

any idea why dont creating channels but no errors?

Images randomly not loading

I have a code to log removed images. However, sometimes the image is displayed correctly, and sometimes it's just not showing in the embed. Here's my code: ```js for (const attachment of attachments) { const fileType = attachment.contentType.split('/')[0];...

Can't upload emojis: TypeError: terminated

Hi, when I try to upload emojis using a URL, it works fine locally but not in production. ```js await guild.emojis.create({ attachment: baseAttachmentURL, // some url to an already existing Discord emoji...
Next