class Tourmaline::Client
- Tourmaline::Client
- Reference
- Object
Overview
The Client
class is the base class for all Tourmaline based bots.
Extend this class to create your own bots, or create an
instance of Client
and add event handlers to it.
Included Modules
- Tourmaline::Client::Api
- Tourmaline::Logger
Defined in:
tourmaline/client.crtourmaline/client/api.cr
tourmaline/client/inline_keyboard_markup_builder.cr
tourmaline/client/inline_query_result_builder.cr
tourmaline/client/reply_keyboard_markup_builder.cr
Constant Summary
-
DEFAULT_API_URL =
"https://api.telegram.org/"
Constructors
-
.new(bot_token : String, endpoint : String = DEFAULT_API_URL, default_parse_mode : ParseMode = ParseMode::Markdown, pool_capacity = 200, initial_pool_size = 20, pool_timeout = 0.1, proxy = nil, proxy_uri = nil, proxy_host = nil, proxy_port = nil, proxy_user = nil, proxy_pass = nil)
Create a new instance of
Tourmaline::Client
.
Class Method Summary
- .build_inline_keyboard_markup(*args, columns = nil, **options, &block : InlineKeyboardMarkupBuilder -> )
- .build_inline_query_result(&block : InlineQueryResultBuilder -> )
- .build_reply_keyboard_markup(*args, columns = nil, **options, &block : ReplyKeyboardMarkupBuilder -> )
Instance Method Summary
-
#bot : User
Gets the name of the Client at the time the Client was started.
-
#bot? : User | Nil
Gets the name of the Client at the time the Client was started.
- #bot_token : String
- #build_inline_keyboard_markup(*args, columns = nil, **options, &block : InlineKeyboardMarkupBuilder -> )
- #build_inline_query_result(&block : InlineQueryResultBuilder -> )
- #build_reply_keyboard_markup(*args, columns = nil, **options, &block : ReplyKeyboardMarkupBuilder -> )
- #default_parse_mode : ParseMode
- #default_parse_mode=(default_parse_mode : ParseMode)
- #dispatcher
- #on(action : UpdateAction, &block : Context -> )
- #on(*actions : Symbol | UpdateAction, &block : Context -> )
- #poll
- #register(*handlers : EventHandler)
-
#request(type : U.class, method, params = {} of String => String) forall U
Sends a request to the Telegram Client API.
-
#request_raw(method : String, params = {} of String => String)
Sends a request to the Telegram Client API.
- #serve(path = "/", host = "127.0.0.1", port = 8081, ssl_certificate_path = nil, ssl_key_path = nil, no_middleware_check = false)
- #use(middleware : Middleware)
Instance methods inherited from module Tourmaline::Client::Api
add_sticker_to_set(user_id : Int32 | Int64, name : String, sticker : Tourmaline::InputSticker)
add_sticker_to_set,
answer_callback_query(callback_query_id : String, text : String | Nil = nil, show_alert : Bool | Nil = nil, url : String | Nil = nil, cache_time : Int32 | Int64 | Nil = nil)
answer_callback_query,
answer_inline_query(inline_query_id : String, results : Array(Tourmaline::InlineQueryResult), cache_time : Int32 | Int64 | Nil = nil, is_personal : Bool | Nil = nil, next_offset : String | Nil = nil, button : Tourmaline::InlineQueryResultsButton | Nil = nil)
answer_inline_query,
answer_pre_checkout_query(pre_checkout_query_id : String, ok : Bool, error_message : String | Nil = nil)
answer_pre_checkout_query,
answer_shipping_query(shipping_query_id : String, ok : Bool, shipping_options : Array(Tourmaline::ShippingOption) | Nil = nil, error_message : String | Nil = nil)
answer_shipping_query,
answer_web_app_query(web_app_query_id : String, result : Tourmaline::InlineQueryResult)
answer_web_app_query,
approve_chat_join_request(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64)
approve_chat_join_request,
ban_chat_member(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64, until_date : Int32 | Int64 | Nil = nil, revoke_messages : Bool | Nil = nil)
ban_chat_member,
ban_chat_sender_chat(chat_id : Int32 | Int64 | String, sender_chat_id : Int32 | Int64)
ban_chat_sender_chat,
close
close,
close_forum_topic(chat_id : Int32 | Int64 | String, message_thread_id : Int32 | Int64)
close_forum_topic,
close_general_forum_topic(chat_id : Int32 | Int64 | String)
close_general_forum_topic,
copy_message(chat_id : Int32 | Int64 | String, from_chat_id : Int32 | Int64 | String, message_id : Int32 | Int64, message_thread_id : Int32 | Int64 | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
copy_message,
copy_messages(chat_id : Int32 | Int64 | String, from_chat_id : Int32 | Int64 | String, message_ids : Array(Int32 | Int64), message_thread_id : Int32 | Int64 | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, remove_caption : Bool | Nil = nil)
copy_messages,
create_chat_invite_link(chat_id : Int32 | Int64 | String, name : String | Nil = nil, expire_date : Int32 | Int64 | Nil = nil, member_limit : Int32 | Int64 | Nil = nil, creates_join_request : Bool | Nil = nil)
create_chat_invite_link,
create_forum_topic(chat_id : Int32 | Int64 | String, name : String, icon_color : Int32 | Int64 | Nil = nil, icon_custom_emoji_id : String | Nil = nil)
create_forum_topic,
create_invoice_link(title : String, description : String, payload : String, provider_token : String, currency : String, prices : Array(Tourmaline::LabeledPrice), max_tip_amount : Int32 | Int64 | Nil = nil, suggested_tip_amounts : Array(Int32 | Int64) | Nil = nil, provider_data : String | Nil = nil, photo_url : String | Nil = nil, photo_size : Int32 | Int64 | Nil = nil, photo_width : Int32 | Int64 | Nil = nil, photo_height : Int32 | Int64 | Nil = nil, need_name : Bool | Nil = nil, need_phone_number : Bool | Nil = nil, need_email : Bool | Nil = nil, need_shipping_address : Bool | Nil = nil, send_phone_number_to_provider : Bool | Nil = nil, send_email_to_provider : Bool | Nil = nil, is_flexible : Bool | Nil = nil)
create_invoice_link,
create_new_sticker_set(user_id : Int32 | Int64, name : String, title : String, stickers : Array(Tourmaline::InputSticker), sticker_format : String, sticker_type : String | Nil = nil, needs_repainting : Bool | Nil = nil)
create_new_sticker_set,
decline_chat_join_request(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64)
decline_chat_join_request,
delete_chat_photo(chat_id : Int32 | Int64 | String)
delete_chat_photo,
delete_chat_sticker_set(chat_id : Int32 | Int64 | String)
delete_chat_sticker_set,
delete_forum_topic(chat_id : Int32 | Int64 | String, message_thread_id : Int32 | Int64)
delete_forum_topic,
delete_message(chat_id : Int32 | Int64 | String, message_id : Int32 | Int64)
delete_message,
delete_messages(chat_id : Int32 | Int64 | String, message_ids : Array(Int32 | Int64))
delete_messages,
delete_my_commands(scope : Tourmaline::BotCommandScope | Nil = nil, language_code : String | Nil = nil)
delete_my_commands,
delete_sticker_from_set(sticker : String)
delete_sticker_from_set,
delete_sticker_set(name : String)
delete_sticker_set,
delete_webhook(drop_pending_updates : Bool | Nil = nil)
delete_webhook,
edit_chat_invite_link(chat_id : Int32 | Int64 | String, invite_link : String, name : String | Nil = nil, expire_date : Int32 | Int64 | Nil = nil, member_limit : Int32 | Int64 | Nil = nil, creates_join_request : Bool | Nil = nil)
edit_chat_invite_link,
edit_forum_topic(chat_id : Int32 | Int64 | String, message_thread_id : Int32 | Int64, name : String | Nil = nil, icon_custom_emoji_id : String | Nil = nil)
edit_forum_topic,
edit_general_forum_topic(chat_id : Int32 | Int64 | String, name : String)
edit_general_forum_topic,
edit_message_caption(chat_id : Int32 | Int64 | String | Nil = nil, message_id : Int32 | Int64 | Nil = nil, inline_message_id : String | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
edit_message_caption,
edit_message_live_location(latitude : Float64, longitude : Float64, chat_id : Int32 | Int64 | String | Nil = nil, message_id : Int32 | Int64 | Nil = nil, inline_message_id : String | Nil = nil, horizontal_accuracy : Float64 | Nil = nil, heading : Int32 | Int64 | Nil = nil, proximity_alert_radius : Int32 | Int64 | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
edit_message_live_location,
edit_message_media(media : Tourmaline::InputMedia, chat_id : Int32 | Int64 | String | Nil = nil, message_id : Int32 | Int64 | Nil = nil, inline_message_id : String | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
edit_message_media,
edit_message_reply_markup(chat_id : Int32 | Int64 | String | Nil = nil, message_id : Int32 | Int64 | Nil = nil, inline_message_id : String | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
edit_message_reply_markup,
edit_message_text(text : String, chat_id : Int32 | Int64 | String | Nil = nil, message_id : Int32 | Int64 | Nil = nil, inline_message_id : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, entities : Array(Tourmaline::MessageEntity) | Nil = nil, link_preview_options : Tourmaline::LinkPreviewOptions | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
edit_message_text,
export_chat_invite_link(chat_id : Int32 | Int64 | String)
export_chat_invite_link,
forward_message(chat_id : Int32 | Int64 | String, from_chat_id : Int32 | Int64 | String, message_id : Int32 | Int64, message_thread_id : Int32 | Int64 | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil)
forward_message,
forward_messages(chat_id : Int32 | Int64 | String, from_chat_id : Int32 | Int64 | String, message_ids : Array(Int32 | Int64), message_thread_id : Int32 | Int64 | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil)
forward_messages,
get_chat(chat_id : Int32 | Int64 | String)
get_chat,
get_chat_administrators(chat_id : Int32 | Int64 | String)
get_chat_administrators,
get_chat_member(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64)
get_chat_member,
get_chat_member_count(chat_id : Int32 | Int64 | String)
get_chat_member_count,
get_chat_menu_button(chat_id : Int32 | Int64 | Nil = nil)
get_chat_menu_button,
get_custom_emoji_stickers(custom_emoji_ids : Array(String))
get_custom_emoji_stickers,
get_file(file_id : String)
get_file,
get_forum_topic_icon_stickers
get_forum_topic_icon_stickers,
get_game_high_scores(user_id : Int32 | Int64, chat_id : Int32 | Int64 | Nil = nil, message_id : Int32 | Int64 | Nil = nil, inline_message_id : String | Nil = nil)
get_game_high_scores,
get_me
get_me,
get_my_commands(scope : Tourmaline::BotCommandScope | Nil = nil, language_code : String | Nil = nil)
get_my_commands,
get_my_default_administrator_rights(for_channels : Bool | Nil = nil)
get_my_default_administrator_rights,
get_my_description(language_code : String | Nil = nil)
get_my_description,
get_my_name(language_code : String | Nil = nil)
get_my_name,
get_my_short_description(language_code : String | Nil = nil)
get_my_short_description,
get_sticker_set(name : String)
get_sticker_set,
get_updates(offset : Int32 | Int64 | Nil = nil, limit : Int32 | Int64 | Nil = nil, timeout : Int32 | Int64 | Nil = nil, allowed_updates : Array(String) | Nil = nil)
get_updates,
get_user_chat_boosts(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64)
get_user_chat_boosts,
get_user_profile_photos(user_id : Int32 | Int64, offset : Int32 | Int64 | Nil = nil, limit : Int32 | Int64 | Nil = nil)
get_user_profile_photos,
get_webhook_info
get_webhook_info,
hide_general_forum_topic(chat_id : Int32 | Int64 | String)
hide_general_forum_topic,
leave_chat(chat_id : Int32 | Int64 | String)
leave_chat,
log_out
log_out,
pin_chat_message(chat_id : Int32 | Int64 | String, message_id : Int32 | Int64, disable_notification : Bool | Nil = nil)
pin_chat_message,
promote_chat_member(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64, is_anonymous : Bool | Nil = nil, can_manage_chat : Bool | Nil = nil, can_delete_messages : Bool | Nil = nil, can_manage_video_chats : Bool | Nil = nil, can_restrict_members : Bool | Nil = nil, can_promote_members : Bool | Nil = nil, can_change_info : Bool | Nil = nil, can_invite_users : Bool | Nil = nil, can_post_messages : Bool | Nil = nil, can_edit_messages : Bool | Nil = nil, can_pin_messages : Bool | Nil = nil, can_post_stories : Bool | Nil = nil, can_edit_stories : Bool | Nil = nil, can_delete_stories : Bool | Nil = nil, can_manage_topics : Bool | Nil = nil)
promote_chat_member,
reopen_forum_topic(chat_id : Int32 | Int64 | String, message_thread_id : Int32 | Int64)
reopen_forum_topic,
reopen_general_forum_topic(chat_id : Int32 | Int64 | String)
reopen_general_forum_topic,
restrict_chat_member(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64, permissions : Tourmaline::ChatPermissions, use_independent_chat_permissions : Bool | Nil = nil, until_date : Int32 | Int64 | Nil = nil)
restrict_chat_member,
revoke_chat_invite_link(chat_id : Int32 | Int64 | String, invite_link : String)
revoke_chat_invite_link,
send_animation(chat_id : Int32 | Int64 | String, animation : ::File | String, message_thread_id : Int32 | Int64 | Nil = nil, duration : Int32 | Int64 | Nil = nil, width : Int32 | Int64 | Nil = nil, height : Int32 | Int64 | Nil = nil, thumbnail : ::File | String | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | Nil = nil, has_spoiler : Bool | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_animation,
send_audio(chat_id : Int32 | Int64 | String, audio : ::File | String, message_thread_id : Int32 | Int64 | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | Nil = nil, duration : Int32 | Int64 | Nil = nil, performer : String | Nil = nil, title : String | Nil = nil, thumbnail : ::File | String | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_audio,
send_chat_action(chat_id : Int32 | Int64 | String, action : String, message_thread_id : Int32 | Int64 | Nil = nil)
send_chat_action,
send_contact(chat_id : Int32 | Int64 | String, phone_number : String, first_name : String, message_thread_id : Int32 | Int64 | Nil = nil, last_name : String | Nil = nil, vcard : String | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_contact,
send_dice(chat_id : Int32 | Int64 | String, message_thread_id : Int32 | Int64 | Nil = nil, emoji : String | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_dice,
send_document(chat_id : Int32 | Int64 | String, document : ::File | String, message_thread_id : Int32 | Int64 | Nil = nil, thumbnail : ::File | String | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | Nil = nil, disable_content_type_detection : Bool | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_document,
send_game(chat_id : Int32 | Int64, game_short_name : String, message_thread_id : Int32 | Int64 | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
send_game,
send_invoice(chat_id : Int32 | Int64 | String, title : String, description : String, payload : String, provider_token : String, currency : String, prices : Array(Tourmaline::LabeledPrice), message_thread_id : Int32 | Int64 | Nil = nil, max_tip_amount : Int32 | Int64 | Nil = nil, suggested_tip_amounts : Array(Int32 | Int64) | Nil = nil, start_parameter : String | Nil = nil, provider_data : String | Nil = nil, photo_url : String | Nil = nil, photo_size : Int32 | Int64 | Nil = nil, photo_width : Int32 | Int64 | Nil = nil, photo_height : Int32 | Int64 | Nil = nil, need_name : Bool | Nil = nil, need_phone_number : Bool | Nil = nil, need_email : Bool | Nil = nil, need_shipping_address : Bool | Nil = nil, send_phone_number_to_provider : Bool | Nil = nil, send_email_to_provider : Bool | Nil = nil, is_flexible : Bool | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
send_invoice,
send_location(chat_id : Int32 | Int64 | String, latitude : Float64, longitude : Float64, message_thread_id : Int32 | Int64 | Nil = nil, horizontal_accuracy : Float64 | Nil = nil, live_period : Int32 | Int64 | Nil = nil, heading : Int32 | Int64 | Nil = nil, proximity_alert_radius : Int32 | Int64 | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_location,
send_media_group(chat_id : Int32 | Int64 | String, media : Array(Tourmaline::InputMediaAudio) | Array(Tourmaline::InputMediaDocument) | Array(Tourmaline::InputMediaPhoto) | Array(Tourmaline::InputMediaVideo), message_thread_id : Int32 | Int64 | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil)
send_media_group,
send_message(chat_id : Int32 | Int64 | String, text : String, message_thread_id : Int32 | Int64 | Nil = nil, parse_mode : ParseMode = default_parse_mode, entities : Array(Tourmaline::MessageEntity) | Nil = nil, link_preview_options : Tourmaline::LinkPreviewOptions | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_message,
send_photo(chat_id : Int32 | Int64 | String, photo : ::File | String, message_thread_id : Int32 | Int64 | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | Nil = nil, has_spoiler : Bool | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_photo,
send_poll(chat_id : Int32 | Int64 | String, question : String, options : Array(String), message_thread_id : Int32 | Int64 | Nil = nil, is_anonymous : Bool | Nil = nil, type : String | Nil = nil, allows_multiple_answers : Bool | Nil = nil, correct_option_id : Int32 | Int64 | Nil = nil, explanation : String | Nil = nil, explanation_parse_mode : String | Nil = nil, explanation_entities : Array(Tourmaline::MessageEntity) | Nil = nil, open_period : Int32 | Int64 | Nil = nil, close_date : Int32 | Int64 | Nil = nil, is_closed : Bool | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_poll,
send_sticker(chat_id : Int32 | Int64 | String, sticker : ::File | String, message_thread_id : Int32 | Int64 | Nil = nil, emoji : String | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_sticker,
send_venue(chat_id : Int32 | Int64 | String, latitude : Float64, longitude : Float64, title : String, address : String, message_thread_id : Int32 | Int64 | Nil = nil, foursquare_id : String | Nil = nil, foursquare_type : String | Nil = nil, google_place_id : String | Nil = nil, google_place_type : String | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_venue,
send_video(chat_id : Int32 | Int64 | String, video : ::File | String, message_thread_id : Int32 | Int64 | Nil = nil, duration : Int32 | Int64 | Nil = nil, width : Int32 | Int64 | Nil = nil, height : Int32 | Int64 | Nil = nil, thumbnail : ::File | String | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | Nil = nil, has_spoiler : Bool | Nil = nil, supports_streaming : Bool | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_video,
send_video_note(chat_id : Int32 | Int64 | String, video_note : ::File | String, message_thread_id : Int32 | Int64 | Nil = nil, duration : Int32 | Int64 | Nil = nil, length : Int32 | Int64 | Nil = nil, thumbnail : ::File | String | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_video_note,
send_voice(chat_id : Int32 | Int64 | String, voice : ::File | String, message_thread_id : Int32 | Int64 | Nil = nil, caption : String | Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | Nil = nil, duration : Int32 | Int64 | Nil = nil, disable_notification : Bool | Nil = nil, protect_content : Bool | Nil = nil, reply_parameters : Tourmaline::ReplyParameters | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | Nil = nil)
send_voice,
set_chat_administrator_custom_title(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64, custom_title : String)
set_chat_administrator_custom_title,
set_chat_description(chat_id : Int32 | Int64 | String, description : String | Nil = nil)
set_chat_description,
set_chat_menu_button(chat_id : Int32 | Int64 | Nil = nil, menu_button : Tourmaline::MenuButton | Nil = nil)
set_chat_menu_button,
set_chat_permissions(chat_id : Int32 | Int64 | String, permissions : Tourmaline::ChatPermissions, use_independent_chat_permissions : Bool | Nil = nil)
set_chat_permissions,
set_chat_photo(chat_id : Int32 | Int64 | String, photo : ::File)
set_chat_photo,
set_chat_sticker_set(chat_id : Int32 | Int64 | String, sticker_set_name : String)
set_chat_sticker_set,
set_chat_title(chat_id : Int32 | Int64 | String, title : String)
set_chat_title,
set_custom_emoji_sticker_set_thumbnail(name : String, custom_emoji_id : String | Nil = nil)
set_custom_emoji_sticker_set_thumbnail,
set_game_score(user_id : Int32 | Int64, score : Int32 | Int64, force : Bool | Nil = nil, disable_edit_message : Bool | Nil = nil, chat_id : Int32 | Int64 | Nil = nil, message_id : Int32 | Int64 | Nil = nil, inline_message_id : String | Nil = nil)
set_game_score,
set_message_reaction(chat_id : Int32 | Int64 | String, message_id : Int32 | Int64, reaction : Array(Tourmaline::ReactionType) | Nil = nil, is_big : Bool | Nil = nil)
set_message_reaction,
set_my_commands(commands : Array(Tourmaline::BotCommand), scope : Tourmaline::BotCommandScope | Nil = nil, language_code : String | Nil = nil)
set_my_commands,
set_my_default_administrator_rights(rights : Tourmaline::ChatAdministratorRights | Nil = nil, for_channels : Bool | Nil = nil)
set_my_default_administrator_rights,
set_my_description(description : String | Nil = nil, language_code : String | Nil = nil)
set_my_description,
set_my_name(name : String | Nil = nil, language_code : String | Nil = nil)
set_my_name,
set_my_short_description(short_description : String | Nil = nil, language_code : String | Nil = nil)
set_my_short_description,
set_passport_data_errors(user_id : Int32 | Int64, errors : Array(Tourmaline::PassportElementError))
set_passport_data_errors,
set_sticker_emoji_list(sticker : String, emoji_list : Array(String))
set_sticker_emoji_list,
set_sticker_keywords(sticker : String, keywords : Array(String) | Nil = nil)
set_sticker_keywords,
set_sticker_mask_position(sticker : String, mask_position : Tourmaline::MaskPosition | Nil = nil)
set_sticker_mask_position,
set_sticker_position_in_set(sticker : String, position : Int32 | Int64)
set_sticker_position_in_set,
set_sticker_set_thumbnail(name : String, user_id : Int32 | Int64, thumbnail : ::File | String | Nil = nil)
set_sticker_set_thumbnail,
set_sticker_set_title(name : String, title : String)
set_sticker_set_title,
set_webhook(url : String, certificate : ::File | Nil = nil, ip_address : String | Nil = nil, max_connections : Int32 | Int64 | Nil = nil, allowed_updates : Array(String) | Nil = nil, drop_pending_updates : Bool | Nil = nil, secret_token : String | Nil = nil)
set_webhook,
stop_message_live_location(chat_id : Int32 | Int64 | String | Nil = nil, message_id : Int32 | Int64 | Nil = nil, inline_message_id : String | Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
stop_message_live_location,
stop_poll(chat_id : Int32 | Int64 | String, message_id : Int32 | Int64, reply_markup : Tourmaline::InlineKeyboardMarkup | Nil = nil)
stop_poll,
unban_chat_member(chat_id : Int32 | Int64 | String, user_id : Int32 | Int64, only_if_banned : Bool | Nil = nil)
unban_chat_member,
unban_chat_sender_chat(chat_id : Int32 | Int64 | String, sender_chat_id : Int32 | Int64)
unban_chat_sender_chat,
unhide_general_forum_topic(chat_id : Int32 | Int64 | String)
unhide_general_forum_topic,
unpin_all_chat_messages(chat_id : Int32 | Int64 | String)
unpin_all_chat_messages,
unpin_all_forum_topic_messages(chat_id : Int32 | Int64 | String, message_thread_id : Int32 | Int64)
unpin_all_forum_topic_messages,
unpin_all_general_forum_topic_messages(chat_id : Int32 | Int64 | String)
unpin_all_general_forum_topic_messages,
unpin_chat_message(chat_id : Int32 | Int64 | String, message_id : Int32 | Int64 | Nil = nil)
unpin_chat_message,
upload_sticker_file(user_id : Int32 | Int64, sticker : ::File, sticker_format : String)
upload_sticker_file
Constructor Detail
Create a new instance of Tourmaline::Client
.
Named Arguments
#bot_token
: the bot token you should've received from @BotFather
endpoint
: the API endpoint to use for requests; default is https://api.telegram.org
, but for
TDLight methods to work you may consider hosting your own instance or using one of
the official ones such as https://telegram.rest
#default_parse_mode
: the default parse mode to use for messages; default is ParseMode::None
(no formatting)
pool_capacity
: the maximum number of concurrent HTTP connections to use
initial_pool_size
: the number of HTTP::Client instances to create on init
pool_timeout
: How long to wait for a new client to be available if the pool is full before throwing a TimeoutError
proxy
: an instance of HTTP::Proxy::Client
to use; if set, overrides the following proxy_
args
proxy_uri
: a URI to use when connecting to the proxy; can be a URI
instance or a String
proxy_host
: if no proxy_uri
is provided, this will be the host for the URI
proxy_port
: if no proxy_uri
is provided, this will be the port for the URI
proxy_user
: a username to use for a proxy that requires authentication
proxy_pass
: a password to use for a proxy that requires authentication
Class Method Detail
Instance Method Detail
Gets the name of the Client at the time the Client was
started. Refreshing can be done by setting
@bot
to get_me
.
Gets the name of the Client at the time the Client was
started. Refreshing can be done by setting
@bot
to get_me
.
Sends a request to the Telegram Client API. Returns the response, parsed as a U
.
Sends a request to the Telegram Client API. Returns the raw response.