News Articles discord.js

I’m doing a Discord bot, and having trouble connecting bot to voice channel, any suggestions?

I want to import joinVoiceChannel from discordjs/voice, but it says “SyntaxError: Cannot use import statement outside a module”. That’s because I’m using .cjs file, if I’m using .js file then nothing will work. Can anybody help me how to connect DiscordBot to voice channel, I can ping him but can not connect him. main.js import […]

questions with mongodb and js

i have a index.js and a mongo.js file and i was watching a youtube video witch they wanted to have 2 separate files. but for the project i want to do i want to have it all on one file so i can compile it all, is there a way that i can move all […]

TypeError: Cannot read properties of undefined (reading ‘guilds’)

my error:"test message " + client.guilds.cache.size + " " + TypeError: Cannot read properties of undefined (reading ‘guilds’) what exactly am i doing wrong? Source: JavaSript – Stack Overflow

What Is The Create Invites In Discord.js

i have a code for YT Together But If The Bot Havent The Create Invites Permission It Shows: I Tried With if(invite.code === "50013") return message.reply(err1) But It Dont Work I Want To Do Something That This if (!‘ADMINISTRATOR’)) return>msg.delete({timeout:"10000"})) But I Have To Replace ADMINISTRATOR For Create Invites Permission Someone Can Help […]

Values from object from rapidapi return undefined (discord.js)

my code and the object in questionR7Z.png When i call for example ‘console.log(seasonsValue.seasons)’ i get a value back of undefined. using ‘typeof’ im told that the data type is an object. Source: JavaSript – Stack Overflow

Cannot send an empty message on discord.js v13

Okay so, I downloaded an old plugin that works on discord.js V12 (discord-pagination) and i want it to work on V13 too, so what can i do? When I’am trying to use my command it says "Cannot send an empty message", the issue is in that code below. const paginationEmbed = async (msg, pages, emojiList […]

Cannot send an empty message error when trying to send Axios response in Discord.js

When I message my bot, it sends this in the console: (node:5852) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message at c:UsersOwnerDesktopselfbotnode_modulesdiscord.jssrcclientrestRequestHandlersSequential.js:85:15 at c:UsersOwnerDesktopselfbotnode_modulessnekfetchsrcindex.js:215:21 at processTicksAndRejections (internal/process/task_queues.js:97:5) (Use `node –trace-warnings …` to show where the warning was created) <node_internals>/internal/process/warning.js:33 (node:5852) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without […]

Get name from JSON JS

In js i get a response in string ex. [{"id":"1a869e62-8993-33d0-bd54-f33753044ced","name":"Cubsonx"},{"id":"c534bcba-0096-3668-a34e-a35435e6aafb","name":"Paulina453"}] And from that i want to only have names, ex. [{"name":"Cubsonx"},{"name":"Paulina453"}] and then render every name that is on the list in an discord.js embed fields. Source: JavaSript – Stack Overflow

Cannot Find Node:Events with discord.js

I’m trying to make a discord bot using discord.js (I have discord.js installed) but for some reason, I keep getting this weird error. I’ve looked through similar articles that address the same issue and suggested that I update my version of NodeJS to 16.6.0 or above (which I did) but have been unable to solve […]

Changue message with reactions Disscord.js

Im a bit new creating Discord bots, my plan with this is to have like a book with the help command that if you press the arrow it changes to the next page, and if you press another arrow it changes to the previus page, I’ll simpifly my code to make it more easier to […]

How to send DM on button click discord.js

I to make my bot sending a DM message on button click here is my code: if( === "onBtn"){ button.clicker.send(‘ok’) } }); Source: JavaSript – Stack Overflow

Discord.js V13 Welcome Message

I’m still fairly new to creating bots, so this welcome message worked back in discord.js v12 but no longer works for me in v13. I am trying to send a message in a specific channel when someone joins the server, but I checked, and .send does not exist on GuildChannel. I checked to documentation but […]

Copy embed and modify between chats discordjs

I’m trying to change some information on embed messages then transfer the message from channels, but when I try to transfer the message, I have this error: RangeError [EMBED_FIELD_NAME]: MessageEmbed field names must be non-empty strings. I’ve trying like this: let title; let fieldName; let fieldValue; if ( == analiseChannelID && === ‘aprovada’) { […]

TypeError: channel.overwritePermissions is not a function

When trying to change the channel permissions to lock users from sending messages, this error pops up no matter what I do, is there anything wrong? module.exports = { async execute(message, args) { const role = message.guild.roles.cache.find(r => === ‘@everyone’) let channel = message.mentions.channels.first() || args[0] if(!channel) channel = if(channel.permissionsFor(‘SEND_MESSAGES’) === false) return […]

How to have bot send specified user a DM?

I’m trying to create a warning command that DMs the specified user to notify them. Here is the specific code I’m trying to use: const user = await client.users .fetch(interaction.options.getString("user"), false) .catch(() => null); console.log(interaction.options.getString("user")); const embed = new MessageEmbed() .setColor("#FCE100") .setTitle(`⚠️ Warning!`) .setDescription(`${interaction.options.getString("warning")}`); await user.send({ embeds: embed }).catch(() => { "Error: user not […]

Can’t edit message in nodejs

So I wanted to make a custom bot for discord using nodejs and it’s been 4 hours and I can’t get this to work. client.on("message", msg => { const channel = client.channels.cache.get(‘1234567890’); channel.fetchMessage(‘0987654321’).then(message => message.edit(output(msg))); }) I want to edit a specific message based on the input (msg). I already have the output(msg) function ready […]

How do you define user in discord.js

I am trying to run some test events and I tried using the one discord.js posted on their website: module.exports = { name: ‘ready’, once: true, execute(client) { console.log(`Ready! Logged in as ${client.user.tag}`); }, }; I tried googling how to define a user but it only led to specific answers for that specific scenerio. Here […]

I have a problem , why the time doesn’t work in tempmute command? [closed]

I have a problem , why the time doesn’t work in tempmute command? Source: JavaSript – Stack Overflow

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.