Creating "Gamer pick up line" chat command

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