NGINX: Redirect only search-bots to a given file

Answering your second question, use an empty string instead of "0" on your map translations (and since the default map value is exactly an empty string, you can omit the default line at all):

map $http_user_agent $search_engines {
    "~bingbot" 1;
    "~BingPreview" 1;
    "~Googlebot" 1;
}
map $http_user_agent $social_networks {
    "~*facebook" 1;
    "~*twitter" 1;
}

and use concatenation of variables for the final condition decision:

map $search_engines$social_networks $is_bot {
    ""      "";
    default 1;
}

server {
    ...
    if ($is_bot) {
        rewrite ^/(.*) /bot.php?$1 break;
    }