Aller au contenu
Afficher dans l'application

Une meilleure façon de naviguer. En savoir plus.

Asterobot

Une application plein écran sur votre écran d'accueil avec notifications push, badges et plus encore.

Pour installer cette application sur iOS et iPadOS
  1. Appuyez sur Icône de partage dans Safari
  2. Faites défiler le menu et appuyez sur Ajouter à l'écran d'accueil.
  3. Appuyez sur Ajouter dans le coin supérieur droit.
Pour installer cette application sur Android
  1. Appuyez sur le menu à trois points (⋮) dans le coin supérieur droit du navigateur.
  2. Appuyez sur Ajouter à l'écran d'accueil ou Installer l'application.
  3. Confirmez en appuyant sur Installer.

asterobot:runtime

(0 notes)

asterobot:runtime lets a script read facts about the packages it's made of: its own package, the packages it depends on, and the built-in asterobot: modules. Nothing in it can change a package.

import { packages } from "asterobot:runtime";

packages is the module's only export. It's a frozen object with one function, info(). There's no flat info export, so it can't be confused with info() from asterobot:console.

packages.info()

packages.info(name) returns a frozen PackageInfo object.

Parameter Type Description
name string A package name, such as "my-first-script" or "@alice:pathfinder", or the name of a built-in module, such as "asterobot:protocol"

The names it knows are:

  • every package in the running script: the bot's package and, all the way down, the packages its dependencies lock;
  • the built-in modules asterobot:protocol, asterobot:bot, asterobot:timers, asterobot:gamedata, asterobot:console and asterobot:runtime.

asterobot:parameters isn't one of them: each package has its own copy of that module, and asking for it throws package "asterobot:parameters" is not installed.

An inline script, loaded as code rather than as a library package, is the package api-script with the version local.

packages.info() throws when:

Error Type Cause
packages.info requires a module or package name TypeError name is missing, empty or not a string. Despite the wording, a module path isn't accepted.
package "<name>" is not installed Error No package in the running script has that name
package "<name>" is ambiguous across <count> locked versions Error The script's dependencies lock more than one version of that package, so the name alone doesn't say which
const self = packages.info("my-first-script");
botInfo(`${self.name} ${self.version}, ${self.provenance}`);

On a local package, this writes my-first-script 1.0.0, local to the bot's console.

packages.info() also answers while Asterobot reads the package's declarations, so a declaration can use it.

PackageInfo

Property Type Value
name string The package's name
version string The package's version. "embedded" for a built-in module.
publisher string The part before the colon in @publisher:name: "asterobot" for official packages and built-in modules, "" for a local package
provenance string "local", "official", "community", or "builtin" for a built-in module
integrity string The checksum Asterobot recorded when it installed the package from the marketplace, starting with sha256-. "" when there's none, as for a local package, and "embedded" for a built-in module.
permissions array of strings The permissions listed in the package's asterobot.json. An empty array when it lists none, and always for a built-in module.
compatibleVersion string The Asterobot versions the package declared it works with, such as ">=1.5.0 <2.0.0", or ""

The type in the editor also lists "builtin-native" as a possible provenance. Asterobot never returns it.

A package's provenance comes from its name: a name starting with @asterobot: is official, another name starting with @ is community, and a name without @ is local. Names and versions explains the rules, The manifest describes asterobot.json, and Compatibility covers compatibleVersion.

Permissions

permissions only reports what a package declares. Asterobot doesn't check it today: any package can use every function of every built-in module, whatever it lists.

Note

Coming soon. Asterobot will enforce the permissions a package declares. Until then, treat the list as information for the people who install your package. Permissions has the details.

Commentaires des utilisateurs

Aucun avis à afficher.

Compte

Navigation

Recherche

Recherche

Configurer les notifications push du navigateur

Chrome (Android)
  1. Appuyez sur l'icône de cadenas à côté de la barre d'adresse.
  2. Tap Autorisations → Notifications.
  3. Ajustez vos préférences.
Chrome (Desktop)
  1. Cliquez sur l'icône représentant un cadenas dans la barre d'adresse..
  2. Select Paramètres du site.
  3. Find Notifications et ajustez vos préférences.