mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 09:23:07 +02:00
Add application commands publishing
This commit is contained in:
parent
aa51cd0554
commit
327573a38a
15
src/listeners/stdin/unknown.js
Normal file
15
src/listeners/stdin/unknown.js
Normal file
@ -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);
|
||||
}
|
||||
};
|
24
src/stdin/commands.js
Normal file
24
src/stdin/commands.js
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user