- 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
For the first 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
└── 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.
If you have some proposals how to improve this boilerplate feel free to open issues and send pull requests!
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request