Discord.js 13 channel.join is not a function

Discord.js no longer supports voice. You need to use the other package they made (@discordjs/voice). You can import joinVoiceChannel from there. //discord.js and client declaration const { joinVoiceChannel } = require(‘@discordjs/voice’); client.on(‘messageCreate’, message => { if(message.content === ‘!join’) { joinVoiceChannel({ channelId: message.member.voice.channel.id, guildId: message.guild.id, adapterCreator: message.guild.voiceAdapterCreator }) } })

Discord.js v12 code breaks when upgrading to v13

Discord.js v13 has a lot of changes, and those are only a few. Before updating to v13, you should change the following things //member.hasPermission(“SEND_MESSAGES”) member.permissions.has(“SEND_MESSAGES”) //channel.send(someEmbed) / channel.send({embed: someEmbed}) channel.send({ embeds: [someEmbed] }) //make sure it’s an array! //client.on(“message”, msg => {}) client.on(“messageCreate”, msg => {}) //channel.send(user) channel.send(user.toString()) //const client = new Client() const { … Read more

None of my discord.js guildmember events are emitting, my user caches are basically empty, and my functions are timing out?

🤖 Discord is now enforcing privileged intents What are intents? Maintaining a stateful application can be difficult when it comes to the amount of data you’re expected to process, especially at scale. Gateway Intents are a system to help you lower that computational burden. Gateway intents allow you to pick and choose what events you … Read more

Why does on_message stop commands from working?

From the documentation: Overriding the default provided on_message forbids any extra commands from running. To fix this, add a bot.process_commands(message) line at the end of your on_message. For example: @bot.event async def on_message(message): # do some extra stuff here await bot.process_commands(message) The default on_message contains a call to this coroutine, but when you override it … Read more

What is the difference between a User and a GuildMember in discord.js?

From Official Discord.js Guide – Common Questions: A lot of users get confused as to what the difference between Users and GuildMembers is. The simple answer is that a User represents a global Discord user and a GuildMember represents a Discord user on a specific server. That means only GuildMembers can have permissions, roles, and … Read more

How do I fix CLIENT_MISSING_INTENTS error?

You need to specify the events which you want your bot to receive using gateway intents. Instead of const client = new Discord.Client(); Use const client = new Discord.Client({ intents: [Enter intents here] }) For example const client = new Discord.Client({ intents: [“GUILDS”, “GUILD_MESSAGES”] }) Here’s another useful link: https://discord.com/developers/docs/topics/gateway

Need help for assigning a variable with discord bot command

You can split your the message into an array of words: const args = message.content.slice(config.prefix.length).split(/ +/).slice(1) // example: `.boosting hello people of the world` // returns: [‘hello’, ‘people’, ‘of’, ‘the’, ‘world’] So, if you’d like to get the first argument (word), you can use args[0]. For the second, args[1], and so on. You updated code: … Read more

Discord bot simple editing its own message gives me error

The “message” variable has the exact same name ad the “message” variable in the client.on(‘message’) so change it to ‘msg’ and everything should work fine : module.exports = { name: ‘hack’, execute: function(message, args) { const user = message.mentions.users.first() || args[0]; const member = message.guild.member(user); if (member) { message.channel .send(‘Scrambling Through Database’) .then((msg) => { … Read more