I have basic knowledge in programming but not in this language. So can someone help me to program a command where if the argument next to the command is e.g. “NAME”, I output “Hello NAME”. But NAME can be something different than the author of the message?
Or can someone give me a link where I can see how to do this? I could not find instructions or a helpful explanation in the documents or anywhere else?
Hey @red_concrete!
Nightbot uses JavaScript, but for simple commands like yours text is more than enough!
With the description you’ve given, I think what you’re looking for is the $(touser)
variable.
With a command like this one:
!addcom !hello Hello $(touser)!
The bot will answer like this:
User1: !hello
Nightbot: Hello User1!
User1: !hello User2
Nightbot: Hello User2!
I already know that, thanks, but that’s not what I want. I want that if the first argument after the command (which is not a person) is a certain string, to insert this in the sentence that is returned. And yes i will need some JS but I only know Java. That’s where I need some help
Could this be what you’re looking for then?
If not, please provide an example like I explained how the bot would answer.
Thats almost what i wanted. Thanks a lot
I tried replacing the $(query) with $(1) and the includes() method with the equals() method, but there is an error saying that “some_string”.toLowerCase(…).equals() is not a function. Isn’t there an “equals check” function?
Simply do the following:
'$(1)'.toLowerCase() === 'WORD_IN_LOWERCASE' ? ...
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.