Usage:
!scp [Number]
or just
!scp
What it does:
This command allows you to do two things:
- Quickly getting the link to a specific SCP article from the wiki by using the command together with the article's number
- Getting a link to a random SCP by not adding any arguments to the command (or if your argument is invalid)
Here is the code:
Edit: Improved code by RokettoJanpu:
$(eval z=4090;a=parseInt(decodeURIComponent(`$(querystring)`),10);a>0&&a<=z?(b=`Your desired SCP`,c=a):(b=`Random SCP`,c=Math.ceil(Math.random()*z));b+`: https://www.scp-wiki.net/scp-`+c.toString().padStart(3,`0`))
My original code:
$(eval randc = "Random SCP:"; if("$(query)" > 0 && "$(query)" < 4090){randc = "Your desired SCP:"} randc;) http://www.scp-wiki.net/scp-$(eval var out = ""; if("$(query)" > 0 && "$(query)" < 4090){out = "$(query)";} else{out = (Math.round(Math.random() * 4090))} if(out == 0){out = 1;} out2 = out; if(out < 100){out = "0" + out;} if(out2 < 10){out = "0" + out;} out;)
(It's not very efficient or good-looking but it works nonetheless. Just know that I basically made this through trial and error.)
To add the command, just copy this and post it in your channel's chat:
Spoiler: > !commands add -cd=5 -ul=everyone !scp $(eval z=4090;a=parseInt(decodeURIComponent($(querystring)),10);a>0&&a<=z?(b=Your desired SCP,c=a):(b=Random SCP,c=Math.ceil(Math.random()*z));b+: https://www.scp-wiki.net/scp-+c.toString().padStart(3,0))
I set the highest available SCP number to 4090 because after that point the article numbers start being unused. If you want you can manually increase this number in the code once more SCPs have been added to the site.
