KlangDocs

    Open Klang

    Bot API reference

    View as Markdown

    Channels

    Reading one channel the bot can see. A server’s text or voice channel with its overwrites, a thread, or one of the bot’s direct messages, with an example of each.

    A channel

    HTTP
    GET /channels/{channel.id}

    One channel the bot can see. What comes back depends on what the ID is:

    The bot needs VIEW_CHANNEL in the channel; for a thread, in the channel the thread belongs to. The route counts in read-message, 50 every 10 seconds per bot, shared with reading one message.

    Status Code When
    404 10003 No such channel, or the bot can’t see it. Klang doesn’t say which.

    A text channel

    JSON
    {
      "id": "1571350333212610562",
      "guild_id": "1571350333212610560",
      "name": "general",
      "position": 0,
      "permission_overwrites": [],
      "nsfw": false,
      "flags": 0,
      "parent_id": null,
      "last_message_id": "1571350339420180482",
      "rate_limit_per_user": 0,
      "type": 0,
      "topic": null,
      "default_auto_archive_duration": 10080
    }

    A thread

    JSON
    {
      "id": "1571350339420180480",
      "type": 11,
      "guild_id": "1571350333212610560",
      "parent_id": "1571350333212610562",
      "name": "Saturday plans",
      "last_message_id": "1571350339550203904",
      "rate_limit_per_user": 0,
      "message_count": 1,
      "total_message_sent": 1,
      "member_count": 0,
      "flags": 0,
      "thread_metadata": {
        "archived": false,
        "auto_archive_duration": 10080,
        "archive_timestamp": "2026-11-15T02:25:15.195Z",
        "locked": false,
        "create_timestamp": "2026-11-15T02:25:15.195Z"
      },
      "owner_id": "1571350324312297472"
    }

    A thread’s rate_limit_per_user is its channel’s slow mode, which is the one that applies in it.

    A direct message

    JSON
    {
      "id": "1571350402322157569",
      "recipients": [
        {
          "id": "1571350327143452672",
          "username": "leo",
          "discriminator": "0",
          "global_name": "Leo",
          "avatar": null,
          "banner": null,
          "accent_color": null,
          "public_flags": 0
        }
      ],
      "last_message_id": "1571350402452180992",
      "flags": 0,
      "type": 1,
      "name": null
    }

    What bots can’t do with channels yet

    Creating, editing and deleting channels, changing overwrites, invites, pins and creating threads aren’t in the bot API yet: those routes answer 404. The compatibility table lists them. A bot learns about changes to channels through the gateway: see CHANNEL_CREATE and THREAD_CREATE.