API v2
CL-TELEGRAM-BOT2/ACTION
Classes
ACTION
Functions
Useful in cl-telegram-bot2/generics:process-state
generic-function methods in case if
state has additional handler stored in the slot and this
slot can be either state or action or a list of actions and states.
This function is recursive, because processing of an action
could return another action and we should call FUNC
until
a new state or NIL
will be returned.
CL-TELEGRAM-BOT2/ACTIONS/DELETE-MESSAGES
Classes
DELETE-MESSAGES
Delete all messages created in the current current state.
Readers
Functions
CL-TELEGRAM-BOT2/ACTIONS/EDIT-MESSAGE-MEDIA
Classes
EDIT-MESSAGE-MEDIA
Readers
Functions
CL-TELEGRAM-BOT2/ACTIONS/SEND-INVOICE
Classes
SEND-INVOICE
Readers
Functions
Types
Type of prices
arguments for send-invoice
class.
(SOFT-LIST-OF HASH-TABLE)
CL-TELEGRAM-BOT2/ACTIONS/SEND-PHOTO
Classes
SEND-PHOTO
Readers
Functions
CL-TELEGRAM-BOT2/ACTIONS/SEND-TEXT
Classes
SEND-TEXT
Readers
Supported values are: "Markdown"
, "MarkdownV2"
or "HTML"
. Read more about formatting options in the Telegram documentaion: https://core.telegram.org/bots/api#formatting-options
Functions
CL-TELEGRAM-BOT2/BOT
Classes
BOT
Readers
This slot will be filled with cl-telegram-bot/user:user
object on first access using a call to cl-telegram-bot/user:get-me
function.
When debug mode is T, then interactive debugger will be called on each error.
HTTPS
file-endpoint
HTTPS
endpoint
Update id
Command processing code will use this cache to update commands list on the server
when a new method for cl-telegram-bot/entities/command:on-command
generic-function is defined.
This slot is for internal use.
Accessors
When debug mode is T, then interactive debugger will be called on each error.
HTTPS
file-endpoint
Update id
Command processing code will use this cache to update commands list on the server
when a new method for cl-telegram-bot/entities/command:on-command
generic-function is defined.
This slot is for internal use.
Macros
Use this macro to define a class of your Telegram bot.
Each bot has a state machine inside. The simplest bot has only one state:
(defbot test-bot ()
()
(:initial-state
(state (send-text "Hello world!"))))
This bot will green each who activates it.
To learn more about bot states and actions see States and Actions
section.
CL-TELEGRAM-BOT2/CALLBACK
Classes
CALLBACK
Readers
Functions
CL-TELEGRAM-BOT2/DEBUG/DIAGRAM
Classes
RENDER-WORKFLOW-DIAGRAM
Functions
CL-TELEGRAM-BOT2/DEBUG/DIAGRAM/GENERICS
Generics
Returns state's slots or groups of slots as a list.
Renders a map item for a given handler.
It should use render-mapslot-value-with-link or render-mapslot-value functions
for proper rendering of PlantUML
.
Renders a map with a list of handlers for some event.
Returns a name for a state slot for such objects as callbacks or commands.
Renders object as an entity on PlantUML
diagram.
CL-TELEGRAM-BOT2/DEBUG/DIAGRAM/GROUP
Classes
GROUP
Readers
Functions
CL-TELEGRAM-BOT2/DEBUG/DIAGRAM/SLOT
Classes
SLOT
Readers
Functions
CL-TELEGRAM-BOT2/DEBUG/DIAGRAM/UTILS
Functions
Returns a state with given ID
.
Works only during PlantUML
diagram rendering.
Call this function after you've finished rendering of the PlantUML
object.
Macros
Executes block of code after the PlantUML
entity with obj-id
alias
has been rendered. Useful for ensuring that both objects are known
to the PlantUML
renderer when rendering a link between objects.
CL-TELEGRAM-BOT2/ERRORS
Classes
TELEGRAM-ERROR
Readers
CL-TELEGRAM-BOT2/GENERICS
Generics
Pre-checkout-query object will be passed as this single arguement and function should return a boolean. When the function return True, user may proceed to the payment.
Pre-checkout queries are not bound the the chat, so current-chat and current-state are not available during processing. This is why methods of this generic function should be defined on bot class.
You can use CL-TELEGRAM-BOT2/API:PRE-CHECKOUT-QUERY-INVOICE-PAYLOAD
function
to extract payload from the query and find associated invoice.
This method is called when some state exits and returns a result using cl-telegram-bot2/term/back:back
function.
This method is called when chat actor's state is changed to a given STATE
.
Such hook can be used to send some prompt to the user.
This method is called when chat actor's state is returned from a given STATE
back to the previous state.
The method is called only when state is removed from the stack. When a new state is added to the stack, this method will not be called for a previous state.
Such hook can be used to hide a keyboard or to delete temporary messages.
This method is called by when processing a single update. It is called multiple times on different parts of an update. Whole pipeline looks like that:
For each update we call:
process-update(bot, update)
new_state = process-state(bot, current_state, update)
This generic-function will be called inside an actor.
Default method resposible for extracting the current state from the stack
and calling process-state
generic-function to get a new state.
CL-TELEGRAM-BOT2/HIGH
High level API
for implementing Telegram bots.
Classes
CHAT-STATE
Functions
Macros
Returns as the first value a list of messages created by reply
function called
during BODY
execution. Values returned by the BODY
code are returned as the second,
third and following arguments.
Also, messages are collected when these actions are called:
CL-TELEGRAM-BOT2/HIGH/CALLBACKS
Functions
Extracts callback query data from the UPDATE
object.
CL-TELEGRAM-BOT2/HIGH/KEYBOARD
Classes
CALL-CALLBACK
Readers
COPY-TEXT
Readers
OPEN-GAME
OPEN-LOGIN-URL
Readers
OPEN-URL
Readers
OPEN-WEB-APP
Readers
PAY-BUTTON
REQUEST-CHAT
Readers
REQUEST-CONTACT
REQUEST-LOCATION
REQUEST-POLL
Readers
If "quiz" is passed, the user will be allowed to create only polls in the quiz mode. If "regular" is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
API
: https://core.telegram.org/bots/api#keyboardbuttonpolltype
REQUEST-USERS
Readers
SWITCH-INLINE-QUERY-CHOOSEN-CHAT
Readers
SWITCH-INLINE-QUERY-CURRENT-CHAT
Readers
SWITCH-INLINE-QUERY
Readers
TEXT-BUTTON
Functions
Returns object of CL-TELEGRAM-BOT2/API:INLINE-KEYBOARD-MARKUP
class.
API
docs: https://core.telegram.org/bots/api#replykeyboardmarkup
Returns object of CL-TELEGRAM-BOT2/API:REPLY-KEYBOARD-MARKUP
class.
API
docs: https://core.telegram.org/bots/api#replykeyboardmarkup
CL-TELEGRAM-BOT2/HIGH/PERMISSIONS
Types
API
docs: https://core.telegram.org/bots/api#chatadministratorrights
(MEMBER :IS-ANONYMOUS :CAN-MANAGE-CHAT :CAN-DELETE-MESSAGES
:CAN-MANAGE-VIDEO-CHATS :CAN-RESTRICT-MEMBERS :CAN-PROMOTE-MEMBERS
:CAN-CHANGE-INFO :CAN-INVITE-USERS :CAN-POST-STORIES :CAN-EDIT-STORIES
:CAN-DELETE-STORIES :CAN-POST-MESSAGES :CAN-EDIT-MESSAGES
:CAN-PIN-MESSAGES :CAN-MANAGE-TOPICS)
(SOFT-LIST-OF CHAT-ADMINISTRATION-PERMISSION)
CL-TELEGRAM-BOT2/MATCH
Classes
MATCHER
Generics
Should return T if OBJ
match to the matcher. The simples matcher compares two strings.
CL-TELEGRAM-BOT2/MATCHERS/REGEX
Classes
REGEX-MATCHER
Readers
Functions
CL-TELEGRAM-BOT2/MATCHERS/STRING
Classes
STRING-MATCHER
Readers
Functions
CL-TELEGRAM-BOT2/SENT-MESSAGES
Functions
If some state class processes update and don't call CALL-NEXT-METHOD
,
then it have to call this function to register received message id.
If you don't do this, then received messages deletion will not work for this state.
Macros
Use this macro to capture messages end during process-state
generic-function handling
in case if your state inherits from base-state
but does not call CALL-NEXT-METHOD
.
CL-TELEGRAM-BOT2/SERVER
Functions
Start processing new updates from the Telegram API
.
Pass bot instance as the first argument and maybe some other optional arguments.
If DEBUG
argument is T, then bot will ignore updates which it can't to process without errors.
Otherwise, an interactive debugger will popup.
CL-TELEGRAM-BOT2/SPEC
Classes
TELEGRAM-OBJECT
CL-TELEGRAM-BOT2/STATE
Classes
STATE
Readers
Result of these handlers is ignored, but they can be used for side-effects.
Generic-function cl-telegram-bot2/generics:on-state-deletion will be called on these handlers.
Functions
Validates if argument is valid for passing as :ON-DELETION
argument to the state constructor.
It also normalizes an argument and return it as a list of workflow blocks.
Types
Type of ON-CALLBACK-QUERY
argument of the state
class.
(SOFT-LIST-OF CALLBACK)
CL-TELEGRAM-BOT2/STATE-WITH-COMMANDS
Classes
BASE-COMMAND
Readers
A command description like "/start" or "/help".
An fbound symbol of two arguments (command-argument update-obj) or a workflow object to return from process-state
generic-function.
A command name like "/start" or "/help".
COMMAND
GLOBAL-COMMAND
This command will be available during in all bot states.
STATE-WITH-COMMANDS-MIXIN
Readers
Functions
Types
(OR SYMBOL WORKFLOW-BLOCK WORKFLOW-BLOCKS)
CL-TELEGRAM-BOT2/STATES/ASK-FOR-CHOICE
Classes
ASK-FOR-CHOICE
Readers
Delete message with the keyboard and all warning messages when the choice was made or a new state was added to the stack.
Delete usual user messages which he might send by a mistake.
Accessors
Functions
CL-TELEGRAM-BOT2/STATES/ASK-FOR-NUMBER
Classes
ASK-FOR-NUMBER
Readers
Functions
CL-TELEGRAM-BOT2/STATES/ASK-FOR-TEXT
Classes
ASK-FOR-TEXT
Readers
Functions
CL-TELEGRAM-BOT2/STATES/BASE
Classes
BASE-STATE
Readers
Accessors
Generics
Functions
CL-TELEGRAM-BOT2/STATES/WAIT-FOR-PAYMENT
Classes
WAIT-FOR-PAYMENT
Readers
On success could be an fbound symbol which function returns a list of workflow blocks or a list of workflow blocks.
Functions
CL-TELEGRAM-BOT2/TERM/BACK
Classes
BACK-TO-ID
Readers
BACK-TO-NTH-PARENT
Readers
BACK-TO
Readers
BACK
Readers
Functions
CL-TELEGRAM-BOT2/TYPES
Types
(OR CL-TELEGRAM-BOT2/API:REPLY-KEYBOARD-MARKUP
CL-TELEGRAM-BOT2/API:REPLY-KEYBOARD-REMOVE
CL-TELEGRAM-BOT2/API:INLINE-KEYBOARD-MARKUP
CL-TELEGRAM-BOT2/API:FORCE-REPLY)
CL-TELEGRAM-BOT2/UTILS
Generics
Does a general deep-copy on the given object and sub-pieces. Returns atoms, numbers and chars. Runs copy-tree on lists, and copy-seq on other sequences. Runs copy-structure on pathnames, hash tables and other structure-objects
Functions
If value is a fbound SYMBOL
, then calls as a function and then returns a result.
If value is a fbound SYMBOL
, then calls as a function with given ARG
or without it depending on function arity.
Types
This type denotes symbols bound to the functions. Such symbol could be funcalled.
(AND SYMBOL (SATISFIES FBOUNDP))
CL-TELEGRAM-BOT2/VARS
Variables
This variable holds an alist associating special variable symbols to forms to evaluate.
State processing might be done by different threads that is why you might want to keep some context around.
Don't modify this variable, just cons onto it. Preceeding values will take a priority.
CL-TELEGRAM-BOT2/WORKFLOW
Types
(AND SYMBOL (SATISFIES FBOUNDP))
(OR FUNCALLABLE-SYMBOL BASE-STATE ACTION BACK)
(SOFT-LIST-OF WORKFLOW-BLOCK)