abstract class TelegramBot::Bot

Defined in:

telegram_bot/bot.cr

Constructors

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(name : String, token : String, whitelist : Array(String) | Nil = nil, blacklist : Array(String) | Nil = nil, updates_timeout : Int32 | Nil = nil, allowed_updates : Array(String) | Nil = nil) #

@name username of the bot @token @whitelist @blacklist @updates_timeout


[View source]

Instance Method Detail

def add_sticker_to_set(user_id : Int, name : String, png_sticker : ::File | String, emojis : String, mask_position : MaskPosition | Nil = nil) #

[View source]
def answer_callback_query(callback_query_id : String, text : String | Nil = nil, show_alert : Bool | Nil = nil, url : String | Nil = nil, cache_time : Int32 | Nil = nil) #

[View source]
def answer_inline_query(inline_query_id : String, results : Array(InlineQueryResult), cache_time : Int32 | Nil = nil, is_personal : Bool | Nil = nil, next_offset : String | Nil = nil, switch_pm_text : String | Nil = nil, switch_pm_parameter : String | Nil = nil) : Bool | Nil #

[View source]
def answer_pre_checkout_query(pre_checkout_query_id : String, ok : Bool, error_message : String | Nil = nil) : Bool | Message | Nil #

[View source]
def answer_shipping_query(shipping_query_id : String, ok : Bool, shipping_option : Array(ShippingOption) | Nil = nil, error_message : String | Nil = nil) : Bool | Message | Nil #

[View source]
def create_new_sticker_set(user_id : Int, name : String, title : String, png_sticker : ::File | String, emojis : String, contains_masks : Bool | Nil = nil, mask_position : MaskPosition | Nil = nil) #

[View source]
def delete_chat_photo(chat_id : Int | String) #

[View source]
def delete_chat_sticker_set(chat_id : Int | String) #

[View source]
def delete_message(chat_id : Int | String, message_id : Int32) : Message | Bool | Nil #

[View source]
def delete_sticker_position_in_set(sticker : String) #

[View source]
def delete_webhook : Bool | Nil #

[View source]
def download(file : File) #

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

[View source]
def download(media) #

[View source]
def edit_message_caption(chat_id : Int | String | Nil = nil, message_id : Int32 | Nil = nil, inline_message_id : String | Nil = nil, caption : String | Nil = nil, reply_markup : InlineKeyboardMarkup | Nil = nil) : Message | Bool | Nil #

[View source]
def edit_message_live_location(latitude : Float, longitude : Float, chat_id : Int | String | Nil = nil, message_id : Int32 | Nil = nil, inline_message_id : String | Nil = nil, reply_markup : ReplyMarkup | Nil = nil) #

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

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

[View source]
def export_chat_invite_link(chat_id : Int | String) #

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

[View source]
def get_chat(chat_id : Int | String) #

[View source]
def get_chat_administrators(chat_id : Int | String) #

[View source]
def get_chat_member(chat_id : Int | String, user_id : Int32) #

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

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

[View source]
def get_game_high_scores(user_id : Int32, chat_id : Int | String | Nil = nil, message_id : Int32 | Nil = nil, inline_message_id : String | Nil = nil) : Array(GameHighScore) #

[View source]
def get_me #

[View source]
def get_sticker_set(name : String) #

[View source]
def get_user_profile_photos(user_id : Int32, offset : Int32 | Nil = nil, limit : Int32 | Nil = nil) #

[View source]
def handle(message : Message) #

handle messages


[View source]
def handle(inline_query : InlineQuery) #

handle inline query


[View source]
def handle(chosen_inline_result : ChosenInlineResult) #

handle chosen inlien query


[View source]
def handle(callback_query : CallbackQuery) #

handle callback query


[View source]
def handle_channel_post(message : Message) #

[View source]
def handle_edited(message : Message) #

handle edited messages


[View source]
def handle_edited_channel_post(message : Message) #

[View source]
def handle_update(u) #

[View source]
def kick_chat_member(chat_id : Int | String, user_id : Int, until_date : Int | Nil = nil) #

[View source]
def leave_chat(chat_id : Int | String) #

[View source]
def pin_chat_message(chat_id : Int | String, message_id : Int32, disable_notification : Bool | Nil) #

[View source]
def pin_chat_message(chat_id : Int | String, message_id : Int, disable_notification : Bool | Nil = nil) #

[View source]
def polling #

run long polling in a loop and call handlers for messages


[View source]
def promote_chat_member(chat_id : Int | String, user_id : Int, can_change_info : Bool | Nil = nil, can_post_messages : Bool | Nil = nil, can_edit_messages : Bool | Nil = nil, can_delete_messages : Bool | Nil = nil, can_invite_users : Bool | Nil = nil, can_restrict_members : Bool | Nil = nil, can_pin_messages : Bool | Nil = nil, can_promote_members : Bool | Nil = nil) #

[View source]
def reply(message : Message, text : String) : Message | Nil #

[View source]
def restrict_chat_member(chat_id : Int | String, user_id : Int, until_date : Int | Nil = nil, can_send_messages : Bool | Nil = nil, can_send_media_messages : Bool | Nil = nil, can_send_other_messages : Bool | Nil = nil, can_add_web_page_previews : Bool | Nil = nil) #

[View source]
def send_audio(chat_id : Int | String, audio : ::File | String, duration : Int32 | Nil = nil, performer : String | Nil = nil, title : String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup = nil) : Message | Nil #

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

[View source]
def send_contact(chat_id : Int | String, phone_number : String, first_name : String, last_name : String | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup = nil) : Message | Nil #

[View source]
def send_document(chat_id : Int | String, document : ::File | String, caption : String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup = nil) : Message | Nil #

[View source]
def send_game(chat_id : Int | String, game_short_name : String, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : InlineKeyboardMarkup | Nil = nil) : Message | Nil #

[View source]
def send_invoice(chat_id : Int, tilte : String, description : String, payload : String, provider_token : String, start_parameter : String, currency : String, prices : Array(LabeledPrice), provider_data : String | Nil = nil, photo_url : String | Nil = nil, photo_size : Int32 | Nil = nil, photo_width : Int32 | Nil = nil, photo_height : Int32 | Nil = nil, need_name : Bool | Nil = nil, need_phone_number : Bool | Nil = nil, need_email : Bool | Nil = nil, need_shipping_address : Bool | Nil = nil, is_flexible : Bool | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup = nil) : Message | Nil #

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

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

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

[View source]
def send_photo(chat_id : Int | String, photo : ::File | String, caption : String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup = nil) : Message | Nil #

@photo file or file id


[View source]
def send_sticker(chat_id : Int | String, sticker : ::File | String, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup = nil) : Message | Nil #

[View source]
def send_venue(chat_id : Int | String, latitude : Float, longitude : Float, title : String, address : String, forsquare_id : String | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup | Nil = nil) : Message | Nil #

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

[View source]
def send_video_note(chat_id : Int | String, video_note : ::File | String, duration : Int32 | Nil = nil, length : Int32 | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup = nil) : Message | Nil #

[View source]
def send_voice(chat_id : Int | String, voice : ::File | String, duration : Int32 | Nil = nil, disable_notification : Bool | Nil = nil, reply_to_message_id : Int32 | Nil = nil, reply_markup : ReplyMarkup = nil) : Message | Nil #

[View source]
def serve(bind_address : String = "127.0.0.1", bind_port : Int32 = 80, ssl_certificate_path : String | Nil = nil, ssl_key_path : String | Nil = nil) #

[View source]
def set_chat_description(chat_id : Int | String, description : String) #

[View source]
def set_chat_photo(chat_id : Int | String, photo : ::File) #

[View source]
def set_chat_sticker_set(chat_id : Int | String, sticker_set_name : String) #

[View source]
def set_chat_title(chat_id : Int | String, title : String) #

[View source]
def set_game_score(user_id : Int32, score : Int32, force : Bool | Nil = nil, disable_edit_message : Bool | Nil = nil, chat_id : Int | String | Nil = nil, message_id : Int32 | Nil = nil, inline_message_id : String | Nil = nil) : Message | Bool | Nil #

[View source]
def set_sticker_position_in_set(sticker : String, position : Int) #

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

[View source]
def stop_message_live_location(chat_id : Int | String | Nil = nil, message_id : Int32 | Nil = nil, inline_message_id : String | Nil = nil, reply_markup : ReplyMarkup | Nil = nil) #

[View source]
def unban_chat_member(chat_id : Int | String, user_id : Int32) #

[View source]
def unpin_chat_message(chat_id : Int | String) #

[View source]
def upload_sticker_file(user_id : Int, png_sticker : ::File) #

[View source]

Macro Detail

macro def_force_request(name, *args) #

[View source]
macro def_request(name, *args) #

[View source]