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 https://pastebin.com/raw/7nHfBLkZ) " .split(”,"); puns[Math.floor(Math.random() * (puns.length - 1))]
Error Message: [Response must be less than 400 characters]
Pastebin link: https://pastebin.com/raw/7nHfBLkZ
!commands add !potd -cd=5 $(eval var puns = “$(urlfetch https://pastebin.com/raw/7nHfBLkZ) " .split(”,"); puns[Math.floor(Math.random() * (puns.length - 1))]
end of the command is not a winky face, its “; )” but with no space between.
You are seeing that error message because https://pastebin.com/raw/7nHfBLkZ 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 https://pastebin.com/raw/7nHfBLkZ))").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.