I have been trying to get the Bio for my Discord Bot to save that a user has set using the setBio command, as every time I reset the bot the Bios would reset too. However, I came up with something that I'm not entirely sure how to do (if I can even do it at all).
After the bot resets and someone tries to use the setBio command for the first time, the bot looks through the message history and finds the last time that person used that command. It then uses args.slice(1) to only read the arguments for setting that Bio. The bot would then say something like:
I found a previous Bio that was set earlier. Type
yesif you want to set your Bio to this:Example bio
After that, if the user typed yes, that Bio would be used. In order to make it less annoying, it would only do that the FIRST time someone changed the Bio after it resets.
I only have that, and I don't know how it would be put in code. What would be used to make this possible?
Here is some code relevant to this question:
case 'setBio':
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!')
} else {
const embed = new Discord.RichEmbed()
.setTitle('__' + message.author.username + '\'s Profile__')
.addField('Bio:', bio[message.author.id].join(" "))
.setColor(message.member.colorRole.color)
.setThumbnail(message.author.avatarURL)
message.channel.send(embed);
}
break;