#discord.js
#discord.js
Вопрос:
Я новичок в этом, мне нужна небольшая помощь. Я делаю Discord bot, я знаю, это глупо, но мне это нравится. Моя проблема заключается в том, чтобы выполнить команду с помощью функции, когда я выполняю эту команду в консоли, я получаю это:
TypeError: args.join is not a function
или TypeError: args.slice(...).join is not a function
(Есть две возможности) Я не знаю, в чем проблема. Любой может мне помочь, спасибо.
module.exports.run = асинхронный (бот, сообщение, аргументы) => {
if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send('You can't use that!')
if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send('I don't have the right permissions.')
const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
if(!args[0]) return message.channel.send('Please specify a user');
if(!member) return message.channel.send('Can't seem to find this user. Sorry 'bout that :/');
if(!member.bannable) return message.channel.send('This user can't be banned. It is either because they are a mod/admin, or their highest role is higher than mine');
if(member.id === message.author.id) return message.channel.send('Bruh, you can't ban yourself!');
let reason = args.slice(1).join(' ');
if(!reason) reason = 'Unspecified';
member.ban(`${reason}`).catch(err => {
message.channel.send('Something went wrong')
console.log(err)
})
Комментарии:
1. Помогите нам помочь вам — поделитесь своим кодом
2.
args
должно быть массивом