Custom Command for MineCraft Server

I want to make a command that give certain info about a MineCraft server:

Command: !server
Response: Online players : […] Ping: […]

I can’t find a good website (custom api) to do this, they only website I found:[server_name]/info

But I don’t know how to get the information out of this page into the command.


I could do something like that. Message me on Twitch so we can set it up

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:

$MinecraftServer = $_GET["Server"];
if (empty($_GET["Server"]) || $_GET["Server"] == null)
    $MinecraftServer = "";
$MinecraftServerJson = json_decode(@file_get_contents("$MinecraftServer/info"), true);
if($MinecraftServerJson['status'] == null)
    echo ' Server "' . $MinecraftServer . '" is currently offline!';
    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 = ""; and instead of the 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” and it’ll show the stats, if any of “”.
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

!addcom !server $(customapi$(query))

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.

1 Like

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 :wink:
They server that would be the most requested is: ‘’ ‘’ So the new API would be:

I hope I adjusted it right. Thanks for helping me :wink:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.