discord.js - Imagine a 👻

DIA

discord.js - Imagine a 👻

Support server for discord.js, a Node.js module to interact with Discord's apps API.

Join

djs-questions

djs-voice

Get Guild Rules Channel

Hi ! Is there a way with Discord.JS to retrieve the rules channel that is defined in a server's settings other than using the ID? Mysterious_Dev...

Closing modal after submitting

I have a modal that does not close but it makes alterations as intended (editing a embed) How i could close it without replying directly?...

Sweeper interval

I want a persistent cache with no interval, but https://discordjs.guide/miscellaneous/cache-customization.html#sweeping-caches does not explicitly state how to achieve this. When I try to remove the "interval" property entirely, it leads to an error. I would like the "lifetime" property and nothing else My question is whether setting it to "0" would remove the interval, or if an interval is required...

How to get title of the modal in Modals.ts (handler file)

I'm trying to get the title of the modal to figure out the type. There are 5 types: * Games * Apps * Movies * Series...

Bot changes nickname, and after the nickname reset itself.

Hi guys, I have a problem with nicknames. I have a bot that after a check, it adds a role and change the nickname of the user. It works, it changes the nickname. But after, like a second, the nickname resets. In the Server Audit Log, there is the event of the nickname changed, but no events of other bots/user resetting it. It's a Discord problem, or I need to update to a new version of Discordjs? (The bot have one of the highest role, with all permissions and administrator)...

application did not reply

Hi, I seem to be getting this error about the application not replying, but it replys in a seperate message. https://media.discordapp.net/attachments/1090613260195217519/1137334679020781618/image.png?width=223&height=129...

message.reply() function takes more than 10 minutes to send message

I'm running multiple bots on the same machine, and the problem that has been happening is that the message.reply() function is taking a long time to execute in busy chats, like general server chats. What's even weirder is that if the bot needs to reply to a message in another chat, it will do without delay. ```js MessageCreateEvent ...

Typescript bot using 14.11.0 claims unknown interaction, fails to compile with 14.12.1

From a conversation that began here: https://discord.com/channels/222078108977594368/824411059443204127/1137518310896967720 I am contributing to a Discord.js bot written in TypeScript. Previously, this bot used Discord.js@14.11.0, until I updated it recently. I was working on simplifying some Embed code when, for some reason, I began to receive a console error any time I used any slash command. The bot fails/refuses to respond to any command, including ones that I am completely certain that I did not modify. I did not modify the command names or parameters of any command. The error I received is attached. My initial guess was that Discord updated its API, and that I needed to update Discord.js. Indeed, running npm outdated indicated that, among other things, discord.js should be updated to 14.12.1. So, I ran npm update --save discord.js. I did not update any packages that did not need to be updated when I did this. When I attempted to reboot the bot using tsc && node dist/bot.js, I received nearly 100 errors from a file named ../node_modules/discord.js/typings/index.d.ts:1175. All of them appear to be various forms of "unexpected / incorrect syntax"; I can provide the errors if necessary. When I git stashed my code to revert to a version that I know works, I continued to receive the errors from discord.js when attempting to compile the typescript. The recommended advice was to update typescript to ^5.0.0 to accommodate changes made to Discordjs@14.12.X, but updating Typescript to latest (5.1.6). Despite updating it (and all other packages) to their latest version, I continue to get errors from the same tile when I attempt to tsc. ...

Bot posts randomly 1 - 3 welcome messages for the same member that already joined.

Lets start from my debugging results. First i wanted to make sure i have only one instance of the bot, so i added console.trace right before send message line, and it logs only once with nothing unusual in the trace stack. Then i made prefix "test" command that should reply multiple times if bot is in more than one instance, but also in this case, every time i get only one reply. There is no specific pattern how bot sends welcome messages, its always between 1 - 3 messages for the same person. If two people join within 2 minutes bot can post three messages for first person, and one for second person. Bot doesn't crash or anything (I use Sentry for detailed logs). I am hosting this bot on DigitalOcean, same as my other 3 bots, but only one have that issue. I am also sure that this is not related with my event handler, because all other events works fine. I ran out of ideas, I even reseted bot token, but problem still exists. What is even more weird that issue does not exists on dev version of the bot. The only difference is the token, (i use Windows WSL configured exactly the same as DigitalOcean server to host bot locally on my PC)...

.isChatInputCommand()

I'm gonna continue this conversation here, it's a bit clearer

interaction has already been answered

Is there any way to make this work? It gives the error that the interaction has already been answered.

HELP

when I use the /upload command, it says "This command is out of date, try again in a few minutes" and after a while it says "The application did not respond", and nothing appears in my terminal ```js const { SlashCommandBuilder } = require("@discordjs/builders"); ...

ratelimit

I'm creating 70 room in discord but i'm getting rate limit after creating around 40 channel so how can we fix thiss issue any idea please ?

HELP

i rlly need help all bots i made didnt reply. Can someone help me make a bot? (Like just gonna start a new bot rn i just need you to do index.js and make the bot reply)

A typeguard to check if the received message is from inside a guild.

I'm currently using the @discordjs/core package along with it's other subpackages and discord-api-types for my bot. Based off of the util functions from API Types. I wanted to check if the message is from a guild or not using a typeguard. Rather than checking if both guild_id and member properties exist using if functions everytime. After reading the docs. I realized the guild_id property only exists when the message is from a guild. (obviously)...

Bot no register slash commands

Tried: reinviting the bot with scopes enabled, testing with ping command in docs example(it worked), using applicationGuildCommand() as well, but to no avail.

Building .exe file with pkg results in "Failed to make bytecode"

Hey, I'm trying to build my node discord.js project into .exe file for ease of use. I managed to do so with https://www.npmjs.com/package/pkg by simply running it with pkg . --targets node18-win-x64 and below configuration: ```js "pkg": { "scripts": "commands/*/.js" }...

Made a command for user information, gives an error

Made a command for user information, gives an error ``` Error [GuildMembersTimeout]: Members didn't arrive in time. at Timeout._onTimeout (C:\Users\User\Desktop\Discord BOT JS\node_modules\discord.js\src\managers\GuildMemberManager.js:267:16)...

Getting data from Oauth2

Im currently trying to get data from an Oauth2 onto a seperate website, but everything I find says to host a new website off your computer, which isnt what I want. Any way to do this?

trying to create a message counting bot

just as a starting creation im trying to make a bot that can count how many messages a person has sent in a certain amount of time