import { ConversationHandle } from "https://deno.land/x/grammy_conversations@v1.0.1/conversation.ts";
Internally used class which acts as a conversation handle.
Type Parameters
Properties
Internal flag, true
if the conversation is currently replaying in order
to jump back to an old state, and false
otherwise. Do not use unless
you know exactly what you are doing.
Utilities for building forms. Contains methods that let you wait for messages and automatically perform input validation.
Methods
Internal method, deactivates the conversation handle. Do not use unless you know exactly what you are doing.
Internal method, finalizes a previously generated slot. Do not use unless you know exactly what you are doing.
Internal method, logs an API call and returns the assigned slot. Do not use unless you know exactly what you are doing.
Internal method, logs an external operation and returns the assigned slot. Do not use unless you know exactly what you are doing.
Internal method, logs a wait call. Do not use unless you know exactly what you are doing.
Internal method, replays an API call operation and advances the replay cursor. Do not use unless you know exactly what you are doing.
Internal method, replays an external operation and advances the replay cursor. Do not use unless you know exactly what you are doing.
Internal method, replays a wait operation and advances the replay cursor. Do not use unless you know exactly what you are doing.
Internal method, creates a promise from a given value that will resolve at the given index in order to accurately restore the order in which different operations complete. Do not use unless you know exactly what you are doing.
Internal method, unlogs the most recent call. Do not use unless you know exactly what you are doing.
Safely performs an operation with side-effects. You must use this to wrap all communication with external systems that does not go through grammY, such as database communication or calls to external APIs.
This function will then make sure the operation is only performed once, and not every time a message is handled by the conversation.
It will need to be able to store the result value of this operation in
the session. Hence, it must store and load the result of the operation
according to your storage adapter. It is therefore best to only return
primitive values or POJOs. If you need to transform your data before it
can be stored, you can specify the beforeStore
function. If you need to
transform your data after it was loaded, you can specify the afterLoad
function.
Safely perform console.log
calls, but only when they should really be
logged (so not during replay operations).
Safely generates a random number from Math.random()
. You should use
this instead of Math.random()
in your conversation because
non-deterministic behavior is not allowed.
Skips handling the update that was received in the last wait
call. Once
called, the conversation resets to the last wait
call, as if the update
had never been received. The control flow is passed on immediately, so
that middleware downstream of the conversation can continue handling the
update.
Effectively, calling await conversation.skip()
behaves as if this
conversation had not received the update at all.
While the conversation rewinds its logs internally, it does not unsend
messages that you send between the calls to wait
and skip
.
Sleep for the specified number of milliseconds. You should use this instead of your own sleeping function so that you don't block the conversation while it is restoring a previous position.
Waits for a new update (e.g. a message, callback query, etc) from the user. Once received, this method returns the new context object for the incoming update.
Waits for a new update (e.g. a message, callback query, etc) that matches the given filter query. As soon as an update arrives that matches the filter query, the corresponding context object is returned.
Waits for a new update (e.g. a message, callback query, etc) from the given user. As soon as an update arrives from this user, the corresponding context object is returned.
Waits for a new update (e.g. a message, callback query, etc) that does
not fulfil a certain condition. This condition is specified via the given
predicate function. As soon as an update arrives for which the predicate
function returns false
, this method will return it.
Waits for a new update (e.g. a message, callback query, etc) that
fulfils a certain condition. This condition is specified via the given
predicate function. As soon as an update arrives for which the predicate
function returns true
, this method will return it.