Со времени моего последнего вопроса я пытался заставить его работать, но теперь возникает ошибка, когда я пытаюсь выполнить команду profile
после успешного получения прошлой Био с помощью обновленной команды setBio
:
bio[message.author.id].join is not a function
Я начал осознавать проблему, но не знаю, как ее исправить.
Вот код, в котором происходит ошибка:
case 'setBio':
if(!bio[message.author.id]) {
let messages = message.channel.messages;
let authorMessages = messages.filter(m => m.author.id === message.author.id);
let setBioCommands = authorMessages.filter(m => m.content.startsWith('!setBio'));
let firstBio = setBioCommands.last();
message.channel.send('I found a Bio you have previously set. Do you want to confirm the change to that Bio?').then(r => r.delete(10000));
message.react('✅').then(() => message.react('❎'));
const filter = (reaction, user) => {
return ['✅', '❎'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 10000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '✅') {
bio[message.author.id] = firstBio
message.reply('Past Bio successfully restored!')
.then(msg => msg.delete(3000));
}
else {
message.reply('Okey, I\'ll delete this Bio.')
.then(msg => msg.delete(3000));
}
})
.catch(collected => {
message.channel.send('You didn\'t respond, so I\'ll throw this Bio into the abyss. *Buh-bye!*');
});
} else {
let newArr = args.slice(1)
bio[message.author.id] = newArr
message.channel.send('Your bio has been changed!')
.then(msg => msg.delete(3000));
}
break;
case 'profile':
if(!bio[message.author.id]) {
return message.channel.send('Sorry, please set a bio with `!setBio` to view your profile!')
.then(msg => msg.delete(3000));
} else {
const embed = new Discord.RichEmbed()
.setTitle('__' + message.author.username + '\'s Profile__')
.addField(`Bio:`, bio[message.author.id].join(" ")) /// this is where the error is
.setColor(message.member.colorRole.color)
.setThumbnail(message.author.avatarURL)
message.channel.send(embed);
}
break;