Module TelegramApi.Command

module Command: sig .. end

type action = 
| Nothing
| GetMe of (TelegramApi.User.user TelegramApi.Result.result ->
action)
| SendMessage of int * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| ForwardMessage of int * int * bool * int
| SendChatAction of int * TelegramApi.ChatAction.action
| SendPhoto of int * string * string option * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
* (string TelegramApi.Result.result -> action)
| ResendPhoto of int * string * string option * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| SendAudio of int * string * string * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
* (string TelegramApi.Result.result -> action)
| ResendAudio of int * string * string * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| SendDocument of int * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
* (string TelegramApi.Result.result -> action)
| ResendDocument of int * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| SendSticker of int * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
* (string TelegramApi.Result.result -> action)
| ResendSticker of int * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| SendVideo of int * string * int option * string option * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
* (string TelegramApi.Result.result -> action)
| ResendVideo of int * string * int option * string option * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| SendVoice of int * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
* (string TelegramApi.Result.result -> action)
| ResendVoice of int * string * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| SendLocation of int * float * float * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| SendVenue of int * float * float * string * string * string option * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| SendContact of int * string * string * string option * bool * int option
* TelegramApi.ReplyMarkup.reply_markup option
| GetUserProfilePhotos of int * int option * int option
* (TelegramApi.UserProfilePhotos.user_profile_photos
TelegramApi.Result.result -> action)
| GetFile of string
* (TelegramApi.File.file TelegramApi.Result.result ->
action)
| GetFile' of string * (string option -> action)
| DownloadFile of TelegramApi.File.file * (string option -> action)
| KickChatMember of int * int
| LeaveChat of int
| UnbanChatMember of int * int
| GetChat of int
* (TelegramApi.Chat.chat TelegramApi.Result.result ->
action)
| GetChatAdministrators of int
* (TelegramApi.ChatMember.chat_member list TelegramApi.Result.result ->
action)
| GetChatMembersCount of int * (int TelegramApi.Result.result -> action)
| GetChatMember of int * int
* (TelegramApi.ChatMember.chat_member TelegramApi.Result.result ->
action)
| AnswerCallbackQuery of string * string option * bool
| AnswerInlineQuery of string * TelegramApi.InlineQuery.Out.inline_query_result list * int option
* bool option * string option
| EditMessageText of [ `ChatMessageId of string * int | `InlineMessageId of string ] * string
* TelegramApi.ParseMode.parse_mode option * bool
* TelegramApi.ReplyMarkup.reply_markup option
| EditMessageCaption of [ `ChatMessageId of string * int | `InlineMessageId of string ] * string
* TelegramApi.ReplyMarkup.reply_markup option
| EditMessageReplyMarkup of [ `ChatMessageId of string * int | `InlineMessageId of string ]
* TelegramApi.ReplyMarkup.reply_markup option
| GetUpdates of (TelegramApi.Update.update list TelegramApi.Result.result ->
action)
| PeekUpdate of (TelegramApi.Update.update TelegramApi.Result.result ->
action)
| PopUpdate of (TelegramApi.Update.update TelegramApi.Result.result ->
action)
| Chain of action * action
The actions that can be used by the bot's commands
type command = {
   name : string;
   description : string;
   mutable enabled : bool;
   run : TelegramApi.Message.message -> action;
}
This type is used to represent available commands. The name field is the command's name (without a slash) and the description field is the description to be used in the help message. run is the function called when invoking the command.
val is_command : TelegramApi.Update.update -> bool
Tests to see whether an update from the update queue invoked a command
val read_command : string option ->
TelegramApi.Message.message ->
command list -> action
Takes an optional postfix for commands (/cmd
val read_update : string option ->
TelegramApi.Update.update ->
command list -> action
Reads a single update and, given a list of commands, matches it to a correct command that can be invoked. Takes an optional postfix for commands (/cmd
val tokenize : string -> string list
Turns a string into the args list that a command may choose to work with
val with_auth : command:(TelegramApi.Message.message -> action) ->
TelegramApi.Message.message -> action
with_auth ~command makes a command only run when the caller is an admin in the chat