0
votes

I'm developing a discord bot using discord.js. With my bot users have their own profiles. So they go !profile @me and their profiles come up. I'm wondering if there is a way for the user to use a command, say "!setDescription I like Discord". And when they use the command to view their profile "!profile @me" their profile embed will have the description they wrote, is this possible? And if so how could I incorporate this into my code? Thank you in advance for any help!

1

1 Answers

2
votes

You can store their description and then reuse it later:

When the user runs !setDescription I like Discord you save I like Discord in an object like this

//the user is stored as "message.author"
//the argument "I like Discord" is stored as "text"
var desc = {};
desc[message.author.id] = text; //desc -> {"id": "I like Discord"}

When the user runs !profile @me you use your desc object to get their description

//the user is stored as "message.author"
embed.setDescription(desc[message.author.id]);

Keep in mind that if you save the data into a variable, when you turn it off all the descriptions will be lost. To avoid that you can save the object into a JSON file or wherever you prefer.