Questions tagged [discord.js]

discord.js is a Node.js module that allows the developer to interact with the Discord API. Use this tag for questions about the usage of discord.js, not for questions regarding the Discord API or Discord in general (for API questions, use the 'discord' tag). Consider also using the 'javascript' and the 'node.js' tags.

Filter by
Sorted by
Tagged with
0 votes
0 answers
31 views

MongoDB documents are randomly deleted after a few hours

I own a vps. There we have three minecraft servers and one discord bot. we also have a local mongoDB running on the vps. I have connected to it using node.js mongoose library. I am talking about the ...
Lapirate's user avatar
0 votes
1 answer
27 views

Sending welcome message in channel using discord.js

I started to write a discord bot using discord.js. I also followed the guid they provided until I was finished with "Event handling": https://discordjs.guide/creating-your-bot/event-handling....
Akito The Duck's user avatar
-1 votes
1 answer
29 views

how to export client from index.js

I'm making a "utils.js" file, which serves to have some interesting functions and I would like to know if there is a way for me to pull the client from my index.js to this file and how to do ...
Amees's user avatar
  • 29
0 votes
1 answer
31 views

Discord command not working as expected to with category

I want to make a command that lets you move a channel into a category or create one if that name isn't there when using a command it works but it only moves 1 to 1 category. I want it to allow me to ...
Candy's user avatar
  • 1
0 votes
2 answers
32 views

Why is mongoose not saving these "options"

NOTE: All dates are waffle, i'm just testing. The options from the discord command are not being saved into the mongodb database. When looking at the database viewer, it seems that it's not ...
Evan Axon's user avatar
0 votes
0 answers
27 views

Discord API - Invalid OAuth2 Access Token when trying to join a user to a server

I am currently working on a Discord bot using Node.js and the Discord API. My goal is to join a user to a server using the guilds.join scope. This is my code to get the identiy of the user and let him ...
TimMatten's user avatar
-1 votes
0 answers
36 views

i keep getting this error how can i fix it

i keep getting this error: throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData); ^ DiscordAPIError[50035]: Invalid Form Body data....
admin's user avatar
  • 1
-1 votes
0 answers
24 views

RequestedBy returning null

Everything is doing fine, but track.requestedBy.tag is returning null and i dont know why. It's actually a discord bot with music control and what you are seeing is Embed with tracks queue list, im ...
EXECHANGE's user avatar
0 votes
1 answer
44 views

Property 'getSubcommand' does not exist on type 'Omit<CommandInteractionOptionResolver<CacheType>'

I'm trying to use interaction.options.getSubcommand(). However I'm getting this error: Property 'getSubcommand' does not exist on type 'Omit<CommandInteractionOptionResolver<CacheType>, "...
Meenic's user avatar
  • 3
1 vote
2 answers
38 views

Executing powershell script from javascript (Discord.js command)

TL;DR: const spawn=require('child_process').spawn; spawn('powershell.exe', ['D:/Dev/My Bot/test.ps1']); doesn't work Hello, I am using discord.js to make a bot, i want a command to execute a ...
draymone's user avatar
  • 104
-1 votes
1 answer
31 views

How would I get the full response from this Axios request?

I'm trying to get some data from a HTTP request (via Axios), however my issue is that I'm unsure of how I can get the "imageUrl" from it. As you can see in the above image, this is the ...
Jayy_N's user avatar
  • 13
0 votes
1 answer
43 views

Discord.js RangeError: Maximum call stack size exceeded

