class Telegram::Context

Included Modules

Defined in:

telegram/context.cr

Constructors

Instance Method Summary

Instance methods inherited from module Telegram::MutableContext

get(name, type : T.class) forall T
get(name)
get
, get?(name, type : T.class) forall T
get?(name)
get?
, has?(name) : Bool has?, remove(name) : Nil remove, set(name, value : _, type : T.class) : Nil forall T
set(name, value : T) : Nil forall T
set(name, type : T.class, &block : -> T) : Nil forall T
set(name, &block : -> T) : Nil forall T
set

Constructor Detail

def self.new(update : API::Update, api : API, me : API::User) #

[View source]

Instance Method Detail

def answer_callback_query(**options) #

Context-aware alias for api.answer_callback_query.


[View source]
def answer_inline_query(results : Array(InlineQueryResult), **options) #

Context-aware alias for api.answer_inline_query.


[View source]
def answer_pre_checkout_query(ok : Bool, **options) #

Context-aware alias for api.answer_pre_checkout_query.


[View source]
def answer_shipping_query(ok : Bool, **options) #

Context-aware alias for api.answer_shipping_query.


[View source]
def api : API #

An API instance which allows you to call any Telegram Bot API method.


[View source]
def approve_chat_join_request(user_id : Int64, **options) #

Context-aware alias for api.approve_chat_join_request.


[View source]
def ban_author(**options) #

Context-aware alias for api.ban_chat_member.


[View source]
def ban_chat_member(user_id : Int64, **options) #

Context-aware alias for api.ban_chat_member.


[View source]
def ban_chat_sender_chat(sender_chat_id : Int64, **options) #

Context-aware alias for api.ban_chat_sender_chat.


[View source]
def callback_query #

Alias for ctx.update.callback_query


[View source]
def callback_query! #

Alias for ctx.update.callback_query.not_nil!


[View source]
def channel_post #

Alias for ctx.update.channel_post


[View source]
def channel_post! #

Alias for ctx.update.channel_post.not_nil!


[View source]
def chat #

Get the chat object from wherever possible.


[View source]
def chat! #

Get the chat object from wherever possible. Will raise if the chat object is not found.


[View source]
def chat_join_request #

Alias for ctx.update.chat_join_request


[View source]
def chat_join_request! #

Alias for ctx.update.chat_join_request.not_nil!


[View source]
def chat_member #

Alias for ctx.update.chat_member


[View source]
def chat_member! #

Alias for ctx.update.chat_member.not_nil!


[View source]
def chosen_inline_result #

Alias for ctx.update.chosen_inline_result


[View source]
def chosen_inline_result! #

Alias for ctx.update.chosen_inline_result.not_nil!


[View source]
def copy_message(chat_id : Int64 | String, **options) #

Context-aware alias for api.copy_message.


[View source]
def create_chat_invite_link(**options) #

Context-aware alias for api.create_chat_invite_link.


[View source]
def decline_chat_join_request(user_id : Int64, **options) #

Context-aware alias for api.decline_chat_join_request.


[View source]
def delete_chat_photo(**options) #

Context-aware alias for api.delete_chat_photo.


[View source]
def delete_chat_sticker_set(**options) #

Context-aware alias for api.delete_chat_sticker_set.


[View source]
def delete_message(**options) #

Context-aware alias for api.delete_message.


[View source]
def edit_chat_invite_link(invite_link : String, **options) #

Context-aware alias for api.edit_chat_invite_link.


[View source]
def edit_message_caption(caption : String | Nil, **options) #

Context-aware alias for api.edit_message_caption.


[View source]
def edit_message_live_location(latitude : Float, longitude : Float, **options) #

Context-aware alias for api.edit_message_live_location.


[View source]
def edit_message_media(media : InputMedia, **options) #

Context-aware alias for api.edit_message_media.


[View source]
def edit_message_reply_markup(reply_markup : InlineKeyboardMarkup | Nil, **options) #

Context-aware alias for api.edit_message_reply_markup.


[View source]
def edit_message_text(text : String, **options) #

Context-aware alias for api.edit_message_text.


