Project

telebot

0.02
No commit activity in last 3 years
No release in over 3 years
Ruby client for Telegram bot API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.1
~> 10.0
>= 0

Runtime

 Project Readme

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.