I have been using the [CustomAPI] Quote system until now to be able to pull info and links to art friends accounts, however I have just finished putting together a spreadsheet to use in a stream I mod to do this for a much bigger pool of people participating in draw alongs on twitch and it’s at like 200+ entries and that feels like a. overkill to use the API for, and b. a lot of work to enter/edit them all individually within twitch chat, so was hoping that if I used a pastebin with the spreadsheet data in, I could then use it to search for the username and it will then pull the links from that into chat.
I have already looked at Fetching data from Google Spreadsheet and Nightbot command with Pastebin - tagging a user for help on this but am still struggling to understand if what I want to make work is possible because everything I have tried so far just doesn’t work to pull anything from the data and I feel like I have turned my brain inside out with how little knowledge I have with anything outside of basic commands in nightbot.
The raw data I have at the moment is https://pastebin.com/raw/6cjMLik3 but I don’t know if I need to put more code or something into that first before then trying to make nightbot pull from it, as well as trying to understand how to make it do the $(urlfetch) without just pasting the link itself into chat.
many thanks in advance for all your help and what a great asset to have already!
If you’re willing to modify the format of your pastebin (like this: https://pastebin.com/raw/QyNJ4pz7), you can try something like this:
$(eval try { const data = eval(`$(urlfetch json https://pastebin.com/raw/QyNJ4pz7)`); const user = "$(query)".toLowerCase(); const entry = data.find(item => item[0].toLowerCase() === user); entry ? entry.slice(1).join(" | ") : "No links found for the user."; } catch (e) { "There was an error processing the data."; })
so i tried it with your pastebin and it worked perfectly, so amended mine and tried substituting that link instead (so that i can make edits to the pastebin in the future) and it no longer works, it just gives the There was an error processing the data every time instead… any ideas why?
i literally just swapped the raw pastebin link for another that I have amended to match yours but i will be able to edit in the future.
I appreciate your help with this SO so much, it has been turning my brain inside out trying to get it to work and it will make such a difference to the modding i do to have this working!
nevermind! for some reason copy and pasting your raw data into a new pastebin didnt work, but cloning it did… either way its working and i have a pastebin i can edit the data in in the future, thank you SO SO much for this @niqofdez!