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

Some issue with the code that doesn't allow the creation of slash command error code 400

discord.js slash command ```js const { Client, GatewayIntentBits } = require('discord.js'); const client = new Client({...

`fetchStarterMessage()` doesnt give me the first message of the thread

I am trying to get the first message associated with the thread. But the message object returned from the fetchStarterMessage is not giving me that. Below is the code I used to capture the thread creation. ```module.exports = { name: Events.ThreadCreate, async execute(thread, newlyCreated) {...

channel.send('content'); error ponying to .send

TypeError: Cannot read properties of undefined (reading 'send') i am trying to send a message to a channel without a user promting it to but it doesnt seem to work. heres the code i got from the discord.js guide: 'const channel = client.channels.cache.get('id'); channel.send('content');'...

ChannelNotCached Error when make thread

Version discord.js - 14.12.1 node js - 18.6.0 Question I got an error when I try to make a thread which connect with sent message....

Getting User Guild Avatar/Banner

Hi I'd like to know how can i get the user's avatar and banner in the current guild Currently I get the user info from ```js let currentUser =...

GuildMember.setNickname weird issue

Im using a modal for my discords verify system, where they input text and that text then becomes their nickname. 90% of the time it works but then sometimes it doesn't set their nickname? There is no error and it runs the code afterwards still which gives them a role, I created logs for it and it logs the correct nickname it was meant to set it to as well. My Intents ```js intents: [...

Multiple Schema creation on message for level???

So basically I have the leveling system and on the surface it seems to work, but there is just a few issues when I send a message 1. it creates more than one level schema (anywhere from 2-13) 2. the cooldowns dont work I am really scratching my head on this one since Ive tested with console.logs and the actual function is only called once succsefully as seen here:...

Getting "Unknown interaction" error even with interaction.deferReply()

Hey folks, I am getting a strange error with this code: ```ts class StandingsInteraction { public async interaction(interaction: TypedCommands['standings']) {...

Unknown Interaction on awaitModalSubmit()

Hi everyone, im kinda scratching my head here trying to figure out whats going on. https://pastebin.com/dRXw5Ffm Behaviour im experiencing: if the user opens the modal using the button, fills out the info and submits it all works great....

member.dmChannel.awaitMessages() breaking when updating from v14.11 to v14.12

I currently have the following code which works perfectly in discord.js v14.11 however when I upgraded to v14.12, I started getting the following error Cannot read properties of null (reading 'awaitMessages'). This can't be an issue with the code since when I downgrade back to v14.11 it starts working perfectly again so I'm not sure what's going on. ```js let member = await client.users.fetch(memberId) let message = await member.dmChannel.awaitMessages({ filter, max: 1, time: timeOutTime, errors: ['time'] });...

Updating an embed following interaction with a button

Hello, I have an embed with 2 buttons, a first which validates and a second which cancels. I would like for example that when I cancel, the buttons disappear to just leave the message of cancellation. Excluding the buttons remains present. I created a new embed, then I called this line of code to update my message: interaction.update({embeds: [Error]} but as said before, the embed changes, but I can't get the pimples to go away/...

Creating a word counter with mongodb and discord.js

I am trying to create a word counter which displays the users tag and how many times they have said a specific word whilst the bot is active I have my database setup and linked just unsure how to access data and change it when the event has been fired...

Check if user that sent a message have permission

How can i check if the bot have a specific permission on the server? I was using if (msg.member.permissions.has("USE_APPLICATION_COMMANDS")) but its giving me Cannot read properties of null (reading 'permissions')...

Slash Command Builders

I am following the guide for slash command builders and trying to figure out what to do with the part that says get the raw data that can be sent to discord on this page: https://github.com/discordjs/discord.js/blob/main/packages/builders/docs/examples/Slash%20Command%20Builders.md

Leveling system not working

So the issue is that when trying to make aleveling system and send the data tyo mongoDB it seems to not even be calling in the message interaction, but an even weirder part is that when I make it a slash command it does seem to call, however it immediatly halts with the if statement at the beginning? All I really want to do is make a simple leveling system that gets sent to mongoDB when A user sends a message in the guild.

Get the list of roles for a server and browse it.

Still a little question about the roles, I would like to retrieve the complete list of all the roles to browse it and retrieve the roles 1 by 1 to do manipulations on them. How could I go about it, I don't know if guild.roles.cache.find(...) will be useful for me to do this?...

error

okay so when ever i start running my code using cmd my code is a discord bot it gives me this

Doesn't run with systemmd

im trying to get my bot to auto start with my computer but when i run the startup script through systemmd i get this error using 14.8.0 ``` Aug 12 20:50:07 JPH systemd[1]: Started discord bot....

Question about message edit limitations

When editing a message (this message has been fetched), is there a limitation on how old a message can be?

JSON File Counter

I am trying to make a simple word counter in discord.js I have managed to get the bot counting the specific word i want to be counted but how do i permanently store this data in a JSON file and update it when the bot is active.