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

why doesn't he find a role?

```js case "ok-ok-ok": channel.send({ embeds: [ new EmbedBuilder()...

Interaction replying with string works but doesn't work when I return a button

Hey, I started creating a discord bot. It returns a link for the user to click on but it's pretty ugly so i wanted to move over to a button, but when I do this, I am not getting any errors in my console, but running the slash command gives me "An error has occurred." in discord. Currently this works fine: await interaction.reply({ content: 'Please log in on our website to sync your account: ' + url}); ...

Dont understand the guide

so im tryna learn how to code a bot discord but i need several help haha... so im at that screen in the steps, and i dont understand where i need to put those, and why when im tryna /ping w my bot that dosnt work

Cannot read properties of null (reading 'id')

Hey, so I have a code that worked everytime, but now not longer... Version: 14.11.0 ```/home/container/src/commands/guesspic.js:42 if (activeRounds[channel.id]) {...

Typescript: Missing type guard field for button components?

Code example: ```ts import { ButtonComponentData, StringSelectMenuComponentData, UserSelectMenuComponentData } from "discord.js"; type Example1 = (...

How can I change the status from "playing" to "listening" using the `discord-rpc` npm package?

I'm adding rich presence to my application, however it's not a game. How can I replace the text that says playing, and make it say listening? I know that it can be done with bots, however I'm not sure how to do it with rpc. Here is my current code:```js const clientId = "1130369366341455872"; const rpc = new discord.Client({ transport: "ipc" });...

Help with @discordjs/core - interactionCreate argument passing

Hello, So decided to use @discordjs/core. However when I went through the docs and got to the point where the interactionCreate event is being listend to like that ```ts client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {...

Hyperlink mask as a chat message works in certain servers?

Attempting to chat a hyperlink mask in one server may work just fine, but hyperlink mask in another server shows the entire url? Missing permission?

ReferenceError: Member is not defined

So I am currently trying to use discord.js and ytdl to play music off of youtube, and it's saying that member is not defined because it cant really tell what member is, but i'm struggling to brainstorm on how to define a member. NPM 14.11.0 Node v 18.17.0 ``` try { ...

Flag like (--help) approach with /slash-command

I'm migrating a bot so it can use slash commands, and wonder how to deal with --help flags ? Let's say we have a command like /play you can describe each parameters with setDescription to give an idea of how the command works. But what if you want to explain it in a bit more verbose way, with a man like approach ? Thought about using a Boolean option to show the wanted explanations or using a dedicated command play-help Do you maybe have a more elegant approach ?...

Error with send files using `@discordjs/rest`

Getting this error while making a raw file and sending it

Im getting an error that i dont know how to solve

error: ```TypeError: Cannot read properties of undefined (reading 'get') at change_status (/home/container/events/client/ready.js:56:68) at module.exports (/home/container/events/client/ready.js:33:5) at Client.emit (node:events:525:35) at WebSocketManager.triggerClientReady (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:387:17)...

TypeError: isJSONEncodable is not a function

Hi! I keep getting this error when i mention the bot: ```TypeError: isJSONEncodable is not a function at C:\Users\Adamh\Documents\marlean\node_modules\discord.js\src\structures\MessagePayload.js:200:9...

Pulling reactions not working when the message has a button attached

Hello when I run this code I get Collection(0) [Map] {} giving me no reactions to loop through. But when I try the same code on another message that does not have a button on it, I get this: Collection(1) [Map] { with my beloved reactions inside of it. ``js const message = await client.channels.cache.get(977096542462808115).messages.fetch(1132567332921823323`) console.log(message.reactions.cache)...

Can anyone help me with the discord intents

i dont know what this error means: ```/home/container/index.js:40 intents: [Discord.Intents.FLAGS.GUILDS, ^ TypeError: Cannot read properties of undefined (reading 'FLAGS')...

Does internal sharding still exist?

I saw it mentioned in the Discord.js Guide, but can't find any reference to it in the API docs.

How can I respawn a disconnected client that was not spawned from a ShardingManager?

I've noticed after a long time my web-server will still be running but the bot will be disconnected from discord's gateway. I do not have access to the ShardClientUtil to respawn all shards since the bot was created using the WebSocketManager. ```js const { Events } = require('discord.js'); module.exports = {...