Skip to content

Telegram ChatBot that can search on Wikipedia/Google domains or get you 3 random Wikipedia articles, it also sends you random funny Gifs every time you write. Built with Ruby using the TDD technique.

Notifications You must be signed in to change notification settings

cristianCeamatu/microverse-ruby-telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hireable

The Master Seach Telegram Bot

In this project, I built a Telegram Bot that can search on Wikipedia/Google domains or get you 3 random Wikipedia articles. It also sends you random funny Gifs every time you write something else in the chat or you use the /start and /stop commands. The main goal is to make a massive use of external API`s by putting into practice the main concepts of Object Oriented Programming, classes, modules, objects and accessing their attributes.
The project is built using the TDD technique.

The Bot is live on Heroku, you can check him here: Master Search Bot

You can see a short demo of the Bot /start command in the screenshot below.

image

The files structure of the project

screenshot

Live version of the code: REPL.it

Available commands for the master-search-bot

  1. /start receive a greetings message, all available commands and a funny random Gif
  2. /stop receive a farewell message, a nice joke and a funny random Gif
  3. search wiki <your query> receive a loading message and maximum 3 Wikipedia articles related to your search query
  4. search wiki random receive 3 random Wikipedia articles
  5. search google <your query> receive a loading message and maximum 3 articles from the Google Domain Websites (not a regular google search)
  6. Writed anything else in the chat and you will be informed about the available commands and receive a random funny Gif

Video Explanation

Here is the video explanation of this project.

Built With

Ruby gems dependencies

  • colorize
  • dotenv
  • httparty
  • telegram-bot-ruby

Prerequisities

To get this project up and running locally, you must have ruby installed on your computer.

Getting Started

To get this project set up on your local machine, follow these simple steps:

Step 1
Navigate through the local folder where you want to clone the repository and run
git clone [email protected]:cristianCeamatu/microverse-ruby-telegram-bot.git. It will clone the repo to your local folder.
or with https
git clone https://github.com/cristianCeamatu/microverse-ruby-telegram-bot.git.
Step 2
Run cd microverse-ruby-telegram-bot
Step 3
Run bundle install to install the gems from the Gemfile.
Step 4
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:AAH4hPt6PDiJB4swk23Lb4oOzwocjKpba0S4 and the link to your bot.
Step 5
Visit Tenor API page and follow the quickstart steps to get a Tenor API Key.
Step 6
Visit Google API page and follow the quickstart steps to get the API token.
Step 7
Run touch .env on your terminal to create the .env file. Then add your tokens in the required fields TELEGRAM_BOT_TOKEN= and TENOR_API_TOKEN= inside the file.
Step 8
Run ruby bin/bot.rb to start the bot.
Step 9
Open the link to the bot that you received from the Botfather.
Step 10
You can use the commands defined in the Available commands section defined above.

Repository Contents

The code for the project is divided into the following directories: ./bin, ./lib, and ./spec.

The ./bin folder contains the executable bot.rb file.

The ./lib folder contains subsidiary files that set up all of the classes and methods used in bin/main.rb

  • search.rb, where the Search class is defined.
  • utils.rb, where the Utils module is defined.
  • responder.rb, the Responder class that takes the messages and delegates responses.
  • bot_replies.rb, where the BotReplies module includes together all the other reply modules.
  • bot_command_replies.rb, where the BotCommandReplies module is defined.
  • bot_search_replies.rb, where the BotSearchReplies module is defined.

The ./spec folder contains all the relative spec tests

  • search_spec.rb, where the tests for the Search class are defined.
  • utils_spec.rb, where the tests for the Utils methods are defined.
  • spec_helper.rb, initial file generated by the RSpec.

In addition to the above, the repo also contains .rubocop.yml for linting.

Tests

  1. Open Terminal

  2. Install RSpec on your system by running:

    gem install rspec

  3. Run the tests with the command:

    rspec

Authors

👤 Cristian Viorel Ceamatu

🤝 Contributing

Our favourite contributions are those that help us improve the project, whether with a contribution, an issue, or a feature request!

Feel free to check the issues page to either create an issue or help us out by fixing an existing one.

Show your support

If you've read this far....give us a ⭐️!

📝 License

This project is licensed by Microverse and the Odin Project

About

Telegram ChatBot that can search on Wikipedia/Google domains or get you 3 random Wikipedia articles, it also sends you random funny Gifs every time you write. Built with Ruby using the TDD technique.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages