M
M
Monte Carlo2020-11-24 20:43:45
Node.js
Monte Carlo, 2020-11-24 20:43:45

How to make Embed padding via commands?

Will explain. I have an Embed in one of my bot (JS) commands. And I need to make it so that on another command (let's say !setTitle LOREM IPSUM! ). After prescribing, it is " LOREM IPSUM! " that will have to get into the .setTitle(` LOREM IPSUM! `) code and issue it on the same Embed.

The whole problem is that I don’t know how to do it, how to make it send data to other commands when writing a command, how to make it all saved, etc. I hope I have clearly explained the essence of the matter.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Israfil22, 2020-11-25
@killsaylden

There are at least three ways to solve this problem.
1. There are message collectors in the discord.js library .
You can instantiate such a collector and catch all settings for your embed. You will get a kind of input from several messages.
2. If the principal implementation is in the form of several commands - you need to save the intermediate state of your embed somewhere - save it to a file, create a storage (for example, where the user and its embed settings will be stored), or use other services - databases, storages Everything has its pros and cons.
3.Also send your embed configuration as a token to the user himself - i.e. save all embed properties into an object, serialize it, for example, using JSON.stringfy and convert it to base64 to increase the magic effect and so that there would be no problems with parsing it later. Next, the user enters the command (for example) configureEmbed <custom_token> <configuration> <configuration value>.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question