diff --git a/src/listeners/stdin/unknown.js b/src/listeners/stdin/unknown.js new file mode 100644 index 0000000..d68e27a --- /dev/null +++ b/src/listeners/stdin/unknown.js @@ -0,0 +1,15 @@ +const { Listener } = require('@eartharoid/dbf'); + +module.exports = class extends Listener { + constructor(client, options) { + super(client, { + ...options, + emitter: client.stdin, + event: 'unknown', + }); + } + + run(commandName) { + console.log('Unknown command:', commandName); + } +}; diff --git a/src/stdin/commands.js b/src/stdin/commands.js new file mode 100644 index 0000000..6b1242b --- /dev/null +++ b/src/stdin/commands.js @@ -0,0 +1,24 @@ +const { StdinCommand } = require('@eartharoid/dbf'); + +module.exports = class Commands extends StdinCommand { + constructor(client, options) { + super(client, { + ...options, + id: 'commands', + }); + } + + async run(args) { + switch (args[0]) { + case 'publish': { + this.client.commands.publish() + .then(commands => { + if (!commands) return console.log('None published'); + console.log('Published %d commands', commands.size); + }) + .catch(console.error); + break; + } + } + } +}; \ No newline at end of file diff --git a/src/stdin/eval.js b/src/stdin/eval.js index c081510..e9787b6 100644 --- a/src/stdin/eval.js +++ b/src/stdin/eval.js @@ -13,8 +13,10 @@ module.exports = class extends StdinCommand { try { const res = await eval(toEval); console.log(res); + return true; } catch (error) { this.client.log.error(error); + return false; } } }; \ No newline at end of file