fix: recognize @botfather as bot peer (special case, not pattern change)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -546,7 +546,7 @@ impl App {
|
|||||||
let url = format!("{}/v1/alias/whois/{}", client.base_url, normfp(&peer));
|
let url = format!("{}/v1/alias/whois/{}", client.base_url, normfp(&peer));
|
||||||
match client.client.get(&url).send().await {
|
match client.client.get(&url).send().await {
|
||||||
Ok(resp) => resp.json::<serde_json::Value>().await.ok()
|
Ok(resp) => resp.json::<serde_json::Value>().await.ok()
|
||||||
.and_then(|d| d.get("alias").and_then(|a| a.as_str().map(|s| s.ends_with("bot") || s.ends_with("Bot") || s.ends_with("_bot"))))
|
.and_then(|d| d.get("alias").and_then(|a| a.as_str().map(|s| s.ends_with("bot") || s.ends_with("Bot") || s.ends_with("_bot") || s == "botfather")))
|
||||||
.unwrap_or(false),
|
.unwrap_or(false),
|
||||||
Err(_) => false,
|
Err(_) => false,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1210,7 +1210,7 @@ async function doSend() {
|
|||||||
try {
|
try {
|
||||||
const wr = await fetch(SERVER + '/v1/alias/whois/' + normFP(peer));
|
const wr = await fetch(SERVER + '/v1/alias/whois/' + normFP(peer));
|
||||||
const wd = await wr.json();
|
const wd = await wr.json();
|
||||||
if (wd.alias && (wd.alias.endsWith('bot') || wd.alias.endsWith('Bot') || wd.alias.endsWith('_bot'))) isBotPeer = true;
|
if (wd.alias && (wd.alias.endsWith('bot') || wd.alias.endsWith('Bot') || wd.alias.endsWith('_bot') || wd.alias === 'botfather')) isBotPeer = true;
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
if (isBotPeer) {
|
if (isBotPeer) {
|
||||||
|
|||||||
Reference in New Issue
Block a user