7 months ago
How can I run it as a background worker instead of a web service?
21 Replies
7 months ago
Railway is a web hosting service, you can host anything you can code (as long as it abides by Railway's TOS and by extension, Telegram's TOS)
7 months ago
If you provide more details as to what you're trying to accomplish, I can point you in the right direction to create a project that fits your requirements.
Thank you! I'm building a Telegram bot using python-telegram-bot and OpenAI. I want to run it as a background worker, not a web service. How can I properly configure Railway to run the bot this way?
Do I need to change anything in the settings or add specific commands?
7 months ago
What is your reasoning for wanting to run it as a background worker? That is not a recommended use case on Railway. If you need it as a background worker I can help you set that up, but if you help me understand your usecase I can suggest better solutions
I'm trying to find a way to connect all of this. but when I tried to connect some of the services, they didn't work because the telegram bot wasn't running in polling mode (without a webhook). it should just handle updates and continue running in the background
7 months ago
Connect all of what? Updates to what? Please provide more details about your tech stack
I'm connecting openAI to a telegram bot, and in theory, everything should work exactly as expected. The bot receives a request from the user and sends it through a python code to the openai server, and vice versa. I need this connection because of the bot's flexible settings through the code.
7 months ago
Okay understood. You have a Telegram bot service that receives requests from the user and forwards it to a separate OpenAI server to process
I'm connecting it through my own code because I haven't found a proper service that allows me to customize the bot and connect it to Telegram.
7 months ago
Those two should ideally be different services that communicate through HTTP or websockets
this is a separate Python code that connects the Telegram bot and the ИИ
7 months ago
Do you have a Github repo you can share?
the main part of the code is located in bot.py
7 months ago
The repo is private, could you please make it public?
I was able to fix all the problems and everything is working smoothly
7 months ago
Glad to hear it!