All Projects → MaximAbramchuck → Ruby Telegram Bot Starter Kit

MaximAbramchuck / Ruby Telegram Bot Starter Kit

✈️ Ruby Telegram boilerplate for creating awesome bots. Check out best tools from the world of bots - https://github.com/BotCube/awesome-bots

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Ruby Telegram Bot Starter Kit

Media Search Bot
Inline bot for channels and groups
Stars: ✭ 150 (-23.86%)
Mutual labels:  bot, telegram
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+1022.84%)
Mutual labels:  bot, telegram
Telegram Kraken Bot
Python bot to trade on Kraken via Telegram
Stars: ✭ 156 (-20.81%)
Mutual labels:  bot, telegram
Vk To Telegram Transfer Bot
Бот, пересылающий сообщения из чатов ВК в Telegram и обратно
Stars: ✭ 143 (-27.41%)
Mutual labels:  bot, telegram
Flottbot
A chatbot framework written in Go. All configurations are made in YAML files, or inside scripts written in your favorite language.
Stars: ✭ 175 (-11.17%)
Mutual labels:  bot, telegram
Bdreborn
An administration bot based on ➣ https://valtman.name/telegram-cli :)
Stars: ✭ 144 (-26.9%)
Mutual labels:  bot, telegram
Icopy
fclone telegram interface.Send commands to Telegram BOT for get a convience way to control fclone resources copy missions.
Stars: ✭ 188 (-4.57%)
Mutual labels:  bot, telegram
Telegram Instapy Scheduling
A Telegram bot for scheduling InstaPy
Stars: ✭ 136 (-30.96%)
Mutual labels:  bot, telegram
Micro Bot
🤖 Zero-configuration Telegram bot runner
Stars: ✭ 173 (-12.18%)
Mutual labels:  bot, telegram
Java Telegram Bot Tutorial
Java Telegram Bot Tutorial. Feel free to submit issue if you found a mistake.
Stars: ✭ 165 (-16.24%)
Mutual labels:  bot, telegram
Expressbot
一个可以帮你订阅、查询快递物流、跟你闲聊Telegram机器人
Stars: ✭ 137 (-30.46%)
Mutual labels:  bot, telegram
Heroku Telegram Bot
Starter pack to host your Python Telegram Bot on Heroku for free.
Stars: ✭ 183 (-7.11%)
Mutual labels:  bot, telegram
Canoe
Functional Telegram Bot API for Scala
Stars: ✭ 137 (-30.46%)
Mutual labels:  bot, telegram
Magento Chatbot
Magento Chatbot Integration with Telegram, Messenger, Whatsapp, WeChat, Skype and wit.ai.
Stars: ✭ 149 (-24.37%)
Mutual labels:  bot, telegram
Tradingview Webhook Bot
⚙️ Send TradingView alerts to Telegram, Discord, Slack, Twitter and/or Email.
Stars: ✭ 135 (-31.47%)
Mutual labels:  bot, telegram
Telegram link line
用Telegram來收發Line的訊息,use telegram to Send and receive messages(from Line)。 或者把它當作Line的訊息備份也是可啦 😛
Stars: ✭ 164 (-16.75%)
Mutual labels:  bot, telegram
Messaging Apis
Messaging APIs for multi-platform
Stars: ✭ 1,754 (+790.36%)
Mutual labels:  bot, telegram
Telegram.bot
.NET Client for Telegram Bot API
Stars: ✭ 1,964 (+896.95%)
Mutual labels:  bot, telegram
Bitprophet
Node crypto trading platform for Binance exchange.
Stars: ✭ 166 (-15.74%)
Mutual labels:  bot, telegram
Telebot
Write Telegram bots in Rust with Tokio and Futures
Stars: ✭ 179 (-9.14%)
Mutual labels:  bot, telegram

Ruby Telegram Bot boilerplate

Ruby and Telegram

UPD (20.06.2016)

I've created an awesome list of resources related to bots (from tutorials and SDKs to the events and people). Be sure to check it out!

Awesome bots list

If you want to use Webhooks API instead of long-polling, be able to save state and create more scalable and powerful bot read the article below.

Full guide on creating statefull Telegram bot

Features

  • Ability to save some data to a local database (Postgres by default)
  • Automatic logging of received and sent message
  • Easy internationalization using i18n gem
  • Already created class for creating custom keyboards
  • Database logging
  • Separate classes for all the functional, so it's very easy to customize something

Usage

Defining responses

Use the on method in message_responder.rb like in the example below:

def respond
  on /^\/start/ do
    answer_with_greeting_message
  end

  on /^\/command (.+)/ do |arg| #supports up to two arguments but it is easily extendable
    # do your stuff
  end
end

Running the bot

For the first you need to install gems required to start a bot:

bundle install

Then you need to create secrets.yml where your bot unique token will be stored and database.yml where database credentials will be stored. I've already created samples for you, so you can easily do:

cp config/database.yml.sample config/database.yml
cp config/secrets.yml.sample config/secrets.yml

Then you need to fill your Telegram bot unique token to the secrets.yml file and your database credentials to database.yml.

After this you need to create and migrate your database:

rake db:create db:migrate

Great! Now you can easily start your bot just by running this command:

bin/bot

Directory layout

Source

└── ruby-telegram-bot-boilerplate
    ├── bin                              # executables folder
    │   └── bot                          # main executable file
    ├── config                           # folder with configs
    │   ├── database.yml.sample          # sample database configuration
    │   ├── secrets.yml.sample           # sample credentials file
    │   └── locales.yml                  # file with i18n locales
    ├── db                               # database related stuff
    │   └── migrate                      # migrations
    │       └── 001_create_users.rb      # migration for creating table 'users'
    ├── lib                              # helper libs folder
    │   ├── app_configurator.rb          # class for application configuration
    │   ├── database_connector.rb        # class for connecting to database
    │   ├── message_responder.rb         # main class for responding to message
    │   ├── message_sender.rb            # simple class just for message sending
    │   └── reply_markup_formatter.rb    # class for creating custom keyboards
    ├── models                           # database models folder
    │   └── user.rb                      # active record User model
    ├── Gemfile                          # Gemfile
    ├── Gemfile.lock                     # Gemfile.lock
    ├── README.md                        # Readme file
    └── Rakefile                         # Rakefile with tasks for database management

Some more specific info you can also find here.

Contributing

If you have some proposals how to improve this boilerplate feel free to open issues and send pull requests!

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].