Reputation: 41
Here is my code:
if(data.queryresult.pods[0]){
ctx.fillText(data.queryresult.pods[0].title)
var img = await loadImage(data.queryresult.pods[0].subpods[0].img.src)
ctx.drawImage(img, 0, 0)
let file = new MessageAttachment(canvas.toBuffer(), 'output.png')
message.channel.send({
files: [file]
})
}
My problem is that ctx.fillText(data.queryresult.pods[0].title)
does not write anything. How can I fix this?
Link to npm package: https://www.npmjs.com/package/canvas
Upvotes: 0
Views: 221
Reputation: 50
As far as I understand, in the function ctx.fillText()
you are supposed to pass three arguments (example from the page you attached):
ctx.fillText('Hello World', 50, 80)
Just like in ctx.drawImage()
Try adding those two arguments, it should start working.
Upvotes: 1