import { use } from "rednode";
const voice = await use("voice"); // EDGEwave's edgewave-voice, or another provider
const line = await voice.speak("Choom, you look like hell.", "judy");
voice.$on("ended", (e) => { if (e.id === line.id) console.log("done"); });
console.log(`${voice.$info.name} speaks`);
Connects to the package that provides a role, such as
"voice", rather than to a package by its id (REDnode 0.44.0 or later). A provider says so in its rednode-app.json with"provides": ["voice"]and answers with its service file, as for service.connect; the handle is the same.Which package answers: the only one installed; or, with several, the one the player chose in the Mod Manager (its Provides section), else the only one switched on. With several and no choice,
userejects with their names, so the player decides which service (and whose bill) a mod uses. A handle keeps its provider: after the player chooses another, calluseagain to reach it.Rejects when no installed package provides the role, or as service.connect does. Pass the interface you expect for typed calls; the provider's docs say what it offers.