Sends a lovely dog into your discord server! Just type -dog and you'll get a random dog image or video.
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let request = await lib.http.request['@1.1.6'].get({
url: `https://random.dog/woof.json`, //the api I use
});
console.log(request);
if (request.statusCode !== 200) {
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `There was an error, try again later`, // you can change that
});
} else {
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${request.data.url}`,
});
}