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's bot field 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>
sendData payloads 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 initData is signed with (32 bytes, hex), or null while the server does not sign.
no setter

Methods

ackWebAppData(WebAppData data) → Future<void>
Done with a sendData payload: removes it from my_web_app_data.
answer(BotCallback press, {String text = '', bool showAlert = false, String url = ''}) → Future<void>
Answers a press: text as a short notice, or an alert the person closes (showAlert); url opens in their app.
checkInitData(String initData, {Duration maxAge = defaultInitDataMaxAge, InitDataReplayGuard? replayGuard}) → Future<WebAppUser?>
Who really opened the web app initData came from, or null when it cannot be trusted: another bot's, older than maxAge, a bad signature, or (unsigned) a session this bot does not have. With a replayGuard, 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 message in its chat, quoting it.
send(Int64 conversationId, String text, {String buttons = '', Int64? replyTo}) → Future<void>
Sends text to conversationId, with an inline keyboard (buttons, see inlineKeyboard) and as a reply to replyTo.
sessionFor(String nonce) → WebAppSession?
The web app session nonce belongs 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; empty buttons removes them.
setCommands(String commands) → Future<void>
Sets the command menu: one command - what it does per 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, see replyKeyboard) in conversationId, to everyone or only to forUser; 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 conversationId while the bot works.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

connect({required String token, AxiyServer server = AxiyServer.production, String? host, String? database, bool ssl = true}) → Future<AxiyBot>
Connects as the bot whose token "Bot yaratish" showed once, on the server it was created on. host and database override it, for a local server.