AxiyBot class
A bot program's connection to Axiy: what reaches the bot as streams, what it can do as methods. Thin on purpose — everything else is the generated client.
Properties
-
callbacks
→ Stream<
BotCallback> -
New presses of the bot's callback buttons, to answer.
no setter
- client → SpacetimeDbClient
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The bot's id as
initData'sbotfield carries it.no setter - identity → Identity?
-
no setter
-
messages
→ Stream<
Message> -
New messages from people (and other bots) in the bot's chats.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
webAppData
→ Stream<
WebAppData> -
sendDatapayloads from the bot's web apps, to ackWebAppData once handled. Includes ones that arrived while the bot was offline.no setter - webAppPublicKey → String?
-
The key web app
initDatais signed with (32 bytes, hex), or null while the server does not sign.no setter
Methods
-
ackWebAppData(
WebAppData data) → Future< void> -
Done with a
sendDatapayload: removes it frommy_web_app_data. -
answer(
BotCallback press, {String text = '', bool showAlert = false, String url = ''}) → Future< void> -
Answers a press:
textas a short notice, or an alert the person closes (showAlert);urlopens in their app. -
checkInitData(
String initData, {Duration maxAge = defaultInitDataMaxAge, InitDataReplayGuard? replayGuard}) → Future< WebAppUser?> -
Who really opened the web app
initDatacame from, or null when it cannot be trusted: another bot's, older thanmaxAge, a bad signature, or (unsigned) a session this bot does not have. With areplayGuard, each nonce is accepted once (see verifyInitData). -
close(
) → Future< void> -
cloudStorageOf(
Identity user) → Map< String, String> -
user's CloudStorage for this bot, key → value. -
deleteMessage(
Int64 messageId) → Future< void> -
editMessage(
Int64 messageId, String text) → Future< void> -
Changes the text of the bot's message
messageId. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reply(
Message message, String text, {String buttons = ''}) → Future< void> -
Answers
messagein its chat, quoting it. -
send(
Int64 conversationId, String text, {String buttons = '', Int64? replyTo}) → Future< void> -
Sends
texttoconversationId, with an inline keyboard (buttons, seeinlineKeyboard) and as a reply toreplyTo. -
sessionFor(
String nonce) → WebAppSession? -
The web app session
noncebelongs to, if it is the bot's and fresh: how a bot backend learns who really opened its page. -
setButtons(
Int64 messageId, String buttons) → Future< void> -
Replaces the buttons under the bot's message
messageId; emptybuttonsremoves them. -
setCommands(
String commands) → Future< void> -
Sets the command menu: one
command - what it doesper line. -
setMenuButton(
String text, String url) → Future< void> - Sets the menu button left of the message field (Mini App bots only).
-
setReplyKeyboard(
Int64 conversationId, String keyboard, {bool resize = true, bool oneTime = false, String placeholder = '', Identity? forUser}) → Future< void> -
Shows a reply keyboard (
keyboard, seereplyKeyboard) inconversationId, to everyone or only toforUser; an empty one removes it. -
toString(
) → String -
A string representation of this object.
inherited
-
typing(
Int64 conversationId, {bool on = true}) → Future< void> -
Shows "yozmoqda…" in
conversationIdwhile the bot works.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited