Initial commit: autoMover, friendsCheck, watchCord plugins and README

This commit is contained in:
X4Lo committed 2026-11-11 17:41:39 +00:00
commit f06f2f493b
11 files changed
+3799

No files matched your search

+122
View File
@@ -0,0 +1,122 @@
# autoMover
A Vencord plugin that automatically moves target users randomly between voice channels when they connect, disconnects them, or applies server mute/deafen on join.
## Features
- **Multi-user support** — add multiple users with per-user configuration
- **Auto-move** — moves a user to random voice channels every N milliseconds
- **Auto-disconnect** — disconnects a user as soon as they join a voice channel
- **Auto server mute** — server-mutes a user when they join a voice channel
- **Auto server deafen** — server-deafens a user when they join a voice channel
- **Mutual exclusion** — auto-move and auto-disconnect cannot be active simultaneously for the same user/server; enabling one automatically disables the other
- **Independent actions** — server mute and server deafen work independently of move/disconnect; they can be combined with any mode
- **Per-user toggle** — enable/disable for individual users
- **Configurable delay** — set the interval between moves in milliseconds (default: 2000)
- **Server-specific** — target a specific server or all servers (`*`)
- **Right-click context menu** — four checkboxes:
- **Auto Mover** — toggle auto-move
- **Auto Disconnect** — toggle auto-disconnect
- **Auto Server Mute** — toggle server mute on join
- **Auto Server Deafen** — toggle server deafen on join
- **Optional DM** — send a custom DM message when the action starts
- **Immediate start** — if the user is already in a voice channel when toggled on, the action starts right away
- **Safe toggling** — toggling any setting while a loop is running stops the old loop and restarts with the new configuration
- **Toolbar button** — shuffle icon in the Discord toolbar for quick access to plugin settings
## Installation
1. Copy the `autoMover` folder to your Vencord `userPlugins` directory:
```
src/userPlugins/autoMover/
├── index.tsx
└── README.md
```
2. Rebuild Vencord or restart Discord
3. Enable the plugin in Settings → Vencord → Plugins → autoMover
## Configuration
### Settings UI
Access via: **Settings → Vencord → Plugins → autoMover** or click the shuffle icon in the toolbar.
#### Adding an Entry
1. Enter the **User ID** (enable Developer Mode → right-click user → Copy User ID)
2. Select the **Server** to watch (or "All Servers")
3. Choose mode:
- Unchecked **Auto Disconnect** → auto-move (moves user between channels)
- Checked **Auto Disconnect** → disconnect (kicks from voice on join)
4. For auto-move: set the **Delay** in milliseconds (default: 2000)
5. Optionally enable **Server Mute** / **Server Deafen** (works with any mode)
6. Optionally enable **Send DM on start** and set a message
7. Click **Add Entry**
#### Managing Entries
Each entry in the list shows:
- **User** and **Server** display
- **Mode**: Move (with delay) or Disconnect
- **Enabled** checkbox — master on/off; toggling on restarts if user is in VC
- **Disconnect** checkbox — switches between move and disconnect mode; stops any active loop and restarts with the new mode
- **Server Mute** checkbox — toggle server mute on join (independent)
- **Server Deafen** checkbox — toggle server deafen on join (independent)
- **Send DM** checkbox — toggle DM sending
- **Delay input** (visible in Move mode) — milliseconds between moves
- **DM message** text input (visible when Send DM is enabled)
- **Remove** button — delete the entry
### Right-Click Context Menu
Right-click any user anywhere in Discord:
| Menu Item | What it does |
|-----------|-------------|
| **Auto Mover** | Creates/enables entry with auto-move mode. Disables auto-disconnect if it was active. Starts immediately if user is already in VC. |
| **Auto Disconnect** | Creates/enables entry with disconnect mode. Disables auto-move if it was active. Disconnects immediately if user is already in VC. |
| **Auto Server Mute** | Toggles server mute on join. Independent — does not affect move/disconnect. Applies immediately if user is already in VC. |
| **Auto Server Deafen** | Toggles server deafen on join. Independent — does not affect move/disconnect. Applies immediately if user is already in VC. |
Both options are mutually exclusive — checking one unchecks the other for the same user/server.
## How It Works
### Auto-Move Mode
1. The plugin listens to `VOICE_STATE_UPDATES` events
2. When a tracked and enabled user connects to a voice channel in the configured server:
- Optionally sends a DM (if configured)
- Picks a random voice channel in the server (different from their current one)
- Moves the user via Discord's HTTP API
- Repeats after the configured delay
3. Stops when:
- The user disconnects from voice
- The entry is disabled
- The mode is switched to disconnect
- The entry is removed
- No other voice channels are available
### Auto-Disconnect Mode
1. When a tracked and enabled user connects to a voice channel:
- Optionally sends a DM (if configured)
- Applies server mute/deafen if configured
- Disconnects them immediately via Discord's HTTP API (`channel_id: null`)
2. This is a one-shot action — no loop
### Auto Server Mute / Deafen
1. When a user connects to a voice channel and has server mute/deafen enabled:
- Applies `mute: true` and/or `deaf: true` via Discord's HTTP API
2. Works independently of auto-move and auto-disconnect
3. Can be combined with any other mode
## Permissions Required
You need the **Move Members** permission in the target server for auto-move and auto-disconnect. Server mute requires **Mute Members**, and server deafen requires **Deafen Members**. Without the appropriate permission, the corresponding action will silently fail (logged to console).
## 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
```
+244
View File
@@ -0,0 +1,244 @@
# autoMover — Detailed Documentation
## Architecture Overview
The plugin operates on a list of `MoveItem` entries, one per (user, server) pair. Each entry carries all configuration for that target. Entries are persisted as JSON in Vencord's plugin settings.
```
┌─────────────────────────────────────────────────────┐
│ autoMover Plugin │
├─────────────────────────────────────────────────────┤
│ Settings UI (MoveListManager) │
│ ├─ Add / remove / toggle entries │
│ └─ Reads/writes Vencord.Settings.plugins.autoMover │
├─────────────────────────────────────────────────────┤
│ Context Menu (user-context) │
│ ├─ Auto Mover checkbox │
│ ├─ Auto Disconnect checkbox │
│ ├─ Auto Server Mute checkbox │
│ └─ Auto Server Deafen checkbox │
├─────────────────────────────────────────────────────┤
│ Flux Handler (VOICE_STATE_UPDATES) │
│ └─ Detects voice joins → calls startMoving() │
├─────────────────────────────────────────────────────┤
│ Core Logic │
│ ├─ startMoving() — action chain with delays │
│ ├─ scheduleMove() — recursive move loop │
│ ├─ tryStartIfInVoice() — starts if user already in VC│
│ └─ toggleServerAction() — mute/deafen toggle handler │
└─────────────────────────────────────────────────────┘
```
## Data Types
### MoveItem
```ts
interface MoveItem {
id: string; // unique ID (Date.now().toString())
userId: string; // Discord user ID
guildId: string; // Server ID or "*" for all
enabled: boolean; // master toggle for move/disconnect
disconnectOnJoin: boolean; // true = disconnect, false = move loop
delay: number; // ms between moves (default: 2000)
serverMute: boolean; // server-mute on join
serverDeafen: boolean; // server-deafen on join
sendDm: boolean; // send DM before actions
dmMessage: string; // DM text
}
```
### MoveState (runtime only, not persisted)
```ts
interface MoveState {
timer: ReturnType<typeof setTimeout> | null;
guildId: string;
}
```
Stored in `activeMoves: Map<userId, MoveState>`. Tracks running move loops.
## Action Chain (startMoving)
When a user joins a voice channel and a matching entry is found, `startMoving()` executes the following **sequential** chain with a **1-second delay** between each step:
```
User joins VC
│
▼
┌──────────────────┐
│ 1. Send DM │ if sendDm === true
│ wait 1000ms │
├──────────────────┤
│ 2. Server Mute │ if serverMute === true
│ wait 1000ms │
├──────────────────┤
│ 3. Server Deafen │ if serverDeafen === true
│ wait 1000ms │
├──────────────────┤
│ 4a. Disconnect │ if disconnectOnJoin === true → one-shot, done
│ or │
│ 4b. Move Loop │ if enabled && !disconnectOnJoin → recursive
└──────────────────┘
```
Each step only executes if its corresponding flag is set. Steps 1–3 are independent of steps 4a/4b — you can have server mute without any move/disconnect.
## Feature Workflows
### Auto-Move
```
VOICE_STATE_UPDATES
│
├─ state.userId matches entry.userId
├─ state.channelId is set (user joined, not left)
├─ entry.guildId matches state.guildId (or "*")
├─ entry.enabled === true
└─ entry.disconnectOnJoin === false
│
▼
startMoving(entry)
│
▼
scheduleMove(entry) ← recursive loop
│
├─ Check: entry still enabled & in move mode?
├─ Check: user still in VC & matching guild?
├─ Pick random voice channel (exclude current)
├─ PATCH /guilds/{guildId}/members/{userId} { channel_id }
└─ setTimeout(scheduleMove, entry.delay)
│
└─ repeats until user disconnects or entry disabled
```
**Stop conditions:**
- User disconnects from voice
- Entry disabled or removed
- Mode switched to disconnect
- No other voice channels available in the guild
### Auto-Disconnect
```
VOICE_STATE_UPDATES → same filter as auto-move
│
▼
startMoving(entry)
│
├─ (DM, mute, deafen with delays if configured)
└─ PATCH /guilds/{guildId}/members/{userId} { channel_id: null }
│
└─ one-shot — no loop
```
### Auto Server Mute
```
VOICE_STATE_UPDATES
│
├─ state.userId matches entry.userId
├─ state.channelId is set
├─ entry.guildId matches state.guildId (or "*")
└─ entry.serverMute === true
│
▼
startMoving(entry)
│
├─ (DM with delay if configured)
└─ PATCH /guilds/{guildId}/members/{userId} { mute: true }
```
Works independently — can be active alongside auto-move or auto-disconnect, or on its own.
### Auto Server Deafen
Same as Auto Server Mute, but sends `{ deaf: true }`.
## Mutual Exclusion Rules
| If you enable… | This happens to the other |
|---------------|--------------------------|
| Auto Mover | Auto Disconnect → disabled |
| Auto Disconnect | Auto Mover → disabled |
| Server Mute | No effect on others |
| Server Deafen | No effect on others |
Server mute and deafen are **fully independent** — they can be combined with move, disconnect, both, or neither.
## Context Menu Behavior
Right-clicking a user shows four checkboxes. The `guildId` from the context is used to scope the entry:
| Context | guildId value |
|---------|--------------|
| Right-click in a server | That server's ID |
| Right-click in DMs / friends | `undefined` → stored as `"*"` (all servers) |
### Checkbox logic
| Checkbox | If user NOT in list | If user IS in list |
|----------|--------------------|--------------------|
| Auto Mover | Creates entry: `enabled=true, disconnectOnJoin=false` | If same mode active → toggle off. Otherwise → switch to move, disable disconnect. |
| Auto Disconnect | Creates entry: `enabled=true, disconnectOnJoin=true` | If same mode active → toggle off. Otherwise → switch to disconnect, disable move. |
| Server Mute | Creates entry: `enabled=false, serverMute=true` | Toggles `serverMute` |
| Server Deafen | Creates entry: `enabled=false, serverDeafen=true` | Toggles `serverDeafen` |
If the user is already in a voice channel when toggled on, the action applies **immediately**.
## Settings UI Behavior
Same mutual exclusion rules apply as context menu. Toggling the **Enabled** checkbox or **Disconnect** checkbox:
- Stops any running move loop
- Restarts with the new configuration if the user is currently in VC
Toggling **Server Mute** or **Server Deafen**:
- Applies immediately via API if user is in VC
- Does not affect move/disconnect loops
Changing the **delay**:
- Takes effect on the next tick of the move loop (picked up from stored settings)
## API Endpoints Used
| Action | Method | URL | Body |
|--------|--------|-----|------|
| Move user | `PATCH` | `/guilds/{guildId}/members/{userId}` | `{ channel_id: channelId }` |
| Disconnect | `PATCH` | `/guilds/{guildId}/members/{userId}` | `{ channel_id: null }` |
| Server mute | `PATCH` | `/guilds/{guildId}/members/{userId}` | `{ mute: true }` |
| Server deafen | `PATCH` | `/guilds/{guildId}/members/{userId}` | `{ deaf: true }` |
## Permissions Required
| Action | Permission |
|--------|-----------|
| Move / Disconnect | **Move Members** |
| Server Mute | **Mute Members** |
| Server Deafen | **Deafen Members** |
## Key Constants
| Constant | Value | Description |
|----------|-------|-------------|
| `ACTION_DELAY_MS` | `1000` | Delay between sequential actions in `startMoving()` |
| Default move delay | `2000` | Delay between moves in the auto-move loop |
## Edge Cases Handled
- **User in multiple guilds' VCs**: `getVoiceStateForUser` returns one state. Guild check via optional `voiceState.guildId` — only blocks on explicit mismatch.
- **No other voice channels**: Move loop stops gracefully.
- **Entry removed mid-loop**: `scheduleMove` re-reads the stored list each tick and bails if entry is gone.
- **Mode switched mid-loop**: `scheduleMove` checks `disconnectOnJoin` and stops if mode changed.
- **Rapid toggle**: `stopMoving()` is always called before starting a new action, preventing duplicate loops.
- **DM channel doesn't exist**: Automatically opens a private channel via `ChannelActionCreators.openPrivateChannel`.
## File Structure
```
autoMover/
├── index.tsx # Main plugin: types, logic, UI, flux handler, context menu
├── README.md # User-facing documentation
└── docs/
└── workflows.md # This file — detailed architecture & workflows
```
+1047
View File
File diff suppressed because it is too large. Load diff