This Telegram bot provides random Hafez poems along with their meanings when prompted with the /fal
command. The bot is built using Python and the python-telegram-bot
library, and it reads the poems from an XLSX file.
hafez_bot/
├── __init__.py
├── hafez_bot.py
├── Faal.xlsx
├── .gitignore
├── LICENSE
├── README.md
└── requirements.txt
- Start the bot with
/start
to get a welcome message. - Use
/fal
to receive a random Hafez poem and its meaning.
- Python 3.7+
- Telegram Bot API token
- An XLSX file containing Hafez poems and their meanings
- Clone the repository:
git clone https://github.com/Mohammadk202/test_bot
cd hafez-poetry-bot
- Install the required packages:
pip install -r requirements.txt
-
Place your
Faal.xlsx
file in the root directory of the project. Ensure the XLSX file has the following columns:- Column A: Poem
- Column B: Meaning
-
Add your Telegram bot token to a .env file:
echo BOT_TOKEN=your_bot_token_here > .env
- Run the bot using the following command:
python hafez_bot.py
- Open your Telegram app and start a chat with your bot. Use the
/start
command to initiate the conversation and then use/fal
to receive a random Hafez poem.
To deploy the bot to a platform like Railway, follow these steps:
- Create a new project on Railway and link it to your GitHub repository.
- Set the environment variable
BOT_TOKEN
with your Telegram Bot API token in the Railway project settings. - Deploy the project, and Railway will automatically build and run the bot.
Feel free to submit issues or pull requests if you have suggestions or improvements.
This project is licensed under the MIT License. See the LICENSE file for details