Can you help me edit this two words command

So I found this command:

!addcom FIRST_WORD_OF_THE_SENTENCE $(eval $(query).includes(REST_OF_THE_SENTENCE)?RESPONSE: ; )

which I enter two words and the Nightbot response with a sentence, it’s great but the question is that can I edit it to have more than one response? sorry idk much about coding can you help me if it’s possible.

Hey @Zoroarid!

Do you mean to have a random RESPONSE between two or more options, but the same REST_OF_THE_SENTENCE; or is it multiple REST_OF_THE_SENTENCE options that lead to a different response each, or the same response for all of them?

no I want the the same REST_OF_THE_SENTENCE but with different random responses for example if I want to type in the chat (word word2) I want the Nightbot to response with a random sentence each time I write these 2 words like (Sentence1, Sentence2, Sentence3).

btw I have this command I found which gives more than one response but it only works for one word.
*!addcom WORD $(eval a=[RESPONSE_1,RESPONSE_2,RESPONSE_3];a[Math.floor(Math.random()a.length)])

I tried combining the two commands but it never worked since idk much about coding and commands.

Yes, so here’s how to combine the two:

!addcom FIRST_WORD $(eval r = ['RESPONSE_1', 'RESPONSE_2', 'RESPONSE_3']; '$(query)'.toLowerCase().includes('REST_OF_THE_SENTENCE_IN_LOWER_CASE') ? r[Math.floor(Math.random() * r.length)] : ' ')

Extra resources for people stumbling upon this topic looking to do the other option:
basic command

1 Like

it worked, thank you so much :heart:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.