diff --git a/warzone/crates/warzone-server/src/routes/web.rs b/warzone/crates/warzone-server/src/routes/web.rs index ca42e43..35695a2 100644 --- a/warzone/crates/warzone-server/src/routes/web.rs +++ b/warzone/crates/warzone-server/src/routes/web.rs @@ -1207,11 +1207,20 @@ async function doSend() { // Check if peer is a bot — send plaintext instead of E2E let isBotPeer = false; - try { - const wr = await fetch(SERVER + '/v1/alias/whois/' + normFP(peer)); - const wd = await wr.json(); - if (wd.alias && (wd.alias.endsWith('bot') || wd.alias.endsWith('Bot') || wd.alias.endsWith('_bot') || wd.alias === 'botfather')) isBotPeer = true; - } catch(e) {} + const peerRaw = $peerInput.value.trim(); + // Check by alias name if peer was set via @alias + if (peerRaw.startsWith('@')) { + const aname = peerRaw.slice(1).toLowerCase(); + isBotPeer = aname.endsWith('bot') || aname.endsWith('_bot') || aname === 'botfather'; + } + // Also check by fingerprint reverse-lookup + if (!isBotPeer) { + try { + const wr = await fetch(SERVER + '/v1/alias/whois/' + peer); + const wd = await wr.json(); + if (wd.alias && (wd.alias.endsWith('bot') || wd.alias.endsWith('Bot') || wd.alias.endsWith('_bot') || wd.alias === 'botfather')) isBotPeer = true; + } catch(e) {} + } if (isBotPeer) { const msgId = crypto.randomUUID ? crypto.randomUUID() : Date.now().toString();