class TelegramBot::Client

Defined in:

telegram_bot.cr

Constant Summary

Log = TelegramBot::Log.for("client")

Constructors

Instance Method Summary

Constructor Detail

def self.new(token : String, http_client : HTTP::Client = HTTP::Client.new(host: "api.telegram.org", tls: true), random : Random = Random::Secure) #

[View source]

Instance Method Detail

def delete_message(chat_id : Int64 | String, message_id : Int32) #

https://core.telegram.org/bots/api#deletemessage


[View source]
def delete_webhook #

https://core.telegram.org/bots/api#deletewebhook


[View source]
def download_file(file_path : String) #

[View source]
def download_file(file_path : String, &block : HTTP::Client::Response -> Nil) #

[View source]
def edit_message_reply_markup(chat_id : Int64 | String | Nil = nil, message_id : Int32 | Nil = nil, inline_message_id : String | Nil = nil, reply_markup : Models::InlineKeyboardMarkup | Nil = nil) #

https://core.telegram.org/bots/api#editmessagereplymarkup


[View source]
def edit_message_text(text : String, chat_id : Int64 | String | Nil = nil, message_id : Int32 | Nil = nil, inline_message_id : String | Nil = nil, parse_mode : ParseMode | String | Nil = nil, disable_web_page_preview : Bool | Nil = nil, reply_markup : Models::InlineKeyboardMarkup | Nil = nil) #

https://core.telegram.org/bots/api#editmessagetext


[View source]
def finalize #

[View source]
def forward_message(chat_id : Int64 | String, from_chat_id : Int64 | String, message_id : Int32, disable_notification : Bool | Nil = nil) #

https://core.telegram.org/bots/api#forwardmessage


[View source]
def get_chat_members_count(chat_id : Int64 | String) #

[View source]
def get_file(file_id : String) #

[View source]
def get_me #

https://core.telegram.org/bots/api#getme


[View source]
def get_updates(offset : Int32 | Nil = nil, limit : Int32 | Nil = nil, timeout : Int32 | Nil = nil, allowed_updates : Array(String) | Nil = nil) #

https://core.telegram.org/bots/api#getupdates


[View source]
def get_webhook_info #

https://core.telegram.org/bots/api#getwebhookinfo


[View source]
def listen(&) #

NOTE Avoid using this method. Prefer webhooks.


[View source]
def send_chat_action(chat_id : Int64 | String, action : String) #

https://core.telegram.org/bots/api#sendchataction


[View source]
def send_contact(chat_id : Int64 | String, phone_number : String, first_name : String, last_name : String | Nil = nil, vcard : String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : Models::ReplyMarkup | Nil = nil) #

https://core.telegram.org/bots/api#sendcontact


[View source]
def send_location(chat_id : Int64 | String, latitude : Float64, longitude : Float64, live_period : Int32 | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : Models::ReplyMarkup | Nil = nil) #

https://core.telegram.org/bots/api#sendlocation


[View source]
def send_media_group(chat_id : Int64 | String, media : Array(Models::InputMedia), disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, allow_sending_without_reply : Bool | Nil = nil) #

TODO Implement media : Array(String | IO) https://core.telegram.org/bots/api#sendmediagroup


[View source]
def send_message(chat_id : Int64 | String, text : String, parse_mode : ParseMode | String | Nil = nil, disable_web_page_preview : Bool | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : Models::ReplyMarkup | Nil = nil) #

https://core.telegram.org/bots/api#sendmessage


[View source]
def send_photo(chat_id : Int64 | String, photo : String, caption : String | Nil = nil, parse_mode : ParseMode | String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : Models::ReplyMarkup | Nil = nil) #

https://core.telegram.org/bots/api#sendphoto


[View source]
def send_photo(chat_id : Int64 | String, photo : IO, caption : String | Nil = nil, parse_mode : ParseMode | String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : Models::ReplyMarkup | Nil = nil) #

[View source]
def send_video(chat_id : Int64 | String, video : String, duration : Int64 | Nil = nil, width : Int64 | Nil = nil, height : Int64 | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode | String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : Models::ReplyMarkup | Nil = nil) #

https://core.telegram.org/bots/api#sendvideo


[View source]
def send_video(chat_id : Int64 | String, video : IO, duration : Int64 | Nil = nil, width : Int64 | Nil = nil, height : Int64 | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode | String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : Models::ReplyMarkup | Nil = nil) #

https://core.telegram.org/bots/api#sendvideo


[View source]
def set_my_commands(commands : Array(Models::BotCommand)) #

[View source]
def set_webhook(url : String, certificate : IO | Nil = nil, max_connections : Int32 | Nil = nil, allowed_updates : Array(String) | Nil = nil) #

https://core.telegram.org/bots/api#setwebhook


[View source]
def token : String #

[View source]