npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

discord-self-lite

v0.1.8

Published

Lightweight Discord selfbot library

Readme

discord-self-lite

A lightweight Discord selfbot library for Node.js with minimal dependencies.

Installation

npm install discord-self-lite

Quick Start

const { Client } = require("discord-self-lite");

const client = new Client();

// Login with your user token
client.login("YOUR_TOKEN_HERE");

client.on("ready", (data) => {
  console.log(`Logged in as ${data.user.username}`);
});

client.on("messageCreate", async (message) => {
  if (message.content === "!ping") {
    await message.reply("Pong!");
  }
});

Features

  • ✅ WebSocket connection to Discord Gateway
  • ✅ REST API integration
  • ✅ Message sending and replying
  • ✅ Message reactions
  • ✅ Button clicking (with custom IDs or indices)
  • ✅ Channel and message fetching
  • Webhook support - Send messages to Discord webhooks
  • ✅ Minimal dependencies (only ws)

API Reference

Client

const { Client } = require("discord-self-lite");
const client = new Client();

Methods

  • client.login(token) - Login with user token
  • client.getChannel(channelId) - Get cached channel
  • client.fetchChannel(channelId) - Fetch channel from API
  • client.fetchMessage(channelId, messageId) - Fetch specific message

Properties

  • client.user - Current user object (available after ready event)
  • client.guilds - Map of cached guild instances
  • client.channels - Map of cached channel instances
  • client.sessionId - Session ID from Discord

Events

  • ready - Fired when client is ready
  • messageCreate - Fired when a message is created

User

Methods

  • user.setStatus(status) - Set user status ('online', 'idle', 'dnd', 'invisible')
  • user.setPresence(presence) - Set full presence data
  • user.setActivity(activity) - Set user activity

Properties

  • user.id - User ID
  • user.username - Username
  • user.discriminator - Discriminator (4-digit number)
  • user.avatar - Avatar hash

Message

Methods

  • message.reply(content, options) - Reply to the message
  • message.react(emoji) - React to the message
  • message.clickButton(identifier) - Click a button on the message
    • identifier can be:
      • null or omitted: clicks first button
      • number: clicks button at index (0-based)
      • string: clicks button with custom ID

Properties

  • message.content - Message content
  • message.author - Message author
  • message.channel - Message channel
  • message.guild - Message guild (null for DMs)
  • message.components - Message components (buttons, etc.)

Channel

Methods

  • channel.send(content, options) - Send a message to the channel
  • channel.fetchMessages(options) - Fetch messages from the channel

Properties

  • channel.id - Channel ID
  • channel.name - Channel name
  • channel.type - Channel type

Guild

Methods

  • guild.getChannels() - Get cached channels for this guild
  • guild.fetchChannels() - Fetch all channels for this guild from API
  • guild.getChannel(channelId) - Get a specific channel from cache
  • guild.fetchChannel(channelId) - Fetch a specific channel from API

Properties

  • guild.id - Guild ID
  • guild.name - Guild name
  • guild.icon - Guild icon hash
  • guild.ownerId - Guild owner ID

WebhookClient

Send messages to Discord webhooks with support for embeds and more.

const { WebhookClient } = require("discord-self-lite");
const webhook = new WebhookClient("YOUR_WEBHOOK_URL", {
  username: "My Bot",
  avatarURL: "https://example.com/avatar.png",
});

Constructor

  • new WebhookClient(url, options) - Create a webhook client
    • url - Discord webhook URL
    • options.username - Default username for messages
    • options.avatarURL - Default avatar URL for messages

Methods

  • webhook.send(content, options) - Send a message (supports text, embeds, and objects)
  • webhook.edit(messageId, content, options) - Edit a message
  • webhook.delete(messageId) - Delete a message
  • webhook.fetchMessage(messageId) - Fetch a message

Static Methods

  • WebhookClient.createEmbed(data) - Create an embed object
  • WebhookClient.parseURL(url) - Parse webhook URL to get ID and token

Examples

Basic Bot

const { Client } = require("discord-self-lite");

const client = new Client();

client.login("YOUR_TOKEN_HERE");

client.on("ready", (data) => {
  console.log(`Ready as ${data.user.username}`);
});

client.on("messageCreate", async (message) => {
  if (message.content.startsWith("!echo ")) {
    const text = message.content.slice(6);
    await message.reply(text);
  }
});

Button Interaction

client.on("messageCreate", async (message) => {
  if (message.components && message.components.length > 0) {
    // Click first button
    await message.clickButton();

    // Click button by index
    await message.clickButton(1);

    // Click button by custom ID
    await message.clickButton("confirm_button");
  }
});

Fetching Messages

const channel = await client.fetchChannel("CHANNEL_ID");
const messages = await channel.fetchMessages({ limit: 50 });

console.log(`Fetched ${messages.length} messages`);

Webhook Usage

const { WebhookClient } = require("discord-self-lite");

// Create webhook client
const webhook = new WebhookClient("YOUR_WEBHOOK_URL", {
  username: "My Bot",
  avatarURL: "https://example.com/avatar.png",
});

// Send simple message
await webhook.send("Hello from webhook!");

// Send with embed
const embed = WebhookClient.createEmbed({
  title: "Test Embed",
  description: "This is a test embed",
  color: 0x00ff00,
  fields: [
    { name: "Field 1", value: "Value 1", inline: true },
    { name: "Field 2", value: "Value 2", inline: true },
  ],
});

await webhook.send("Check out this embed!", { embeds: [embed] });

// Send object payload (new flexible way)
await webhook.send({
  content: "Multiple embeds!",
  embeds: [embed1, embed2],
  username: "Multi-Embed Bot",
});

// Send just embeds
await webhook.send({ embeds: [embed] });

// Send array of embeds
await webhook.send([embed1, embed2]);

Important Notes

⚠️ Selfbots are against Discord's Terms of Service

This library is for educational purposes only. Using selfbots can result in account termination. Use at your own risk.

License

GPL3.0