package telegraml

  1. Overview
  2. Docs

Generate a bot's interface to allow for direct calls to functions

Parameters

module B : BOT

Signature

val url : string

The base url for all connections to the API

val commands : Command.command list

A list of all commands supported by the bot

The inline query handler for the bot

The callback query handler for the bot

Get the user information for the bot; use to test connection to the Telegram server

val send_message : chat_id:int -> text:string -> parse_mode:ParseMode.parse_mode option -> disable_web_page_preview:bool -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send a text message to a specified chat

val forward_message : chat_id:int -> from_chat_id:int -> ?disable_notification:bool -> message_id:int -> unit Result.result Lwt.t

Forwards any message from one chat to another (can be same chat)

val send_chat_action : chat_id:int -> action:ChatAction.action -> unit Result.result Lwt.t

Send an action report to the chat, to show that a command will take some time

val send_photo : chat_id:int -> photo:string -> ?caption:string option -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> string Result.result Lwt.t

Send a new image file (jpeg/png) to a specified chat. Note that photo refers to the file's name to send.

val resend_photo : chat_id:int -> photo:string -> ?caption:string option -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send an existing image file (jpeg/png) to a specified chat. Note that photo refers to the file's id on the Telegram servers.

val send_audio : chat_id:int -> audio:string -> performer:string -> title:string -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> string Result.result Lwt.t

Send a new audio file (mp3) to a specified chat. Note that audio refers to the file's name to send.

val resend_audio : chat_id:int -> audio:string -> performer:string -> title:string -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send an existing audio file (mp3) to a specified chat. Note that audio refers to the file's id on the Telegram servers.

val send_document : chat_id:int -> document:string -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> string Result.result Lwt.t

Send a new document file to a specified chat. Note that document refers to the file's name to send.

val resend_document : chat_id:int -> document:string -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send an existing document file to a specified chat. Note that document refers to the file's id on the Telegram servers.

val send_sticker : chat_id:int -> sticker:string -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> string Result.result Lwt.t

Send a new sticker file (webp) to a specified chat. Note that sticker refers to the file's name to send.

val resend_sticker : chat_id:int -> sticker:string -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send an existing sticker file (webp) to a specified chat. Note that sticker refers to the file's id on the Telegram servers.

val send_video : chat_id:int -> video:string -> ?duration:int option -> ?caption:string option -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> string Result.result Lwt.t

Send a new video file (mp4/mov/webm) to a specified chat. Note that video refers to the file's name to send.

val resend_video : chat_id:int -> video:string -> ?duration:int option -> ?caption:string option -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send an existing video (mp4/mov/webm) file to a specified chat. Note that video refers to the file's id on the Telegram servers.

val send_voice : chat_id:int -> voice:string -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> string Result.result Lwt.t

Send a new voice message (ogg) to a specified chat. Note that voice refers to the file's name to send.

val resend_voice : chat_id:int -> voice:string -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send an existing voice message (ogg) to a specified chat. Note that voice refers to the file's id on the Telegram servers.

val send_location : chat_id:int -> latitude:float -> longitude:float -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send a location to a specified chat

val send_venue : chat_id:int -> latitude:float -> longitude:float -> title:string -> address:string -> foursquare_id:string option -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send a venue to a specified chat

val send_contact : chat_id:int -> phone_number:string -> first_name:string -> last_name:string option -> ?disable_notification:bool -> reply_to:int option -> reply_markup:ReplyMarkup.reply_markup option -> unit Result.result Lwt.t

Send a contact to a specified chat

val get_user_profile_photos : user_id:int -> offset:int option -> limit:int option -> UserProfilePhotos.user_profile_photos Result.result Lwt.t

Get a given user's profile pictures

val get_file : file_id:string -> File.file Result.result Lwt.t

Get the information for a file that's been uploaded to Telegram's servers by the file_id

val get_file' : file_id:string -> string option Lwt.t

Download a file that's been uploaded to Telegram's servers by the file_id

val download_file : file:File.file -> string option Lwt.t

Download a file that's been uploaded to Telegram's servers by the file

val kick_chat_member : chat_id:int -> user_id:int -> unit Result.result Lwt.t

Kick/ban a given user from the given chat

val leave_chat : chat_id:int -> unit Result.result Lwt.t

Leave a chat manually to stop receiving messages from it

val unban_chat_member : chat_id:int -> user_id:int -> unit Result.result Lwt.t

Unban a given user from the given chat

val get_chat : chat_id:int -> Chat.chat Result.result Lwt.t

Get the info for a given chat

val get_chat_administrators : chat_id:int -> ChatMember.chat_member list Result.result Lwt.t

Get the list of admins for a given chat

val get_chat_members_count : chat_id:int -> int Result.result Lwt.t

Get the number of members in a given chat

val get_chat_member : chat_id:int -> user_id:int -> ChatMember.chat_member Result.result Lwt.t

Get information about a certain member in the given chat

val answer_callback_query : callback_query_id:string -> ?text:string option -> ?show_alert:bool -> unit -> unit Result.result Lwt.t

Answer a callback query sent from an inline keyboard

val answer_inline_query : inline_query_id:string -> results:InlineQuery.Out.inline_query_result list -> ?cache_time:int option -> ?is_personal:bool option -> ?next_offset:string option -> unit -> unit Result.result Lwt.t

Answers between 1 to 50 inline queries

val edit_message_text : ?chat_id:string option -> ?message_id:int option -> ?inline_message_id:string option -> text:string -> parse_mode:ParseMode.parse_mode option -> disable_web_page_preview:bool -> reply_markup:ReplyMarkup.reply_markup option -> unit -> unit Result.result Lwt.t

Edit an existing message, selected by either the chat id, the message id, or the inline message id

val edit_message_caption : ?chat_id:string option -> ?message_id:int option -> ?inline_message_id:string option -> caption:string -> reply_markup:ReplyMarkup.reply_markup option -> unit -> unit Result.result Lwt.t

Edit the caption of an existing message, selected by either the chat id, the message id, or the inline message id

val edit_message_reply_markup : ?chat_id:string option -> ?message_id:int option -> ?inline_message_id:string option -> reply_markup:ReplyMarkup.reply_markup option -> unit -> unit Result.result Lwt.t

Edit the reply markup of an existing message, selected by either the chat id, the message id, or the inline message id. Use None to remove the reply markup

val get_updates : Update.update list Result.result Lwt.t

Get a list of all available updates that the bot has received

Get the first available update from the update queue

val pop_update : ?run_cmds:bool -> unit -> Update.update Result.result Lwt.t

Get the first available update from the update queue and mark it as read (deletes the update)

val run : ?log:bool -> unit -> unit

Run the bot with a default main loop, optionally logging the output to stdout

OCaml

Innovation. Community. Security.