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

Per Server Currency System

I know the currency system tutorial exists on the discord.js guide (https://discordjs.guide/sequelize/currency.html#file-overview), but can anyone suggest any ways or tutorials for trying to set one up for a discord bot on several servers? I'm not sure how to go about separating the shop system/database tables, and subsequent djs bot commands for individual servers.

selectmenu dont working

Hi, I'm making a ticket system in discord.js v14, but when selecting in selectmenu, it shows that this action failed and there are no errors in the console (vsc), does anyone know the reason?

What is the best way to detect a change in server ownership when the bot happens to be offline?

Hi, I am using Discord.JS and am trying to figure out how I might change a server in my database's owner_id field when the owner id is found to be different. Here is an example:...

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 {...