This project is a Telegram bot that connects people via their DM based on their interests. Built with Ruby and the telegram-bot-ruby library.
The LinkMeUp bot is a mini social networking system built ontop of the Telegram Bot api. It helps people connect with other private users who actively shares their current interests. A user asks the bot to search for another user who shares the similar sets of interests with them and if the bot finds a match, it instantly automatically exchange their chat links/usernames.
- Ruby programming language
- Telegram-Bot-Ruby library
- RSpec
- ActiveRecord Gem
- Sinatra
- PostgreSQL
To set up a local version of this project, a collection of steps have been put together to help guide you from installations to usage. Simply follow the guide below and you'll be up and running in no time.
-
Install git
-
Install the Ruby programming language, if you haven't already.
-
Open Terminal
-
Navigate to the preferred location/folder you want the app on your local machine. Use
cd <file-path>
for this. -
Run
git clone https://github.com/Moreneecoder/link-me-up-bot.git
to download the bot source file. -
Now that you have a local copy of the project, navigate to the root of the project folder from your terminal.
-
Run
bundle install
to install all dependencies in the Gemfile file. -
Run
rake db:create
to create the database. -
Run
rake db:migrate
to migrate/create database tables. -
Alternatively, you can
run rake db:reset
to drop database, recreate the database and then recreate the tables in one command.
You need to have PostgreSQL installed on your machine for your database actions to work. If you don't know how, you can do so here
- One last important detail. To control your bot uniquely, you will need a Telegram Bot Api token from the Botfather
- When you get your api token from Botfather, open the
bot_client.rb
file and replace the value of the token class variable with your new token. The current value of the token variable should beENV['BOT_API_KEY']
. Or alternatively, you could create a.env
file and put the token in there.
-
Rubocop: This is a tool for checking code quality and ensuring they meet the requirements. Don’t worry about this if you’re not a developer. Microverse provides a wonderful setup guide for rubocop here.
-
RSpec: This is a tool for testing the effectiveness of the program's logic at every step. Again, don’t worry about this if you’re not a developer. To set up RSpec:
- run
gem install rspec
in your terminal. This should install rspec globally on your local machine. - run
rspec --version
. This should display your rspec version if successfully installed. - run
rspec
to see passing and failing tests.
- run
At this point, you now have everything you need to properly run the program (source code, ruby, rspec, rubocop, api token). If not, refer back to the setup section of this documentation.
To get the bot running, follow the instructions below:
- run
bin/main.rb
in the terminal. You should make sure your terminal is navigated to the current directory of the program. Now you should see a message that says Bot is running...
- Open your newly created bot in telegram and send /help as shown in the image below.
- You should get a response from the bot with a short list of commands
- Send /connect to the bot to request a new connection based on your interests.
- The bot should now give you a short important note on how to format your interests.
NOTE: The /connect command is what tells the bot you want to enter new interests. You have to enter it anytime you want request a new connection by new interests.
- Now, enter your interests (a maximum of five) and send to the bot.
- If at least a match is found with one of your interests, the bot should send you the telegram chat link of the matched user. It will also send them your chat link. See reference in the image below:
- If a match is not found instantly, the program will store your interests in the database.
- When a new connection request that matches your interest comes along, you will get their chat link and they will get yours.
- That's it! Have fun!
👤 Morenikeji Fuad Bello
- GitHub: @Moreneecoder
- Twitter - @mo_bello19
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
- Micoverse for the rubocop setup link
This project is MIT licensed.