A Telegram bot to get latest progress on COVID-19
The project is written with on Spring Boot. No Telegram library, framework or whatsoever is used in this project. All the telegram integration is done through direct REST calls.
The @covid19_update_bot bot gets data from covid-19-api created by Muhammad Mustadi. Data is scrapped from John Hopkins University CSSE.
- JDK 11
Follow the steps to get it run in local.
Set Telegram token in application.properties
.
Or alternatively export them as environment variable. For example,
$ export TELEGRAM_TOKEN=[telegram_token]
Run the project in console,
$ ./mvnw spring-boot:run
Download Ngrok from here and run it as follow,
$ ./ngrok http 8080
Update the bot hook using hook-update.sh
.
Before running the script, export the following environment variables,
$ export URL=[ngrok_url]
$ export TOKEN=[bot_token]
And finally run the script,
$ ./hook_update.sh
To mimic the production environment, run the project with the production
profile as follows,
$ ./mvnw spring-boot:run -Pproduction
To deploy the project to production, ensure the following environment variable is exported,
SPRING_PROFILES_ACTIVE = production
The rest of the process is more or less similar to run the project in local.
- In production profile, swagger-ui is disabled.
- Only API calls that come from Telegram servers are accepted, the rest is ignored, see
SecurityConfig.java
.
Check my site @geekyhacker.com
COVID-19-Telegram-bot is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.COVID-19-Telegram-bot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. http://www.gnu.org/licenses/
Author(s):
© 2020 Kasra Madadipouya [email protected]