This command runs provided python code, usage: !python <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);
const result = await axios(
'https://codexweb.netlify.app/.netlify/functions/enforceCode',
{
method: 'post',
data: {
code: content.join(' '),
language: 'py',
input: '',
},
headers: {
'Content-Type': 'application/json',
},
}
).then((res) => res.data?.output);
return lib.discord.channels['@0.3.0'].messages.create({
content: `\`\`\`py\n ${result} \`\`\``,
channel_id: context.params.event.channel_id,
});