From 2ad7a7b691170c7b28f64c11085e1073c1f49967 Mon Sep 17 00:00:00 2001 From: Viktor AI Date: Thu, 14 May 2026 19:33:58 +0000 Subject: [PATCH] fix: wire up missing feature enforcement in relay - Mirror channels now receive relayed messages (was blocked from sending but never sent to) - Server allowlist enforced in relay (allowlist_servers gate check) - Silent mode suppresses status broadcasts (_status respects 'silent' flag) - Welcome message sent when channel joins via 'wh open' --- wormhole/commands/network.py | 8 ++++++++ wormhole/core.py | 2 ++ wormhole/listeners/relay.py | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/wormhole/commands/network.py b/wormhole/commands/network.py index cbc4e5f..29b8898 100644 --- a/wormhole/commands/network.py +++ b/wormhole/commands/network.py @@ -71,6 +71,14 @@ class NetworkCommands(WormholeBase): ns[name].setdefault("channels", []).append(ctx.channel.id) await ctx.send(embed=ok_embed(f"Channel linked to `{name}`. Messages will now relay.")) await self._audit(name, "open", str(ctx.author), str(ctx.channel.id)) + # Send welcome message if configured + nd_fresh = await self._net(name) + welcome = nd_fresh.get("welcome_message") if nd_fresh else None + if welcome: + try: + await ctx.channel.send(embed=info_embed(welcome, title=f"🌀 Welcome to {name}")) + except Exception: + pass @WormholeBase.wh.command(name="close") async def wh_close(self, ctx: commands.Context, name: str = None) -> None: diff --git a/wormhole/core.py b/wormhole/core.py index 984d1e2..2ac6435 100644 --- a/wormhole/core.py +++ b/wormhole/core.py @@ -415,6 +415,8 @@ class Wormhole( nets[name]["audit_log"] = log_list[-_AUDIT_LIMIT:] async def _status(self, net_name: str, net_data: dict, src_ch: Optional[int], text: str) -> None: + if net_data.get("silent"): + return for ch_id in net_data.get("channels", []): if ch_id == src_ch: continue diff --git a/wormhole/listeners/relay.py b/wormhole/listeners/relay.py index c188c83..0c4a47d 100644 --- a/wormhole/listeners/relay.py +++ b/wormhole/listeners/relay.py @@ -141,6 +141,11 @@ class RelayListener: if message.guild.id in nd.get("muted_servers", []): return + # Server allowlist — if set, ONLY these servers can relay + allowlist = nd.get("allowlist_servers", []) + if allowlist and message.guild.id not in allowlist: + return + # Rules acceptance gate if nd.get("rules_required"): accepted = nd.get("rules_accepted", {}) @@ -373,6 +378,8 @@ class RelayListener: # ── Build target list ────────────────────────────────────────────── relay_targets = [cid for cid in nd["channels"] if cid != eff_ch] + # Include mirror (receive-only) channels + relay_targets.extend(nd.get("mirror_channels", [])) for bridge_net in nd.get("bridge_to", []): bd = nets.get(bridge_net) if bd and not bd.get("frozen"):