If I had a local text file (like a notepad document) with 50 or more lines and one insult on each line, could I have a command, like “!insult”, that pulls one random line from that text doc and Nightbot posts it in chat?
As a little extra, would I be able to make the command targetable like if a user sends “!insult @dave_nugget” in the chat, could Nightbot then @ that targeted user and then puts in the random insult line?
Trust me, this is a VERY important Nightbot command issue, so much so if anyone wants I could post a link to a copy of my insult text file so you can use them and add your own… ( ͡° ͜ʖ ͡°)
Yes this is possible just separate the insults like this
[`INSULT_1`,
`INSULT_2`,
`INSULT_3`,
...]
Please make sure to include the square brackets only at the very start of the list and very end.
As for adding a certain user you would make the command as follows.
So if I had a local text file for insults would I still use urlfetch and then a https link or can I put in the file explorer path for it? Or would I have to upload it and get a shareable link for Nightbot to use?
Yes, as long as the link returns plain text it should work though make sure you include the “json” parameter in the url fetch to circumvent the character limit.
Any suggestions on where to upload it or what kind of URL it’ll accept?
I’ve tried both uploading the .txt file to a google drive and putting the text into a google doc and neither method work.
No, I am not sure as to what URLs are considered valid or not.
Honestly I would recommend creating a pastebin account and just copy and pasting it over there as I know for certain that works. That would be the simplest fix to this I can see.
No you do not put a comma after the last one it would create an extra component to the array that would return nothing. After your done reformatting try again and it should work.
I’ve tested it and this works. Though if you plan on ever changing/adding any insults for future use I highly recommend creating an account on pastebin so you can edit and save your posts. Hope I helped <3