How do I check if a user is banned or not in DiscordJS V14?

Advertisements So I want to fetch banned members in DiscordJS V14, but the old method doesn’t work. My code: const { EmbedBuilder } = require("discord.js"); const { colors } = require("discordjs-colors-bundle"); module.exports = { config: { name: "unban", description: "Unban a member from the guild", usage: "unban [id]", }, permissions: ["BanMembers"], owner: false, run: async… Read More How do I check if a user is banned or not in DiscordJS V14?

How do I check if a user is banned or not in DiscordJS V14?

Advertisements So I want to fetch banned members in DiscordJS V14, but the old method doesn’t work. My code: const { EmbedBuilder } = require("discord.js"); const { colors } = require("discordjs-colors-bundle"); module.exports = { config: { name: "unban", description: "Unban a member from the guild", usage: "unban [id]", }, permissions: ["BanMembers"], owner: false, run: async… Read More How do I check if a user is banned or not in DiscordJS V14?

Can not read properties of null (reading 'username')

Advertisements I’m trying to find a user by id but its erroring. Here is my code: module.exports = { name: ‘whois’, execute: (client, message, args) => { const userId = args[0]; const member = message.guild.members.fetch(userId); message.reply(`Thats ${member.user.username}!`); } } >Solution : The cause of the error is due to the fact you’re not awaiting the… Read More Can not read properties of null (reading 'username')

I am making a Discord bot using Javascript. I am using a .env file and the dotenv library for security. I am getting an error with importing dotenv

Advertisements I am making my first Discord bot using Javascript. I decided to use a .env file to hide my token so I can push the files to Github. To do that I had to use the dotenv library. When I try to import that library, I get an error. import { config } from… Read More I am making a Discord bot using Javascript. I am using a .env file and the dotenv library for security. I am getting an error with importing dotenv

Is it possible to return if it is a specific error?

Advertisements I was creating my bot discord when I got a missing permissions error, I was wondering if it was possible to not display the error if it’s only a permissions error. Let me explain, the error starts with DiscordAPIError: Unknown Message and I thought that if (err.includes("DiscordAPIError: Unknown Message") return might work >Solution :… Read More Is it possible to return if it is a specific error?

How to select a item from a array and have the next item that is selected be the next item in the array

Advertisements I am pretty new to stack overflow and this is my first question here. Sorry if it wasn’t clear! I want to make it so that a item is picked from a array and the next item is the item after it I also want to pick a item every 15 seconds I am… Read More How to select a item from a array and have the next item that is selected be the next item in the array

TypeError: Cannot read properties of undefined (reading 'has')

Advertisements I’m trying to do a clear command on Discord.js v14, but it keeps telling this error: TypeError: Cannot read properties of undefined (reading ‘has’) Here’s the code: const { SlashCommandBuilder, Embed, EmbedBuilder } = require(‘discord.js’); module.exports = { data: new SlashCommandBuilder() .setName(‘clear’) .setDescription("Delete messages") .addIntegerOption(option => option.setName(‘messages’).setDescription(‘Messages to delete’).setRequired(true)), async execute(interaction) { const messages… Read More TypeError: Cannot read properties of undefined (reading 'has')

Console Log Result And Typing the result is different

Advertisements When I run this Javascript code that selects the id where the username is admin. conauth.connect(function(err) { if (err) throw err; conauth.query("SELECT id FROM account WHERE username = (?)",[object], function (err, result, fields) { if (err) throw err; console.log(result) message.reply(result) }); }); The Console result is Correct [ RowDataPacket { id: 8 } ]… Read More Console Log Result And Typing the result is different

DiscordJS v14 invalid form body

Advertisements I have been trying to make a slash command with subcommand that sends message to specified channel. When i try to deploy it, i get: DiscordAPIError[50035]: Invalid Form Body options[1][APPLICATION_COMMAND_OPTIONS_TYPE_INVALID]: Sub-command and sub-command group option types are mutually exclusive to all other types at SequentialHandler.runRequest (D:\projs\cpp\tbot\node_modules\@discordjs\rest\dist\index.js:659:15) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.queueRequest (D:\projs\cpp\tbot\node_modules\@discordjs\rest\dist\index.js:458:14) at… Read More DiscordJS v14 invalid form body