Any way to run code once on deploy?

I'm currently developing a discord bot that, due to only needing to handle slash commands, will run on a cloudflare worker. Is there a way to run a part of the worker only once right after deployment? I need that to update the commands on discords end. I can do it in the github deployment, but since I can't get node to allow directory imports and imports without ".js"at the end (using typescript), I would prefer a cloudflare-native approach
2 Replies
Hello, I’m Allie!
Not at the moment. You could have a route that is nigh-unguessable, then deploy the commands after hitting that URL?
mandar1jn
mandar1jnOP9mo ago
okay. Thank you very much. okay. Found an alternative solution: use bun! It does support directory imports and stuff. It also removed the need to use tsc first!
Want results from more Discord servers?
Add your server