[View source]
def edited_channel_post #

Alias for ctx.update.edited_channel_post


[View source]
def edited_channel_post! #

Alias for ctx.update.edited_channel_post.not_nil!


[View source]
def edited_message #

Alias for ctx.update.edited_message


[View source]
def edited_message! #

Alias for ctx.update.edited_message.not_nil!


[View source]
def export_chat_invite_link(**options) #

Context-aware alias for api.export_chat_invite_link.


[View source]
def forward_message(chat_id : Int64 | String, **options) #

Context-aware alias for api.forward_message.


[View source]
def from #

Get the message author from wherever possible.


[View source]
def from! #

Get the message author from wherever possible. Will raise if the from object is not found.


[View source]
def get_author(**options) #

Context-aware alias for api.get_chat_member.


[View source]
def get_chat(**options) #

Context-aware alias for api.get_chat.


[View source]
def get_chat_administrators(**options) #

Context-aware alias for api.get_chat_administrators.


[View source]
def get_chat_member(user_id : Int64, **options) #

Context-aware alias for api.get_chat_member.


[View source]
def get_chat_members_count(**options) #

Context-aware alias for api.get_chat_members_count.


[View source]
def get_file(file_id : String | Nil = nil) #

Context-aware alias for api.get_file.


[View source]
def get_user_profile_photos(**options) #

Context-aware alias for api.get_user_profile_photos.


[View source]
def inline_message_id #

Get the inline message ID from wherever possible.


[View source]
def inline_message_id! #

Get the inline message ID from wherever possible. Will raise if the inline_message_id object is not found.


[View source]
def inline_query #

Alias for ctx.update.inline_query


[View source]
def inline_query! #

Alias for ctx.update.inline_query.not_nil!


[View source]
def leave_chat(**options) #

Context-aware alias for api.leave_chat.


[View source]
def match : String | Regex | Nil #

Used by some middleware to stor information about how a String or regular expression was matched.


[View source]
def match=(match : String | Regex | Nil) #

Used by some middleware to stor information about how a String or regular expression was matched.


[View source]
def me : API::User #

Information about the bot itself.


[View source]
def message #

Alias for ctx.update.message


[View source]
def message! #

Alias for ctx.update.message.not_nil!


[View source]
def msg #

Get the message object from wherever possible


[View source]
def msg! #

Get the message object from wherever possible. Will raise if no message object is found.


[View source]
def my_chat_member #

Alias for ctx.update.my_chat_member


[View source]
def my_chat_member! #

Alias for ctx.update.my_chat_member.not_nil!


[View source]
def pin_chat_message(message_id : Int64, **options) #

Context-aware alias for api.pin_chat_message.


[View source]
def poll #

Alias for ctx.update.poll


[View source]
def poll! #

Alias for ctx.update.poll.not_nil!


[View source]
def poll_answer #

Alias for ctx.update.poll_answer


[View source]
def poll_answer! #

Alias for ctx.update.poll_answer.not_nil!


[View source]
def pre_checkout_query #

Alias for ctx.update.pre_checkout_query


[View source]
def pre_checkout_query! #

Alias for ctx.update.pre_checkout_query.not_nil!


[View source]
def promote_author(**options) #

Context-aware alias for api.promote_chat_member.


[View source]
def promote_chat_member(user_id : Int64, **options) #

Context-aware alias for api.promote_chat_member.


[View source]
def reply(text : String, **options) #

Context-aware alias for api.send_message.


[View source]
def reply_with_game(game_short_name : String, **options) #

Context-aware alias for api.send_game.


[View source]
def reply_with_invoice(title : String, description : String, payload : String, provider_token : String, currency : String, prices : Array(LabeledPrice), **options) #

Context-aware alias for api.send_invoice.


[View source]
def reply_with_sticker(sticker : InputFile | String, **options) #

Context-aware alias for api.send_sticker.


[View source]
def restrict_author(**options) #

Context-aware alias for api.restrict_chat_member.


[View source]
def restrict_chat_member(user_id : Int64, **options) #

