Route IPC send_message by paired room role

This commit is contained in:
Eyejoker
2026-04-04 23:02:30 +09:00
parent 4a331c5036
commit 7f0fbd5811
9 changed files with 268 additions and 44 deletions

View File

@@ -93,6 +93,26 @@ export function findChannel(
return channels.find((c) => c.ownsJid(jid));
}
export function findChannelForDeliveryRole(
channels: Channel[],
jid: string,
senderRole?: string,
): Channel | undefined {
if (senderRole === 'reviewer') {
return (
findChannelByName(channels, 'discord-review') ||
findChannel(channels, jid)
);
}
if (senderRole === 'arbiter') {
return (
findChannelByName(channels, 'discord-arbiter') ||
findChannel(channels, jid)
);
}
return findChannel(channels, jid);
}
export function findChannelByName(
channels: Channel[],
name: string,