Issue I need a bit of help with my code, I don’t get any errors except This Interaction Failed in Discord. The code I am using for slash commands: name: "random", description: "Random Message", options: [], async execute(_bot, say, interaction)
Continue readingTag: discord
Discord bot is not running with uptime robot and repl.it
Issue I wanted to make my own discord bot wich should be online without my pc running, so i followed this tutorial: https://www.youtube.com/watch?v=Gqurhm2QxA0 It all worked fine and yesterday my bot was running and the whole time even without the
Continue readingFetch is not Defined
Issue I’m very new to Javascript and just built my very first bot, I try to run my bot and it WORKS! But when I use the discord command it crashes on Repl.it. I have done npm install node-fetch but
Continue readingProperty assignment expected error on TypeScript
Issue I have ran into an issue with my Discord bot’s audit log system. I am trying to make it have have automatic entries for the bot guilds. It cannot take “ strings with ${guild.id} inside. Here is my code:
Continue readingMissing Access for Slash Commands
Issue Heres the error message: PS C:\Users\User\Documents\Discord Bot> node . ready C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154 throw new DiscordAPIError(request.path, data, request.method, res.status); ^ DiscordAPIError: Missing Access at RequestHandler.execute (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154:13) at processTicksAndRejections (node:internal/process/task_queues:93:5) at async RequestHandler.push (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:39:14) { method: ‘post’, path: ‘/applications/723863781607997451/guilds/722043668730740788/commands’,
Continue readingHow to read Class Objects / Functions when passed as a param?
Issue I’m current working with Discord’s Gateway and sockets to create something similar to discord.js and to make it easier for a new user to use the package i’m making i would like them to view the Message class objects
Continue readingDiscord bot js v13, is not removing the specific role and adding a specific role
Issue My code is not working, I need your help. It does not show any it only adds position in some bots. client.on(‘messageCreate’, async(message) => { // Membros role id = 871442068508123136 // Manutenção role id = 978322456328687656 let args
Continue readingBad words filter is not working correctly discord.js v13
Issue I was trying to make a bad words filter with my bot in discord.js v13 and node.js v16. I wrote a simple code but It’s not working correctly. My code: const args = message.content.split(/ +/); if ((message.guild.id = ‘GUILD_ID’))
Continue readingsetNickname is not including spaces in discord.js v13
Issue When I set someone’s nickname for example Stack Overflow", It does not set It correctly. It sets my nickname to "stackoverflow", Without spaces. My code: const { MessageEmbed } = require(‘discord.js’); module.exports = { name: ‘changenickname’, aliases: [‘changenick’], permissions:
Continue readingWhy does my addrole command have errors? (discord.jsV12)
Issue So basically my addrole command after the new version of discord.jsv13 no longer works and displays errors like role.id is not a function or role.id is not defined even though I believe there is no error, I’m pretty experienced
Continue readingHow do I make the leaderboard not reset after restarting my client
Issue How do I make the leaderboard not reset after restarting my client, here is an example: ignore the "undefined" right there, I’ll fix it Here the leaderboard is only showing the people who’ve used the bot after it restarted,
Continue readingHow to use a SQL Result in Discord.JS SelectMenus?
Issue I am trying to add Options to a SelectMenu from a SQL request. My code is the following: case "edit":{ const editrow = new MessageActionRow(); let query = `SELECT * FROM tickettypes WHERE guild_id = ‘${interaction.guild.id}’` const editmenu =
Continue readingWhy does my Discord.js robot keep disconnecting
Issue My discord.js bot keeps on disconnecting from Discord during the night. My discord bot works, and I’m hosting it on replit and using UptimeRobot to ping my bot. It works during the day, but sometime during the night, it
Continue readingTypeError: Cannot read properties of undefined (reading 'hasPermission')
Issue I am back again with again my ticket function. This time I am working on a close command. Whatever I try I always come back at the same errors: TypeError: message.member.hasPermission is not a function Anyone who can look
Continue readingHow can I remove a specific role from everyone that has it in Discord.js v13
Issue I want my bot to remove a specific role from everyone that has it when a message is sent in a channel client.on(‘messageCreate’, async message => { if(message.channel.id === ‘954375143965216869’){ //counting message.guild.roles.get(‘944674567811645472′).members.map(m=>m.member.id).delete(); } }) I’m using discord.js v13 and
Continue readingDiscord.js setGame() not working anymore
Issue I have been coding my Discord bot using Discord.JS for about 2 months now and I’ve just recently noticed that my bot isn’t saying that it’s playing what I’m telling it. When I first coded the bot up until
Continue readingHow do I fetch guild owner Id in discordjs v13?
Issue I am trying to fetch the guild owner Id’s of the servers my bot is currently in. Everything I try returns undefined. Current owner fetching from cache. I also tried guild.fetchOwner() let owner = client.users.cache.get(guild.ownerID); if (typeof owner !==
Continue readingHow to ignore this error? As in stop it from sending
Issue I made a feature in my discord bot to react to emojis with the same emoji, but when someone sends a message that isnt an emoji, it sends this error (it doesnt stop the bot, it just annoys me
Continue readingIs there a way to listen for reaction events on a specific Discord message id
Issue Let’s say Person A has sent a message, with message ID "A1". How can I make my Bot listen to messageReactionAdd and messageReactionRemove events on that message, "A1"? Solution You can use a Collector. message.createReactionCollector({ … }) You can
Continue readingWhy is my kick command only giving errors?
Issue Wassup people. I am working on some admin commands. At this moment it’s going to be a kick command. But it’s only giving errors. If you remove a line or change anything, it will infect the code in another
Continue readinguser.presence.status is now working in discord.js v13
Issue I wanted my bot to set the name of a channel: the number of users. I wanted to filter online/dnd/idle members and offline members. but my code is not working. My code: let humanMembers = guild.members.cache.filter( (user) => !user.user.bot
Continue readingJoin an specific voice channel when the bot is ready in discord.js v13
Issue I found some articles about this question. like this. But it was in discord v12. I want discord.js v13 My code: client.on("ready", async() => { const { joinVoiceChannel } = require(‘@discordjs/voice’); joinVoiceChannel({ channelId: "863783336860975114", guildId: "847071265100791849", adapterCreator: channelId.guild.voiceAdapterCreator })
Continue readinghow to add space in commands? discord.js
Issue I want my command to include a space, for example $ sudo faq mod (note the space) But that doesn’t seem to work, and I usually have to just do faq_mod instead. This is my code, but spaces don’t
Continue readingSearching for a message without knowing exact channel [discord.js]
Issue I’m trying to get specific message content on the server by its ID, but without knowing exact channel. This is the code I’m using: message.guild.channels.cache.filter(c => c.type === ‘GUILD_TEXT’).each((c) => { console.log(c.messages.cache.get("ID").content) }) but the only thing I get
Continue readingDiscord.js sending message upon voice channel joining is not working
Issue so what my bot is meant to do is that when someone joins a certain channel, it will send a message to log channel "SomeGuy123 joined the channel!". So I was constructing it for like an hour, and now
Continue readingDiscord API Error: Cannot send an empty message
Issue I’m writing a simple discord bot that just spews out a randomly selected response from a list but I keep running into the same Discord API error. Here’s my code. client.on(‘messageCreate’, message => { const responses = [[‘Yehaw’, ‘Yehaw!!’,
Continue readingDifferent choices for each guild slash command using discord js
Issue I am building a discord bot that is going to be used on multiple guilds (a.k.a servers). The bot has a command called ‘send’ that has a set of choices inside an option: const { SlashCommandBuilder } = require(‘@discordjs/builders’);
Continue readingMongoDB .find() doesn't return the right data
Issue I’m trying get the data from mongodb but whenever i try to use find() I get following response. I’m very new to Mongo and just don’t know why this is happening. Also this code is written in TypeScript and
Continue readingDiscord.js – How to change style of Button
Issue This is how I create and send the button: client.on(‘messageCreate’, (message) => { /* … Checking Command … */ const actionRow = new MessageActionRow().addComponents( new MessageButton() .setStyle("PRIMARY") .setLabel("X") .setCustomId("test")); message.channel.send({ content: "Test", components: [actionRow] }); } A blue Button
Continue readingDiscord/Twitter/others preview for link not working
Issue So I’ve been trying to make a preview for my website images, on cdn.luckiecrab.nl and I’ve asked few people and they tried to help me but it didn’t work. So the current code I have in my <head> tag
Continue readingHow to add the user id to the button interaction?
Issue I am working on a Discord bot and I am trying to get the buttons to work only for the user who used the command. I’m sorry if I sound dumb, but I don’t know how to explain it
Continue readingDiscord.js V13: How do I get/ find a category?
Issue I want to find a category just like how you find a channel. let channel = message.guild.channels.cache.get(<id>); Is there a way to find a category like this? I am trying to see if a specific category exists, and if
Continue readingIs there a way of creating more than 3 inlined fields in a discord.js embeded message?
Issue I am trying to create an embed for a discord bot using node.js. I want the embed to have 4 inlined fields so that there effectively are 4 columns with and an arbitrary number of rows in each column.
Continue readingDiscord Oauth2 Join Guild
Issue const guildMembersResponse = fetch(`http://discordapp.com/api/guilds/440494010595803136/members/278628366213709824`, { method: ‘PUT’, headers: { Authorization: `Bearer TOKEN`, }, }); setTimeout(() => { console.log(guildMembersResponse) }, 500); I want to join a user to my Discord server with his userid and his token in nodejs, but
Continue readingMessage Collector first Message
Issue I’m using thecreateMessageCollector. It is collecting messages, but the problem is, that it is not getting the first message sent in the channel. const filter = m => m.content.toLowerCase() === message.content.toLowerCase(); const collector = message.channel.createMessageCollector(filter, { max: 1, time:
Continue readingdiscord bot is not sending image of collected URL while using collector
Issue I am trying to do a simply paste a link in a particular channel and wait for the bot to send it again with message. here in this example I should get: hello image but I am only getting
Continue readingHow to detect if the author of a message was a Discord bot?
Issue The title explains my question. This question might sound stupid, but how do I detect if the author of a message was a Discord bot? Thanks. Solution If you want to check if a message author is a bot
Continue readingHeroku doesn't deploy TypeScript Application
Issue Problem I’ve made a typescript discord bot and hosted it on heroku. I get the below error while compiling it and then running it. Error: Starting process with command `npm run dev` State changed from starting to up Process
Continue readingFaster and cleaner way to update Discord Message Embed with a MessageComponentInteraction collector
Issue I’m trying to make a horse race command for my discord bot (TypeScript). The code itself works fine, but I have to update an embed which contains the race and the participants. The thing is that for it to
Continue readingDiscord Js not updating permissions
Issue I thought this code was working but now it seems to have stopped. I’ve tried giving the bot more permissions (eg Admin) but still not luck. There is no error and I really can’t tell why this won’t work.
Continue readingV13 Discord.JS Bot is not sending messages
Issue This’s my code below, I have tried enabling Intents from the developer portal, and I’ve checked the channel permissions, and my node version is running on v16.14.2, and still, it doesn’t send any messages for some reason. const {
Continue readingTypeError: message.guild.roles.cache.array is not a function
Issue Actually, I don’t know how to fix my code anymore, I tried a lot, but I can’t solve the problem yet const Discord = require("discord.js"); const client = new Discord.Client({ intents: 32767 }); const AsciiTable = require("ascii-data-table").default; const prefix
Continue readingMember counter is not updating members count discord.js
Issue I created a member counter, but it is not updating. it’s stuck on 80585. When I want to update it, I need to restart the bot. My code: client.on("ready", async() => { let servercount = await client.guilds.cache.reduce((a,b) => a+b.memberCount,
Continue readingSending a message into all servers where bot is
Issue How do I send one message per guild that my bot is in? It doesn’t matter which channel it will be, but I don’t know how to code it. I finally came up with that idea: client.guilds.cache.forEach(guild => {
Continue readinghow do I make a setNickname command in discord.js
Issue I created a Change Nickname command in discord.js v13, and It’s not working. I am not getting any errors. My code: const target = message.mentions.members.first(); const nickname = args.slice(1).join(‘ ‘); if(!target) return message.channel.send(‘Please specify a target to change nickname’);
Continue readingHeroku doesn't deploy TypeScript Application
Issue Problem I’ve made a typescript discord bot and hosted it on heroku. I get the below error while compiling it and then running it. Error: Starting process with command `npm run dev` State changed from starting to up Process
Continue readingSend message with multiple local images in a single line – discord.js
Issue Is this possible to send messages with multiple local images in a single line? I’m using MessageAttachment here is the code const attachment = new MessageAttachment(EmojiPack1/green/g_a.png) message.reply({files: [attachment]}) I’m using it in a for loop But it sends a
Continue readingFaster and cleaner way to update Discord Message Embed with a MessageComponentInteraction collector
Issue I’m trying to make a horse race command for my discord bot (TypeScript). The code itself works fine, but I have to update an embed which contains the race and the participants. The thing is that for it to
Continue reading(DISCORD.JS V13) client.guilds.cache.get is not working properly
Issue Im making a bot in discord.js v13, and i wanted to return client’s number of guilds/users/channels. But it returns function get() { [native code] } instead. const main = new MessageEmbed() .setColor("#6164ab") .addField("<:discordReply:971028493645262888> Stats", `• ${client.guilds.cache.get} guilds\n• ${client.users.cache.get} users\n•
Continue readinghow to check if a message has a ping in it discord.js
Issue I know you can use: client.on(‘messageCreate’, msg => { if(msg.content.includes("<@") && msg.content.includes(">")){ //some code } }) but this method isn’t really the best. Is there a better way to check for pings in a discord message? Solution If you
Continue readingdiscord.js reaction method outputs wrong emoji
Issue I need help with my current method which doesn’t get the right reaction emoji. But I want it to get the right Emoji. Can someone help me? bot.on(‘messageReactionAdd’, async (reaction, user) => { const message = reaction.message if (reaction.partial)
Continue readingDiscord.js: TypeError: Cannot read properties of null (reading 'status')
Issue So I have a command that outputs user information. Though most fields have no problems, the Status field is rather buggy for me. This is the code for the command: import { Command } from ‘@sapphire/framework’; import { MessageEmbed
Continue readingColor text in discord
Issue My goal is to partly color a text. I know I can use .sendCode(“css”,”this is my message”); which we’ll make my text yellow but I don’t want my whole text to be yellow. Perhaps I could create another .css
Continue readingTypeScript(err:2532): object is possibly undefined dispite null/undefined check
Issue I’ve been writing a Discord-bot in TypeScript and I added a command that retrieves information from an airport. The only thing you have to provide is the ICAO code of the airport(4 character code that identifies the airport). Now:
Continue readingIs there a way to split up a message based off special characters?
Issue I am currently trying to make a discord bot with a command title "reactionrole". In this command I would like to let the user create an embed using a single message. For example, (-reactionrole "title blah blah" / "description
Continue readingDiscord.JS Command Handler: How to read files from all directories within a directory?
Issue I am running into some issue with checking the commands directory for my files. I want readdirSync to read all .js files from some directories inside the /commands/ directory (music, info etc.) but I don’t seem to know or
Continue readingSyntaxError: Unexpected reserved word "await"
Issue I keep getting this error even thought I am in a asynchronous function… import { dirname, join } from "path"; import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); export async function importer(client) {
Continue readingDiscord.client is not a constructor – discord.js
Issue i made a discord bot and tried a beginner code i found on youtube, this is my code and my errors index.js // Require the necessary discord.js classes const Discord = require(‘discord.js’); const client = new Discord.client(); const config
Continue readingIs there a way to split up a message based off special characters?
Issue I am currently trying to make a discord bot with a command title "reactionrole". In this command I would like to let the user create an embed using a single message. For example, (-reactionrole "title blah blah" / "description
Continue readingIs there a way to split up a message based off special characters?
Issue I am currently trying to make a discord bot with a command title "reactionrole". In this command I would like to let the user create an embed using a single message. For example, (-reactionrole "title blah blah" / "description
Continue readingDiscord.js v12 server member count
Issue (Welcome command using canvas) How could I fetch the server member count as soon as someone joins?? Because I use that line of code const guild = client.guilds.cache.get("843190900930510869"); let image = await welcomeCanvas .setUsername(member.user.tag) .setDiscriminator(member.user.discriminator) .setMemberCount(guild.memberCount) //this line etc…
Continue readingMissing Access for Slash Commands
Issue Heres the error message: PS C:\Users\User\Documents\Discord Bot> node . ready C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154 throw new DiscordAPIError(request.path, data, request.method, res.status); ^ DiscordAPIError: Missing Access at RequestHandler.execute (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154:13) at processTicksAndRejections (node:internal/process/task_queues:93:5) at async RequestHandler.push (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:39:14) { method: ‘post’, path: ‘/applications/723863781607997451/guilds/722043668730740788/commands’,
Continue readingDiscord.client is not a constructor – discord.js
Issue i made a discord bot and tried a beginner code i found on youtube, this is my code and my errors index.js // Require the necessary discord.js classes const Discord = require(‘discord.js’); const client = new Discord.client(); const config
Continue readingDiscord.client is not a constructor – discord.js
Issue i made a discord bot and tried a beginner code i found on youtube, this is my code and my errors index.js // Require the necessary discord.js classes const Discord = require(‘discord.js’); const client = new Discord.client(); const config
Continue readingdiscord.js 13 | How do i DM a member a message when they join the server?
Issue I’ve been trying to find a way to DM a member a welcome message when they join the server. I have a way to DM the member, but I can’t find a way to trigger it when someone joins.
Continue readingdiscord.js 13 | How do i DM a member a message when they join the server?
Issue I’ve been trying to find a way to DM a member a welcome message when they join the server. I have a way to DM the member, but I can’t find a way to trigger it when someone joins.
Continue readingjs 13 discord buttons clicked one
Issue I am writing tickets to the system. Reports come to a special channel. There is an "accept" button, it works, but when more than one report arrives, if you click on the "accept" button, then all reports will be
Continue readingjs 13 discord buttons clicked one
Issue I am writing tickets to the system. Reports come to a special channel. There is an "accept" button, it works, but when more than one report arrives, if you click on the "accept" button, then all reports will be
Continue readingWhy bot doesn't fire messageReactionAdd event when the message was sent before the bot was online
Issue This is my event to check user add react: const client = require("../index"); client.on(‘messageReactionAdd’, async (reaction, user) => { if (user.bot) return; console.log(reaction.emoji.name); }); It’s working, but when the bot restarts, it can’t fetch any message sent before? Why
Continue readingWhy bot doesn't fire messageReactionAdd event when the message was sent before the bot was online
Issue This is my event to check user add react: const client = require("../index"); client.on(‘messageReactionAdd’, async (reaction, user) => { if (user.bot) return; console.log(reaction.emoji.name); }); It’s working, but when the bot restarts, it can’t fetch any message sent before? Why
Continue readingdiscord.js and node.js module not exporting correctly? returned statement not working
Issue So Im trying to get a couple messages returned from a specific channel to get info about ‘clans’ that were registered before. However I can fetch the channel and all and then I can filter and loop through the
Continue readingdiscord.js disable “interaction failed”
Issue If an interaction (for example button click) is not replied, discord will display “interaction failed” in the client What they expect you to do: inter.reply(‘stuff’) What I want to do: inter.channel.send(‘stuff’) This is not an error I just want
Continue readingguild.channels.filter is not a function discord.js
Issue I was trying to make a user presence but I am getting an error: guild.channels.filter is not a function My code: const Discord = require(‘discord.js’); const guild = client.guilds.cache.get(‘847071265100791849’); const categoryChannels = guild.channels.filter( (channel) => channel.type === ‘886241068855734273’ );
Continue readinghow to check if the member is joined to an specific voice channel DiscordJS
Issue I want to check if the member is joined to the voice channel that the bot is joined. The whole code is working, I just want to add that line that I put in code comments. My code: const
Continue readingHow do I check if user is already timed out in Discord?
Issue I’m making a timeout command for my own bot since it has more potential than the Built-In one, and I wanted to make a checker if a user is already timed out or not, but as far as I
Continue readingHow do I check if user is already timed out in Discord?
Issue I’m making a timeout command for my own bot since it has more potential than the Built-In one, and I wanted to make a checker if a user is already timed out or not, but as far as I
Continue readinghow to check if the member is joined to an specific voice channel DiscordJS
Issue I want to check if the member is joined to the voice channel that the bot is joined. The whole code is working, I just want to add that line that I put in code comments. My code: const
Continue readingguild.channels.filter is not a function discord.js
Issue I was trying to make a user presence but I am getting an error: guild.channels.filter is not a function My code: const Discord = require(‘discord.js’); const guild = client.guilds.cache.get(‘847071265100791849’); const categoryChannels = guild.channels.filter( (channel) => channel.type === ‘886241068855734273’ );
Continue readingdiscord.js disable “interaction failed”
Issue If an interaction (for example button click) is not replied, discord will display “interaction failed” in the client What they expect you to do: inter.reply(‘stuff’) What I want to do: inter.channel.send(‘stuff’) This is not an error I just want
Continue readingdiscord line color off
Issue How to remove the strip to the left of the insert so that it turns out, as in screenshot #1, removing setcolor does not help. is it embed at all? https://i.stack.imgur.com/OF8lW.png https://i.stack.imgur.com/BW6yq.png Solution You can’t remove it. You have
Continue readingThe ban command doesn't do what it's supposed to do
Issue When I try to run my command, instead of the errors I specified, I get the errors from the console and the result is: Failed to ban the user and the console says DiscordAPIError: Interaction has already been acknowledged.
Continue readingdiscord line color off
Issue How to remove the strip to the left of the insert so that it turns out, as in screenshot #1, removing setcolor does not help. is it embed at all? https://i.stack.imgur.com/OF8lW.png https://i.stack.imgur.com/BW6yq.png Solution You can’t remove it. You have
Continue readingThe ban command doesn't do what it's supposed to do
Issue When I try to run my command, instead of the errors I specified, I get the errors from the console and the result is: Failed to ban the user and the console says DiscordAPIError: Interaction has already been acknowledged.
Continue readingSend a message to a specific channel with discord bot
Issue I am looking on how to send a message to a specific channel. I saw some people to use client.channels.cache.get(‘channelidhere’).send(‘text’) however that whole thing is an error for me. Here is my whole code. working on a ticket bot
Continue readingMissing Access for Slash Commands
Issue Heres the error message: PS C:\Users\User\Documents\Discord Bot> node . ready C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154 throw new DiscordAPIError(request.path, data, request.method, res.status); ^ DiscordAPIError: Missing Access at RequestHandler.execute (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154:13) at processTicksAndRejections (node:internal/process/task_queues:93:5) at async RequestHandler.push (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:39:14) { method: ‘post’, path: ‘/applications/723863781607997451/guilds/722043668730740788/commands’,
Continue readingDiscord.js v12 server member count
Issue (Welcome command using canvas) How could I fetch the server member count as soon as someone joins?? Because I use that line of code const guild = client.guilds.cache.get("843190900930510869"); let image = await welcomeCanvas .setUsername(member.user.tag) .setDiscriminator(member.user.discriminator) .setMemberCount(guild.memberCount) //this line etc…
Continue readingmember cannot be mentioned in the embed discord.js v13
Issue I was making a join and leave log system that returns a specific embed when someone joins/leaves the server. but when the bot sends the embed in the channel, the member is not mentioned. My code: client.on(‘guildMemberAdd’, guildMember =>{
Continue readingDiscord Modals without TextInputComponent but a Text and Button only
Issue I just discovered discord-modals, and I’ve tried using it when asking for information with the TextInputComponent. After a while, I became curious about achieving this: The image above is the pop-up message (a modal) that appears when you try
Continue readingcannot read the properties of undefined 'highest'
Issue I want to check if the member that was mentioned role is as the same position of the bot or higher, but I am getting an error. const member = message.mentions.users.first(); const reason = args.slice(1).join(‘ ‘) || ‘No reason
Continue readingHow to filter the member counter in discord.js v13
Issue I made a member counting system for my server but it counts every member that is joined. I want to filter the counter to just count the humans/users My code: module.exports = async (message, args, cmd, client, Discord, profileData)
Continue readinghow can I make my bot disconnect from voice after 15 seconds being idle in discord.js
Issue I wanted to make the bot to disconnect after being idle for 15 seconds, but I don’t know how. I wrote some code lines but I did not know how to specify a time. My code: player.on(AudioPlayerStatus.Idle, () =>
Continue readingUse Discord.js/Node.js/NeDB to Remove Role From User After X Number of Hours
Issue I’m relatively new to Javascript and Node, but I have managed to create a bot for my discord server and implement a basic economy, granting points based off of post submissions. These points are stored in an NeDB. I’d
Continue readingENOENT: no such file or directory, open 'Filename'
Issue I was requiring some data from a .json file but I am getting this error: Error: ENOENT: no such file or directory, open ‘../Jsons/eshop.json’ at Object.openSync (node:fs:585:3) at Object.readFileSync (node:fs:453:35) at Object.execute (C:\Users\Pooyan\Desktop\PDM Bot Main\commands\shop.js:9:24) at module.exports (C:\Users\Pooyan\Desktop\PDM Bot
Continue readingHow can I set a URL for my description field in discord.js 13 embed?
Issue I wanted to make an embed that contains a description with a URL on it. But I am getting an error: RangeError [EMBED_DESCRIPTION]: MessageEmbed description must be a string. My code: player.on(‘trackAdd’, (queue, track) => { const embed =
Continue readingHow to make when bot ask a question, he waiting for an answer and ask another question
Issue I wanted to create my bot for economics, but I ran into a problem. What do I want to do: after writing one question, the bot waits for an answer and then asks another question and so on. Can
Continue readingWhat is the difference between a User and a GuildMember in discord.js?
Issue I’ve gotten many errors in my code that I believe has been the result of mix-ups between GuildMembers and Users. Can someone explain the difference? const user = message.mentions.users.first(); // TypeError: user.kick() is not a function user.kick({ reason: ‘spamming’
Continue readingTypeError: Cannot read properties of undefined (reading 'execute') command handler
Issue const discord = require(‘discord.js’) const client = new discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] }) const prefix = ‘&’; const fs = require(‘fs’); client.commands = new discord.Collection(); const commandFiles = fs.readdirSync(‘./commands’).filter(file => file.endsWith(‘.js’)); for(const file of commandFiles){ const command = require(`./commands/${file}`);
Continue readingTypeError: Cannot read properties of undefined (reading 'has')
Issue I want to check if the member is the owner of the server, but I am getting an error. My code: const member = message.mentions.users.first(); const reason = args.slice(1).join(‘ ‘) || ‘No reason specified.’ if (member.permissions.has(‘MANAGE_GUILD’)) return message.reply( ‘I
Continue readingWelcome message when joining discord Server using discord.js
Issue I am making a discord bot using node.js and discord.js, and I am currently trying to make it so that when a user joins the discord server, a custom welcome message is sent. Here is my code: bot.on(“guildMemberAdd” ,(message,
Continue readingHow do I add or remove roles on my Discord JS server, through a button click I have on my website or localhost?
Issue I have 2 buttons on my localhost currently, which on click sends a post request along with my discord ID. Add role and remove role This is my post request: app.post(‘/addUser’, urlencodedParser, (req,res) => { const discordID=req.body.discordID; const roleID=
Continue reading