Microverse Ruby Capstone Project
- This is Telegram Bot implemented using Ruby And Telegram bot API
- You can search for 'programming_is_fun', which is my Bot name.
- This bot accepts a few commands and return you an article about programming, a saying or joke about programming.
-
Rspec tests are in these files: jokes_spec.rb, sayings_spec.rb, articles_spec.rb and reuse_spec.rb in spec directory.
-
Tests can be found for below mentioned instance methods.
-
'#initialize' for Jokes
-
'#initialize' for Sayings
-
'#initialize' for Articles
-
'#random_joke'
-
'#random_saying'
-
'#random_article'
-
'#rand_string'
- You need to have Rspec Gem installed on your system or If you use use Code editor, you don't need Gem to be included
- Tests can be run using rspec or rspec --format documentation command
- Screenshot of passing spec is attached above
This Bot has five commands
- /start - It gives the information that how to use othe commands to get the desired info.
- /stop - It says "Don't say bye, your name!".
- /article - It gives you a random article related to any topic of programming.
- /joke - It displays a random joke related to programming.
- /saying - It displays a random saying related to programming.
In order to run the Bot, you need to install RUBY in your computer. For windows you can go to Ruby installer and for MAC and LINUX you can go to Ruby official site for intructions on how to intall it.
Step 1
Clone the repo in your local folder where you want to run it
git clone https://github.com/SajjadAhmad14/Telegram-bot.git
.
Step 2
Run bundle install
to install the gems from the Gemfile
.
Step 3
Download the Telegram app, create an account and talk to the Botfather. Follow the instructions and create a bot, you will then receive an API Token that looks like this: 1347431199:AAH4hPt6PDiJB4swk23Lb4oOzwocjKpba0S6
and the link to your bot.
Step 4
Run touch .env
on your terminal to create the .env
file in root of the directory. Then add your token in the required field TELEGRAM_KEY=
inside the file.
Step 5
Run ruby bin/main.rb
to start the bot.
Step 6
Open the link to the bot that you received from the Botfather.
Step 7
You can use the commands defined in the Available commands section defined above.
This Bot is Live Now. You can click Here to Play with Bot
- Ruby
- Telegram API
- Dotenv
- Rubocop
- Rspec
- VsCode
👤 Sajjad Ahmad
- Github: @githubhandle
- Twitter: @twitterhandle
- Linkedin: linkedin
- If you want to contribute or have a feature to add.
- Go to the repo
- Open a pull request
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
- Microverse