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

Is there a way to send a message when the bot is about to turn off ?

I want to send a message kinda like that : "Bot off" when the bot is about to turn off.

How do I get the number of roles that a user has on the server?

How do I get the number of roles that a user has on the server?

I tried to repeat the "Registering slash commands" page on discord.js guide

Finally, i could get rid of all the errors, registered the command and then i started the bot, but when i tried to use the command in discord, i saw this, what is the problem ? My deploy.commands.js file My main.js file ...

So, i tried to repeat the Registering slash commands page from djs guide website

(https://discordjs.guide/creating-your-bot/command-deployment.html#command-registration) But something went wrong, i did all the pages before,created a file with my command, put it in a folder, that was created in my project, even did a subfolder, but i cant get rid of that annoying error My code (deploy-commands.js) My command (ping.js) ...

Modifying internal functions

Is it safe to modify any Discord.js function to add my own code before and after the execution. Example: ```js const defaultInteractionReply = interaction.reply; //I have a better way to handle args but this is just for eg...

Structuring within discord.js

I am fairly new to discord.js but have quite a bit of experience in web-development. I know that structuring a project is very important (the files), so I wanted to ask how that is usually done within discord.js/how people usually do it. Thanks for answers in advance 🙂

env is not grey

When i put my mongodb link in .env it's not fully greyed out because there's a "=". How do I fix this? I suppose I can't?

Trying to receive and log individual responses from two servers.

I am using Rcon to remotely connect to two game servers. I have created a slash command for my Discord bot to send whatever command typed in to both servers. I can get both of them to work, but I cannot get my bot to reply with both individual responses. ```client.on('interactionCreate', async (interaction) => { if (interaction.commandName === 'rcon') { ...

Forum thread tag not working

Why doesn't my bot add the tag to the forum thread? ```js const serverId = interaction.guild.id; const forumChannel = config[serverId].channels.forum_channel;...

Collector filter editing after creation

So I have an embed with buttons (panel) and each voice channel has one panel to itself. I've filtered the panel using the channelId so that someone in voiceChannel2 can't interact with voiceChannel1 panel. My collector + filter code:...

What property is display name

Title. What is the property for the proper display name? In my script I ask for displayname but certain users display their internal name. For example myself I appear as papagoose. instead of as Papa Goose, like other users

Guide doesn't match up with my needs.

I was trying to make a deploy-commands file /w the guide, but then i realized it only works if i "organized" the commands file. How do i fix this without "organizing?"

Getting an error when im trying to node main.js

The code const { Client, Intents } = require('discord.js'); const { token: token } = require('./config.json'); const client = new Client({ intents: [Intents.FLAGS.guilds] }); client.once('ready', () => {...

An error when i try node main.js, im absolutely new at javascript and i wanna try to do my small bot

PS C:\Users\User\Desktop\Discord Bot> node main.js node:internal/modules/cjs/loader:1327 throw err; ^ ...

need help with my bot

well i think i built my bot around 2021 and got it verified on the djs version at that time, but now i completely shut discord and any social platforms for 2 years and my bot went offline so i was wondering if you can help me make updates to my bot and i tried reading the updates but idk im kinda confused

Message Specific Collector

So I have a embed with buttons which acts as a panel to control a voice channel. There can be multiple of these panels for multiple voice channels. Right now every panel generated can be used interchangeably. How would I differentiate each panel with each voice channel so that only the generated voice panel/specific panel can be used to interact with the voice channel. ...

Edit button for only one user

Hey, I try to update a button after one user click on it. Like, one button say "Join" and after clicking on it, the button change on link like : example.com?discord_id=user.id When i do something like that, the button change for all users. I just want the button update only for the user who click on it. ...

Getting error TypeError: client.actions.InteractionCreate.hasPermissionshandle is not a function

I'm getting the error TypeError: client.actions.InteractionCreate.hasPermissionshandle is not a function for some reason and I can't figure it out https://pastebin.com/yYf9kj5N...