Files
X4Lo bd8f826bb6 watchCord: fix tracking bugs, add Vencord Toolbox actions
- Seed voice channels and statuses on start and when adding a user so
  the first leave/move/status change is detected
- Match server-specific status entries by guild membership
- Webhooks never ping (allowed_mentions) and are capped at 2000 chars
- Throttle repeated typing events, reuse a single AudioContext
- Dedupe associated voice logs, stable ids for legacy entries,
  cache parsed watch list, escape newlines in log file
- Replace fragile toolbar patch with toolbox actions and a modal
- Migrate to new Heading/Paragraph/Button and Modal components
2026-11-11 18:56:00 +00:00

446 lines
16 KiB
Markdown

# WatchCord
A comprehensive Vencord plugin for monitoring and logging Discord user activity, including voice channel changes and online status updates.
## 📋 Features
### Core Functionality
- **Voice Activity Tracking**: Monitor when specific users join, leave, or switch voice channels
- **Channel Members Logging**: Automatically logs existing users in a channel when a watched user joins
- **Associated Activity Tracking**: Logs when other users join or leave a watched user's current voice channel
- **Status Change Tracking**: Track when users change their online status (Online, Idle, DND, Offline, Invisible)
- **Message Watching**: Log when a watched user sends a message (works in servers and DMs)
- **Typing Watching**: Log when a watched user starts typing ("`User` started typing in `#channel`")
- **Per-User Configuration**: Customize tracking settings individually for each watched user
- **Server-Specific Tracking**: Watch users globally or only in specific servers
### Notification Options
- **Desktop Notifications**: Get native desktop notifications for tracked events
- **Sound Alerts**: Optional notification sounds for voice and status changes
- **Discord Webhooks**: Send activity logs (voice, status, messages, typing) to a Discord webhook for external monitoring
- **In-App Logs Viewer**: Built-in interface to view and filter activity logs
### Data Management
- **Persistent Logging**: All events are saved to a text file (`watchcord-logs.txt`)
- **In-Memory Cache**: Fast access to recent logs (last 500 entries)
- **Log Filtering**: Filter logs by type (Voice, Status, or All)
- **Easy Export**: Direct access to log file via "Open Log File" button
## 🚀 Installation
1. Ensure you have [Vencord](https://vencord.dev/) installed
2. Copy the `watchCord` folder to your Vencord `userPlugins` directory:
```
src/userPlugins/watchCord/
├── index.tsx
├── native.ts
└── README.md
```
3. Rebuild Vencord or restart Discord
4. Enable the plugin in Settings → Vencord → Plugins → WatchCord
## ⚙️ Configuration
### Plugin Settings
Access settings via: **Settings → Vencord → Plugins → WatchCord**
#### 1. Webhook URL (Optional)
- **Description**: Discord webhook URL for remote logging
- **Format**: `https://discord.com/api/webhooks/...`
- **Usage**: Leave empty to disable webhook notifications
- **Example**: Logs will be sent as messages to the specified webhook
#### 2. Enable Notifications
- **Description**: Show native desktop notifications for tracked events
- **Default**: Enabled
- **Note**: Requires notification permissions in your browser/client
#### 3. Debug Mode
- **Description**: Log verbose debug information to the DevTools console
- **Default**: Disabled
- **Usage**: Enable it, then open DevTools (Ctrl+Shift+I) → Console and filter by `WatchCord` to see a full trace of the message/typing pipeline (raw events, skip decisions, watch list, and the reason a match did or didn't happen)
- **Note**: `TYPING_START` fires for everyone typing in channels you can see, so this can be noisy — turn it off when done
### Watch List Manager
Add users to monitor with granular control:
#### Adding a User
1. **User ID**: Discord user ID (right-click user → Copy User ID)
2. **Server**: Choose specific server or "All Servers (*)"
3. **Tracking Options**:
- ✅ **Watch Voice**: Track voice channel activity
- ✅ **Watch Status**: Track online status changes
- 💬 **Watch Messages**: Log messages sent by the user
- ⌨️ **Watch Typing**: Log when the user starts typing
- 🔊 **Voice Sound**: Play sound on voice activity
- 🔊 **Status Sound**: Play sound on status changes
4. Click **Add Entry**
> 💡 Existing entries can be toggled inline: each entry in the watch list shows its own checkboxes, so you can enable/disable **Messages** or **Typing** (or any other flag) without removing and re-adding the user.
#### Watch List Display
Each entry shows:
- **User**: Username and User ID
- **Server**: Server name or "All Servers"
- **Active Features**: Icons indicating enabled tracking options
- **Remove Button**: Delete the watch entry
### Logs Viewer
View and manage activity logs:
#### Features
- **Filter Logs**: View All, Voice Only, Status Only, Messages Only, or Typing Only
- **Auto-Refresh**: Logs update every second
- **Color Coding**:
- 🟢 Green: Voice activity
- 🟡 Yellow: Status changes
- 🔵 Blue: Messages
- 🟣 Purple: Typing
- **Buttons**:
- **Open Log File**: Open `watchcord-logs.txt` in your default text editor
- **Open Full Status Changes**: Open `watchcord-full-status-changes.json` to view complete status change objects
- **Clear Logs**: Delete all logs (both in-memory and file)
- **Clear Status Changes**: Delete all full status change records
## 📊 Log Format
### Log Entry Structure
```
[MM/DD/YYYY, HH:MM:SS AM/PM] [TYPE] Message
```
### Log Types
#### Voice Activity - Watched Users
```
[2/11/2026, 3:45:12 PM] [VOICE] <@123456789>(Username-123456789) joined General(987654321) in ServerName(111222333)
└─ Existing users in channel: Alice(111111111), Bob(222222222), Charlie(333333333)
[2/11/2026, 3:47:30 PM] [VOICE] <@123456789>(Username-123456789) left General(987654321) in ServerName(111222333)
```
**Note**: When a watched user joins a voice channel, the plugin logs all existing users in that channel. If the channel is empty, it logs "Empty channel".
#### Voice Activity - Associated Users
```
[2/11/2026, 3:50:00 PM] [VOICE] <@444444444>(David-444444444) joined <@123456789>(Username)'s channel General(987654321) in ServerName(111222333)
[2/11/2026, 3:55:00 PM] [VOICE] <@444444444>(David-444444444) left <@123456789>(Username)'s channel General(987654321) in ServerName(111222333)
```
**Note**: When someone joins or leaves a channel where a watched user is currently present, those events are also logged.
#### Status Changes
```
[2/11/2026, 4:15:00 PM] [STATUS] <@123456789>(Username-123456789) status changed: Online → Away/Idle
[2/11/2026, 4:30:22 PM] [STATUS] <@123456789>(Username-123456789) status changed: Away/Idle → Offline
```
#### Messages
```
[2/11/2026, 5:00:12 PM] [MESSAGE] <@123456789>(Username-123456789) sent in general(987654321) in ServerName(111222333): "hello world"
```
#### Typing
```
[2/11/2026, 5:05:40 PM] [TYPING] <@123456789>(Username-123456789) started typing in general(987654321) in ServerName(111222333)
```
**Note**: In DMs, the channel name is replaced with the recipient's username (e.g. `started typing in Alice(123456789) in DM`).
#### System Events
```
[2/11/2026, 2:00:00 PM] [SYSTEM] WatchCord started
```
## 🔔 Webhook Integration
### Setup
1. Create a Discord webhook in your server:
- Server Settings → Integrations → Webhooks → New Webhook
- Copy the webhook URL
2. Paste the URL in WatchCord settings → Webhook URL
3. Save settings
### Webhook Message Format
#### Voice Activity
```
`[2/11/2026, 3:45:12 PM]` 🟢 <@123456789>(Username) joined General in ServerName
`[2/11/2026, 3:47:30 PM]` 🔴 <@123456789>(Username) left General in ServerName
```
#### Status Changes
```
`[2/11/2026, 4:15:00 PM]` <@123456789>(Username) status changed: Online → Away/Idle
```
#### Messages
```
`[2/11/2026, 5:00:12 PM]` 💬 <@123456789>(Username) sent in #general in ServerName: "hello world"
[Go to message](https://discord.com/channels/111222333/987654321/555555555)
```
The channel renders as a clickable link, and `[Go to message]` jumps directly to the message in Discord.
#### Typing
```
`[2/11/2026, 5:05:40 PM]` ⌨️ <@123456789>(Username) started typing in #general in ServerName
```
The channel renders as a clickable link.
**Note**: For DMs (which have no guild), the channel link falls back to the recipient's name, and the message jump link uses `@me` as the guild segment.
**Note**: User mentions (`<@123456789>`) will be clickable in Discord if they share servers with the webhook
## 📝 Advanced Logging Features
### Channel Member Tracking
When a watched user joins a voice channel, WatchCord automatically logs:
- The user joining the channel
- All existing members already in the channel (with usernames and IDs)
- If the channel is empty, it explicitly notes "Empty channel"
**Example scenario:**
```
Alice (watched user) joins "General Voice"
Bob and Charlie are already in the channel
```
**Log output:**
```
[2/11/2026, 3:45:12 PM] [VOICE] <@111111111>(Alice-111111111) joined General(987654321) in MyServer(123456789)
└─ Existing users in channel: Bob(222222222), Charlie(333333333)
```
### Associated User Tracking
WatchCord monitors voice activity around watched users by logging when:
- Someone joins a channel where a watched user is present
- Someone leaves a channel where a watched user is present
**Example scenario:**
```
Alice (watched user) is in "General Voice"
Bob joins the same channel
```
**Log output:**
```
[2/11/2026, 3:50:00 PM] [VOICE] <@222222222>(Bob-222222222) joined <@111111111>(Alice)'s channel General(987654321) in MyServer(123456789)
```
**Benefits:**
- See who is interacting with watched users
- Track social patterns and voice channel usage
- Identify who joins/leaves when specific people are present
**Important Notes:**
- These detailed logs are **only saved to the local log file**, not sent to webhooks
- Webhooks only receive simplified notifications about the watched user's own activity
- This prevents webhook spam while maintaining detailed local records
## 🎯 Use Cases
### Parental Monitoring
- Track when children join voice channels
- Monitor their online hours and status
### Community Management
- Monitor VIP members or moderators
- Track staff availability and activity
### Personal Security
- Monitor your own account across different devices
- Get alerted to unusual activity
### Research & Analytics
- Collect data on user behavior patterns
- Analyze voice channel usage statistics
## 🔧 Technical Details
### File Structure
```
watchCord/
├── index.tsx # Main plugin logic, UI components, event handlers
├── native.ts # Node.js/Electron file operations, webhook requests
└── README.md # This file
```
### Data Storage
- **Log File Location**: `%APPDATA%/discord/watchcord-logs.txt` (Windows)
- **Full Status Changes**: `%APPDATA%/discord/watchcord-full-status-changes.json` (Windows)
- **Watch List**: Stored in Vencord settings (JSON format)
- **In-Memory Logs**: Last 500 entries for quick access
### Full Status Change Logging
For debugging and advanced analysis, WatchCord logs the **complete status change object** from Discord to a separate JSON file.
**File**: `watchcord-full-status-changes.json`
**Format**: Each entry contains:
- **timestamp**: ISO 8601 timestamp
- **data**: Complete status change object from Discord's PRESENCE_UPDATES event
**Example entry**:
```json
{
"timestamp": "2026-02-26T15:30:45.123Z",
"data": {
"user": {
"id": "123456789",
"username": "ExampleUser",
"discriminator": "0001",
"avatar": "abc123...",
"bot": false,
"system": false
},
"status": "idle",
"activities": [
{
"name": "Visual Studio Code",
"type": 0,
"created_at": 1708960245000
}
],
"client_status": {
"desktop": "idle"
},
"guildId": "987654321"
}
}
---
```
**Benefits**:
- Full Discord presence data for debugging
- See activities, client status, and all metadata
- Useful for understanding Discord's status system
- Can be parsed programmatically for analysis
**Access**: Use the "Open Full Status Changes" button in the Logs Viewer
### Event Listeners
- `VOICE_STATE_UPDATES`: Monitors voice channel activity
- `PRESENCE_UPDATES`: Tracks online status changes
- `MESSAGE_CREATE`: Logs messages sent by watched users (skips your own `optimistic` messages)
- `TYPING_START`: Logs when watched users start typing (your own typing is ignored)
### Status Labels
| Discord Status | Display Label |
| -------------- | -------------- |
| `online` | Online |
| `idle` | Away/Idle |
| `dnd` | Do Not Disturb |
| `offline` | Offline |
| `invisible` | Invisible |
## 🎨 UI Features
### Toolbox Actions
- **Location**: Vencord Toolbox button in Discord's title bar (requires the built-in **VencordToolbox** plugin)
- **Open WatchCord**: Opens a modal with the watch list manager and the logs viewer
- **Open WatchCord Log File**: Opens `watchcord-logs.txt` in your default text editor
### Notification Sound
- **Type**: Procedurally generated beep
- **Frequency**: 800 Hz sine wave
- **Duration**: 0.5 seconds
- **Volume**: 30% (0.3 gain)
## 🐛 Troubleshooting
### Notifications Not Showing
1. Check if "Enable Notifications" is enabled in settings
2. Ensure Discord has notification permissions in your OS
3. Check browser/client notification settings
### Webhook Not Working
1. Verify webhook URL is correct and active
2. Check console for error messages (Ctrl+Shift+I)
3. Ensure webhook has permission to send messages
4. Test webhook with a curl command or webhook tester
### User Not Being Tracked
1. Verify User ID is correct
2. Check if tracking options are enabled (Voice/Status/Messages/Typing) for that entry
3. Ensure server selection matches where you want to track
4. User must be in a mutual server with you
### Messages or Typing Not Logging
1. Make sure **Messages** / **Typing** is ticked for the entry (use the inline checkboxes in the watch list)
2. Turn on **Debug Mode**, open DevTools (Ctrl+Shift+I) → Console, and filter by `WatchCord`
3. Trigger the event from the **watched** account — your own messages are skipped (`optimistic`) and your own typing never fires `TYPING_START`
4. Read the `reason` in the log: it shows whether the user isn't watched, the flag is off, or the guild doesn't match
5. For DMs, the entry must use **All Servers (*)**
### Logs Not Saving
1. Check file system permissions
2. Look for errors in DevTools console
3. Verify `watchcord-logs.txt` exists in Discord's app data folder
### Sound Not Playing
1. Check system audio settings
2. Verify "Play Sound" options are enabled for the user
3. Check browser audio permissions
4. Ensure volume is not muted
## 📝 Privacy & Ethics
**Important Considerations:**
⚠️ **User Privacy**: This plugin tracks other users' activity. Please use responsibly and ethically.
- Only track users with their knowledge and consent when possible
- Be aware of privacy laws in your jurisdiction
- Don't use this plugin to harass or stalk users
- Consider informing tracked users about monitoring
- Respect Discord's Terms of Service
**Data Security:**
- Logs are stored locally on your device
- Webhook data is transmitted over HTTPS
- No data is sent to third-party services (except configured webhooks)
## 📄 License
This plugin is part of Vencord and is licensed under GPL-3.0-or-later.
```
Vencord, a Discord client mod
Copyright (c) 2026 Vendicated and contributors
SPDX-License-Identifier: GPL-3.0-or-later
```
## 🤝 Contributing
Contributions are welcome! Please follow Vencord's contribution guidelines.
### Feature Ideas
- [ ] Export logs to CSV/JSON
- [ ] Activity graphs and statistics
- [ ] Custom notification sounds
- [ ] Regex-based filters for logs
- [ ] Schedule-based tracking (only track during certain hours)
- [ ] Multiple webhook support
## 📞 Support
For issues or questions:
1. Check the troubleshooting section above
2. Review Vencord's documentation
3. Open an issue in the Vencord repository
## 🙏 Acknowledgments
- Built for [Vencord](https://vencord.dev/)
- Thanks to the Vencord team and contributors
- Inspired by user activity monitoring needs in Discord communities
---
**Version**: 1.0.0
**Last Updated**: February 2026
**Compatibility**: Vencord (Discord Desktop/Web)