Trying to create a Random Pun Generator

This is the command im using and dont know why it keeps giving me an error message back, My Command: !commands add !potd -cd=5 $(eval var puns = “$(urlfetch " .split(”,"); puns[Math.floor(Math.random() * (puns.length - 1))]:wink:
Error Message: [Response must be less than 400 characters]
Pastebin link:

!commands add !potd -cd=5 $(eval var puns = “$(urlfetch " .split(”,"); puns[Math.floor(Math.random() * (puns.length - 1))]:wink:
end of the command is not a winky face, its “; )” but with no space between.

You are seeing that error message because contains more than 400 characters. If your command downloads more than 400 characters, you must use urlfetch json.

Fixed version:

!commands add !potd -cd=5 $(eval puns = decodeURIComponent("$(querystring $(urlfetch json").split(","); puns[Math.floor(Math.random() * (puns.length - 1))])

I used decodeURIComponent and querystring to protect your command from breaking if you ever add a pun that contain a ".

Thank you so much, It all works now <3

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