I feel like an utter idiot. Here’s what I’m trying to do:
I want “!command ARGUMENT” to turn the ARGUMENT into lowercase and then return the contents of a file from my server, where ARGUMENT is the file name, so that “!command FiLeNAME” returns the contents of https://www.myserver.com/directory/filename
This is probably incredibly easy to do, but somehow I’m stuck. Any help would be much appreciated!
To make the query is in lower case you use .toLowerCase():
$(eval '$(1)'.toLowerCase())
However, since you call an API/URL you have to do it in two steps, because Nightbot executes the $(urlfetch) before the JS code, so it replaces the Nightbot variables with values/data that can be used with JS, the solution to that is to use an alias command: you have your first command that sets the argument to lowercase, and then the second command is called with the output of the first one: