0

Pls help, my discord bot says `"client" has already been declared` when doing a ban command!

require('./server')(); bot.login(config.token); const { Client, Message, MessageEmbed } = require('discord.js') module.exports = { name: "idban", description: "Ban a user with their ID", run: async (Client, message, args) => { if (!message.member.permissions.has("BAN_MEMBERS")) return message.reply("You Don't Have The Permission To ban A User!"); if (!args[0]) return message.reply("You need to specify a user ID"); let user = args[0]; let reden = args[1] 'No reason given.' let ban = await message.guild.members.ban(user, { reden }) const embed1 = new MessageEmbed() .setColor('#8BED7F') .setTitle(`:white_check_mark: Banned ${ban.tag "Unknown User"}) .setDescription(Reason: ${reden}) return message.reply({ embeds: [embed1]}); }, }); (Check comment/answer for more code)

20th Feb 2022, 3:27 AM
Glitching shift Sans
Glitching shift Sans - avatar
8 Answers
+ 1
------- IDUnban command ------- const { Client, Message, MessageEmbed } = require('discord.js') module.exports = { name: "idunban", description: "UnBan a user with their ID", run: async (client, message, args) => { if (!message.member.permissions.has("BAN_MEMBERS")) return message.reply("**You Don't Have The Permission To ban A User!**"); if (!args[0]) return message.reply("You need to specify a user ID"); let user = args[0]; let reden = args[1] || 'No reason given.' let ban = await message.guild.members.unban(user, { reden }) const embed1 = new MessageEmbed() .setColor('#8BED7F') .setTitle(:white_check_mark: Banned ${ban.tag || "Unknown User"}) .setDescription(Reason: ${reden}`) return message.reply({ embeds: [embed1]}); }, });
20th Feb 2022, 3:27 AM
Glitching shift Sans
Glitching shift Sans - avatar
+ 1
Glitching shift Sans So you cannot write const{Client, Message, MessageEmbed} = two times in same block of code. You have already defined on 3rd line so no need to write again.
20th Feb 2022, 4:05 AM
A͢J
A͢J - avatar
0
Glitching shift Sans All code is in just 1 file?
20th Feb 2022, 3:55 AM
A͢J
A͢J - avatar
0
A͢J yes, it's index.js
20th Feb 2022, 3:57 AM
Glitching shift Sans
Glitching shift Sans - avatar
0
I'm, let me show you the whole full code
20th Feb 2022, 4:06 AM
Glitching shift Sans
Glitching shift Sans - avatar
20th Feb 2022, 4:08 AM
Glitching shift Sans
Glitching shift Sans - avatar
0
A͢J it made more error It says "no reason given"
20th Feb 2022, 4:10 AM
Glitching shift Sans
Glitching shift Sans - avatar
0
Glitching shift Sans That is another error you have to comment that line. let reden = args[1];//'No reason given.' You have many errors just solve one by one.
20th Feb 2022, 5:03 AM
A͢J
A͢J - avatar