This snippet allows you to upload your code to code bin or hastebin. Usage: !bin <your code>
/* Import Modules */
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
/* extract content from event and split it then slice its 1st value so that */
/* we get main content without command name */
const content = context.params.event.content.split(' ').slice(1);
/* Post request to api */
const codeBin = await axios
.post(
'https://www.toptal.com/developers/hastebin/documents',
content.join(' ')
)
.then((res) => res.data);
/* Return the url of code bin */
return lib.discord.channels['@0.3.0'].messages.create({
content: `Here is your code: https://www.toptal.com/developers/hastebin/${codeBin.key}`,
channel_id: context.params.event.channel_id,
});