The method wallet.voice.buy()
is used to purchase voice tokens using the bot's wallet. It requires specifying the priority of the bot's wallet. After purchasing the voice tokens, the bot automatically starts a voice chat.
Note: When buying boost and voice tokens, the bot will automatically start a boost or voice chat session in the room rather than just purchasing the tokens.
const { Prioreties } = require("highrise.sdk");
// Assuming you have defined the Highrise instance as "bot".
bot.on("chatCreate", async (user, message) => {
if (message === "buy voice") {
bot.wallet.voice.buy(Priorities.BotWalletAndUser).then(() => {
console.log("The bot has successfully bought voice tokens");
}).catch(e => console.error(e));
}
});
Go Back: Buy & Fetch Wallet