Context-aware alias for api.restrict_chat_member.


[View source]
def revoke_chat_invite_link(link : String, **options) #

Context-aware alias for api.revoke_chat_invite_link.


[View source]
def send_animation(animation : InputFile | String, **options) #

Context-aware alias for api.send_animation.


[View source]
def send_audio(audio : InputFile | String, **options) #

Context-aware alias for api.send_audio.


[View source]
def send_chat_action(action : String, **options) #

Context-aware alias for api.send_chat_action.

TODO Use ChatAction enum.


[View source]
def send_contact(phone_number : String, first_name : String, **options) #

Context-aware alias for api.send_contact.


[View source]
def send_dice(emoji : String, **options) #

Context-aware alias for api.send_dice.

TODO Use Dice enum.


[View source]
def send_document(document : InputFile | String, **options) #

Context-aware alias for api.send_document.


[View source]
def send_location(latitude : Float, longitude : Float, **options) #

Context-aware alias for api.send_location.


[View source]
def send_media_group(media : Array(InputMedia), **options) #

Context-aware alias for api.send_media_group.


[View source]
def send_photo(photo : InputFile | String, **options) #

Context-aware alias for api.send_photo.


[View source]
def send_poll(question : String, items : Array(String), **options) #

Context-aware alias for api.send_poll.


[View source]
def send_venue(latitude : Float, longitude : Float, title : String, address : String, **options) #

Context-aware alias for api.send_venue.


[View source]
def send_video(video : InputFile | String, **options) #

Context-aware alias for api.send_video.


[View source]
def send_video_note(video_note : InputFile | String, **options) #

Context-aware alias for api.send_video_note.


[View source]
def send_voice(voice : InputFile | String, **options) #

Context-aware alias for api.send_voice.


[View source]
def sender_chat #

Get the sender chat from wherever possible.


[View source]
def sender_chat! #

Get the sender chat from wherever possible. Will raise if the sender_chat object is not found.


[View source]
def set_chat_administrator_author_custom_title(custom_title : String, **options) #

Context-aware alias for api.set_chat_administrator_custom_title.


[View source]
def set_chat_administrator_custom_title(user_id : Int64, custom_title : String, **options) #

Context-aware alias for api.set_chat_administrator_custom_title.


[View source]
def set_chat_description(description : String | Nil, **options) #

Context-aware alias for api.set_chat_description.


[View source]
def set_chat_permissions(permissions : ChatPermissions, **options) #

Context-aware alias for api.set_chat_permissions.


[View source]
def set_chat_photo(photo : InputFile, **options) #

Context-aware alias for api.set_chat_photo.


[View source]
def set_chat_sticker_set(sticker_set_name : String, **options) #

Context-aware alias for api.set_chat_sticker_set.


[View source]
def set_chat_title(title : String, **options) #

Context-aware alias for api.set_chat_title.


[View source]
def set_passport_data_errors(errors : Array(PassportElementError), **options) #

Context-aware alias for api.set_passport_data_errors.


[View source]
def shipping_query #

Alias for ctx.update.shipping_query


[View source]
def shipping_query! #

Alias for ctx.update.shipping_query.not_nil!


[View source]
def stop #

[View source]
def stop_message_live_location(**options) #

Context-aware alias for api.stop_message_live_location.


[View source]
def stop_poll(**options) #

Context-aware alias for api.stop_poll.


[View source]
def text #

Get the message text from wherever possible.


[View source]
def text! #

Get the message text from wherever possible. Will raise if the text object is not found.


[View source]
def unban_chat_member(user_id : Int64, **options) #

Context-aware alias for api.unban_chat_member.


[View source]
def unban_chat_sender_chat(sender_chat_id : Int64, **options) #

Context-aware alias for api.unban_chat_sender_chat.


[View source]
def unpin_all_chat_messages(**options) #

Context-aware alias for api.unpin_all_chat_messages.


[View source]
def unpin_chat_message(message_id : Int64, **options) #

Context-aware alias for api.unpin_chat_message.


[View source]
def update : API::Update #

The Updtate object that is contained in the context.


[View source]