(help) making a command that posts links

Asked Dec 19, 2024·2 replies·Last activity 1 year ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

hi I'm wondering if its possible to make a command that pulls a random twitch clip from a pastebin link. i have made other commands that will pull a random fact and other stuff but is it possible to do with links? here's what i have so far let me know how i can get this to work

!commands add !funnyclips $(eval a=$(urlfetch json https://pastebin.com/raw/wJDZ96C6 );a[Math.floor(Math.random()*a.length)])

2 replies

You can use the following:

!commands add !funnyclips $(eval a=`$(urlfetch json https://pastebin.com/raw/wJDZ96C6 )`.split('|').map(b=>b.trim());a[Math.floor(Math.random()*a.length)])