Commit graph

16 commits

Author SHA1 Message Date
Viktor
13b28d3800 feat(wormhole): add 'Jump to replied message' button on relayed replies
When a reply is relayed across servers, each copy now includes a URL
button underneath the quoted reply text:

- If the referenced message has a relayed copy in the target channel,
  the button links to that local copy (so users stay in their own server).
- Otherwise, it falls back to the original message URL.

Works across all relay modes (webhook, embed, compact) and leverages
the existing msg_map to resolve per-channel message IDs.

Bumps version to 3.4.3.
2026-05-14 15:13:20 +00:00
Viktor AI
bbf427284e feat: per-network mention config + user opt-in/out for pings
- Migration now uses a _mention_migrated flag so it only forces mentions
  off once. After that, admins can freely toggle per-network settings
  with 'wh mentions set <network> <type> <true/false>'

- New mention_optout_users list per network: users can opt out of being
  @pinged through the relay even when user mentions are enabled
  network-wide. Their <@ID> mentions are stripped; everyone else's pass
  through. Default: opted in.

- New commands:
  • wh mentions optout <network>  — stop receiving relay pings
  • wh mentions optin <network>   — start receiving relay pings again
  • wh mentions mystatus <network> — check your current ping status

- apply_mention_policy() now accepts optout_users set and selectively
  strips only opted-out users' mentions when user mentions are globally
  allowed

- Updated 'wh mentions status' to show opt-out count and correct
  defaults
2026-05-12 15:49:56 +00:00
Viktor AI
8c5b422d83 fix: migrate existing networks to strip all mentions + revert empty-prefix guard
- On cog load, all existing networks are migrated to disable every
  mention type (user, role, everyone, here) — changing the default
  only affected new networks, not existing ones
- Reverted the v3.4.2 'and ctx.prefix' guard in the command filter —
  the real relay bug was the regex crash, not the empty prefix.
  ctx.valid alone correctly identifies registered commands even with
  an empty-string prefix
2026-05-12 15:21:08 +00:00
Viktor AI
9e8650c01a feat: strip all mentions from relayed messages by default (v3.4.3)
- Default mention_policy now disables all mention types including user
  mentions (previously allow_user_mentions defaulted to True)
- Blocked mentions are now removed entirely instead of replaced with
  ZWSP placeholders — '@mention HI!' becomes 'HI!' on the other side
- Trailing whitespace from removed mentions is cleaned up
- Updated both apply_mention_policy() and sanitise_mentions()
2026-05-12 14:55:56 +00:00
Viktor AI
39188d9f4e feat: add relay diagnostic commands (relaydebug, testsend, tracemode)
Added three diagnostic tools to help debug relay issues:

- wh relaydebug: static check of all on_message gates against the
  current channel — reports which checks pass/fail
- wh testsend [text]: bypasses on_message entirely and sends a test
  message directly through the webhook to verify connectivity
- wh tracemode: toggles live tracing for the channel — when enabled,
  every message produces a diagnostic embed showing exactly which
  gate-check blocked it or that the relay succeeded

Also added trace checkpoints at every early-return in on_message so
tracemode can pinpoint the exact check that blocks a message.
2026-05-12 13:38:15 +00:00
Viktor AI
9598f752c1 fix: Wormhole v3.4.2 — empty-prefix command filter bug
The v3.4.1 command filter used bot.get_context() to detect commands,
but an empty-string prefix ('') matched EVERY message, causing
ctx.valid to return True for any message whose first word happened
to be a registered command.  With enough built-in commands (help,
ping, info, set, etc.) this silently dropped most or all relay
traffic (total_messages stayed at 0).

Fix: require ctx.prefix to be truthy (non-empty) before skipping
a message as a command.  Empty-prefix matches are now ignored,
so only messages with a real prefix (!, @bot, etc.) are filtered.

