In this project, I built a telegram bot that tells you the COVID-19 statistics, today's word of brevity, and today's quote.
telegram-bot
is a chatbot built on top of Telegram messenger, this means you access it via Telegram messenger. It is able to help you with the following:
The following screenshots, show you the command and it's response (Command : header, response:screenshot)
/start |
/help |
quote |
---|---|---|
word |
covid/usa |
date |
---|---|---|
@neza_connect_bot
and hit START
button or simply access it via this link nezaBot
To be able to use this bot follow the following steps
To be able to setup and run this project locally, you should have the following
terminal
, or bash
Run this command git clone https://github.com/descholar-ceo/telegram-bot.git && cd telegram-bot
to clone and go in this repo
Create a file and name it .env
in root directory of this project
Copy all of the fields which are in .env.example
file from the root directory => in next steps I will show you how you are going to get the values of those fields
Click here or go to your telegram and search for @BotFather
and send him this message: /newbot
and follow instruction untill you get your bot api token which appears to look like this: 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
Copy it and paste it on the first field in your .env
file, (that field is TELEGRAM_BOT_API_TOKEN=
)
Go to RapidApi, Signup or signin, and get your COVID_API_HOST, COVID_API_KEY
and COVID_API_URL
from there. When you see the window which looks like the following on the screenshot, scroll down on the rightmost window, and copy the values of request["x-rapidapi-host"]
: paste this value on COVID_API_HOST
in your .env
file, and copy the value of request["x-rapidapi-key"]
and paste it on COVID_API_KEY
in your .env
file, lastly for the COVID_API_URL
use https://covid-193.p.rapidapi.com/statistics
.
For the remaining fields use the following values:
i. WORD_OF_DAY_API=https://type.fit/api/quotes
ii. PROGRAMMING_QUOTE_API=https://programming-quotes-api.herokuapp.com/quotes/lang/en
bundle install
=> To install all gemsbin/main.rb
=> To start your telegram-bot
. At this point you should see in your terminal a window which looks like the following on the screenshot:START
button, and start chatting with it, in last step, I will show you the list of commands the bot can understand so far 1. message : /start => response : Greeting and introduction
2. message : /help => response : List of all available messages (commands)
3. message : word => response : Word of bravity of the day
4. message : quote => response : Today programming quote
5. message : time => response : To get current time
6. message : date => response : To get current date
7. message : covid/<name_of_country => response : To read covid-19 statistics of any country
===>remember to replace <name_of_country> with the country name you want to read its statistics,
example: covid/usa
If all of the installations went well in the previous step, then you will be able to run tests
rspec --init
rspec
=> If you get some failures under LookUp #read
, make sure that you have a stable internet connectivity
1. dotenv
2. json
3. net-http-persistent
4. rspec
5. rubocop
6. telegram-bot-ruby
There are two ways of contributing to this project:
If you see something wrong or not working, please check the issue tracker section, if that problem you met is not in already opened issues then open the issue by clicking on new issue
button.
If you have a solution to that, and you are willing to work on it, follow the below steps to contribute:
git clone https://github.com/your-username/telegram-bot.git
Replace your username with the username you use on github
Give a ⭐️ if you like this project!