Blurred bg of logoDressed logo

Build Faster
Deploy Anywhere

A sleek, serverless-ready Discord API library.

183 API functions
Works with BunWorks with DenoWorks with Node.jsWorks with Cloudflare Workers
Dressed
import { createMessage } from "dressed";
 
createMessage("<CHANNEL_ID>", "Hello from Dressed!");
import { createConnection } from "@dressed/ws";
 
const connection = createConnection({ intents: ["GuildMessages"] });
 
connection.onMessageCreate((message) => {
  if (message.author.bot) return;
  if (message.content === "ping") {
    createMessage(message.channel_id, "Pong!");
  }
});
import { ActionRow, Button, Container, TextDisplay } from "dressed";
 
createMessage("<CHANNEL_ID>", {
  components: [
    Container(
      TextDisplay("# Hello!\nThis is a Components V2 message."),
      ActionRow(Button({ custom_id: "click_me", label: "Click me" })),
    ),
  ],
  flags: ["IsComponentsV2"],
});
import { createInteraction } from "dressed/server";
 
connection.onInteractionCreate((interaction) => {
  if (interaction.type !== 3) return;
  return createInteraction(interaction).reply("You like efficient code!");
});
Every other library¹
const { Client } = require("library.js");
 
const client = new Client({ intents: ["GuildMessages"] });
 
client.once("ready", async () => {
  const channel = await client.channels.fetch("<CHANNEL_ID>");
  await channel.send("Hello");
});
 
client.login(process.env.DISCORD_TOKEN);
client.on("messageCreate", (message) => {
  if (message.author.bot) return;
  if (message.content === "ping") {
    message.channel.send("Pong!");
  }
});
const { ContainerBuilder, TextDisplayBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require("discord.js");
 
client.once("ready", async () => {
  const channel = await client.channels.fetch("<CHANNEL_ID>");
 
  const container = new ContainerBuilder()
    .addTextDisplayComponents(
      new TextDisplayBuilder()
        .setContent("# Hello!\nThis is a Components V2 message.")
    )
    .addActionRowComponents(
      new ActionRowBuilder().addComponents(
        new ButtonBuilder()
          .setCustomId("click_me")
          .setLabel("Click me")
          .setStyle(ButtonStyle.Primary)
      )
    );
 
  await channel.send({
    components: [container],
    flags: ["IsComponentsV2"],
  });
});
¹: "Every other library" refers to how most other libraries seem to follow the same syntax, as such Discord.js (the leading JavaScript library) was used to create the comparison snippets. Comparisons were created in good faith and may not use abolutely optimized code for either library. The name library.js was used in the first snippet as it is the most general, discord.js is later used to show that logic may be specific to the discord.js library.