Tele QR is a simple telegram bot that allows users to easily generate QR codes for text/links. Using it is as simple as dropping a text message to the bot! The link is also shared below:
https://t.me/teleqrbot
Tele QR currently takes in a text message and generates a .png
QR code for it.
Technologies used by Tele QR are as below:
Python
https://github.com/tjtanjin/tele-qr
The following section will guide you through setting up your own Tele QR (telegram account required).
- First, head over to BotFather and create your own telegram bot with the
/newbot
command. After choosing an appropriate name and telegram handle for your bot, note down the bot token provided to you. - Next,
cd
to the directory of where you wish to store the project and clone this repository. An example is provided below:cd /home/user/exampleuser/projects/ git clone https://github.com/tjtanjin/tele-qr.git
- Once the project has been cloned,
cd
into it and install required dependencies with the following command:python3 -m pip install --no-cache-dir -r requirements.txt
- Following which, create (or copy) a .env file at the root of the project using the provided .env.template. In order to run the bot, the bare minimum that needs to be done is for you to replace the BOT_TOKEN variable within the .env file with the token you received from BotFather.
- You can also feel free to modify the other variables as you deem fit. Clear descriptions for the variables have been included in the .env.template file.
- You will also have to create an empty images folder in the root directory of the project to temporarily store the QR code image to be sent to the user:
mkdir images
- Finally, head to the root of the project and execute the following command to launch your bot:
$ python3 main.py
For deployment, Docker is the preferred approach, especially if you would like to avoid the hassle of manually installing dependencies. If you are unfamiliar with docker, it is recommended you go through a quick tutorial for it first. This section will not dive into the details of docker usage.
- First, if you have not done so, create a .env file from the provided .env.template and update the variables (at the very least, you need to input a valid BOT_TOKEN).
- If you using the project as it is (i.e. no intended code changes), then simply run
./deploy.sh tele-qr
within the scripts folder and your deployment will be automatically done! Otherwise, if you wish to make code changes to the project, please read on. - Once you are done with your code changes, you would have to build your own docker image with the following command (take note to replace the tag
-t
with that of your own):docker build -t tjtanjin/tele-qr .
- Upon obtaining your image, you may then start your container with the following command (remember to replace image name below if you built your own image):
Note: Notice that the .env file we configured in step 1 is being passed via the
docker run -d --name qr --env-file .env tjtanjin/tele-qr:master
--env-file
argument. This is true for the auto deployment in step 2 as well. Hence, ensure that you have setup your configuration properly before passing in the file. - Finally, you may wish to update the deployment script to reference your own image/container if you would like to have an easier deployment workflow.
Alternatively, if you are unfamiliar with docker or would like a more manual approach, you may also follow the guide here to setup the bot 24/7. Note that you would have to go through the steps in the setup section to setup the project manually as well.
If you have code to contribute to the project, open a pull request and describe clearly the changes and what they are intended to do (enhancement, bug fixes etc).
Alternatively, you may contact me via discord or simply raise bugs or suggestions by opening an issue.
For any questions regarding the implementation of the project, you may reach out on discord or drop an email to: cjtanjin@gmail.com.