NightDev Community Forums

Different responses to the command

Hi guys, I have a question
Can I make the bot react differently to the command? So to speak, different answers to 1 command

I hope I could explain what I need

For instance:
command “yes”
the bot will answer “no” or answer “yes” or answer “maybe”

Depending on the answer options
If this can be done, please tell us in detail how?

Try looking here Can somebody give me a command script for adding multiple responses to one command?

2 Likes

@NikaMyaso Welcome to the community. Try this:

!addcom -cd=5 !COMMAND_NAME $(eval const responses = [`yes`, `no`, `maybe`];  responses[Math.floor(Math.random() * responses.length)];)

Your command is similar to !8ball
Regards

2 Likes

And if I want to add some long answers, can I do it somehow?

Can I somehow add many long text answer choices? For example, quotes from famous people

Yes you can. Just note that there is a character limit. There is a way around it if you need a lot of responses though.

1 Like

yes, I would like to get around this limitation
But how can this be done?

You’ll want to use pastebin you’ll write out a pastebin like this:

Qoute1:
Qoute2:
Qoute3

Make sure the ‘:’ is in between all the responses

Can you describe this in more detail? And throw off an example

@NikaMyaso Well, you can use mine quotes command.

!addcom -cd=5 !quotes $(eval a = $(urlfetch json https://pastebin.com/raw/CQ6sdh4r); a[Math.floor(Math.random() * a.length)];)

Regards

2 Likes

So basically you’ll want to creat an account on pastebin and write out the responses like I said. Here’s an example https://pastebin.com/raw/6AfagFQq

Then the command will look like this:

$(eval a=`$(urfletch json Raw_Pastebin_Link)`.split(`SEPARATOR`);a[Math.floor(Math.random()*a.length)])

The “SEPARATOR” is whatever you use to separate the responses it should be something like , ; : | ~ or - just things that wont appear in the qoutes. The raw pastebin link is the link to your pastebin file.

2 Likes

The answers should look like in the link from this user?(https://pastebin.com/raw/CQ6sdh4r)
Or just start on a new line like in your example?
(sorry for a bunch of questions, I’m new here)

I’d recommend just putting the answers in the way I showed as it is simpler to do. But both work just the way you format the command is different depending on which you use.

2 Likes

Should I replace the word “SEPARATOR” with the ending character or leave it as it is?

.split(`SEPARATOR`); or .split(`|`);

Thank you, it was your method that worked for me :heart:

@NikaMyaso I will add more quotes in the future. Regards

Edit: Quotes*

1 Like