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 🙏

© 2025 – Pkg Stats / Ryan Hefner

royal-selfbot

v1.0.5

Published

A Discord self-bot library. USE WITH EXTREME CAUTION - AGAINST DISCORD TOS.

Readme

Royal Code SelfBot


⚠️ EXTREME WARNING: USE AT YOUR OWN RISK!
Using self-bots violates Discord's Terms of Service and can lead to the permanent suspension of your Discord account.
This project is for educational purposes only to demonstrate API interactions.
DO NOT USE THIS FOR MALICIOUS PURPOSES OR TO VIOLATE DISCORD'S TOS.
The maintainers are not responsible for any action taken against your account.


Royal Code SelfBot is an experimental Node.js library for interacting with the Discord API using a user account (self-bot).
It provides a familiar structure to libraries like discord.js, but adapted for user tokens.
Includes support for @discordjs/voice (with limitations).


🚀 Quick Start

1. Install Dependencies

npm install royal-selfbot @discordjs/voice ws axios dotenv libsodium-wrappers
# or
yarn add royal-selfbot @discordjs/voice ws axios dotenv libsodium-wrappers

Requires Node.js v20 or newer


2. Set Up Your Token

Create a .env file in your project root:

DISCORD_USER_TOKEN=YOUR_DISCORD_USER_TOKEN_HERE

Never share your token! It grants full access to your account.


3. Basic Usage Example

// example.js
require('dotenv').config();
const { Client } = require('royal-selfbot');

const client = new Client();

client.on('ready', (readyClient) => {
    console.log(`Logged in as ${readyClient.user.tag}!`);
    console.log(`Watching ${readyClient.guilds.cache.size} guilds.`);
});

client.on('messageCreate', async (message) => {
    if (message.author?.id === client.user?.id) return;

    // Simple ping command
    if (message.content.toLowerCase() === '!selfping') {
        await message.reply('Pong!');
    }

    // Example: Get user info
    if (message.content.toLowerCase() === '!myinfo') {
        await message.channel.send(`Your Tag: ${message.author.tag}\nYour ID: ${message.author.id}`);
    }
});

client.on('error', (error) => {
    console.error('[Client Error]', error);
});

client.login(process.env.DISCORD_USER_TOKEN);

🔊 Voice Usage (Experimental)

Note: Joining voice channels with user tokens is blocked by Discord and will likely fail.

The library includes a voiceAdapterCreator for @discordjs/voice integration, but this is mostly for reference.


✨ Features

  • Event Handling: Listen for Discord gateway events (Ready, Message Create, etc.)
  • Messaging: Send, edit, and manage messages
  • REST API: Fetch users, guilds, channels
  • Voice Integration: Adapter for @discordjs/voice (limited for user tokens)
  • Caching: Basic caching for guilds, channels, users

📖 API Reference

Client

  • constructor(options?)
    Create a new selfbot client.

  • .login(token: string): Promise
    Log in with your Discord user token.

  • Events:

    • ready: Emitted when logged in and ready.
    • messageCreate: Emitted on every message received.
    • error: Emitted on error.

Message

  • .reply(content: string): Promise
    Reply to a message.

  • .edit(content: string): Promise
    Edit a message.

Guild

  • .fetch(): Promise
    Fetch guild info.

Channel

  • .send(content: string): Promise
    Send a message to a channel.

💡 Examples

Ping Command

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

User Info Command

client.on('messageCreate', async (message) => {
    if (message.content === '!myinfo') {
        await message.channel.send(`Your Tag: ${message.author.tag}\nYour ID: ${message.author.id}`);
    }
});

❓ FAQ

Q: Is this safe to use?
A: No. Self-bots are against Discord's ToS and can get your account banned.

Q: Can I use this for moderation or automation?
A: No. Use a bot account for legitimate automation.

Q: Will voice features work?
A: Voice is experimental and likely blocked for user tokens.

Q: Where can I get help?
A: Join the Royal Discord for discussion and limited support.


🤝 Community & Support

Join the Royal community Discord server for discussions, help (within reasonable limits respecting ToS), and updates:
Join Royal Discord

Self-botting is risky, and support is limited regarding actions that violate Discord's ToS.


⚖️ Disclaimer

This project is experimental and intended for educational purposes. Use of this library is entirely at your own risk.
The developers are not responsible for any consequences resulting from its use, including but not limited to account suspension or termination by Discord.
Always adhere to Discord's Terms of Service and Community Guidelines.