fix(?) the nickname

This commit is contained in:
loicbersier 2019-11-29 22:04:26 +01:00
parent 35378dfa07
commit 868779edf7

View file

@ -36,13 +36,16 @@ class fakebotCommand extends Command {
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
let url; let url;
let username = args.user.username; let username = args.user.username;
let member = message.guild.members.get(args.user.id);
// Get attachment link // Get attachment link
if (Attachment[0]) { if (Attachment[0]) {
url = Attachment[0].url; url = Attachment[0].url;
} }
// Show nickname if user is in guild // Show nickname if user is in guild
if (message.guild.members.get(args.user.id).nickname) { if (member) {
username = message.guild.members.get(args.user.id).nickname; if (member.nickname) {
username = member.nickname;
}
} }
message.channel.createWebhook(username, { message.channel.createWebhook(username, {