Download pool/shard004/JavaScript/0025193_govuk.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard004/JavaScript/0025193_govuk.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard004/JavaScript/0025193_govuk.js
-
curl -L -o 0025193_govuk.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard004/JavaScript/0025193_govuk.js
1.16 kB
| const request = require('request-promise') | |
| const colors = require('irc').colors | |
| module.exports = { | |
| commands: { | |
| govuk: { | |
| help: 'Returns a random GOV.UK page', | |
| fireMessageEvent: true, | |
| command: async function () { | |
| const res = await request({ | |
| followRedirect: false, | |
| resolveWithFullResponse: true, | |
| simple: false, | |
| url: 'https://www.gov.uk/random' | |
| }) | |
| return res.headers.location | |
| } | |
| }, | |
| govorg: { | |
| help: 'Returns a random UK Government organisation', | |
| command: async (bot) => { | |
| const data = await request({ | |
| json: true, | |
| url: 'https://government-organisation.register.gov.uk/records.json?page-size=5000' | |
| }) | |
| const orgs = [] | |
| for (const prop in data) { | |
| if (Object.prototype.hasOwnProperty.call(data, prop)) { | |
| orgs.push(data[prop]) | |
| } | |
| } | |
| console.log(orgs) | |
| const rand = Math.floor(Math.random() * orgs.length) | |
| const org = orgs[rand].item[0] | |
| return `${colors.wrap('white', org.name)} ${colors.wrap('gray', org.website)}` | |
| } | |
| } | |
| } | |
| } | |