This commit is contained in:
loicbersier 2019-03-01 19:39:55 +01:00
commit 88da111874

View file

@ -55,7 +55,7 @@ class nolightCommand extends Command {
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
ctx.font = applyText(canvas, text); ctx.font = applyText(canvas, text);
ctx.fillStyle = '#FFFFFF'; ctx.fillStyle = '#FFFFFF';
ctx.fillText(text, canvas.width / 10, canvas.height / 9.8); ctx.fillText(text, canvas.width / 10, canvas.height / 9);
fs.writeFile('./img/frame001.png', canvas.toBuffer(), function (err) { fs.writeFile('./img/frame001.png', canvas.toBuffer(), function (err) {
if (err) { if (err) {
@ -64,13 +64,15 @@ class nolightCommand extends Command {
}); });
async function apng() { async function apng() {
fs.unlink('./img/nolight.png', (err) => {
if (err) throw err;
});
const { stdout, stderr } = await exec('apngasm -o img/nolight.png img/frame00*.png -s') const { stdout, stderr } = await exec('apngasm -o img/nolight.png img/frame00*.png -s')
.then(() => message.channel.send({files: ['./img/nolight.png']})); .then(() => message.channel.send({files: ['./img/nolight.png']}));
console.log(`stdout: ${stdout}`); console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`); console.log(`stderr: ${stderr}`);
} }
apng(); apng();
return;
} }
} }