This Telegram bot collects Quran recitations from users as voice messages or audio files. Each accepted submission is forwarded instantly to one designated Telegram group for admins to review there, without sending direct messages to individual admins.
- Python 3.11 installed locally
- A Telegram bot token from BotFather
- A Telegram group where all recitations will be forwarded
- Permission to add the bot to that group and grant it posting rights
- Open Telegram and search for
@BotFather. - Start a chat with BotFather and send
/newbot. - Follow the prompts to choose a bot name and a unique bot username.
- BotFather will send you an API token.
- Copy that token and use it as the value for
BOT_TOKENin your.envfile or Railway variables.
- Create your Telegram group if you have not already done so.
- Add
@RawDataBotto the group. - Send any new message in the group after adding
@RawDataBot. @RawDataBotwill print the raw update data, including the group ID.- Copy the group ID and use it as
ADMIN_GROUP_ID. It will be a negative number, usually starting with-100.
- Add your bot to the target Telegram group.
- Open the group settings and promote the bot to an admin.
- Grant the bot the permission to post messages in the group.
- Save the group settings.
- Keep the bot in that group so it can forward all user submissions there.
6. Local setup: copy .env.example → .env → fill values → pip install -r requirements.txt → python bot.py
-
Open a terminal in the project folder.
-
Copy
.env.exampleto.env. -
Fill in
BOT_TOKEN,ADMIN_GROUP_ID, and optionallyMAX_SUBMISSIONS. -
Install dependencies:
pip install -r requirements.txt
-
Start the bot:
python bot.py
- Push this code to a GitHub repository.
- Go to railway.app and create a new project.
- Choose New Project and then Deploy from GitHub repo.
- Select the repository that contains this bot.
- Open the Variables tab in Railway.
- Add these variables:
BOT_TOKENADMIN_GROUP_IDMAX_SUBMISSIONS
- Railway will detect the
Procfileand deploy automatically. - After deployment, confirm the worker starts successfully in the Railway logs.
- Important: SQLite is ephemeral on Railway and resets on redeploy or container replacement. For persistent logs, upgrade to Railway's PostgreSQL plugin and adapt
db.pyaccordingly.