print shit to my printer

This commit is contained in:
loicbersier 2018-11-21 01:33:53 +01:00
parent d2ce8049de
commit 195a26699a

30
commands/owner/print.js Normal file
View file

@ -0,0 +1,30 @@
const { Command } = require('discord.js-commando');
const printer = require('printer');
module.exports = class printCommand extends Command {
constructor(client) {
super(client, {
name: 'print',
group: 'owner',
memberName: 'print',
description: 'print what you write',
ownerOnly: true,
args: [
{
key: 'text',
prompt: 'What do you want to print',
type: 'string',
}
]
});
}
async run(message, { text }) {
printer.printDirect({data:text, printer:'HP-Color-LaserJet-CM1312-MFP'
, type: 'TEXT' // type: RAW, TEXT, PDF, JPEG, .. depends on platform
, success:function(jobID){
console.log("sent to printer with ID: "+jobID);
}
, error:function(err){console.log(err);}
});
}
};