#!/bin/bash
source "$WEBSITE_ROOT/common";
offline() {
echo """HTTP/1.1 200 OK
Content-type: text/html
Refresh: 10
X-Accel-Expires: 10
""";
cat "$WEBSITE_ROOT/static/head.html";
sidebar;
echo "LiBot is currently offline!
It is not possible to select the best shred for authorization. Please wait until it comes back before attempting to add it to your guild.";
cat "$WEBSITE_ROOT/static/tail.html";
exit 0;
}
if bot_up; then
bestid="$(get_prop 'BESTID')";
if [ -z $bestid ]; then
offline;
fi;
url="https://discord.com/oauth2/authorize?client_id=$bestid&scope=bot&permissions=3459136";
echo """HTTP/1.1 301 Moved Permanently
Content-type: text/html
Location: $url