@openpets/discord
v1.0.1
Published
Search and read messages from Discord servers, list channels, send messages using a Discord bot, and connect personal Discord accounts via mautrix-discord Matrix bridge
Downloads
17
Maintainers
Readme
Discord Pet
Discord integration for reading messages, listing channels, and managing servers. Supports both Discord Bot API and mautrix-discord Matrix bridge for personal account access.
Features
Bot API Features
- List servers (guilds) the bot has access to
- List channels in a server
- Read and search messages
- Send messages (when enabled)
- Generate bot invite URLs
Matrix Bridge Features (via mautrix-discord)
- Connect personal Discord accounts without a bot
- QR code and token-based login
- Bridge Discord servers to Matrix
- Access DMs and private servers
Quick Start
Option 1: Bot Token (Recommended for Servers)
- Create a Discord Application at https://discord.com/developers/applications
- Go to Bot section and create a bot
- Copy the bot token
export DISCORD_BOT_TOKEN="your-bot-token"
export DISCORD_APPLICATION_ID="your-app-id"- Use
discord-generate-invite-urlto get an invite link and add the bot to your server
Option 2: Matrix Bridge (For Personal Accounts)
- Deploy mautrix-discord: https://github.com/mautrix/discord
- Configure the bridge and get the shared secret from your config
export DISCORD_BOT_TOKEN="dummy" # Required but not used for bridge
export MAUTRIX_BRIDGE_URL="https://your-bridge.example.com"
export MAUTRIX_SHARED_SECRET="your-provisioning-secret"- Use
discord-bridge-login-tokenordiscord-bridge-login-qrto connect
Environment Variables
Required
| Variable | Description |
|----------|-------------|
| DISCORD_BOT_TOKEN | Discord Bot Token from Developer Portal |
Optional
| Variable | Description |
|----------|-------------|
| DISCORD_APPLICATION_ID | Application ID for generating invite URLs |
| DISCORD_PUBLIC_KEY | For webhook verification (interactions) |
| DISCORD_ENABLE_POSTING | Set to true to enable sending messages |
| MAUTRIX_BRIDGE_URL | URL of your mautrix-discord bridge instance |
| MAUTRIX_SHARED_SECRET | Bridge provisioning API shared secret |
Available Tools
Bot API Tools
discord-bot-status- Check bot connection statusdiscord-verify-setup- Verify configuration and diagnose issuesdiscord-generate-invite-url- Generate OAuth2 bot invite URLdiscord-join-server- Get instructions for adding bot to a serverdiscord-list-guilds- List accessible serversdiscord-list-channels- List channels in a serverdiscord-get-channel-info- Get channel detailsdiscord-get-channel-messages- Read messages from a channeldiscord-fetch-all-messages- Fetch all messages with paginationdiscord-search-messages- Search messages in a guilddiscord-send-message- Send a message (requires DISCORD_ENABLE_POSTING)discord-get-guild-info- Get server details
Bridge Tools (when MAUTRIX_BRIDGE_URL is configured)
discord-bridge-status- Check bridge connection statusdiscord-bridge-login-qr- Start QR code login flowdiscord-bridge-login-token- Login with Discord tokendiscord-bridge-logout- Disconnect Discord accountdiscord-bridge-guilds- List guilds via bridgediscord-bridge-connect-guild- Bridge a guild to Matrix
Usage Examples
# List all servers
opencode run "list all discord servers I have access to"
# Read recent messages
opencode run "get the last 20 messages from channel 123456789"
# Search for content
opencode run "search for messages containing 'meeting' in the server"
# Check bridge status
opencode run "check my discord bridge connection status"
# Login via bridge
opencode run "login to discord using token"Getting IDs
- Enable Developer Mode in Discord (User Settings > Advanced > Developer Mode)
- Right-click any server, channel, or user to copy their ID
Getting a User Token (for Bridge)
- Log into Discord in a browser (private window recommended)
- Open Developer Tools (F12 or Cmd+Shift+I)
- Go to Network tab, filter by
api - Reload the page
- Click any successful request
- Find
Authorizationheader in Request Headers - Copy the token value
Note: User tokens should be kept private and not shared.
mautrix-discord Setup
For detailed bridge setup instructions, see:
- https://docs.mau.fi/bridges/go/discord/index.html
- https://github.com/mautrix/discord
Basic Docker setup:
services:
mautrix-discord:
image: dock.mau.dev/mautrix/discord:latest
volumes:
- ./config:/data
ports:
- "29334:29334"