İçeriğe geç
BETA Voxnup şu an beta aşamasında. Hatalar ve eksiklikler olabilir — geri bildiriminiz bizim için çok değerli! Geri bildirim gönder
Voxnup

How to build a Voxnup bot (Voxnup Bot Manager v2)

Official Voxnup documentation Updated: Türkçe
In short

Voxnup bots are written in JavaScript and run in the Voxnup Bot Manager app (Windows and Linux, x64). Steps: 1) get an API key and create a bot on developer.voxnup.com, 2) download and open Bot Manager, 3) type bot new mybot in its console, 4) put your bot_token and api_key in bots/mybot.json, 5) start it with bot start mybot. In chat, /mybot:yardim lists the bot's commands.

Run your first bot

  1. Get an API key on the developer portal

    Sign in to developer.voxnup.com with your Voxnup account. On the API Anahtarı (API Key) page, click API Anahtarı Oluştur. You need an API key before you can create bots. Keep it secret; if you think it leaked, use Yenile (Regenerate) on the same page, and the old key stops working. The developer portal is in Turkish only.

  2. Create a bot and copy its token

    Botlarım (My Bots) → Yeni Bot (New Bot): a name (3–32 characters), a category and an optional description. After saving, the Bot bağlantı bilgileri (connection details) window shows the API Key and Bot Token. The bot gets its own account on the platform and shows a Voxnup Bot badge next to its name.

  3. Download and open Voxnup Bot Manager

    Download the Windows or Linux (x64) zip from the portal's Dokümantasyon (Docs) page, extract it and open the app (Voxnup.BotManager.exe on Windows, ./Voxnup.BotManager on Linux). No installer or .NET needed. The zip also contains a sample bot (bots/ornekbot.js).

  4. Create the bot from the template

    Type in the app's console:

    bot new mybot

    This creates bots/mybot.js (the bot code) and bots/mybot.json (the credentials). Type definitions for the whole API are in bots/voxbot.d.ts, which gives you autocomplete in editors such as VS Code.

  5. Put the credentials in the .json file

    bots/mybot.json:

    { "bot_token": "…", "api_key": "…", "owners": ["<your user key>"] }

    The API key must belong to the account that owns the bot. owners is for owner-only commands. Credentials never go in the .js file, so sharing the .js file is safe; don't share the .json. You can also use environment variables: VOXNUP_MYBOT_BOT_TOKEN, VOXNUP_MYBOT_API_KEY.

  6. Start the bot

    Type bot start mybot. The bot runs in the background and the console stays usable. Check it with bot status and read its log with bot logs mybot. To try it in a channel, the bot must join that channel like any user, through an invite link; channel roles and permissions apply to bots too.

Example bot

A bot is a JavaScript class that extends VoxBot. This example answers /selamci:zar (or !zar) with a dice roll and replies when it is mentioned:

/// <reference path="./voxbot.d.ts" />
class Selamci extends VoxBot {
    constructor() {
        super();
        this.name = "selamci";
        this.prefix = "!";   // "!zar" works too; "/selamci:zar" always works
        this.command("zar", { description: "Rolls a die", usage: "[sides]", cooldown: 3 }, (ctx) => {
            const n = parseInt(ctx.args[0]) || 6;
            ctx.reply(`🎲 ${Math.floor(Math.random() * n) + 1}`);
        });
    }
    onReady() { console.info("ready"); }
    onMessage(text, user, roomKey, channelKey, msg) {
        if (msg.mentionsMe) msg.reply(`Yes, ${user.displayName}?`);
    }
}
globalThis.bot_instance = new Selamci();

Every command option, event and method: Bot commands, events and methods.

Tip

While developing, use bot watch mybot: the bot reloads every time you save the file.

Frequently asked questions

Does Voxnup have a public API?

Yes. Bots sign in over REST (POST https://voxnup.com/api/v1/login?api_key=… with bot_token in the body) and connect in real time over a secure WebSocket. Voxnup Bot Manager handles this for you; details are in the developer docs.

Which systems does Bot Manager run on?

Windows and Linux (x64). To run it headless on a server: Run a bot 24/7 on a server.

Will my v1 bot still work?

Yes. v1 bots run unchanged, and the old bot activate command is the same as bot start. Moving the credentials from the .js file to the .json file is recommended.

Can a bot talk in a voice room?

No. A bot can join a voice room and moderate (move, deafen, kick from the room), but it can't send audio.

Can a bot access files on my computer?

No. Bot code runs in a sandbox with no access to the file system, the operating system or the local network. For persistent data it uses its own storage (getState / setState).

Related guides

Still stuck? Email support@voxnup.com. Tell us which device and browser you use and include the exact error text you see, and we'll get back to you quickly.