Skip to content

Apmyp/telebot

 
 

Repository files navigation

Telebot

Build Status

Ruby client for Telegram's Bot API.

Demo bot that demonstrates API calls: http://telegram.me/demoTelebot

Installation

Add this line to your application's Gemfile:

gem 'telebot'

Run

$ gem install telebot

Usage

Minimal example, that repeats a message, would look like this:

bot = Telebot::Bot.new(TOKEN)

bot.run do |client, message|
  reply = "You've said: #{message.text}"
  client.send_message(chat_id: message.chat.id, text: reply)
end

Please check out full featured example as well: demo.rb.

Using pure client

client = Telebot::Client.new(TOKEN)

# Perform getMe call
client.get_me
# =>
# #<Telebot::User:0x0000000111f688
#  @first_name="Telebot Demo",
#  @id=97445105,
#  @last_name=nil,
#  @username="demoTelebot">

# Send message to chat with id=12345
client.send_message(chat_id: 12345, text: "Hello there!")

The client supports all Telegram's Bot API methods.

For more information check the documentation for Telebot::Client and demo.rb.

Running demo

Clone the repo and run demo example to see how you can use Telegram's Bot API.

git clone /github.com/greyblake/telebot
cd telebot
bundle install

TOKEN=<YOUR_TOKEN> ruby ./examples/demo.rb

License

The gem is available as open source under the terms of the MIT License.

About

Ruby client for Telegram bot API

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 99.7%
  • Shell 0.3%