NightDev Community Forums

Help with respond command

First of all hello and thanks for your help in advance.

Im trying to make a command that gives different answers depending on what the user types.
For example:

!what is the command name

*User: !what is your name?
*Nightbot: My name is X
*User: !what is your upload schedule
*Nightbot: My upload schedule is X
*etc…

by using this command:
addcom !command name $(eval $(query).toLowerCase().includes(rest of sentence)?response: )

How can I make multiple possibilities ? And is there a way to use Pastebin for all the possibilities?

Thank you again for your help

Yeah this is possible I made a very crude version of this before it needs feed two variables but tbh it’s not very practical. Cleetus chatbot - Pastebin.com

So here’s what I’ll tell you to do your pastebin should have this format:

a.match(/Expression1|Expression2/gi)?`Response if either of those Expressions match.`:
a.match(/Expression3|Expression4/gi)?`Response if either of those Expressions match.`:
a.match(/ExpressionX/gi)?`Response that Expression matches.`:
`Response if none match`

So basically the expressions will be in category’s like age so key words for that could be age or old and the regex would look like /age|old/gi if you look at the example I linked you’ll see some of the caragories I have and you can change them however you like. Also worth noting in the case two ore more different expressions are matched from different categories it will respond with whatever response in higher up in the list

Here is what your command should look like:

$(eval a=`$(query)`;$(urlfetch json https://pastebin.com/raw/xxxxxx))

Should you want to include functions like what game your playing or what time it is for you that will require additional variables.

2 Likes