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'
This commit is contained in:
Viktor AI 2026-05-14 19:33:58 +00:00
parent 4bc143b26f
commit 2ad7a7b691
3 changed files with 17 additions and 0 deletions

View file

@ -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:

View file

@ -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

View file

@ -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"):