Bot API rehberi

Portal üzerinden uygulama ve bot token oluşturduktan sonra REST API, event gateway ve voice join akışını kullanarak botunu bağlayabilirsin.

Komut akışı

Botlar slash komutlarını seçenek şemasıyla senkronize edebilir; desktop istemci bu kaydı autocomplete yüzeyinde gösterir ve seçilen komutu interaction endpoint’i üzerinden APPLICATION_COMMAND eventi olarak iletir.

PUT ${API_ORIGIN}/api/bot/v1/commands
{
  "commands": [
    {
      "name": "play",
      "description": "Play a track in voice",
      "options": [
        { "name": "url", "description": "Track URL", "type": "string", "required": true }
      ]
    }
  ]
}

POST ${API_ORIGIN}/api/channels/{channelId}/interactions/commands
{
  "commandId": "<registered-command-id>",
  "rawInput": "/play https://example.com/audio.mp3"
}

REST akışı

Bot token ile sunucuları listele, kanalları oku, mesaj gönder ve typing tetikle.

curl -H "Authorization: Bearer <bot-token>" \
  {API_ORIGIN}/api/bot/v1/servers

Gateway akışı

WebSocket bağlantısı HELLO, IDENTIFY ve HEARTBEAT çerçevesi ile açılır; mesaj ve voice olayları DISPATCH paketleri olarak gelir.

const socket = new WebSocket("${GATEWAY_ORIGIN}/gateway/bot");
socket.onmessage = (event) => console.log(JSON.parse(event.data));

Voice akışı

Bot, voice join endpoint’inden LiveKit token alır ve aynı kimlikle ses odasına bağlanıp audio publish eder.

POST /api/bot/v1/channels/{channelId}/voice/join
=> { token, url, channelId, participants }