If you’re wanting to host your own API, meaning you have a website to host the php file to, you can just use this:
<?php
$MinecraftServer = $_GET["Server"];
if (empty($_GET["Server"]) || $_GET["Server"] == null)
{
$MinecraftServer = "play.teegeecraft.net";
}
$MinecraftServerJson = json_decode(@file_get_contents("https://mcapi.ca/query/$MinecraftServer/info"), true);
if($MinecraftServerJson['status'] == null)
{
echo ' Server "' . $MinecraftServer . '" is currently offline!';
}
else
{
echo $MinecraftServer . ' has ';
echo $MinecraftServerJson['players']['online'];
echo '/';
echo $MinecraftServerJson['players']['max'];
echo ' players, with a ping of ';
echo $MinecraftServerJson['ping'];
echo 'ms.';
}
?>
All you’d have to do is edit line #5$MinecraftServer = "play.teegeecraft.net"; and instead of the play.teegeecraft.net just add your own server, just make sure to keep the "" at either end of the server and the ; at the end. This API will also accommodate a user inputted server, but will fall back to a default if nothing is added after !server. So you can type “!server” and it’ll output the stats of whatever server is hardcoded in, or “!server whatever.server.you.want” and it’ll show the stats, if any of “whatever.server.you.want”.
Or if you don’t want/can’t host your own API, I’ll host this API for awhile. I have a site, just basically to host APIs. You can use this command to add the API into your NightBot
Just let me know what you plan on doing, if you want to use my solution, I’ll keep the API on my hosting, otherwise I’ll just delete it since I don’t play Minecraft.
Thank you for answering my question. No I don’t have a server/website to host the API, so it would be very nice if you can host it on your website. This is for a Dutch channel so it would be nice if they respond of the command is Dutch
They server that would be the most requested is: ‘’ 193.111.140.158:28281 ‘’ So the new API would be: