← Back to Plugins
Channels

Moltbot Discord User

d-roak By d-roak 👁 19 views ▲ 0 votes

Discord user account monitoring plugin for Moltbot (selfbot - read-only)

GitHub

Install

npm install

#

README

# Moltbot Discord User Plugin

## β›” PROJECT STATUS: ARCHIVED - DO NOT USE

**This project has been abandoned after account was flagged within 45 minutes of first use.**

Read the full post-mortem: [POSTMORTEM.md](./POSTMORTEM.md)

### What Happened

- Built Discord selfbot for read-only monitoring
- Connected once to test functionality
- **Account flagged in < 1 hour**
- Discord's detection is extremely fast and effective

### Recommendation

**Use Matrix bridges instead:**
- βœ… Legal and safe
- βœ… No ban risk
- βœ… Works with Moltbot
- See: https://github.com/matrix-org/matrix-appservice-discord

---

**⚠️ ORIGINAL DISCLAIMER:** This plugin uses Discord user account automation (selfbot), which violates Discord's Terms of Service. Account suspension/ban is **highly likely** if used.

## Overview (Historical - Do Not Use)

**ARCHIVED PROJECT - ACCOUNT WAS FLAGGED ON FIRST USE**

This was an attempt at read-only Discord monitoring for Moltbot. It connected to Discord as a user account to monitor:
- All DMs (direct messages)
- All servers (guilds) you're in
- All channels you have access to
- Real-time message stream

**Features:**
- πŸ“± Full DM access
- 🏰 All server messages
- πŸ“¨ Real-time message monitoring
- πŸ”’ Read-only mode (no sending)
- πŸ” Session persistence

## Installation

```bash
# From the repo directory
npm install

# Build the plugin
npm run build

# Install into Moltbot
moltbot plugins install ./path/to/moltbot-discord-user
```

## Configuration

### 1. Get Your Discord User Token

**Desktop/Web method:**
1. Open Discord (desktop app or web)
2. Press `Ctrl+Shift+I` (Windows/Linux) or `Cmd+Option+I` (Mac) to open DevTools
3. Go to **Network** tab
4. Refresh the page (`Ctrl+R` or `Cmd+R`)
5. Filter by "api" or "gateway"
6. Click on any Discord API request
7. Look in **Headers** β†’ **Request Headers** β†’ **authorization**
8. Copy the token (long string starting with `mfa.` or similar)

**Alternative: Token grabber script (included):**
```bash
node scripts/get-token.js
```

### 2. Configure Moltbot

Add to your Moltbot config (`~/.moltbot/moltbot.json` or `~/.config/moltbot/config.jsonc`):

```json5
{
  "channels": {
    "discord-user": {
      "enabled": true,
      "token": "YOUR_DISCORD_USER_TOKEN",
      "dmPolicy": "open",
      "groupPolicy": "open"
    }
  }
}
```

**Or use environment variable:**
```bash
export DISCORD_USER_TOKEN="YOUR_DISCORD_USER_TOKEN"
```

### Configuration Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `enabled` | boolean | `false` | Enable the plugin |
| `token` | string | - | Discord user token (required) |
| `dmPolicy` | string | `"open"` | DM access policy |
| `groupPolicy` | string | `"open"` | Server/channel access policy |
| `allowFrom` | array | `[]` | User ID allowlist (optional) |
| `servers` | object | `{}` | Per-server configuration |
| `readOnly` | boolean | `true` | Enforce read-only mode |

### Per-Server Configuration

```json5
{
  "channels": {
    "discord-user": {
      "servers": {
        "123456789012345678": {
          "enabled": true,
          "channels": {
            "general": { "monitor": true },
            "456789012345678901": { "monitor": true }
          }
        }
      }
    }
  }
}
```

## Usage

Once configured and running:

1. Start Moltbot gateway
2. Plugin connects to Discord using your user token
3. Messages from monitored DMs/servers flow into Moltbot
4. Access via Moltbot sessions:
   - DMs: `discord-user:dm:<userId>`
   - Servers: `discord-user:guild:<guildId>:channel:<channelId>`

## Safety Recommendations

To reduce detection risk:

1. **Read-only mode** - Default, don't send messages via selfbot
2. **Rate limiting** - Built-in delays between API calls
3. **Realistic behavior** - Plugin mimics normal user activity patterns
4. **No mass operations** - Avoid bulk reads/scraping
5. **Monitor infrequently** - Don't run 24/7 unless necessary

## Development

```bash
# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Clean build artifacts
npm run clean
```

## How It Works

1. Connects to Discord Gateway as a user client
2. Authenticates with your user token
3. Receives message events via WebSocket
4. Forwards messages to Moltbot's message bus
5. Moltbot routes them to appropriate sessions

## Troubleshooting

**"Invalid token"**
- Token expired or incorrect
- Get a fresh token using the method above

**"Connection failed"**
- Discord may be blocking the connection
- Check if your account has 2FA enabled
- Verify token is correct

**"No messages received"**
- Plugin may not be monitoring the right servers/channels
- Check `servers` configuration
- Verify `dmPolicy` and `groupPolicy` settings

**Account banned/suspended**
- Discord detected selfbot activity
- Create a new account or appeal to Discord support
- Use with more caution going forward

## License

MIT

## Contributing

Issues and PRs welcome. Remember: this is for personal monitoring only.

---

**Reminder:** Using this plugin violates Discord's Terms of Service. Use at your own risk.
channels

Comments

Sign in to leave a comment

Loading comments...