discord.js - Imagine an app

DIA

discord.js - Imagine an app

Support server for discord.js, a Node.js module to interact with Discords apps API.

Join

djs-questions

djs-voice

Slash Command Not working

PING COMMAND ```js module.exports.run = async (interaction) => { ...
No description

message event not working

sorry, accidently marked the previous post i made as "resolved" ```javascript import express from "express";...

message event not working

```javascript import express from "express"; import Discord, { ActionRowBuilder, ActivityType,...

TS Bot Handlers not running with correct envs

can anyone figure out why the handlers in this bot is not working? I have provided correct envs. https://github.com/TeaClientMC/Discord-Bot/...

can't set role to user (user.roles.add is not a function)

If I have a code like this ```ts const member = interaction.options.getMember("user"); const type = interaction.options.getRole("type"); member.roles.add(type);...

Button Image

Hello, Is there a way to add an emoji to the button like so: I've been searching for quite a bit on this discord, websites and docs, but I just couldn't find any valuable information that helped me....
No description

How to check server's subscription without API call ?

Is it possible to check the entitlement of a server without having to make a query after each interaction? I search alternative without call that query => https://discord.com/api/v10/applications/123/entitlements...

Locate (multiple) images in post and repost to different channel

I'm able to read the original message, locate the image URL and repost a single image. However, if multiple images get posted, I only return the first URL and corresponding image. I'm stuck... Forgive me if it's something silly, this is my 2nd day using discord.js. Using discord.js v14.16.3 and node v22.11.0. ```const { Client, IntentsBitField, MessageCollector, Collection } = require('discord.js'); const client = new Client({...

SystemChannelFlagsBitField

Why is new SystemChannelFlagsBitField(systemMessageFlagsChange?.new).serialize().SuppressRoleSubscriptionPurchaseNotificationReplies always false?

How to handle unhandled rejections?

My app usually crashes when a very weird unhandled rejection occurs, usually when it's an event where I don't have a general error handler. So how can I catch unhandled rejections effectively? (Maybe even do something with it like send it with a Webhook or log it)...

client is undefined error

Hey, I have the problem that I get an error with "client is undefined" after I call my script via "const script = require("./src/script"); script()". I have attached screenshots of the problem.
No description

Why are my embeds not sent but Files are?

I'm using this payload in a raw rest.post() request and the files are being sent, but not the embeds. Why? I have based the code on the original code from djs. ```ts payload = {...
No description

npx create-discord-bot generates broken code

I'm picking up Discord.JS in order to expand my choices for clients, so I figured I should take a look at Discord.JS, however when i run npx create-discord-bot and say yes to Typescript, it will create a project with broken code in src/util/deploy.ts it says Argument of type 'RESTPostAPIApplicationCommandsJSONBody[]' is not assignable to parameter of type 'RESTPutAPIApplicationCommandsJSONBody on const result = await api.applicationCommands.bulkOverwriteGlobalCommands(process.env.APPLICATION_ID!, commandData);, its the commandData part that is showing the issue, I have no clue how or why this happens, for context I originally come from Discord.NET which pretty much hides away the entire command registering behind its RegisterCommandsGloballyAsync function...

Problem with guildMemberRemove.js (duplicate leave message)

hi i have problem with my code, general when someone leave bot duplicate the message x2... but my guildMemberAdd looks VERY VERY same and send only 1 message ;/

Is the promise rejected when a REST.post request fails?

I'm doing something like this and I'm wondering in which case the promise is rejected (when the body and all stuff is correct). Is the promise rejected when the HTTP status code is not 2xx ? Is there a Type I can use? ```ts try {...

Cron Job doing what it wants

I used cron job several times and I googled how to correctly use it, but my command here executes in different times whenever it feels like doing so. The picture shows the code that triggers it For the past 10 weeks, it triggered on a Sunday at 22:54, Monday 20:32, Thursday 17:56 and so on (not at the time I want it to trigger) Today it triggered on a Tuesday at 18:00 which is the time I put in. I want it to run without problems, anything you know of?...
No description

Could someone help me with a problem I’m getting

I run my bot from my pc using npm index.js or node index. Js cannot remember of the top Of my head and when I run it it says my command has no name or function when it does...

Can't get this to work Interaction failed discord.js

I've been coding a discord ticket bot that opens a private channel with a user after they've opened a ticket, I've also added an advanced setup system that works just fine. However I'm not able to figure out why the bot is not creating a ticket after clicking on the Create Ticket button (Video showcase below). I've spent hours trying to figure out but I couldn't fix anything. Please help. Heres the code: https://github.com/ScremerMemer/Advanced-Ticket-Bot Video: https://www.youtube.com/watch?v=_6ZS_IC780c&ab_channel=Saket...
Next