Can I connect a Telegram bot with AI via railway?
githiber-mine
FREEOP

7 months ago

How can I run it as a background worker instead of a web service?

$5 Bounty

21 Replies

githiber-mine
FREEOP

7 months ago

d7d4729c-345c-4709-b3e8-233c4d7d3297


adam
MODERATOR

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)


adam
MODERATOR

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.


githiber-mine
FREEOP

7 months ago

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?


adam
MODERATOR

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


githiber-mine
FREEOP

7 months ago

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


adam
MODERATOR

7 months ago

Connect all of what? Updates to what? Please provide more details about your tech stack


githiber-mine
FREEOP

7 months ago

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.


adam
MODERATOR

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


githiber-mine
FREEOP

7 months ago

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.


adam
MODERATOR

7 months ago

Those two should ideally be different services that communicate through HTTP or websockets


githiber-mine
FREEOP

7 months ago

this is a separate Python code that connects the Telegram bot and the ИИ


adam
MODERATOR

7 months ago

Do you have a Github repo you can share?


githiber-mine
FREEOP

7 months ago

Yes, just a second



githiber-mine
FREEOP

7 months ago

The code there can be confusing


githiber-mine
FREEOP

7 months ago

the main part of the code is located in bot.py


adam
MODERATOR

7 months ago

The repo is private, could you please make it public?


githiber-mine
FREEOP

7 months ago

sorry i made it public


githiber-mine
FREEOP

7 months ago

I was able to fix all the problems and everything is working smoothly


adam
MODERATOR

7 months ago

Glad to hear it!


Loading...