Socket
Book a DemoInstallSign in
Socket

kodkord

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kodkord

Minimal, zero-dependency, high-performance Discord HTTP REST client for Bun, written in NAPI-RS.

1.2.0
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

Kodkord

A small, ultra‑fast REST Client for Discord built with Rust using napi‑rs. Exposes a single Rest class to JavaScript/TypeScript, with built‑in rate‑limit handling and optional file attachments.

Installation

# Using npm
npm install kodkord

# Or with Bun
bun add kodkord

Example

import { Method, Rest } from "kodkord";

const rest = new Rest({
  authorization: `Bot ${process.env.TOKEN}`,
  user_agent   : "DummyBot/1.0"
});

rest.start_scheduler();

const result = await rest.request({ 
    method: Method.GET,
    route : "/users/@me"
});
console.log(result);

await rest.stop_scheduler(); // this kill the scheduler 
                             // and stops the runtime.

File Attachments

To send a file, include an attachments array on your request:

await rest.request({
    method: Method.POST,
    route : "/channels/123/messages",
    body  : JSON.stringify({
                content: "Here's my avatar",
                embeds: [{
                    image: {
                        url: `attachment://avatar.png`  // Must be the same as attachmen.name
                    }
                }]
            }),
    attachments: [{
        content_type: "image/png"                  ,
        name        : "avatar.png"                 ,
        field       : "file"                       ,
        data        : await Bun.file("avatar.png")
                            .arrayBuffer()
    }]
});

Under the hood it uses multipart/form-data and handles Discord’s rate limits for you.

🛠️ License

MIT © Kodkord Team

Keywords

discord

FAQs

Package last updated on 29 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.