package telegraml
Module TelegramApi.CommandSource
type action = | Nothing| GetMe of User.user Result.result -> action| SendMessage of int * string * ParseMode.parse_mode option * bool * bool * int option * ReplyMarkup.reply_markup option| ForwardMessage of int * int * bool * int| SendChatAction of int * ChatAction.action| SendPhoto of int * string * string option * bool * int option * ReplyMarkup.reply_markup option * string Result.result -> action| ResendPhoto of int * string * string option * bool * int option * ReplyMarkup.reply_markup option| SendAudio of int * string * string * string * bool * int option * ReplyMarkup.reply_markup option * string Result.result -> action| ResendAudio of int * string * string * string * bool * int option * ReplyMarkup.reply_markup option| SendDocument of int * string * bool * int option * ReplyMarkup.reply_markup option * string Result.result -> action| ResendDocument of int * string * bool * int option * ReplyMarkup.reply_markup option| SendSticker of int * string * bool * int option * ReplyMarkup.reply_markup option * string Result.result -> action| ResendSticker of int * string * bool * int option * ReplyMarkup.reply_markup option| SendVideo of int * string * int option * string option * bool * int option * ReplyMarkup.reply_markup option * string Result.result -> action| ResendVideo of int * string * int option * string option * bool * int option * ReplyMarkup.reply_markup option| SendVoice of int * string * bool * int option * ReplyMarkup.reply_markup option * string Result.result -> action| ResendVoice of int * string * bool * int option * ReplyMarkup.reply_markup option| SendLocation of int * float * float * bool * int option * ReplyMarkup.reply_markup option| SendVenue of int * float * float * string * string * string option * bool * int option * ReplyMarkup.reply_markup option| SendContact of int * string * string * string option * bool * int option * ReplyMarkup.reply_markup option| GetUserProfilePhotos of int * int option * int option * UserProfilePhotos.user_profile_photos Result.result -> action| GetFile of string * File.file Result.result -> action| GetFile' of string * string option -> action| DownloadFile of File.file * string option -> action| KickChatMember of int * int| LeaveChat of int| UnbanChatMember of int * int| GetChat of int * Chat.chat Result.result -> action| GetChatAdministrators of int * ChatMember.chat_member list Result.result -> action| GetChatMembersCount of int * int Result.result -> action| GetChatMember of int * int * ChatMember.chat_member Result.result -> action| AnswerCallbackQuery of string * string option * bool| AnswerInlineQuery of string * InlineQuery.Out.inline_query_result list * int option * bool option * string option| EditMessageText of [ `ChatMessageId of string * int | `InlineMessageId of string ] * string * ParseMode.parse_mode option * bool * ReplyMarkup.reply_markup option| EditMessageCaption of [ `ChatMessageId of string * int | `InlineMessageId of string ] * string * ReplyMarkup.reply_markup option| EditMessageReplyMarkup of [ `ChatMessageId of string * int | `InlineMessageId of string ] * ReplyMarkup.reply_markup option| GetUpdates of Update.update list Result.result -> action| PeekUpdate of Update.update Result.result -> action| PopUpdate of bool * Update.update 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 : 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.
Tests to see whether an update from the update queue invoked a command
Takes an optional postfix for commands (/cmd@bot), a message, known to represent a command, and a list of possible commands. These values are used to find the matching command and return the actions that it should perform
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@bot) as the first parameter
Turns a string into the args list that a command may choose to work with
with_auth ~command makes a command only run when the caller is an admin in the chat