Note: The
dev
branch is the most up-to date version of this repository and where major features are currently being worked on
We welcome contributions to Amibot-tg from the community. If you would like to contribute, please follow these steps:
- Fork this repository
- Create a new branch (
git checkout -b dev/my-feature
) - Make your changes and commit them (
git commit -am 'Add my feature'
) - Push to the branch (
git push origin dev/my-feature
) - Open a pull request
Please make sure your code follows the PEP 8 style guide and includes any necessary documentation or tests.
To use Amibot-tg, you'll need:
- Python 3.11 or higher
- The following Python packages:
- pymongo
- grpcio
- protobuf
- google-api-python-client
- grpc-gateway-protoc-gen-openapiv2
- python-telegram-bot
- python-dotenv
- A token generated by the Telegram BotFather
- Miscellaneos:
Clone the repository:
git clone https://github.com/achintya-7/Amibot-tg.git
cd Amibot-tg
-
Install Python dependencies, pre-commit hooks and setup the virtual environment:
make install
-
Install Nodemon
npm install -g nodemon
-
Install docker. While knowing docker isn't a prerequisite, you have to install and run docker in the background in order to use MongoDB.
Before running the bot, you'll need to update the token in the env.py
file with the token generated by the Telegram BotFather. To generate a token:
-
Open Telegram and search for the BotFather.
-
Send the BotFather the
/newbot
command. -
Follow the prompts to name and create your bot.
-
The BotFather will provide you with a token for your bot. Copy this token and replace the 'token' keyword with it.
TOKEN = os.environ.get("TOKEN", "token")
To something like this!
TOKEN = os.environ.get("TOKEN", "5123422892:ABEyasfEXf...")
If you make any changes to the amizone.proto
file, you'll need to regenerate the corresponding Python code. You can do this by running the following command:
make gen
To run the bot, you'll need to set up a MongoDB instance. You can use Docker to create a local instance by running the following command:
make mongo
If you want to automatically restart the bot whenever you make changes to the code, you can use Nodemon. Run the following command instead of poetry run python main.py
:
make dev
Always make sure to check the quality of code before committing/pushing i.e making sure that the codebase is properly formatted and linted.
Use the following command to Lint and format.
make check
This project uses go-amizone via gRPC to get its data. While knowledge of gRPC isn't a requirement, you can test how we get data through this Postman collection
Once the bot is up and running, you can use the following commands to interact with it:
/start
: Start the bot and display the available commands./login "amzione_id" "amizone_password"
: Logs you in Amizone./attendance
: Get your attendance information./schedule
: Get your class schedule./about
: Get details about our project.
For testing CI/CD, we use act. Act is a tool that allows you to run GitHub Actions locally. It spins up a Docker container that emulates the GitHub Actions environment, allowing you to test your workflows locally. To install act, run the following command:
brew install act
Further, you can run the following command to test the CI/CD pipeline:
act -W .github/workflows/workflow-file-name.yml