Also re-added the empty-prefix warning to 'wh debug' output so
users know to clean up their bot prefix configuration.
2026-05-12 12:53:18 +00:00
Viktor AI
5ece19dae7 fix: Wormhole v3.4.1 — relay engine hardening 2026-05-12 12:24:44 +00:00
everestmcarthur
2bde18b727 fix: Discord 25-subcommand limit — use prefix group + standalone slash commands
Discord enforces a max of 25 subcommands per slash command group.
Wormhole has 50 children on the main group and 39 on wh set, making
hybrid_group impossible.

Fix: wh is now a regular prefix group, with 7 standalone slash commands
registered for the most common user-facing operations:
  /wormhole-list, /wormhole-info, /wormhole-discover,
  /wormhole-accept, /wormhole-agree, /wormhole-report,
  /wormhole-profile

All 4 context menus still work (Report, Bookmark, Delete, Profile).
All 85+ prefix commands still work via [p]wh.
2026-05-08 03:06:05 +00:00
everestmcarthur
15e42fb454 fix: mod edit/nuke resolve relayed IDs back to original — any copy's ID works
get_relayed() now checks reverse map as fallback, so passing any
relayed copy's message ID resolves to the full mapping.

mod edit and mod nuke both call get_original() first, so staff can
right-click or copy ANY copy of a message and it deletes/edits the
entire chain across all servers.
2026-05-08 03:02:39 +00:00
everestmcarthur
f8fcb1670b v3.4.0 — Phase 5: hybrid commands, context menus, mention policy, ToS gate, reports, mod edit/delete
Phase 5 — Security, Privacy & Power Update:

HYBRID COMMANDS
- Main command group converted to hybrid_group (slash + prefix)
- All commands work as both /wh and [p]wh

CONTEXT MENU ACTIONS (right-click)
- Report to Wormhole — opens modal for report reason
- Wormhole Bookmark — saves message to DM
- Wormhole Delete — staff can delete from entire network
- Wormhole Profile — view user stats across networks

GRANULAR MENTION POLICY
- Per-network control: allow/block @user, @role, @everyone, @here
- Per-server overrides (different rules per guild)
- Per-user exemptions (trusted users bypass policy)
- Replaces legacy strip-* with proper policy engine
- wh mentions set/server-set/exempt/unexempt/status

TERMS OF SERVICE / RULES ACCEPTANCE GATE
- wh tos enable — require acceptance before messaging
- Built-in legal template (6 sections, prosecution-ready)
- Consent tracking with timestamps
- wh tos set (custom text), template (reset), accepted (view), reset (force re-accept)
- wh accept / wh agree — user-facing acceptance flow
- Blocks relay for non-accepted users with helpful reminder

MOD EDIT/DELETE ACROSS NETWORK
- wh mod edit <name> <msg_id> <new_content> — edits all relayed copies
- wh mod nuke <name> <msg_id> — deletes from every server + original
- Both audit-logged

REPORT SYSTEM
- wh report message — report via reply or message ID
- Context menu report with modal (reason input)
- Anti-abuse cooldown (60s between reports)
- Content hashing for audit trails
- Reports sent to log channel + network owner DM
- wh report list/resolve/action (ban/mute/warn/dismiss)
- Capped at 200 reports per network

PRIVACY & SECURITY
- _ReportModal class for context menu reporting
- Content hash stored instead of plaintext in report records
- Report cooldowns prevent abuse
- ToS acceptance with ISO timestamps for legal compliance

4,196 lines in wormhole.py, 419 in utils.py — 85+ commands total
2026-05-08 02:53:38 +00:00
everestmcarthur
622d9afdb8 fix: remove stats alias conflicting with other cogs 2026-05-07 22:59:05 +00:00
everestmcarthur
627e5a426d v3.3.0 — Phase 4: hardened command filter, anonymous mode, polls, AFK, analytics, bridging, 15+ new features
Phase 4 additions:
- Hardened 4-layer command filtering (bot prefix, common prefixes, slash commands, context validation)
- Anonymous mode (hashed usernames, default avatars)
- One-way mirror channels (receive-only)
- Network-wide polls with reaction voting and auto-expiry
- AFK system with auto-clear on message send
- Personal ignore lists (per-user DM relay blocking)
- Staff auto-responses (word + regex triggers)
- Ephemeral messages (auto-delete after configurable seconds)
- Media-only mode (only relay attachments/images)
- Network analytics dashboard (hourly activity, peak hours, top users)
- Relay health monitor (15-min background check for channel accessibility)
- Message bookmarks (saved to DM)
- Per-user vanity embed colours
- Quiet hours (DM relay pause during configurable hours)
- Inter-network bridging (one-way or two-way)
- Updated README with full command reference (70+ commands)
- 3,376 lines in wormhole.py
2026-05-07 22:53:20 +00:00
everestmcarthur
a4f5265083 v3.2.1 — Fix relay issues: robust init, webhook fallback, debug command
Fixes:
- _init() now always sets _ready event even on error (prevents
  permanent relay blockage if init fails)
