Hello!
A couple of days ago I found this great response post:
… which allows you to basically create a database using a Pastebin file.
I modified the command to look something like this:
!commands add .drawdata -ul=moderator $(eval var data = “$(urlfetch https://pastebin.com/raw/MY_FILE) “.split(”,”); data[$(query)]
… because I didn’t want the command to draw random data from the file, instead draw each line/entry as I request it.
So with the command above I would do .drawdata 0 and that would return Line/Entry 1 from the Pastebin file.
The command may be a bit messy but I’m not very familiar with the different things you can do with certain functions… like that “.split”, I had no idea that even existed xD
My question is: Would there be a way for me to store data in that Pastebin file via a command? Say, .storedata instead of .drawdata in my example? Someone suggested it would be easier to use a Quote system instead but I would really like to know if something like this can be done. Perhaps changing the link from “/raw/” to “/edit/” as that takes you to the editing page for the Pastebin file.
The current URL fetch system only does GET requests, so it’s not possible to modify data in a Pastebin file. If you are skilled you can build an API that proxies requests between Nightbot and Pastebin, but at that point you might as well just store it yourself.
Thanks for the response!
Yeah I suppose, but then when I want to use something like this (link to my other help request):
I can’t really edit a command to add a $(countdown) because the countdown is triggered the moment the !set command goes out. I imagine the solution is to store the variable along with any hardcoded data (like the timezone ( $(countdown $(query) Zone) ), and then call it with the command that checks the countdown… Unless there’s a way to implement $(countdown) and not have it print it out until I really want it to?
Oh sorry!
Yeah I imagined from the moment I was typing this topic that this wouldn’t be possible at all. Wish there was a way for me to remove the thread altogether.