Creating "Gamer pick up line" chat command

Hello so I’m currently trying to help set up a unique chat command for my friend and for some reason it says "unexpected token ‘<’ ". How would I fix this so the url will work and pull the jokes over to twitch? I’m new to creating commands, someone please help!

$(eval $(urlfetch json 195+ Gamer Pick-up Lines to Impress Your “the One.”))

The url that you use in the $(urlfetch) command needs to actually text, not a full website. We don’t include any parsing or scaping for sites. You can use all those quotes and put them in a pastebin with a new quote on each line in a JSON array. For example:

[
    "Pick up lines for when you’re in a rush but want to make a good impression on your love interest.",
    "Are you casting blizzaga? Because I swear everything froze when I saw you.",
    "You must be a planet; your Halo caught my eye."
]

You can use a site like https://jsonlint.com/ to verify that your json is correct. Then use a command to fetch from pastebin, and randomly pick on from the list.

!commands add !randomlove Random love line: $(eval let l = $(urlfetch json https://pastebin.com/raw/4aK0X0fg); l[Math.floor(Math.random()*l.length)])

Aaron128: !randomlove
Nightbot: Random love line: You must be a planet; your Halo caught my eye.

In this case I only have 3 of the lines but your more than welcome to create a new pastebin with additional entries, use the linter above to verify your notation is correct.

1 Like

Ok I copied the jokes over to pastebin and I have a few questions regarding how it should look after its typed. Would I use the quote marks for each pickup line? And what does the let 1, 1[math.floor… that whole last part mean? Do I type it all in after the pickup lines? Apologies I am a little dumb lol

This is what I got from what you are saying
$(eval let 1 = $(url fetch json Pastebin Link); l[Math.floor(Math.random()*l.length)])
(Instead of the actual pastebin link I had to swap it. It wouldn’t let me post this otherwise.)
I typed this input into the json lint link you gave me and this is what it said

Error: Parse error on line 1:
$(eval let 1 = $(url
^
Expecting ‘STRING’, ‘NUMBER’, ‘NULL’, ‘TRUE’, ‘FALSE’, ‘{’, ‘[’, got ‘undefined’

what does STRING, NUMBER,NULL, TRUE, and FALSE mean? And how would I type it?

The list you put into Pastebin is the text you put into the verifier… not the actual command. If you have a list of the phrases on pastebin I can probably help put them into an actual list. The command itself is fine and shouldn’t be checked anywhere.

I got it set to public on pastebin my user is the same. Just type in gamer pick up lines.

Here’s the finished command:

!commands add !randomlove Random love line: $(eval let l = $(urlfetch json https://pastebin.com/raw/Hmu9M1ag); l[Math.floor(Math.random()*l.length)])
1 Like

Omg thank you so much! I literally just figured out how to change it to the raw format LOL You are awesome <3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.