- Webhook method retries with cache refresh on stale/deleted webhooks
- Falls back to embed mode if webhooks fail (permissions, etc.)
- Empty content guard (prevents 400 errors on empty messages)
- Fixed deprecated discord.Embed.Empty usage for discord.py 2.x
- Prefix check now skips empty prefixes (prevents all-message block)
- asyncio.ensure_future() instead of bot.loop.create_task()
- Better error logging with exc_info for relay failures

New:
- [p]wh debug command — shows cog state, intents, permissions,
  webhook status, connected channels, and prefix diagnostics
2026-05-07 22:39:12 +00:00
Viktor AI
56d5b11882 Fix discord.py 2.x compat: replace Embed.Empty with conditional kwargs
Embed.Empty was removed in discord.py 2.x — set_footer and set_author
now only pass icon_url when a value actually exists.
2026-05-07 22:38:02 +00:00
everestmcarthur
680b87db39 v3.2.0 — Phase 3: DM relay, starboard, karma, auto-mod, highlights, search & more
Complete ground-up rewrite (2,762 lines across 3 files):

Phase 3 features:
- Bidirectional DM relay (subscribe, send, receive, 3 formats)
- Cross-network starboard with configurable threshold
- Reputation/karma system with leaderboard
- Keyword highlight notifications (DM alerts)
- Anti-raid detection with auto-freeze
- Attachment filters (blocked extensions, max filesize)
- Pin sync across channels
- Typing indicator relay
- Network discovery (public flag + tags)
- Message search across network
- Scheduled messages (timed broadcasts)
- Network-wide slowmode
- Relay delay (configurable)
- Vanity invite codes
- Per-channel setting overrides
- Purge command (mass delete relayed)
- Audit log (500 entries, full trail)
- MOTD and rules
- Comprehensive README with full command reference

Phase 2 features (carried forward):
- Auto-moderation engine (spam, caps, invites, links, zalgo, spoiler, emote/newline spam)
- Invite system with expiry and max uses
- Staff announcements and portal messages
- Welcome messages and mention control
- User profiles and network stats
- Backup/restore (JSON export/import)
- Blackout scheduling
- Global blocklist (bot owner)
- Embed and compact relay modes

Phase 1 features (carried forward):
- Named networks with webhook relay
- Edit/delete/reply/reaction/sticker sync
- Staff system with ownership transfer
- Word and regex content filters
- Rate limiting and NSFW gate
- Server nicknames, custom identity
- Logging channel
2026-05-07 22:19:09 +00:00
everestmcarthur
6ca37b9ba1 Initial commit — Wormhole v3.0.0: advanced cross-server relay cog
Features:
- Named wormhole networks with full per-network config
- Webhook relay with custom avatar/name modes (user, server, both, custom)
- Message edit, delete, reply, reaction, thread & sticker sync
- Staff system (owner + staff) with granular permissions
- Moderation: user ban/mute, server ban/mute, allowlist
- Word & regex content filters with auto-delete
- Token-bucket rate limiting per user per network
- Per-network logging channel
- Statistics dashboard
- NSFW gating, freeze/pause, silent mode
- Custom network icon, description, accent colour
- Server nickname overrides
- Ownership transfer
- Thread support
- Embed forwarding
- Professional README, info.json, LICENSE
2026-05-07 21:53:21 +00:00