I am creating a bot who sends an image when someone joins a discord server.
I am using canvas-constructor.
Canvas.registerFont(
resolve(
join(
__dirname,
“…/…/…/256ccade-fb85-42e6-882f-cd3dd81f765c%2FSheepingCatsStraight-lrlZ.ttf?v=1579512573401”
)
),
“Dark-Font”
);
But it shows error
node:17310) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, lstat ‘/256ccade-fb85-42e6-882f-cd3dd81f765c%2FSheepingCatsStraight-lrlZ.ttf?v=1579512573401’
So now how can i use custom font??
Is the .ttf file already in your project, or are you loading it from a URL? Also, providing the project name could be helpful.
Bro my project is private and i have added .ttf I’m asssets and using that cdn link.
You sure you provided the whole URL including cdn.glitch.com
part? AND ALSO THERE’S NO NEED TO USE __dirname
part.