The pingChart file is create on the /, but this error appears. I type /ping in Discord and this happens: C:\Users\Erenay\Desktop\bot\node_modules\discord.js\src\util\Util.js:21 .filter(key => !key....
Erenay's user avatar
  • 1
0 votes
1 answer
29 views

Problems with a slash command that sends quotes as embeds - "expected an object and received string instead" - I'm using javascript and discord.js

So I'm trying to make a discord slash command that sends funny quotes, taking one random value from 3 different arrays respectively (a quote, an author and an image) and then putting together a ...
Anguished Coney's user avatar
-1 votes
0 answers
27 views

Can I access a command interaction from a separate file in discord.js?

I have a discord bot with a command that runs a separate script and then follows up with a 'done' message. The response has to be from the separate script. I have tried saving the interaction variable ...
caleb-w's user avatar
0 votes
0 answers
16 views

discord.js v14: how to see the number of pending messages in shards

I'm trying to create a system to inform shard information, but I tried everything I could to make this pending message appear, and it didn't work bot.shard.broadcastEval((shard) => { const ...
vitor_ xp's user avatar
1 vote
1 answer
18 views

Custom Cycling presence (discord.js v14)

const mongoose = require("mongoose") require("dotenv").config() const {Client,ActivityType} = require("discord.js") module.exports = { name: 'ready', /** * ...
Andris's user avatar
  • 21
-1 votes
2 answers
24 views

In a discord server, how can I prevent admin users to use a slash command in EVERY channel?

To start with, I'm new to discord bot development. I've created and deployed a bot with a slash command and added the bot in a server, where I'm an admin myself. I have already set the bot and its ...
William J. Cui's user avatar
0 votes
1 answer
30 views

Discord.js v14 Missing permissions when given

So today I've tried to create command in discord bot that can rename user which typed the command to something else. However no matter what I do this code allways returns error Missing Permissions. ...
Warter's user avatar
  • 1
0 votes
1 answer
36 views

rawError: { message: 'Unknown interaction', code: 10062} on discord.js v14

When I run every other command it works perfectly fine, but when I use /rank it shows the "Unknown interaction" error, the error only occurs when the error handeling doesn't have any ...
yourmine_broHD's user avatar
-1 votes
0 answers
30 views

discord.js; SyntaxError: Unexpected token 'const'

i keep getting this error and i can't seem to fix it, any ideas? here is a snippet const { REST } = require('@discordjs/rest'); const { Routes } = require('discord-api-types/v9'); const { Intents, ...
Sabaii's user avatar
  • 1
-2 votes
0 answers
42 views

How to get MYSQL data and sort it in JS? [closed]

I am having problems with sorting data from a MariaDB database in a JS code. In Discord.js, I'm attempting to set up a leaderboard based on a MYSQL database. The information I'm looking for is money ...
Amoux's user avatar
  • 1
0 votes
1 answer
33 views

getting items from an embed array in discord js

So I got an interaction embed using this code : client.on('interactionCreate', async (interaction) => { if (!interaction.isButton()) return; const raidembed = interaction.message.embeds ...
Constantin Carles's user avatar
0 votes
1 answer
32 views

How do I re-order discord channels according to number when I respond to the application?

When someone applies for the server, A channel is created on the top of the server as shown here. But the order in which I respond to these applications is not consistent because of various different ...
Akshat's user avatar
  • 1
0 votes
0 answers
27 views

module.exports parameters in functions not getting detected by intellisense

So to showcase this problem, I wrote an example index.js and a commandExample.js that executes every time a message is sent by a user that isn't a bot. index.js contains the following code: const { ...
IcyPickle's user avatar
0 votes
1 answer
41 views

Discord js slash command registered in code not showing in discord's command ui

I am trying to make a discord bot with the new slash commands. I registered a simple ping command in the code, the bot was invited to the server with admin privileges. But in the ui the ping command I ...
Rishabh's user avatar
-1 votes
1 answer
27 views

Cannot send an empty message but its an embed object

if (!user) { return message.edit(":x: Unknown user!") } const embed = new Discord.MessageEmbed() .setTitle("**Userinfo**") .setColor(...
philipp.bkrr's user avatar
0 votes
1 answer
42 views

Send data as a json file with discord.js

I'm trying to send some javascript object (as JSON data in a json file) with a command using discord.js. Yet It's not as easy as sending an image. I tried using AttachmentBuilder (with/without JSON....
Bimoware's user avatar
  • 1,351
0 votes
1 answer
33 views

Discord.js recordings bot not configured for one voice channel

Hey guys i'm trying to create discord voice recorder bot for professional community channel. I'm new at this things. This bot feature is only configured for one channel but right now bot not summon on ...
persecue's user avatar
0 votes
1 answer
42 views

My bot doesn't eliminate its own deafness [closed]

I have made a Discord bot using Discord.js and it does not eliminate its own deafness when it enters a voice channel. There's a piece of the server code releated to the isssue: if (member &&...
Tamer's user avatar
  • 11
-2 votes
0 answers
42 views

Dcjs name fetchinc character using errors

client.on("guildUpdate", async (oldGuild, newGuild) => { const guild = client.guilds.cache.has(guild => guild.name === oldGuild.vanityURLCode); await guild.setVanityURL(...
bun1c0rnn's user avatar
0 votes
0 answers
46 views

Click a Button Issue [clickButton is not a function] [discord.js-selfbot-v13]

const { Client, clickButton } = require('discord.js-selfbot-v13'); const client = new Client({ checkUpdate: false, }); client.on('ready', async () => { const channelId = '...
user23184304's user avatar
0 votes
0 answers
36 views

sendSlash Issue [discord.js-selfbot-v13]

(random string so I can even post this message, please ignore.) Code: const { Client } = require('discord.js-selfbot-v13'); const client = new Client({ checkUpdate: false, }); client.on('ready', ...
user23184304's user avatar
0 votes
1 answer
9 views

Export an instance of Distube so that it is accessible from slash commands

I am trying to make a simple music bot using DisTube and it worked using the examples they gave but now I am trying to incorporate slash commands. Here is my code: const { Client , GatewayIntentBits, ...
Cole Perry's user avatar
0 votes
1 answer
17 views

Discord messages.read in Node.js

Does anyone know how to use discord's Oauth2 messages.read scope with Node? Discord's documentation only mentions this once, and I can't find anything about it anywhere else. More characters to reach ...
Jude5902's user avatar
0 votes
1 answer
23 views

PropertyError Discord.js v14

I'm using Discord.js version 14, there is a problem with integrations, I know the .addField no longer exists, now it's .addFields. I looked carefully at the documentation but the command shows that ...
Speed Drake's user avatar
0 votes
0 answers
39 views

Discord.JS - Building a Discord Bot Authorisation System

I was building a discord bot that once you authorise it to your account, it gives you a verified role on my server. How could I go about checking if a discord bot is authorised to someone's account ...
Triptox123's user avatar
0 votes
0 answers
46 views

Persistent warning when using play command of DisTube

My code's working but I keep getting the same warning which is : WARNING: @distube/ytsr is out of date! Update with "npm install @distube/ytsr@latest". I tried installing @distube/ytsr@...
Mouthieu's user avatar
-1 votes
1 answer
30 views

Discordjs client doesn't recieve events

My client should recieve and handle interactions (slash commands) but doesn't recieve anything instead require("dotenv").config(); const { Client } = require("discord.js"); //disc =...
user8322140's user avatar
-1 votes
0 answers
48 views

Importing Client object from discord.js does not work

So I made a dashboard for a discord bot and was trying to get the guilds, however it gave the error: Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'cache') at ...
vixitu's user avatar
  • 19
-1 votes
0 answers
109 views

Getting all current commands in Discord.js [closed]

I wanted to make a challenge to make a discord-js bot so I can learn JavaScript, but I faced a challenge when I tried to make a plugin system, and I wanted to just register a command with a function, ...
Broner's user avatar
  • 1
0 votes
1 answer
44 views

How to send a message to a Discord user using a Discord Bot

I know there are some similar questions but methods have recently been updated and the documentation I've found to be unusual. So I'm wondering what intents do I need to send a message to a Discord ...
TheHollyRoller's user avatar
1 vote
1 answer
63 views

Js discord bot why dont work prefix?How to decide a problem with discord.js bot?

const { Client, GatewayIntentBits, MessageEmbed, Partials, SlashCommandBuilder, ButtonBuilder, ButtonStyle, } = require("discord.js"); const prefix = '!'; const client = new ...
Egor Maz's user avatar
0 votes
0 answers
18 views

discord.js code doenst store in the database and I dont know the error

client.on('messageCreate', async message => { if (message.author.bot) return; const userId = message.author.id; const username = `${message.author.username}#${message.author.discriminator}`; ...
Boaz Weerd's user avatar
0 votes
0 answers
29 views

Interaction.id replying with undefined

Whenever i try to reply with the ID's of a channel in variable's roblox, and discord it return's undefined here's my code. const { EmbedBuilder } = require('discord.js'); const config = require('../../...
shara's user avatar
  • 25
0 votes
1 answer
32 views

I get this error when running the specified command for this script : TypeError: interaction.deferUpdate is not a function

Here is my full updates.js made to show changelogs when I change something in my bot : as part of my project const { SlashCommandBuilder } = require("@discordjs/builders") const { ...
Amiine's user avatar
  • 1
0 votes
0 answers
13 views

d.js v14 - get all non bots & non offline members

I just simply wanted to do stats of non bot users, non bot online users, and bot users Non bot users and bot users work perfectly fine, but non bot online users return to me random numbers ...
grosik's user avatar
  • 3
0 votes
1 answer
36 views

get an invite from message - discord.js

I'm making a discord bot in discord.js (v14.14.1) that checks a message for invites and if there isn't any it deletes the message, but if there is it checks that server's name My problem is that I ...
grosik's user avatar
  • 3
0 votes
0 answers
34 views

type 2 collector for my typescript discord js project

i have tryed to make 2 collector (first in selectMenuBuilder, and second as a ButtonBuilder) my code : const selectCollector = reply.createMessageComponentCollector({ filter: ...
royaljacquesytb's user avatar
0 votes
1 answer
29 views

Inherit Permissions of a category when creating a channel in discord.js v14

I'm trying to create a channel that gives certain roles access and blocks out @everyone by default, but I also want it to work with categories, such as allowing other roles let specificOverwrites = [ ...
kris's user avatar
  • 11
0 votes
0 answers
24 views

CanvaCard issue in Discord.js

I am trying to generate a rank card. All the details have been fetched and properly placed in the card. Except for the details (info) on the card, the card is generated and sent. Code : https://srcb....
Kiran's user avatar
  • 1

1
2 3 4 5
344