Tofu
gofretfkintank
HOBBYOP

2 months ago

I'm running a Discord bot on Railway, and right now I'm working on a generic image generation command. However, no matter how many fonts I try, Railway won't load any of them, and when I test the command, everything just shows up as tofu

vs-1.png

Screenshot_20260405_212753_Discord.jpg

43 Replies

gofretfkintank
HOBBYOP

2 months ago


2 months ago

Can you try using Railpack instead of Nixpacks?


2 months ago

I guess Nixpacks isn't including your font in the final build, Railpack may include it but either way Nixpacks is deprecated for awhile already.


gofretfkintank
HOBBYOP

2 months ago

It didnt worked but thx for ur opinion


2 months ago

Oof, are you familiar with a Dockerfile?


gofretfkintank
HOBBYOP

2 months ago

Nah


gofretfkintank
HOBBYOP

2 months ago

I hate it


2 months ago

I saw that you removed the fonts, I know you are installing them via APT but bring the old way back (in a folder inside your application).

I guess your canvas isn't picking them up via APT.


2 months ago

@Gofret if i may, i know its a crude solution but can fix your fonts issue

There is an api called cookie api that can generate images, but it uses google fonts. What you could do it use your code to generate everything except the font, and then send to cookie to generate the remaindfer of the image with the fonts. It is a free api too.


2 months ago

obvs may not be the right solution for you, but wanted to share how i did it


gofretfkintank
HOBBYOP

2 months ago

How long exactly does it take for this cookie API to generate the image? I can probably just get it to add the fonts.


2 months ago

sorry for late reply, The api takes up to about 2 seconds to generate an image.


gofretfkintank
HOBBYOP

2 months ago

I've installed it now and I'm going to try it.


gofretfkintank
HOBBYOP

2 months ago

<:Burnt_toast:1452711118995722487>

image0.jpg

Attachments


2 months ago

have you got the api key from their website?

i did forget to mention, any images generated with cookie get deleted from their file storage after 7 days. If your generating images that are referenced when a command is run, shouldnt be an issue, but if you need those generated images kept, it make be a good idea to build a cf worker that can store them after they are made



2 months ago

that is the site for the api btw


2 months ago

its not very easy to find with searches tbh


2 months ago

youll be looking for the card builder function to generate images

it is all code for the api but a friend of mine made a builder for making the code for the images aswell



gofretfkintank
HOBBYOP

2 months ago

Yes, I got the API from their website, and the image is generated in real-time. The information needed to generate the image is from MongoDB and is updated almost daily.


gofretfkintank
HOBBYOP

2 months ago

The API key is what I got by clicking the "create API" button there, right? They also gave a root key, but I'm not sure about that one. @MrMech


2 months ago

as far as im aware, the api key is the only thing you need, give me a moment


2 months ago

curl -X POST "https://api.cookie-api.com/api/cards/card-builder/build?dev=true" -H "Authorization: YOUR_API_KEY" -H "Content-Type: application/json" -d '{"card":{"width":"700","height":"250","bg":"#6b4eff","bg_type":"color"},"elements":[{"id":"1","type":"discord_profile","user_id":"{DISCORD_USER_ID}","position":{"x":30,"y":45},"size":160},{"id":"2","type":"text","text":"{USERNAME}, welcome to {SERVER_NAME}","text_size":32,"font":"DM Sans","color":"#ffffff","position":{"x":220,"y":105}}]}'

thats an example curl request i was working on before


gofretfkintank
HOBBYOP

2 months ago

Maybe cuz name I just made it up.

Screenshot_20260405_234048_Chrome.jpg

Attachments


2 months ago

oh, you dont have to add a discord bot to use the api


gofretfkintank
HOBBYOP

2 months ago

I think you misunderstood.

image0.jpg

Attachments


2 months ago

this root key is the api key yeah

image.png

Attachments


gofretfkintank
HOBBYOP

2 months ago

Fuh


2 months ago

yep thats it, sorry theyve updated the dashboard since i was last on lol


gofretfkintank
HOBBYOP

2 months ago

Ok i try


gofretfkintank
HOBBYOP

2 months ago

Np


2 months ago

yeah my dashboard has nothing for the production keys part

image.png

Attachments


gofretfkintank
HOBBYOP

2 months ago

Errored again btw


gofretfkintank
HOBBYOP

2 months ago

U want to see logs


2 months ago

sure, i can try to help fix it


2 months ago

what is the request you are doing btw? if it has sensitive info blur it lol


gofretfkintank
HOBBYOP

2 months ago


2 months ago

image.png

Attachments


gofretfkintank
HOBBYOP

2 months ago


gofretfkintank
HOBBYOP

2 months ago

Ye. I saw that


2 months ago

yeah its being removed immediatly, send in dms instead


2 months ago

mine are open


Welcome!

Sign in to your Railway account to join the conversation.

Loading...