refactor: Wormhole v4.0.0 — full modular architecture with hierarchical staff
BREAKING: Complete cog restructure from monolithic wormhole.py into modular architecture.
## Architecture
- models/permissions.py — Role IntEnum (MEMBER→OWNER), requires_role() decorator
- models/config.py — DEFAULT_NETWORK/DEFAULT_GLOBAL with 80+ config keys
- models/message_map.py — MessageMap class (extracted from _MessageMap)
- services/emoji.py — Foreign emoji resolution and relay
- ui/views.py — Reply jump button view
- ui/modals.py — Report modal
- core.py — Main Wormhole class, helpers, background loops, context menus
- commands/ — 13 command modules as mixin classes
- listeners/ — relay pipeline, edit/delete/reaction sync, typing/pin sync
## Staff System (new)
Per-network hierarchical roles replacing flat owner/staff:
Bot Owner (Red built-in) — global override
└─ Network Owner → Admin → Moderator → Helper → Member
Each role assigned per-network. Higher roles can assign lower.
Legacy staff_ids auto-migrated to ADMIN role.
## Enhanced Moderation
- Server-level ban/mute (not just user-level)
- Allowlist mode (only whitelisted servers can send)
- Mod edit and nuke (delete N messages by user)
- Anti-raid detector with auto-freeze
- Expanded automod: anti-zalgo, anti-emote-spam, anti-newline-spam
## Commands (100+)
network, settings, staff, moderation, filters, social, dm, mentions,
tos, reports, bridge, advanced (polls/afk/auto-responses/scheduled/
analytics/quiet-hours/colours/invites/announcements/blackout/portal),
debug (health/trace/testsend/relaydebug/backup/restore/version)
## Files
- 30 Python files, 5,274 lines total (was 4,782 in monolith)
- Original wormhole.py preserved for reference
- utils.py unchanged (all helpers reused)
2026-05-14 19:07:49 +00:00
|
|
|
"""
|
|
|
|
|
Default configuration structures for Wormhole networks.
|
|
|
|
|
|
|
|
|
|
All per-network data lives inside ``networks.<name>`` in Red's Config.
|
|
|
|
|
Global data (cross-network) lives at the top level.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
DEFAULT_NETWORK: dict = {
|
|
|
|
|
# ── Ownership / staff ──────────────────────────────────────────────────
|
|
|
|
|
"owner_id": 0,
|
|
|
|
|
"staff": {}, # {user_id_str: Role int} (new hierarchy)
|
|
|
|
|
"staff_ids": [], # LEGACY — flat list, migrated on read
|
|
|
|
|
|
|
|
|
|
# ── Channels ───────────────────────────────────────────────────────────
|
|
|
|
|
"channels": [],
|
|
|
|
|
|
|
|
|
|
# ── Identity ───────────────────────────────────────────────────────────
|
|
|
|
|
"use_webhooks": True,
|
|
|
|
|
"relay_mode": "webhook", # webhook | embed | compact
|
|
|
|
|
"image_mode": "user", # user | server | custom
|
|
|
|
|
"name_mode": "both", # user | server | both | custom
|
|
|
|
|
"custom_icon": None,
|
|
|
|
|
"custom_name": None,
|
|
|
|
|
"colour": None,
|
|
|
|
|
"description": "",
|
|
|
|
|
|
|
|
|
|
# ── Moderation ─────────────────────────────────────────────────────────
|
|
|
|
|
"banned_users": [],
|
|
|
|
|
"banned_servers": [],
|
|
|
|
|
"muted_users": [],
|
|
|
|
|
"muted_servers": [],
|
|
|
|
|
"word_filters": [],
|
|
|
|
|
"regex_filters": [],
|
|
|
|
|
"allowlist_servers": [],
|
|
|
|
|
|
|
|
|
|
# ── Feature toggles ────────────────────────────────────────────────────
|
|
|
|
|
"sync_edits": True,
|
|
|
|
|
"sync_deletes": True,
|
|
|
|
|
"sync_reactions": True,
|
|
|
|
|
"sync_replies": True,
|
|
|
|
|
"sync_threads": False,
|
|
|
|
|
"sync_stickers": True,
|
|
|
|
|
"sync_pins": False,
|
|
|
|
|
"forward_embeds": True,
|
|
|
|
|
"nsfw_gate": True,
|
|
|
|
|
"silent": False,
|
|
|
|
|
"frozen": False,
|
|
|
|
|
|
|
|
|
|
# ── Rate limit ─────────────────────────────────────────────────────────
|
|
|
|
|
"rate_limit_rate": 5,
|
|
|
|
|
"rate_limit_per": 10.0,
|
|
|
|
|
|
|
|
|
|
# ── Logging ────────────────────────────────────────────────────────────
|
|
|
|
|
"log_channel": None,
|
2026-08-05 13:07:20 -04:00
|
|
|
"report_channel": None,
|
refactor: Wormhole v4.0.0 — full modular architecture with hierarchical staff
BREAKING: Complete cog restructure from monolithic wormhole.py into modular architecture.
## Architecture
- models/permissions.py — Role IntEnum (MEMBER→OWNER), requires_role() decorator
- models/config.py — DEFAULT_NETWORK/DEFAULT_GLOBAL with 80+ config keys
- models/message_map.py — MessageMap class (extracted from _MessageMap)
- services/emoji.py — Foreign emoji resolution and relay
- ui/views.py — Reply jump button view
- ui/modals.py — Report modal
- core.py — Main Wormhole class, helpers, background loops, context menus
- commands/ — 13 command modules as mixin classes
- listeners/ — relay pipeline, edit/delete/reaction sync, typing/pin sync
## Staff System (new)
Per-network hierarchical roles replacing flat owner/staff:
Bot Owner (Red built-in) — global override
└─ Network Owner → Admin → Moderator → Helper → Member
Each role assigned per-network. Higher roles can assign lower.
Legacy staff_ids auto-migrated to ADMIN role.
## Enhanced Moderation
- Server-level ban/mute (not just user-level)
- Allowlist mode (only whitelisted servers can send)
- Mod edit and nuke (delete N messages by user)
- Anti-raid detector with auto-freeze
- Expanded automod: anti-zalgo, anti-emote-spam, anti-newline-spam
## Commands (100+)
network, settings, staff, moderation, filters, social, dm, mentions,
tos, reports, bridge, advanced (polls/afk/auto-responses/scheduled/
analytics/quiet-hours/colours/invites/announcements/blackout/portal),
debug (health/trace/testsend/relaydebug/backup/restore/version)
## Files
- 30 Python files, 5,274 lines total (was 4,782 in monolith)
- Original wormhole.py preserved for reference
- utils.py unchanged (all helpers reused)
2026-05-14 19:07:49 +00:00
|
|
|
|
|
|
|
|
# ── Server nicknames ───────────────────────────────────────────────────
|
|
|
|
|
"server_nicknames": {},
|
|
|
|
|
|
2026-08-05 13:07:20 -04:00
|
|
|
# ── Stats ─────────────────────────────────────────────────────────────
|
refactor: Wormhole v4.0.0 — full modular architecture with hierarchical staff
BREAKING: Complete cog restructure from monolithic wormhole.py into modular architecture.
## Architecture
- models/permissions.py — Role IntEnum (MEMBER→OWNER), requires_role() decorator
- models/config.py — DEFAULT_NETWORK/DEFAULT_GLOBAL with 80+ config keys
- models/message_map.py — MessageMap class (extracted from _MessageMap)
- services/emoji.py — Foreign emoji resolution and relay
- ui/views.py — Reply jump button view
- ui/modals.py — Report modal
- core.py — Main Wormhole class, helpers, background loops, context menus
- commands/ — 13 command modules as mixin classes
- listeners/ — relay pipeline, edit/delete/reaction sync, typing/pin sync
## Staff System (new)
Per-network hierarchical roles replacing flat owner/staff:
Bot Owner (Red built-in) — global override
└─ Network Owner → Admin → Moderator → Helper → Member
Each role assigned per-network. Higher roles can assign lower.
Legacy staff_ids auto-migrated to ADMIN role.
## Enhanced Moderation
- Server-level ban/mute (not just user-level)
- Allowlist mode (only whitelisted servers can send)
- Mod edit and nuke (delete N messages by user)
- Anti-raid detector with auto-freeze
- Expanded automod: anti-zalgo, anti-emote-spam, anti-newline-spam
## Commands (100+)
network, settings, staff, moderation, filters, social, dm, mentions,
tos, reports, bridge, advanced (polls/afk/auto-responses/scheduled/
analytics/quiet-hours/colours/invites/announcements/blackout/portal),
debug (health/trace/testsend/relaydebug/backup/restore/version)
## Files
- 30 Python files, 5,274 lines total (was 4,782 in monolith)
- Original wormhole.py preserved for reference
- utils.py unchanged (all helpers reused)
2026-05-14 19:07:49 +00:00
|
|
|
"total_messages": 0,
|
|
|
|
|
"created_at": None,
|
|
|
|
|
|
|
|
|
|
# ── Auto-moderation ────────────────────────────────────────────────────
|
|
|
|
|
"automod": {
|
|
|
|
|
"enabled": False,
|
|
|
|
|
"anti_spam": False,
|
|
|
|
|
"anti_mention_spam": False,
|
|
|
|
|
"anti_caps": False,
|
|
|
|
|
"anti_invite": False,
|
|
|
|
|
"anti_link": False,
|
|
|
|
|
"anti_zalgo": False,
|
|
|
|
|
"anti_spoiler": False,
|
|
|
|
|
"anti_emote_spam": False,
|
|
|
|
|
"anti_newline_spam": False,
|
|
|
|
|
"anti_raid": False,
|
|
|
|
|
"max_mentions": 5,
|
|
|
|
|
"caps_threshold": 0.7,
|
|
|
|
|
"spam_window": 30.0,
|
|
|
|
|
"spam_threshold": 3,
|
|
|
|
|
"max_emotes": 10,
|
|
|
|
|
"max_newlines": 15,
|
|
|
|
|
"raid_window": 60.0,
|
|
|
|
|
"raid_threshold": 10,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
# ── Invites ────────────────────────────────────────────────────────────
|
|
|
|
|
"invites": {},
|
|
|
|
|
"vanity_invite": None,
|
|
|
|
|
}
|