First command

This commit is contained in:
Isaac 2022-05-05 21:47:08 +01:00
parent cbfbf05e8c
commit a37d5e7613
3 changed files with 23 additions and 4 deletions

View File

@ -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);
}
}
};

View File

@ -22,6 +22,7 @@
*/ */
const pkg = require('../package.json');
const fs = require('fs'); const fs = require('fs');
const semver = require('semver'); const semver = require('semver');
const { colours } = require('leeks.js'); const { colours } = require('leeks.js');
@ -33,8 +34,6 @@ const Client = require('./client');
process.env.NODE_ENV ??= 'development'; // make sure NODE_ENV is set process.env.NODE_ENV ??= 'development'; // make sure NODE_ENV is set
require('dotenv').config(); // load env file require('dotenv').config(); // load env file
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
// check node version // check node version
if (!semver.satisfies(process.versions.node, pkg.engines.node)) { 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}".`)); console.log('\x07' + colours.redBright(`Error: Your current Node.js version, ${process.versions.node}, does not meet the requirement "${pkg.engines.node}".`));

View File

@ -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) { constructor(client) {
super(client, { super(client, {
emitter: client, emitter: client,