diff --git a/src/commands/stdin/eval.js b/src/commands/stdin/eval.js new file mode 100644 index 0000000..ef394d0 --- /dev/null +++ b/src/commands/stdin/eval.js @@ -0,0 +1,20 @@ +const { StdinCommand } = require('@eartharoid/dbf'); + +module.exports = class extends StdinCommand { + constructor(client) { + super(client, { + id: 'stdinEval', + name: 'eval', + }); + } + + async run(input) { + const toEval = input.join(' '); + try { + const res = await eval(toEval); + console.log(res); + } catch (error) { + this.client.log.error(error); + } + } +}; \ No newline at end of file diff --git a/src/index.js b/src/index.js index e98cd17..4571a7c 100644 --- a/src/index.js +++ b/src/index.js @@ -22,6 +22,7 @@ */ +const pkg = require('../package.json'); const fs = require('fs'); const semver = require('semver'); const { colours } = require('leeks.js'); @@ -33,8 +34,6 @@ const Client = require('./client'); process.env.NODE_ENV ??= 'development'; // make sure NODE_ENV is set require('dotenv').config(); // load env file -const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')); - // check node version if (!semver.satisfies(process.versions.node, pkg.engines.node)) { console.log('\x07' + colours.redBright(`Error: Your current Node.js version, ${process.versions.node}, does not meet the requirement "${pkg.engines.node}".`)); diff --git a/src/listeners/client/ready.js b/src/listeners/client/ready.js index 5ef5e5b..b6965b4 100644 --- a/src/listeners/client/ready.js +++ b/src/listeners/client/ready.js @@ -1,6 +1,6 @@ -const dbf = require('@eartharoid/dbf'); +const { Listener } = require('@eartharoid/dbf'); -module.exports = class extends dbf.Listener { +module.exports = class extends Listener { constructor(client) { super(client, { emitter: client,