News Articles discord.js

How can i use global slash command in discord.js v13?

I’ve created a simple slash command. It works on the only guild. before that, I was using v12. Now I wanna switch to v13. Now how can I make these global slash commands? Code client.on ("ready", () => { console.log(`${client.user.tag} Has logged in`) client.user.setActivity(`/help | ${client.user.username}`, { type: "PLAYING" }) const guildId = "914573324485541928" const […]

I got an error when trying to delete all channels via a Discord bot

I was making a purge command delete all channels and ended up running into the error: C:UserszanedDesktopbotmain.js:13 message.guild.channels.forEach(channel => channel.delete()) ^ ReferenceError: message is not defined at Client.<anonymous> (C:UserszanedDesktopbotmain.js:13:5) at Client.emit (node:events:390:28) at MessageCreateAction.handle (C:Userszanednode_modulesdiscord.jssrcclientactionsMessageCreate.js:25:14) at Object.module.exports [as MESSAGE_CREATE] (C:Userszanednode_modulesdiscord.jssrcclientwebsockethandlersMESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (C:Userszanednode_modulesdiscord.jssrcclientwebsocketWebSocketManager.js:350:31) at WebSocketShard.onPacket (C:Userszanednode_modulesdiscord.jssrcclientwebsocketWebSocketShard.js:443:22) at WebSocketShard.onMessage (C:Userszanednode_modulesdiscord.jssrcclientwebsocketWebSocketShard.js:300:10) at WebSocket.onMessage (C:Userszanednode_moduleswslibevent-target.js:199:18) at WebSocket.emit (node:events:390:28) […]

Discord.js DiscordAPIError: Invalid Form Body 0.permissions: Must be 10 or fewer in length

I was going to run my bot on a bigger server than the test server and after I re-registered slash commands to the bigger server, the error output: /home/runner/UnfortunateDistortedEngine/node_modules/discord.js/src/rest/RequestHandler.js:349 throw new DiscordAPIError(data, res.status, request); ^ DiscordAPIError: Invalid Form Body 0.permissions: Must be 10 or fewer in length. 1.permissions: Must be 10 or fewer in length. […]

Discord.js V13 404 not found

Trying to get a user id with regex, and then sending them a dm. Not working at all. The args will be like !DM @usermention. const { MessageMentions: { USERS_PATTERN } } = require(‘discord.js’); const Discord = require("discord.js"); const Command = require("../Structures/Command.js"); module.exports = new Command({ name: "DM", description: "Will DM given author", async run(message, […]

createMessageComponentCollector allow only opponent [email protected]

i’m try so hard for createMessageComponentCollector(MessageButton), But I don’t know what code would allow the opponent to be able to press it alone. someone know, please help me! Here my code: const filter = m => m.customId === ‘accept’ || ‘decline’ && m.author.id === member.id const collector = interaction.channel.createMessageComponentCollector({ filter: filter, max: 1, time: 30000 […]

Creating a module for multiple ‘chat’ features for a discord bot

I’m revisiting one of my first discord bots that I want to test an upgrade on. This bot essentially gives users a lot of information on characters (it’s a fandom bot) so they have a lot of lines that respond to specific quotes. My prior experience is C# and with Unity. In that scenario, if […]

How do I delete an interaction reply in discord.js v13?

I’m trying to delete the bot’s reply to the user’s purge command. module.exports = { data: new SlashCommandBuilder() .setName("purge") // Command name .setDescription("Deletes a set number of messages") // Command description .addNumberOption((option) => // Adds an argument option .setName("number") // Argument name .setDescription("Sets the number of messages to delete") // Argument description .setRequired(true), // Argument […]

Discord User ID verify

Because the system needs the user to fill in the ID, but the Discord User ID rule does not know how to verify. I will have an input field on the screen for users to input. Source: JavaSript – Stack Overflow

Bot discord Green circle [closed]

this is the first time I ask for help on a forum. I would like to know if it was possible to create a bot discord that reacts to the green circle. I would like to know if it is possible to create a bot that reacts to the green circle, for example, that writes […]

How come my "message.reply" is not working (Discord.JS)

So I am learning discord.Js and I am trying to figure out why my message.reply function is not working. I created an event for the bot to listen to messages and when a message with the content of "hello" is sent it should reply with "hello buddy" here is the code: require(‘dotenv’).config() const discord = […]

how can i make my bot play random music when the queue end? (discord.js)

my code look like this: https://replit.com/@hotdogwastaken/MUSICBOT i need someone to help me, i am new name: ‘play’, aliases: [‘p’], category: ‘Music’, utilisation: ‘{prefix}play [name/URL]’, execute(client, message, args) { if (!message.member.voice.channel) return message.channel.send(`${client.emotes.error} Mày có ở trong voice đéo đâu? `); if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id) return message.channel.send(`${client.emotes.error} Bot đang được sử dụng ở voice […]

Discord js permission not working for specific commands

I have a Discord bot running on Heroku. But i have an permission issue for the following commands Commands As u can see in the attached picture. I don’t have permissions for the "add" command. But when i restart the bot. I get permission to use the "add" command but lose the permissions to use […]

Why am I getting: TypeError: channel.updateOverwrite is not a function

I’m following a tutorial on discord.js, making a ticket bot. I have doubled checked and I am still getting the same error: TypeError: channel.updateOverwrite is not a function I’ve looked over all the StackOverflow questions that I could find, but none has worked for me. I have also explored a little deeper outside of stack, […]

Error with missing module "events" on discord.js

bot in discord.js hello, i’m a newbie, i’m having this issue. i can’t run my bot. Error: Cannot find module ‘node:events’ My node is updated; 16.13 I just started now to use discord.js, because discord.py is dead and learn everything in a new place is hard *tear Source: JavaSript – Stack Overflow

Discord.js: How to make a logging system with cases using MongoDB?

Currently, I have no cases thing in my logging system in my Discord bot. Once I tried implementing it using Quick.db and it worked but it is unstable and insecure. The case is the serial number of moderation action taken. So I decided to move on MongoDB because it is faster and more secure. Sadly, […]

discordjs v13 voice join channel

I hve a big issue. I have coded a music bot in nodejs. I have an array with bot data (example: bot name, id, channel id, ect.) and I create a Discord.Client for every bot in a for. In on(‘ready’) I create the callbacks (sending an embeded message with reaction buttons in the text channel. […]

Discord slash command "interaction failed"

I am following a tutorial for discord slash commands on V13 and there are no errors when I run the but but when I go to do /ping it says interaction failed. I went through the permissions needed on the docs but it looked like I go all the permissions needed to run it which […]

Discord.js Can’t ban member by message author

I want the bot to ban member. Code: let member = message.guild.members.get(message.author); if(message.content === message.content && message.channel.id === id) member.ban("reason") message.channel.send("x") So basically, whenever member sends message in specified channel, he will get ban. However, it does not ban. I tried to do it like message.author.id and so on but not successfully. Also, as I […]

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.