Skip to content

monad/Telegruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegruby

Gem Version

Telegram Bot Api library for Ruby. See https://core.telegram.org/bots/api.

Every method and data structure is supported.

Classes:

Bot: a bot associated with a token. Message: a message structure returned by getUpdates.

Every data type is represented as a OpenStruct object. For example, to create a ReplyKeyboardMarkup object to pass to send_message:

kdb = { 
  :keyboard => [[ "a" ], [ "b" ]],
  :selective => true,
  :one_time_keyboard => true,
}
bot.send_message(chat_id, text, reply_markup: kdb)

Methods:

Mandatory arguments are given in their order; optional arguments are given as `key: value` pairs,
    e.g. send_message(chat_id, "text", reply: msg.message_id) after mandatory arguments.
Note that `reply_to_message` is `reply` for every method.

Bot.new(token): creates a new bot with authentication token.

send_message: sendMessage note: disable_web_page_preview is disable_preview

send_photo: sendPhoto

send_photo_bytestring(chat_id, data, reply:): send binary data as jpg image

send_audio: sendAudio

send_document: sendDocument

send_sticker: sendSticker

send_video: sendVideo

send_voice: sendVoice

send_location: sendLocation

send_action: sendChatAction

get_userphotos: getUserProfilePhotos

get_updates(callback:): getUpdates note: the optional argument callback: is called on http error with the request body as the only argument.

set_webhook: setWebhook

get_file: getFile

answer_inline_query: answerInlineQuery

Examples

See in the examples/ folder for a minimal bot using the API; also see https://github.com/webgiorno/lainbot for a full bot.

About

Telegram bot library in Ruby.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages