How do I make a !bbc command

Asked Jul 13, 2022·2 replies·Last activity 4 years 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.

I want to make a command that get a random recent article (or just any at all, it doesnt even have to be random, it could be the first article) on https://bbc.com/news , but it keeps returning with "Code generation from strings disallowed for this context".

$(eval a=$(urlfetch json https://bbc.com/news).split(";");a[Math.floor(Math.random()*a.length)])

2 replies

Hey @Mild Shrimp!

The issue is that you fetch a webpage, and not an API. There's only one way to fix this: use an API.

$(urlfetch https://api.scorpstuff.com/bbcnews.php)