Reputation: 77
I've Solved A Problem That Says ReferenceError: member is not defined
But Now I'm Getting The Following Problem TypeError: Cannot read property 'find' of undefined
I Think That They've Changed The find
Property To Another Property But I'm Not Sure What's The New Property So... Someone HELP !
My Code :
1: const discord = require("discord.js");
2: const config = require('../config.json');
3:
4: module.exports.run = async (bot, message, args) => {
5:
6: let target = message.guild.member(message.mentions.users.first());
7: let reason = args.slice(1).join(' ');
8: let logs = message.guild.channel.find(channel => channel.name === "⚠server_logs");
9:
10: // member.guild.channels.cache.find('⚠server_logs', config.logsChannel);
11:
12: if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('you don\'t have permissions to use this command!s');
13:
14: if (!target) return message.reply('please specify a member to ban!');
15: if (!reason) return message.reply('please specify a reason for this ban!');
16: if (!logs) return message.reply(`please create a channel called ${config.logsChannel} to log the bans!`);
17:
18: let embed = new discord.RichEmbed()
19: .setColor('RANDOM')
20: .setThumbnail(target.user.avatarURL)
21: .addField('Banned Member', `${target.user.username} with an ID: ${target.user,id}`)
22: .addField('Banned By', `${message.author.username} with an ID: ${message.author.id}`)
23: .addField('Banned Time', message.createdAt)
24: .addField('Banned At', message.channel)
25: .addField('Banned Reason', reason)
26: .addFooter('Banned user information', target.user.displayAvatarURL);
27:
28: message.channel.send(`${target.user.username} was banned by ${message.author} for ${reason}`);
29: target.ban(reason);
30: logs.send(embed);
31: };
32:
33: module.exports.help = {
34: name: 'ban'
35: };
Upvotes: 1
Views: 776
Reputation: 188
let logs = message.guild.channel.find
It has to be: "let logs = message.guild.channels.cache.find" , like in your comment i think
Upvotes: 1